cancel
Showing results for 
Search instead for 
Did you mean: 

Error found in HAL-Driver "stm32h7xx_hal_fdcan.c" Version 1.10.0.0

GK_CPfal2020
Associate II

Dear Madame or Sir.

We found some errors in HAL-Driver "stm32h7xx_hal_fdcan.c" Version 1.10.0.0:

for the FDCAN modul of STM32H743.

stm32h7xx_hal_fdcan.c

A call of the function "HAL_FDCAN_DeactivateNotification" and

"HAL_FDCAN_TT_DeactivateNotification"

CAN CLEAR UNWANTED

"Interrupt Line Enable Flag" in the ILE register.

The result is, that NOT DEACTIVATED interrupts are also disabled !

forever, because the

Calling of function "HAL_FDCAN_ActivateNotification"

especially "HAL_FDCAN_TT_ActivateNotification"

DON'T SET again the WRONGLY CLEARED "Interrupt Line Enable Flag"

in the ILE register.

The result is, that NOT DEACTIVATED interrupts are disabled forever !

Workaround example for FDCAN interrupt: TX-COMPLETE interrupt

// Calling of the macro
CLEAR_BIT(hfdcan->Instance->IE, FDCAN_IT_TX_COMPLETE);
// instead of the function "HAL_FDCAN_DeactivateNotification" at the moment.

Workaround example for TTCAN interrupt: REGISTER TIMEMARK interrupt

// Calling of the macro
CLEAR_BIT(hfdcan->ttcan->TTIE, FDCAN_TT_IT_REG_TIME_MARK);
// instead of the function "HAL_FDCAN_TT_DeactivateNotification" at the moment.

Please find the details in the attachment.

Best regards

Christian

1 ACCEPTED SOLUTION

Accepted Solutions
Amel NASRI
ST Employee

Hi @GK_CPfal2020​ ,

First of all thanks for your valuable feedback and the time spent to explain it with details.

The way that FDCAN HAL driver is designed requires that any call of HAL_FDCAN_DeactivateNotification is preceded by HAL_FDCAN_ActivateNotification().

So the steps to follow should be like this:

  1. call HAL_FDCAN_ConfigInterruptLines() in order to assign interrupts to either Interrupt line 0 or 1
  2. enable relevant interrupt line(s) using HAL_FDCAN_ActivateNotification()
  3. use the macros  __HAL_FDCAN_ENABLE_IT() and __HAL_FDCAN_DISABLE_IT() to enable or disable interrupts
  4. disable the interrupt line(s) with HAL_FDCAN_DeactivateNotification()

-Amel

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.

View solution in original post

2 REPLIES 2
Amel NASRI
ST Employee

Hi @GK_CPfal2020​ ,

First of all thanks for your valuable feedback and the time spent to explain it with details.

The way that FDCAN HAL driver is designed requires that any call of HAL_FDCAN_DeactivateNotification is preceded by HAL_FDCAN_ActivateNotification().

So the steps to follow should be like this:

  1. call HAL_FDCAN_ConfigInterruptLines() in order to assign interrupts to either Interrupt line 0 or 1
  2. enable relevant interrupt line(s) using HAL_FDCAN_ActivateNotification()
  3. use the macros  __HAL_FDCAN_ENABLE_IT() and __HAL_FDCAN_DISABLE_IT() to enable or disable interrupts
  4. disable the interrupt line(s) with HAL_FDCAN_DeactivateNotification()

-Amel

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.

GK_CPfal2020
Associate II

Hello Amel.

Thank you for your reply.

OK.

We use now for INIT of FDCAN interrupt SOURCE and LINES

// Enable INTERRUPT LINE 0 of FDCAN1 in the NVIC
HAL_NVIC_EnableIRQ(FDCAN1_IT0_IRQn);
 
// Select INTERRUPT LINE of FDCAN interrupt
HAL_FDCAN_ConfigInterruptLines(&sCanModul, FDCAN_IT_TX_COMPLETE, FDCAN_INTERRUPT_LINE0);
 
// Enable INTERRUPT LINE and INTERRUPT SOURCE of FDCAN interrupt
HAL_FDCAN_ActivateNotification(&sCanModul, FDCAN_IT_TX_COMPLETE, FDCAN_TX_BUFFER1);

and for DISABLING / ENABLING FDCAN interrupts

// Disable FDCAN interrupt
__HAL_FDCAN_DISABLE_IT(&sCanModul, FDCAN_IT_TX_COMPLETE);
 
// Enable FDCAN interrupt
__HAL_FDCAN_ENABLE_IT(&sCanModul, FDCAN_IT_TX_COMPLETE);

For INIT of TTCAN interrupt SOURCE and LINES we use now

// Enable INTERRUPT LINE 1 of FDCAN1 in the NVIC
HAL_NVIC_EnableIRQ(FDCAN1_IT1_IRQn);
 
// Select INTERRUPT LINE of TTCAN interrupt
HAL_FDCAN_TT_ConfigInterruptLines(&sCanModul, FDCAN_TT_IT_REG_TIME_MARK, FDCAN_INTERRUPT_LINE1);
 
// Enable INTERRUPT LINE and INTERRUPT SOURCE of TTCAN interrupt
HAL_FDCAN_TT_ActivateNotification(&sCanModul, FDCAN_TT_IT_REG_TIME_MARK);

and for DISABLING / ENABLING TTCAN interrupts

// Disable FDCAN interrupt
__HAL_FDCAN_TT_DISABLE_IT(&sCanModul, FDCAN_TT_IT_REG_TIME_MARK);
 
// Enable FDCAN interrupt
__HAL_FDCAN_TT_ENABLE_IT(&sCanModul, FDCAN_TT_IT_REG_TIME_MARK);

Thank you very much for your help.

This is working as expected, now.

Best regards,

Christian