-
Notifications
You must be signed in to change notification settings - Fork 11
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
Hang when waking up on battery #12
Comments
Got a hang without waking off from power, right after flashing firmware. Plugging USB back in got me out of the hang. The calculator was shut down, maybe because I had hit the |
Doing a few more experiments, I am quite puzzled by the observed behavior. It looks like some specific functions in the Intel Binary Decimal library are causing the issue, and that can be as simple as rendering a number to text. Here is the behaviour that I observe reliably:
The first one executes in 76ms on USB, 199ms on battery. The second one is about 10 times longer. I can run both on battery reliably. |
The problem persists if I replace the code to render // Align the value
bid128 num = value();
// Render in a separate buffer to avoid overflows
char buf[MAXBIDCHAR];
bid128_to_string(buf, &num.value);
record(decimal128, "Render raw output [%s]", buf);
#if 0
size_t sz = decimal_format(buf, sizeof(buf), r.editing());
record(decimal128, "Render formatted output [%s]", buf);
#else
size_t sz = strlen(buf);
#endif
// And return it to the caller
return r.put(buf, sz) ? sz : 0;
}
|
This is really super-weird. I get the exact same behaviour even I don't call the char buf[MAXBIDCHAR];
uint32_t *ptr = (uint32_t *) #
snprintf(buf, MAXBIDCHAR-1, "%04X-%04X-%04X-%04X", ptr[0], ptr[1], ptr[2], ptr[3]); Works like a charm on USB, hangs as soon as on batter power, and one of the strings generated by that code is produced. |
It looks like the problem goes away if I do not move the
So it looks like the problem derives from executing code from the QSPI. |
There must be something wrong with the setup of timers when waking up from sleep that causes the timers to be out of sync, and generates a temporary freeze of the machine.
A sequence that tends to reproduce this quite often is to start editing something on USB power, then remove USB, keep editing a little, switch off/on. At that point, editing either stops working, or will after a few keystrokes. However, as soon as USB is powered back in, the machine wakes up and catches up on all the pending keystrokes.
The text was updated successfully, but these errors were encountered: