Hello,
im trying to send data (36 bytes) using CAN FD :
for example :
CAN0->RAMn[ 0*MSG_BUF_SIZE + 2] = 22; /* MB0 word 2 */
CAN0->RAMn[ 0*MSG_BUF_SIZE + 3] = 33; /* MB0 word 3 */
CAN0->RAMn[ 0*MSG_BUF_SIZE + 4] = 44; /* MB0 word 4 */
CAN0->RAMn[ 0*MSG_BUF_SIZE + 5] = 55; /* MB0 word 5*/
CAN0->RAMn[ 0*MSG_BUF_SIZE + 6] = 66; /* MB0 word 6 */
CAN0->RAMn[ 0*MSG_BUF_SIZE + 7] = 77; /* MB0 word 7*/
CAN0->RAMn[ 0*MSG_BUF_SIZE + 8] = 88; /* MB0 word 8 */
CAN0->RAMn[ 0*MSG_BUF_SIZE + 9] = 99; /* MB0 word 9*/
CAN0->RAMn[ 0*MSG_BUF_SIZE + 10] = 100; /* MB0 word 10*/
CAN0->RAMn[ 0*MSG_BUF_SIZE + 1] = 0x14440000; /* MB0 word 1: Tx msg with STD ID 0x511 */
CAN0->RAMn[ 0*MSG_BUF_SIZE + 0] = 0xCC4F0000 | 14 <<CAN_WMBn_CS_DLC_SHIFT; /* MB0 word 0: */
since im sending a payload of 36 bytes the DLC should be equal to 14.
- In Receive function : i retreive the DLC which is equal to 14
and acording to the table above a DLC equal to 14 means my data size could be 0 to 48 byte.
My question is how should i know that my data is only 36 bytes and not 48bytes.
hope my question is clear.
Hi,
you cannot send/receive just 36 bytes, with DLC=14 FlexCAN sends/receives 48 bytes, with DLC=15 it sends/receives 64 bytes and so on.
Moreover with
CAN0->RAMn[ 0*MSG_BUF_SIZE + 0] = 0xCC4F0000 | 14 <<CAN_WMBn_CS_DLC_SHIFT; /* MB0 word 0: */
64 bytes will be sent, to send 48 bytes use
CAN0->RAMn[ 0*MSG_BUF_SIZE + 0] = 0xCC400000 | 14 <<CAN_WMBn_CS_DLC_SHIFT; /* MB0 word 0: */
BR, Petr