Skip to content

Channel data fetch freezes for 2^32 microseconds #17

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

Open
tomek-szczesny opened this issue Jun 7, 2022 · 1 comment
Open

Channel data fetch freezes for 2^32 microseconds #17

tomek-szczesny opened this issue Jun 7, 2022 · 1 comment

Comments

@tomek-szczesny
Copy link
Contributor

Issue described here in greater detail:

https://forum.odroid.com/viewtopic.php?p=350730#p350730

In short:

  • Data fetching freezes at some point

  • Display shows last fetched data

  • ttyUSB and Wifi sends data as normal, but also the last value before the "freeze"

  • blue LED also freezes, either on or off

  • Menus and buttons are operational during the freeze

  • The problem appears at some micros() overflow events, which happens about every 71 minutes (2^32 microseconds)

  • The problem appears inconsistently, it took me 16 hours to recreate it

  • The problem resolved itself and unfroze the data fetch after 2^32 microseconds in all documented cases to date

  • No errors are reported via ttyUSB

Symptoms indicate the main loop() executes a delay of 2^32 microseconds or a value close to that.
There is only one place in code where delayMicroseconds() is being called:

unsigned long delay;
uint8_t buffer[12];
float V; float A;
// ensure that 1ms has already passed since last refresh
delay = (1000 - micros() + PAC->refresh_timestamp);
// do a delay if result is not nagtive (note it's an unsinged variable)
if (delay < 1000) delayMicroseconds(delay);

Yet it seems it should not be possible to ever launch that delay with extreme value.

@cedel1
Copy link
Contributor

cedel1 commented Mar 25, 2023

I've skimmed over the info in the thread and on the surface it looks, at least in some aspects, to be very similar to the problems I've experienced when trying to build the firmware with latest Espressif323 platform (a bug in PAC library related to I2C). Fix for that bug has made it into master (#22) but not yet into a release.

Can you confirm the bug still happens with firmware built from the latest master that includes the seemingly unrelated fix?

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

2 participants