-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Description
- Type: Bug
- Related issue: Test set for critical section #5201
- Priority: Blocker
Bug
Targets
UBLOX_C030_U201
, UBLOX_C030_N211
Toolchain:
GCC_ARM
Toolchain version:
6.3.1 20170215
mbed-cli version:
1.2.0
mbed-os sha:
3c793a7
Expected behavior
Test mbed_platform-critical_section
should pass on all platforms.
Actual behavior
The very first test fails (test_C_API()
with N=1
). The test sets up a Timeout
, attaches a callback to this with a timeout value of 1 usecond, waits for 100 useconds and then tests that the callback has been called. In this case it hasn’t. If the timeout value is set to 3 useconds or higher (with the wait time fixed at 100 useconds) the test passes. All the UBLOX_C030_xxx
boards use an STM32F437VG
CPU so, for comparison, we've tried running the same test on a UBLOX_EVK_ODIN_W2
(which uses an STM32F439ZI
) and a NUCLEO_F429ZI
board. For an interesting data point, while doing this we measured the time it takes to run the attach_us()
method:
Timer t;
t.start();
timeout.attach_us(callback(tiemout_callback), timeout_time_us);
int x = t.read_us();
wait_us(wait_time_us);
printf("*** x was %d.\n", x);
In the ODIN and NUCLEO cases it was 13 useconds while in the C030 case it was 9 useconds.
Both C030 and ODIN set a 168 MHz sysclock
but C030 uses a 12 MHz crystal whereas ODIN uses an 8 MHz crystal. I’m not entirely sure what the NUCLEO board does by default but C030 is certainly running faster. I’ve tried adding a 1 second wait before the test runs (just to make sure that all clocks have settled) and that doesn’t help. My guess is that this is somehow a clock speed issue, though I don't understand why.
Steps to reproduce
Run mbed test
on any UBLOX_C030_xxx
board with GCC_ARM
or ARM
toolchains.