-
Notifications
You must be signed in to change notification settings - Fork 3k
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
K64F: LowPowerTimeout: Inaccurate delay after board power up #5348
Comments
Would you mind trying this again using the latest version of mbed-os? I was not able to reproduce the bug on my end. |
@cmonr I checked the code on current master (6811c9f) and it behaves same way as before. :( It might be more convenient to use some non-default UART: #include "mbed.h"
#define TEST_DELAY_US 30000ULL
int main() {
Serial ser(PTC17, PTC16); // tx, rx
Timer timer;
LowPowerTimeout timeout;
timer.start();
timeout.attach_us(mbed::callback(&timer, &Timer::stop), TEST_DELAY_US);
// Need to wait much longer than TEST_DELAY_US
Thread::wait(3000);
ser.printf("%10i\n", timer.read_us());
return 0;
} [Mirrored to Jira] |
I changed the serial pins, updated the GCC_ARM compiler, and manually checked out mbed-os to your SHA, but was still not able to see the issue. A couple of things:
[Mirrored to Jira] |
Initially I compiled this code on a Windows 10 machine, but have same results on my Linux laptop (native Ubuntu 16.04.3 LTS) on $ ./arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 6.3.1 20170620 (release) [ARM/embedded-6-branch revision 249437]
$ pip list | grep mbed
mbed-cli (1.2.2)
mbed-greentea (1.3.2)
mbed-host-tests (1.3.0)
mbed-ls (1.3.4) Regarding the power method I initially just used USB cable connected to
These results are from latest master 4d81ead. The K64F I have is marked as follows: |
@fkjagodzinski I think this can be closed. Latest ticker specs for 5.9 should have resolved this. |
Good point. I'll retry on current master and report here. |
I checked the code with current master (65abff9). Here is an UART dump:
As you can see, the results are pretty much the same, 39852f7 didn't fix this issue. |
with @maciejbocianski help, I did some investigation here, which probably show what gone wrong. Let's begin with the list of devices, on that I checked this case:
The problem occurs only for Freedom devices K22F, K64F, K82F. Secondly, I want to present the list of components that has similiar problem:
They are all based on LP ticker. What the problem is? I have checked the LPTMR0 registers, after initialization, and after timer start. The values are ok. Finally, documentation of K64F says that after enabling RTC we should wait "oscilator startup time" before enabling the time counter to allow the 32.768 kHz clock time to stabilize. (I couldn't find what exactly value is this time). To conclude, problem is related to RTC oscilator. It starts to generate pulses around 75 ms after writing the values to its registers. This behaviour occurs after powering up the device Standard timers are based on other clock source. If you want to ask me how does logic level analyzer test looks like, then:
[Mirrored to Jira] |
Good job @MateuszMaz! Thanks for sharing your findings. Will you be able to provide a fix for this issue? |
After a short discussion with @MateuszMaz we came to a conclusion that help from @ARMmbed/team-nxp may be needed. Could you guys take a look? |
@mmahadevan108 - Any update on this one? Can you analyze the issue and fix if possible? |
Internal Jira reference: https://jira.arm.com/browse/IOTPART-5669 |
#8272 have introduced a regression to the CI and had to be reverted (by #8826). @ARMmbed/team-nxp, @mmahadevan108, although your patch fixed this issue, it was missing the capacitor config and left the |
I checked an updated fix, #8872 on K64F -- the issue is resolved for all 3 toolchains. |
Resolved by #8872. |
Description
Bug
Target
K64F
Toolchain
GCC_ARM, ARM, IAR
Toolchain version
GCC_ARM -- 6.3.1,
ARM -- 5.24 (Flex) ARM Compiler 5.06 update 5 (build 528),
IAR -- ANSI C/C++ Compiler V7.80.4.12462/W32 for ARM
mbed-cli version
1.2.0
mbed-os sha
e1090ca
Code
Expected behavior
When the board is powered up the callback is called exactly after
TEST_DELAY_US
.Actual behavior
Callback is triggered with a delay different than expected after powerup. When a RESET button is pressed the delay is correct though.
Regular
Timeout
works as expected.CC @bulislaw @0xc0170 @mmahadevan108
The text was updated successfully, but these errors were encountered: