STM32G431 bug in fdcan? - no databytes send
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-12-14 3: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.
- Labels:
-
STM32G4 series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-12-14 4: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.
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-12-14 6:38 PM
Show more relevant code. How are you initializing the FDCAN_TxHeaderTypeDef and data?
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-12-15 1: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
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-12-15 2:30 AM
Yes, but HAL is pretty bloated, and i am working on a bootloader.
