cancel
Showing results for 
Search instead for 
Did you mean: 

the collision between HAL_SPI_TransmitReceive and osDelay

along ma
Associate

I use STM32CUBEMX to create code,and when the code is running,I find a problem.My code is stuck at prvCheckTasksWaitingTermination.(stm32f405 + st25ru3993)

Simple Description with my system:

1,freertos use systick, and HAL use TIM7

2,two simple task,one is flashing led,other is RFID test function,as below

******************************************************

void StartDefaultTask(void *argument)

{

 /* USER CODE BEGIN StartDefaultTask */

 /* Infinite loop */

 for(;;)

 {

  HAL_GPIO_TogglePin(SYS_LED_GPIO_Port,SYS_LED_Pin);

               osDelay(500);

 }

 /* USER CODE END StartDefaultTask */

}

*******************************

void StartTask02(void *argument)

{

 /* USER CODE BEGIN StartTask02 */

 /* Infinite loop */

 for(;;)

 {

 inventoryGen2_fast(); 

       osDelay(500);

 }

 /* USER CODE END StartTask02 */

}

******************************************************

simple test result:

1,when run code without modifing nothing,the first time,the code execute over inventoryGen2_fast(),and try run into osDelay(500),the code may stack at function of "prvCheckTasksWaitingTermination",and never resume;

2,when i annotate the code "inventoryGen2_fast()",the system can run ok;

3,when i annotate the code "HAL_SPI_TransmitReceive" which in the function of inventoryGen2_fast(),the system can run ok;

so i get a primary result that the "HAL_SPI_TransmitReceive" may cause some problem,when goon running "osDelay",but i can't solve the problem, pls give some help thanks.

can use chinese

some code as below:

****************************************************

osStatus_t osDelay (uint32_t ticks) {

 osStatus_t stat;

 if (IS_IRQ()) {

   stat = osErrorISR;

 }

 else {

   stat = osOK;

   if (ticks != 0U) {

     vTaskDelay(ticks);

   }

 }

 return (stat);

}

0 REPLIES 0