i.MX8QM Cortex-M FLEXCAN FreeRTOS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8QM Cortex-M FLEXCAN FreeRTOS

Jump to solution
1,170 Views
io
Contributor II

Hello,
I’m working with i.MX8QM Cortex-M4 running FreeRTOS.
I use the NXP FlexCAN driver with interrupt callback. Inside the callback I try to call xSemaphoreGiveFromISR(), but the program always hangs/stuck at that point.

I already tried changing interrupt priority and checked FreeRTOS config, but still same result.
Does anyone have a simple example how to use FlexCAN with FreeRTOS task (semaphore or task notify) on i.MX8QM?

Here is my main program.
https://pastebin.com/BrhXQC1w 

Thanks.

Tags (3)
0 Kudos
Reply
1 Solution
1,092 Views
io
Contributor II

Just wanna share for anyone who may need it.

The problem was just the interrupt setup. I wrongly set the NVIC Priority
NVIC_SetPriority(DMA_FLEXCAN0_INT_IRQn, 3); which should be NVIC_SetPriority(IRQSTEER_4_IRQn, 3);

The FLEXCAN0 interrupt was connected to IRQSTEER_4_IRQn. Because the interrupt priority was wrongly set, it defaulted to a high priority (maybe 0). Then when calling xSemaphoreGiveFromISR() inside isr flexcan_callback, it causing the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() failure and the program to stuck there.

Ref:
https://community.nxp.com/t5/i-MX-Processors/imx8qm-IRQSTEER-interrupt-mapping/m-p/1067519/highlight...

https://www.freertos.org/Documentation/02-Kernel/03-Supported-devices/04-Demos/ARM-Cortex/RTOS-Corte...

 

Regards,

io

View solution in original post

0 Kudos
Reply
2 Replies
1,093 Views
io
Contributor II

Just wanna share for anyone who may need it.

The problem was just the interrupt setup. I wrongly set the NVIC Priority
NVIC_SetPriority(DMA_FLEXCAN0_INT_IRQn, 3); which should be NVIC_SetPriority(IRQSTEER_4_IRQn, 3);

The FLEXCAN0 interrupt was connected to IRQSTEER_4_IRQn. Because the interrupt priority was wrongly set, it defaulted to a high priority (maybe 0). Then when calling xSemaphoreGiveFromISR() inside isr flexcan_callback, it causing the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() failure and the program to stuck there.

Ref:
https://community.nxp.com/t5/i-MX-Processors/imx8qm-IRQSTEER-interrupt-mapping/m-p/1067519/highlight...

https://www.freertos.org/Documentation/02-Kernel/03-Supported-devices/04-Demos/ARM-Cortex/RTOS-Corte...

 

Regards,

io

0 Kudos
Reply