2020-01-21 04:45 AM
I am getting a CAN message with the function `HAL_CAN_GetRxMessage`.
The struct `CAN_RxHeaderTypeDef` has a field called `RTR`.
The doc string says: "This parameter can be a value of @ref CAN_remote_transmission_request".
`CAN_remote_transmission_request` consists of two macros:
#define CAN_RTR_DATA (0x00000000U) /*!< Data frame */
#define CAN_RTR_REMOTE (0x00000002U) /*!< Remote frame */
The received CAN message, however, has a RTR value of 1 because it is shifted by `CAN_RI0R_RTR_Pos` to result in a boolean value.
When sending the message with `HAL_CAN_AddTxMessage` it is checked with `assert_param(IS_CAN_RTR(pHeader->RTR));` that RTR is indeed either `CAN_RTR_DATA` or `CAN_RTR_REMOTE` and not 1.
2020-01-21 05:18 AM
> Where and how can I report it?
Here, as you did.
I'm not aware that ST opened up a channel to their bug tracking tool for users.
Not even fully convinced they have one ... ;)
2020-01-21 06:39 AM
Hi @Erik Zöllner
Thanks for your post.
There's 3 ways to report a bug to ST :
BR,
Olivier
2020-01-21 06:58 AM
That probably should be https://my.st.com/OLS (with a period between "my" and "st").
2020-01-21 07:01 AM
Yes right. Thanks to highlight the typo.
Olivier
2020-01-22 02:22 AM
Hello,
What MCU family ?
When you say:
>> The received CAN message, however, has a RTR value of 1 because it is shifted by `CAN_RI0R_RTR_Pos` to result in a boolean value.
Where do you see that ?
I can only see that in the legacy HAL files for F0/F3.
2020-01-22 05:49 AM
@Mike_ST
We are using the STM32 F765VG.
We have generated the code with Cube MX 5.4.0.
We are not aware that there would be a newer HAL. How could we get that?
In file Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_can.c in function `HAL_CAN_GetRxMessage` line 1559 is
pHeader->RTR = (CAN_RI0R_RTR & hcan->Instance->sFIFOMailBox[RxFifo].RIR) >> CAN_RI0R_RTR_Pos;
2020-01-23 02:01 AM
>> We are not aware that there would be a newer HAL. How could we get that?
No, there is no newer HAL, I just mean that in the HAL there is a Legacy directory where older version are stored.
It seems that it has been patched on F0/F3 family:
F0 legacy folder: pRxMsg->RTR = (CAN_RI0R_RTR & hcan->Instance->sFIFOMailBox[FIFONumber].RIR) >> CAN_RI0R_RTR_Pos;
F0: pHeader->RTR = (CAN_RI0R_RTR & hcan->Instance->sFIFOMailBox[RxFifo].RIR);
Same on F3:
F3: pHeader->RTR = (CAN_RI0R_RTR & hcan->Instance->sFIFOMailBox[RxFifo].RIR);
F3 legacy folder: pRxMsg->RTR = (CAN_RI0R_RTR & hcan->Instance->sFIFOMailBox[FIFONumber].RIR) >> CAN_RI0R_RTR_Pos;
And there is no shift in other family. So without being a CAN expert, I think there is something wrong too.
Ticket entered.
Thank you.