Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CubeCell micros() issue in Arduino code #287

Open
michapr opened this issue Mar 25, 2024 · 2 comments
Open

CubeCell micros() issue in Arduino code #287

michapr opened this issue Mar 25, 2024 · 2 comments

Comments

@michapr
Copy link

michapr commented Mar 25, 2024

We are expecting different problems with the CubeCell using the micros() function.

To reproduce:

#include <Arduino.h>

uint32_t last = 0;

void setup() {
    Serial.begin(115200);
    delay(2000);
    while(!Serial);
}

void loop() {
    uint32_t now = micros();
    Serial.println(now);
    if(now < last) {
        Serial.println("Stopped!");
        Serial.println(now);
        Serial.println(last);
        delay(900);
    }
    last = now;
}

now should never be smaller than last, yet we get the following output about every other x seconds :

12:38:27.451 > Stopped!
12:38:27.456 > 92596866
12:38:27.458 > 92596999

Interestingly, the last value that is printed, always ends in 999 or sometimes 998 or 997.
However, removing the line Serial.println(now); makes it such that the problem doesn't happen... why?????

With millis() it runs fine - so something is wrong. Can you check it?

@jgromes
Copy link

jgromes commented Mar 31, 2024

+1 since this actually showed up in two separate issues in RadioLib, first here and then second here.

@ellisgl
Copy link

ellisgl commented Mar 31, 2024

Saw a note in the code about micros having ~1.7% error. http://community.heltec.cn/t/cubecell-micros-function/985

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants