2023-12-14 03:58 PM
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.
Solved! Go to Solution.
2023-12-14 11:02 PM - edited 2023-12-14 11:47 PM
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":
IF it is NOT the actual "length", it should be named "lengthCode"... :thumbs_down:
2023-12-14 04:57 PM - edited 2023-12-14 10:40 PM
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.
2023-12-14 06:38 PM
Show more relevant code. How are you initializing the FDCAN_TxHeaderTypeDef and data?
2023-12-14 10:42 PM
I added the init code. But cant you tell, that any uint8_t shifted 8 or more bits to the right is always 0?
2023-12-14 11:02 PM - edited 2023-12-14 11:47 PM
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":
IF it is NOT the actual "length", it should be named "lengthCode"... :thumbs_down:
2023-12-15 01:05 AM
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
2023-12-15 02:30 AM
Yes, but HAL is pretty bloated, and i am working on a bootloader.