mirror of https://github.com/ARMmbed/mbed-os.git
tests-mbed_hal-sleep: finish UART transmission before sleep test
There is no problem with this test during the morph, but some issue has been noticed while testing new Jenkins CI in Oulu on NRF52_DK. I was able to reproduce the issue locally. The difference between morph and local run is that CPU statistics are enabled on morph. This makes the difference and test passes. The sleep test case perform sleep for 100 us, 200 us, ... ,1000 us in loop (us ticker wakes the board) and verifies if sleep time matches the assumption. I got the following results: sleep wake-up after 100 us ~100 us ok 200 us ~200 us ok 300 us ~300 us ok 400 us ~400 us ok 500 us ~14 us (??) When requested sleep time is equal to 500 us some unexpected interrupt occurs which wakeup the board and force the test to fail. Register state just after exit from sleep: Control and State Register: 0x00400000 (ISRPENDING - Interrupt pending flag is set). NVIC Interrupt Set-pending Register[0]: 0x00000004 (UARTE0_UART0_IRQn) or 0x00000200 (TIMER1_IRQn - timer used by us ticker). UART interrupt is generated because of green-tea transmission. We know that it is performed while test is executed since we need to wait before going into deep-sleep since otherwise the transmission will be broken. So to take care of UART interrupt we need to wait before sleep test in the same way like it is done in deep-sleep test.pull/8257/head
parent
eaa5102358
commit
25b23a9286
|
@ -140,6 +140,11 @@ void sleep_usticker_test()
|
||||||
|
|
||||||
const ticker_irq_handler_type us_ticker_irq_handler_org = set_us_ticker_irq_handler(us_ticker_isr);
|
const ticker_irq_handler_type us_ticker_irq_handler_org = set_us_ticker_irq_handler(us_ticker_isr);
|
||||||
|
|
||||||
|
/* Give some time Green Tea to finish UART transmission before entering
|
||||||
|
* sleep mode.
|
||||||
|
*/
|
||||||
|
busy_wait_ms(SERIAL_FLUSH_TIME_MS);
|
||||||
|
|
||||||
/* Test only sleep functionality. */
|
/* Test only sleep functionality. */
|
||||||
sleep_manager_lock_deep_sleep();
|
sleep_manager_lock_deep_sleep();
|
||||||
TEST_ASSERT_FALSE_MESSAGE(sleep_manager_can_deep_sleep(), "deep sleep should be locked");
|
TEST_ASSERT_FALSE_MESSAGE(sleep_manager_can_deep_sleep(), "deep sleep should be locked");
|
||||||
|
|
Loading…
Reference in New Issue