Hello,
I'm implementing the flexcan only the calback function is overloaded with kStatus_FLEXCAN_RxIdle events.
And I can't find in the API documentation/ datasheet or example how to acknowledge this event or disable it.
Any suggestion how to solve this?
Thanks!
MCU: RT1060
Hi,
- Acknowledge a message object
My experiences is that FLEXCAN_TransferHandleIRQ doesn't acknowledge the message object. When I send a can message. If I breakpoint in the callback function the corresponding mailbox code is 0010b full. when I send an other canbus message the corresponding mailbox code is 0110b overrun.
To work around this. in the callback function I reinitialize FLEXCAN_TransferReceiveNonBlocking after I read the communication data. That seems to work. But I assume this is not the intended use.
- Interrupts
My intended question is: How do I prioritize the canbus interrupt with other peripherals like: timer, UARTs?
- flexcanConfig.enableIndividMask
This doesn't work.:
flexcanConfig.enableIndividMask = true;
FLEXCAN_SetRxIndividualMask(CAN2, mb_index, 0x7FF);
This does:
flexcanConfig.enableIndividMask = false;
FLEXCAN_SetRxIndividualMask(CAN2, mb_index, 0x7FF);
that doesn't seem very logical to me.
Regards,
Ernst
Hello,
- Acknowledge a message object
The overrun condition occurs when you are receiving more messages than the ones you can process. To prevent this from happening you should use either the FlexCAN FIFO or the DMA instead of the mailbox.
- Interrupts
You need to change the interrupt priority in the NVIC.
- flexcanConfig.enableIndividMask
Did you verify that the global mask and the individual masks are not mutually excluded?
Regards,
Victor
Hello Ernst,
Within the SDK you will find an example named "flexcan_interrupt_transfer". I recommend you check this example to see how to configure the FlexCAN module and the callback function.
Regards,
Victor
I already did that. The documentation is so limited and the example so basic.
- That I still don't have any understanding how to acknowledge of Message object(mail box) work.
- how the RX(TX) interrupt are handled and which one do i need for handling my RX message.
kStatus_FLEXCAN_RxIdle, kStatus_FLEXCAN_RxBusy, kStatus_FLEXCAN_RxFifoBusy:
kStatus_FLEXCAN_RxRemote, kStatus_FLEXCAN_UnHandled.
- How interrupt priority works in general?
- how to use FLEXCAN_TransferReceiveNonBlocking to acknowledge a message so I can receive a new one.
- how the option flexcanConfig.enableIndividMask works. And why I don't receive any messages when the mask is 0x7FF.
After some poking around I got something working. But that is not how I like to develop. I like to understand how the mechanism work but NXP really likes to keep it secrets.
Hello,
- That I still don't have any understanding how to acknowledge of Message object(mail box) work.
- how the RX(TX) interrupt are handled and which one do i need for handling my RX message.
In the function FLEXCAN_TransferReceiveNonBlocking the only thing that you are doing is activating the Message Buffer interrupt. The acknowledge of the message and the handling of the RX interrupt is done on the FlexCAN interrupt handler (FLEXCAN_TransferHandleIRQ). If you take as an example the project flexcan_interrupt_transfer you will find this handler in the file fsl_flexcan.c. The acknowledge of the message is done with the function FLEXCAN_SubHandlerForDataTransfered.
- How interrupt priority works in general?
Please refer to section 44.7.11 of the RT1060 reference manual. Here you will find the explanation of how the FlexCAN interrupts work.
- how to use FLEXCAN_TransferReceiveNonBlocking to acknowledge a message so I can receive a new one.
As mentioned before, this function doesn't acknowledge the received message. The interrupt handler of the FlexCAN module does this.
- how the option flexcanConfig.enableIndividMask works. And why I don't receive any messages when the mask is 0x7FF.
How did you activate the individual masks? Did you verify that the global mask and the individual masks are not mutually excluded? Did you modify the flexcanConfig.enableIndividMask to true?
Regards,
Victor