Hello, I am using STM32F4 with FreeRTOS. I have read through all the documentation multiple times and believe I have the interrupt priorities set correctly in my FreeRTOSConfig.h but am still getting an assert failure on priorities when calling xQueueReceiveFromISR in a CAN Rx ISR on rare occassions. The following is my FreeRTOSConfig.h snippet:
#define configPRIO_BITS 4
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
#define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
The PriorityGrouping is set to NVIC_PRIORITYGROUP_4 as advised. The CAN Rx ISR priority is set to 5 at bootup before the scheduler is started and the following is what the ISR looks like:
void HAL_CAN_TxMailbox0CompleteCallback(CAN_HandleTypeDef* hcan) {
can_frame_t message;
if (xQueueReceiveFromISR(can_rx_queue, &message, NULL) == pdPASS) {
(CAN_transmit_frame(hcan1, message.header.StdId, message.data, message.header.DLC);
}
}
Sometimes I will get a fault due to an assert hitting from the function: portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
in queue.c which then calls configASSERT( ( portAIRCR_REG & portPRIORITY_GROUP_MASK ) <= ulMaxPRIGROUPValue );
in port.c