Skip to content

Commit f03860a

Browse files
authored
Merge pull request #12604 from OpenNuvoton/nuvoton_nano130_tickless_lpticker
NANO130: Fix test failures with tickless from lp_ticker
2 parents dba3962 + c3473e4 commit f03860a

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

TESTS/events/queue/main.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ using namespace utest::v1;
3434
// (for more details about EVENTS_EVENT_SIZE see EventQueue constructor)
3535
#define TEST_EQUEUE_SIZE (18*EVENTS_EVENT_SIZE)
3636

37+
// By empirical, we take 80MHz CPU/2ms delay as base tolerance for time left test.
38+
// For higher CPU frequency, tolerance is fixed to 2ms.
39+
// For lower CPU frequency, tolerance is inversely proportional to CPU frequency.
40+
// E.g.:
41+
// 100MHz: 2ms
42+
// 80MHz: 2ms
43+
// 64MHz: 3ms
44+
// 48MHz: 4ms
45+
#define ALLOWED_TIME_LEFT_TOLERANCE_MS ((SystemCoreClock >= 80000000) ? 2 : ((80000000 * 2 + SystemCoreClock - 1) / SystemCoreClock))
46+
3747
// flag for called
3848
volatile bool touched = false;
3949

@@ -283,7 +293,7 @@ int timeleft_events[2];
283293
void check_time_left(EventQueue *queue, int index, int expected)
284294
{
285295
const int event_id = timeleft_events[index];
286-
TEST_ASSERT_INT_WITHIN(2, expected, queue->time_left(event_id));
296+
TEST_ASSERT_INT_WITHIN(ALLOWED_TIME_LEFT_TOLERANCE_MS, expected, queue->time_left(event_id));
287297
touched = true;
288298
}
289299

TESTS/mbed_hal/stack_size_unification/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ extern uint32_t mbed_stack_isr_size;
4040
#define EXPECTED_ISR_STACK_SIZE (1024)
4141
#endif
4242

43-
#if defined(TARGET_NUCLEO_F070RB) || defined(TARGET_NANO100) || defined(TARGET_STM32F072RB) || defined(TARGET_TMPM46B) || defined(TARGET_TMPM066)
43+
#if defined(TARGET_NUCLEO_F070RB) || defined(TARGET_STM32F072RB) || defined(TARGET_TMPM46B) || defined(TARGET_TMPM066)
4444
#define EXPECTED_MAIN_THREAD_STACK_SIZE (3072)
4545
#else
4646
#define EXPECTED_MAIN_THREAD_STACK_SIZE (4096)

targets/TARGET_NUVOTON/TARGET_NANO100/device/StdDriver/nano100_clk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ uint32_t CLK_WaitClockReady(uint32_t u32ClkMask)
613613
{
614614
int32_t i32TimeOutCnt;
615615

616-
i32TimeOutCnt = __HSI / 200; /* About 5ms */
616+
i32TimeOutCnt = __HSI / 20; /* About 50ms */
617617

618618
while((CLK->CLKSTATUS & u32ClkMask) != u32ClkMask) {
619619
if(i32TimeOutCnt-- <= 0)

0 commit comments

Comments
 (0)