Hello All,
I try to integrate the CAN-interrupt-tx example code (frdmkw36_driver_examples_flexcan_interrupt_transfer) into my project, and I use the wireless-UART example code (frdmkw36_wireless_examples_bluetooth_w_uart_freertos) as my code-based, Unfortunately, It seems the CAN-BUS can't work and no any CAN interrupt can be generated. I have verified and confirmed that my CAN0_init() function can work fine, because I have added it to the CAN-interrupt-tx example code and it seems to work well, Now I have some questions, Is it impossible to execute interrupt ISR in NXP's FreeRots, or I missed some configuration for CAN's ISR, Can anyone share some useful experience to me,
Thank you very much.
Hello sihanchen / estephania_mart,
I am getting same heap files error after adding the flexcan driver into "frdmkw36_wireless_examples_bluetooth_w_uart_freertos" project.
Also, attaching the image of project build error.
I am using SDK ver. 2.2.1 and MCUXpresso IDE 11.0.1
Kindly suggest the solution.
Thank you.
2 quick comments:
- wireless uart is a complicated example. If you are new to BLE applications, I recommend you to start from something simpler, like the bps demo.
- FreeRTOS has its own way to handle ISRs. Maybe you need to register the CAN ISR inside FreeRTOS. I don't remember this part of codes by heart, need to check also.
Hi Xiang Li,
Thank you for your suggestions, but our product code is based on wireless-UART SDK, so I have to use it.
In addition. I have checked that the CAN's interrupt vector table and it already exists, anyway I will check the ISR's register you mentioned, thank you for your help.
Hi Sihan,
I did a quick look to the example code "frdmkw36_driver_examples_flexcan_interrupt_transfer", and I see the CAN interrupt priority is not changed by default.
In this example, only the CAN ISR is enabled inside FLEXCAN_TransferCreateHandle(), via EnableIRQ(). But I don't see any call to NVIC_SetPriority(). So it means the CAN ISR priority would be the default as in ARM M0+ core.
So you might need to check if the priority setting is ok when FreeRTOS is running.
Hi Xiang Li,
Thank you for your help. I have added NVIC_SetPriority() to my CAN_init(), but the CAN interrupt still cannot be generated.Thanks
Hello,
You can check as well this application note with the implementation. I would recommend you to start with the CAN communication first and only adding the driver to receive/send a message through CAN and after that if you are interested adding the rest of the functionality mentioned there (security+LIN) .
regards,
Estephania
HI Estephania,
I have tried adding CAN_init() to (frdmkw36_wireless_examples_bluetooth_w_uart_freertos) according to the instructions in the Application Note, but it seems that CAN-BUS still does not work. In order to confirm whether the CAN-Driver can run in the FreeRtos project, I tried to dump the register value after executing "FLEXCAN_WriteTxMb()" and compare it with (frdmkw36_driver_examples_flexcan_interrupt_transfer) , As shown in the figure below, we can see that the register value of the yellow item is wrong . Can anyone provide me with some suggestions, Many thanks.
Source Code :
Wrong memory content :
Correct memory content :
HI Estephania,
Thank you for sharing your experience. I have referenced the Application Note for creating the CAN driver, and used "SDK Component Management window" to add the CAN Driver to my project, but it seems that there are some compiler errors. I remove some files as follows to fix the compiler's errors. Is it correct ? Thank you very much.