Hi, I have a problem when using OsIf_SuspendAllInterrupts() and OsIf_ResumeAllInterrupts() .
I setup a simple project with STM0 in a 5ms periodic interrupt . When I call OsIf_SuspendAllInterrupts() and then call OsIf_ResumeAllInterrupts() immediately the timer resumes and runs normally.
But if I do some "heavy work" betweeen these two functions, for example a soft-delay in several minitues, the timer cannot resumes.
My board is S32K344 EVB RED.
Thank you for any help.
My Code:
static int os_timer_ms=0;
void Stm0Ch0Callback(void)
{
os_timer_ms+=5;
if(os_timer_ms>99999)
{
os_timer_ms=0;
}
if(os_timer_ms%1000==0)
printf("os_timer_ms=%d\r\n",os_timer_ms);
}
void SoftDelayMs(int ms)
{
for(int i=0;i<ms;i++)
{
for(int j=0;j<16000;j++)
{
int k=i+j;
}
}
}
int main(void)
{
BoardInit();
HAL_LED_Init();
HAL_UART_Init();
HAL_STM0_Init();
printf("hello!\r\n");
for(;;)
{
static int timer_ms=0;
if(timer_ms<os_timer_ms)
{
timer_ms=os_timer_ms;
if(timer_ms==5000)
{
printf("a\r\n");
OsIf_SuspendAllInterrupts();
printf("b\r\n");
SoftDelayMs(5000);
printf("c\r\n");
OsIf_ResumeAllInterrupts();
printf("d\r\n");
}
}
if(exit_code != 0)
{
break;
}
}
return exit_code;
}