Skip to content

FDCAN bus interrupts are not handled for the STM32G0B1 causing an infinite loop #2224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rondlh opened this issue Dec 7, 2023 · 2 comments · Fixed by #2301
Closed

FDCAN bus interrupts are not handled for the STM32G0B1 causing an infinite loop #2224

rondlh opened this issue Dec 7, 2023 · 2 comments · Fixed by #2301
Labels
enhancement New feature or request

Comments

@rondlh
Copy link

rondlh commented Dec 7, 2023

With my limited understanding I see the following:

The FDCAN implementation on the STM32G0B1 uses interrupt "TIM16_FDCAN_IT0_IRQn", which calls "TIM16_IRQHandler(void)" (in HardwareTimer.cpp).
In "timer.h" it says: #define TIM16_IRQHandler TIM16_FDCAN_IT0_IRQHandler.

"TIM16_IRQHandler" should analyze the interrupt source and forward to "HAL_FDCAN_IRQHandler" if the FDCAN bus is the interrupt source so the FDCAN callbacks can be used/called.

Currently TIM16_IRQHandler only processes interrupts triggered by Tim16, so the FDCAN bus callbacks cannot be used, and even worse, the interrupt flag is not cleared causing an infinite loop.

"TIM16_IRQHandler" in HardwareTimer.cpp

void TIM16_IRQHandler(void)
  {
    if (HardwareTimer_Handle[TIMER16_INDEX]) {
      HAL_TIM_IRQHandler(&HardwareTimer_Handle[TIMER16_INDEX]->handle);
    }
  }
@fpistm
Copy link
Member

fpistm commented Dec 8, 2023

Hi @rondlh
right, as we have no official support for FDCAN it is not added.
Do not hesitate to provide a PR to implement this.

@fpistm fpistm added the enhancement New feature or request label Jan 8, 2024
fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this issue Mar 11, 2024
Application have to declare the phfdcan1 and phfdcan2.

Example:
FDCAN_HandleTypeDef myhfdcan1;
FDCAN_HandleTypeDef *phfdcan1 = &myhfdcan1;
#if defined(FDCAN2_BASE)
FDCAN_HandleTypeDef *phfdcan2 = NULL;
#endif

Fixes stm32duino#2224.

Signed-off-by: Frederic Pillon <[email protected]>
@fpistm
Copy link
Member

fpistm commented Mar 11, 2024

Hi @rondlh,
I've made a PR to fix this issue, see #2301.
If you can test and give us a feedback, it would be very appreciated.

fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this issue Mar 11, 2024
Application have to declare the phfdcan1 and phfdcan2.

Example:
FDCAN_HandleTypeDef myhfdcan1;
FDCAN_HandleTypeDef *phfdcan1 = &myhfdcan1;
#if defined(FDCAN2_BASE)
FDCAN_HandleTypeDef *phfdcan2 = NULL;
#endif

Fixes stm32duino#2224.

Signed-off-by: Frederic Pillon <[email protected]>
fpistm added a commit that referenced this issue Mar 12, 2024
Application have to declare the phfdcan1 and phfdcan2.

Example:
FDCAN_HandleTypeDef myhfdcan1;
FDCAN_HandleTypeDef *phfdcan1 = &myhfdcan1;
#if defined(FDCAN2_BASE)
FDCAN_HandleTypeDef *phfdcan2 = NULL;
#endif

Fixes #2224.

Signed-off-by: Frederic Pillon <[email protected]>
tadtruex pushed a commit to TadAtThayer/Arduino_Core_STM32 that referenced this issue Apr 23, 2024
Application have to declare the phfdcan1 and phfdcan2.

Example:
FDCAN_HandleTypeDef myhfdcan1;
FDCAN_HandleTypeDef *phfdcan1 = &myhfdcan1;
#if defined(FDCAN2_BASE)
FDCAN_HandleTypeDef *phfdcan2 = NULL;
#endif

Fixes stm32duino#2224.

Signed-off-by: Frederic Pillon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

2 participants