Changing the Data Length of the CAN Mailbox during Run time

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ShopithamR_26
Employee
Employee
25 replies posted 10 replies posted 5 replies posted

<b>Is it possible to change the Data length field for the CAN maibox during the run time ?</b>

   

Yes . By default the data length for each of the CAN mailbox is defined in the CAN configuration window . In case if you need to change data length field for each of the message you are sending you need to modify the CMD register of the CAN transmitter .

   

The datalength is stored in the DLC field of the CMD register. The CAN TX CMD register contains 4 bits to store the DLC value. The bit 19:16 contains the DLC for each mailbox. Below is the code snippet to change this value 

   

CAN_TX[Mailbox_No].txcmd.byte[2u] &= 0xF0; 

   

CAN_TX[Mailbox_No].txcmd.byte[2u] |= No_of_Data_Bytes;

   

Through the above register write it is possible to change the DLC field during run time .

   

Regards,
Sobi

0 Likes
1 Reply
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Such topics belong to the knowledge base, not to the forum (at least when nobody is asking about them). So please add them there, and don't spam the forum...

0 Likes