I don't want to use the SDK function MCAN_TransferSendNonBlocking() which is not working anyway if used in combination with below receive handler code. Initialization done as per SDK example.
Can I have an example just like receive interrupt provided in the SDK -
void CAN0_IRQ0_IRQHandler(void)
{
MCAN_ClearStatusFlag(EXAMPLE_MCAN, CAN_IR_RF0N_MASK);
MCAN_ReadRxFifo(EXAMPLE_MCAN, 0, &rxFrame);
rxComplete = true;
/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
exception return operation might vector to incorrect interrupt */
#if defined __CORTEX_M && (__CORTEX_M == 4U)
__DSB();
#endif
}
Above code is working perfectly for receive interrupt. I can't find a similar one for transmission!
Thanks for reading. Looking for a solution.
Hi, Friend,
As you know that it is okay to read data from CAN receiver in ISR, but I do not think it is suitable to write the CAN frame to CAN transmitter in ISR.
Anytime you want to transfer CAN frame, you can call the MCAN_TransferSendNonBlocking(), if you do not want to call the api function, you can write the snippet yourself to replace the MCAN_TransferSendNonBlocking() function.
Hope it can help you
BR
XiangJun Rong
Hi xiangjun.rong
Thanks for the reply.
I don't have any problem using the API MCAN_TransferSendNonBlocking().
Buy its only working for the first time for me.
When it is called for the second time its not working.
It gets stuck at some place in the middle of function definition.
I can post CAN specific code if needed!
Meanwhile please share some working project using receive IRQ handler & MCAN_TransferSendNonBlocking() which I can use.
can transciever
Hi,
I think that CAN example project in the SDK works fine. If it does not work, pls tell us the code snippet which the chip stuck at.
BR
XiangJun Rong