Skip to main content
SSoor.1
Associate
April 22, 2023
Solved

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 ?

  • April 22, 2023
  • 1 reply
  • 1333 views
This topic has been closed for replies.
Best answer by Foued_KH

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

1 reply

Foued_KH
Foued_KHBest answer
ST Employee
April 22, 2023

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.