Skip to main content
Benjamin.Lee
Visitor II
August 21, 2018
Question

CubeMX generated code crashed when calling HAL_CAN_Transmit_IT in timer interrput

  • August 21, 2018
  • 0 replies
  • 385 views

Hi,

I'm using CubeMX to generate code to test my stm32f103c8 platform, but I've encountered a problem that when I put HAL_CAN_Transmit_IT in the interrupt callback function of TIM3, it then goes into Hardfault_Handler.

If I put HAL_CAN_Transmit_IT in the main loop, then everything goes well and I can successfully read the transmitted CAN data on my PC.

By debugging I can locate the crash happened at line 744 and 745 in HAL_CAN_Transmit_IT:

hcan->Instance->sTxMailBox[transmitmailbox].TDTR &= 0xFFFFFFF0U;

hcan->Instance->sTxMailBox[transmitmailbox].TDTR |= hcan->pTxMsg->DLC;

Could anyone help me to tackle this problem? Thanks.

    This topic has been closed for replies.