cancel
Showing results for 
Search instead for 
Did you mean: 

I'm trying to do can transmission using an stm32. I'm trying to send a 8 byte data . but the data is not shown on the can analyser when the data length (.DLC) is 8. but when I change the .DLC to 5 , data appears on the can analyser. how to fix this ?

SSoor.1
Associate
 
1 ACCEPTED SOLUTION

Accepted Solutions
Foued_KH
ST Employee

Hello @SSoor.1​ ,

You can use the CAN extended frame format which supports up to 8 bytes of data per frame.

To use the extended frame format, you will need to modify the CAN message structure in your code to include the extended frame format bit (EFF) and a 29-bit identifier instead of the standard 11-bit identifier.

TxHeader.DLC = 8; // 8 bytes of data
 
TxHeader.ExtId = 0x12345678; // 29-bit identifier
TxHeader.RTR = CAN_RTR_DATA; // Data frame
TxHeader.IDE = CAN_ID_EXT; // Extended frame format
 

Hope I helped you!

If this solves your problem, please mark my answer as "Best Answer" by clicking on the "Select as Best" button, this can be helpful for Community users to find this solution faster. 

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
Foued_KH
ST Employee

Hello @SSoor.1​ ,

You can use the CAN extended frame format which supports up to 8 bytes of data per frame.

To use the extended frame format, you will need to modify the CAN message structure in your code to include the extended frame format bit (EFF) and a 29-bit identifier instead of the standard 11-bit identifier.

TxHeader.DLC = 8; // 8 bytes of data
 
TxHeader.ExtId = 0x12345678; // 29-bit identifier
TxHeader.RTR = CAN_RTR_DATA; // Data frame
TxHeader.IDE = CAN_ID_EXT; // Extended frame format
 

Hope I helped you!

If this solves your problem, please mark my answer as "Best Answer" by clicking on the "Select as Best" button, this can be helpful for Community users to find this solution faster. 

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.