We are using LPC55S06 board, we're working with CAN, we are receiving the data from the CAN successfully but when we try CAN transmission it is not working.
after execution of this funciton code is waiting at /* Wait until message sent out. */
while (0U == MCAN_IsTransmitOccurred(base, idx)) in MCAN_TransferSendBlocking fucntion so please suggest possibel issue with our code
We're following the above configurations.
Hi,
Okay, I see that the TX buffer is initialized.
For the api function MCAN_TransferSendBlocking(MAUTO_CAN,0, &txXfer); it uses polling mode instead of interrupt mode, but the example architecture is based on interrupt mode.
Pls try to comment the MCAN_TransferCreateHandle(EXAMPLE_MCAN, &mcanHandle, mcan_callback, NULL); which enable and initialize the interrupt and have a try
Hope it is helpful
BR
XiangJun Rong
Hi,
Regarding your issue, the api function MCAN_TransferSendBlocking(MAUTO_CAN,0, &txXfer); write TX buffer with the function status_t MCAN_WriteTxBuffer(CAN_Type *base, uint8_t idx, const mcan_tx_buffer_frame_t *pTxFrame); so before you call the MCAN_TransferSendBlocking(), you have to initialize the TX buffer with index 0.
You can use the following code to initialize TX buffer, Note that the TX_BUFFER_OFS is an accumulated address for TX buffer.
Pls refer to section 41.8.31 Tx buffer configuration register which specify the CAN buffer address in SRAM. Pls refer to the section 41.5.1 Message RAM configuration for the memory allocation.
/* TX buffer config. */
memset(&txBuffer, 0, sizeof(txBuffer));
txBuffer.address = TX_BUFFER_OFS;
txBuffer.dedicatedSize = 1U;
txBuffer.fqSize = 0;
txBuffer.datafieldSize = kMCAN_8ByteDatafield;
#if (defined(USE_CANFD) && USE_CANFD)
txBuffer.datafieldSize = BYTES_IN_MB;
#endif
MCAN_SetTxBufferConfig(EXAMPLE_MCAN, &txBuffer);
Hope it can help you
BR
XiangJun Rong