@@ -47,6 +47,12 @@ static void load_and_start_lp_core_firmware(ulp_lp_core_cfg_t* cfg, const uint8_
4747
4848}
4949
50+ static void clear_test_cmds (void )
51+ {
52+ ulp_main_cpu_command = LP_CORE_NO_COMMAND ;
53+ ulp_command_resp = LP_CORE_NO_COMMAND ;
54+ }
55+
5056TEST_CASE ("LP core and main CPU are able to exchange data" , "[lp_core]" )
5157{
5258 const uint32_t test_data = 0x12345678 ;
@@ -76,9 +82,7 @@ TEST_CASE("LP core and main CPU are able to exchange data", "[lp_core]")
7682 printf ("data out: 0x%" PRIx32 ", expected: 0x%" PRIx32 " \n" , ulp_test_data_out , test_data );
7783 TEST_ASSERT (test_data == ulp_test_data_out );
7884
79- /* Clear test data */
80- ulp_main_cpu_command = LP_CORE_NO_COMMAND ;
81- ulp_command_resp = LP_CORE_NO_COMMAND ;
85+ clear_test_cmds ();
8286}
8387
8488TEST_CASE ("Test LP core delay" , "[lp_core]" )
@@ -113,9 +117,7 @@ TEST_CASE("Test LP core delay", "[lp_core]")
113117 printf ("Waited for %" PRIi64 "us, expected: %" PRIi32 "us\n" , diff , delay_period_us );
114118 TEST_ASSERT_INT_WITHIN (delta_us , delay_period_us , diff );
115119
116- /* Clear test data */
117- ulp_main_cpu_command = LP_CORE_NO_COMMAND ;
118- ulp_command_resp = LP_CORE_NO_COMMAND ;
120+ clear_test_cmds ();
119121}
120122
121123#define LP_TIMER_TEST_DURATION_S (5)
@@ -210,6 +212,8 @@ static void check_reset_reason_and_sleep_duration(void)
210212 printf ("CPU slept for %" PRIi64 " ms, expected it to sleep approx %" PRIi64 " ms\n" , sleep_duration , expected_sleep_duration_ms );
211213 /* Rough estimate, as CPU spends quite some time waking up, but will test if lp core is waking up way too often etc */
212214 TEST_ASSERT_INT_WITHIN_MESSAGE (1000 , expected_sleep_duration_ms , sleep_duration , "LP Core did not wake up the expected number of times" );
215+
216+ clear_test_cmds ();
213217}
214218
215219TEST_CASE_MULTIPLE_STAGES ("LP Timer can wakeup lp core periodically during deep sleep" , "[ulp]" ,
0 commit comments