Hello,
I am facing an issue regarding the implementation of a CAN peripheric in FreeRTOS.
Configuration : FreeRTOS V8.1.2
STM32F407VG (discovery board)
Indeed, i am using a binary semaphore in the reception interrupt of the CAN to trigger a task processing the received data.
The thing is that it makes my Os crash after a couple of minutes and i can’t figure out how to debug it.
The interrupts priorities are set correctly (priority of CAN Rx interrupt set to minimum for test) and i for test purposes i activated only the CANRx Task.
Here is my CAN Rx interruption :
~~~~~~
void CAN1
RX0IRQHandler(void){
BaseType_t xHigherPriorityTaskWoken=pdFALSE;
CAN_Receive(CAN1, CAN_FIFO0, &RxMessage);
xSemaphoreGiveFromISR(CANRx_semaphore, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
}
~~~~~~
Here is my CAN Rx Task :
~~~~~~
xTaskCreate( CANRxTask, “CANRx”, configMINIMAL
STACKSIZE, ( void * ) NULL, 3, NULL );
void CANRxTask( void *pvParameters ){
CANRx_semaphore=xSemaphoreCreateBinary();
CAN_ITConfig(CAN1, CAN_IT_FMP0, ENABLE);
for(;;){
if(xSemaphoreTake(CANRx_semaphore, portMAX_DELAY)){
if(RxMessage.StdId==0x0C0){
BMS_SOC=RxMessage.Data[0];
BMS_Mode=RxMessage.Data[1]&0x03;
}
else if(RxMessage.StdId==0x0C1){
BMS_Tension=RxMessage.Data[0];
BMS_Intensite=RxMessage.Data[1];
}
}
~~~~~~
I can post you my CAN_init function if needed.
I can’t figure out what is going wrong.
Any help is appreciated.
Thanks !