Skip to content

K64F: LowPowerTimeout: Inaccurate delay after board power up #5348

@fkjagodzinski

Description

@fkjagodzinski

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

#include "mbed.h"

#define TEST_DELAY_US 30000ULL

int main() {
    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);
    printf("%10i\n", timer.read_us());
    return 0;
}

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.

# board power up
     95670  # not even near 30000 us!
# RESET button pressed
     30013
# RESET button pressed
     30027
# RESET button pressed
     30029

# board power up
     94519
# RESET button pressed
     30014
# RESET button pressed
     30010

# board power up
     94744
# RESET button pressed
     30034

CC @bulislaw @0xc0170 @mmahadevan108

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions