cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G431 bug in fdcan? - no databytes send

Tobe
Senior III

Hi,

i a trying to figure out, why my fdcan is not sending databytes. It only sends the id.

And i think i found a bug. Or maybe its just me having not enough knowledge to comprehend it.

In the function "FDCAN_CopyMessageToRAM" there is a part, where the data length is bit shifted to zero.

data zero.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Tobe
Senior III

I found the problem and fixed the issue: I was not using "FDCAN_data_length_code" for the data length.

I added this to the code to make it work using it without "FDCAN_data_length_code":

 

fixed.jpg

 IF it is NOT the actual "length", it should be named "lengthCode"... 👎

View solution in original post

6 REPLIES 6
Tobe
Senior III

I removed the bit shift, and the bytes are transferred to the txAddress. But still it wont send the bytes. I feel like i am on the complete wrong track? But the bitshifft still makes no sense at all to me.

 

its there.jpg

fdcaninit.jpg

Karl Yamashita
Lead II

Show more relevant code. How are you initializing the FDCAN_TxHeaderTypeDef and data?

 

I added the init code.  But cant you tell, that any uint8_t shifted 8 or more bits to the right is always 0?

Tobe
Senior III

I found the problem and fixed the issue: I was not using "FDCAN_data_length_code" for the data length.

I added this to the code to make it work using it without "FDCAN_data_length_code":

 

fixed.jpg

 IF it is NOT the actual "length", it should be named "lengthCode"... 👎

FDCAN_CopyMessageToRAM is declared static so you shouldn't have removed static keyword to use that function.

Instead you need to use HAL_FDCAN_AddMessageToTxFifoQ

Yes, but HAL is pretty bloated, and i am working on a bootloader.