cancel
Showing results for 
Search instead for 
Did you mean: 

I believe I have found an error in the HAL. Where and how can I report it?

EZöll.1
Associate

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.

7 REPLIES 7
Ozone
Lead II

> 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 ... ;)

Olivier GALLIEN
ST Employee

​Hi @Erik Zöllner​ 

Thanks for your post.

There's 3 ways to report a bug to ST :

BR,

Olivier

Olivier GALLIEN
In order 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.

That probably should be https://my.st.com/OLS (with a period between "my" and "st").

​Yes right. Thanks to highlight the typo.

Olivier

Olivier GALLIEN
In order 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.
Mike_ST
ST Employee

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.

EZöll.1
Associate

@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;

>> 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.