Just reporting a minor bug in HAL_FDCAN_GetProtocolStatus function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-16 7:13 AM
This line:
ProtocolStatus->Activity = (StatusReg & FDCAN_PSR_ACT);
I think it should be:
ProtocolStatus->Activity = ((StatusReg & FDCAN_PSR_ACT) >> FDCAN_PSR_ACT_Pos);
I'd appreciate if ST can confirm this.
- Labels:
-
FDCAN
-
STM32Cube MCU Packages
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-16 8:36 AM
I concur with you findings, in a sense. Activity status are 3 bits to the left and needs a mask of 2 bits.
So adding .FDCAN_PSR_ACT_Pos will shift the bits over to the correct position.
And so the 2 bits represent
but you can't use ST's defines as they are wrong. But would work if you didn't add FDCAN_PSR_ACT_Pos to shift the bits 3 over.
I'd rather ST redo their defines so 0, 1, 2 and 3 are used as it makes sense.
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
‎2022-11-22 12:31 AM
Hello @XP.1acheco​ and welcome to the Community :),
For my side it is not a bug.
The activity function there is no need to shift the 3 bits because the comparison is done on all bits.
Thanks for your contribution.
Kaouthar
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-22 4:02 AM
I'm not sure what comparison you mean. I had to left shift 3 positions to properly read the activity bits status.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-22 4:49 AM
Hello @XP.1acheco​,
Could you please provide more details concerning your problem?
Do you have any problem when you use the activity function without shift 3 positions?
Thank you.
Kaouthar
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-22 7:48 AM
ST's defines 0x0, 0x8, 0x10, 0x18 are correct when comparing to activity state. If you use your own defines which are probably 0x1, 0x2 and 0x3, then the comparison doesn't work. 0x0 will work though.
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
