AnsweredAssumed Answered

STM32F302 CAN interrupt handling

Question asked by Gerber on Nov 30, 2017


I have some issue setting up CAN for STM32F302 using Keil. As a starting point I used the Keil STM32 CAN Example:


Everything seems to work, except the interrupt handling. After startup can only send one CAN message (verified with external CAN-USB monitor), and I’m not able to receive any CAN messages.

After sending the first successful CAN message, CAN_TxRdy[0] is NOT set to “1”.


Interrupt related code:


NVIC_EnableIRQ(USB_HP_CAN1_TX_IRQn); /* enable CAN TX interrupt */


  CAN transmit interrupt handler
void USB_HP_CAN1_TX_IRQHandler (void) {

  if (CAN1->TSR & CAN_TSR_RQCP0) {          /* request completed mbx 0        */
    CAN1->TSR |= CAN_TSR_RQCP0;             /* reset request complete mbx 0   */
    CAN1->IER &= ~CAN_IER_TMEIE;            /* disable  TME interrupt         */
      CAN_TxRdy[0] = 1;


Why I can only send one message, or whats causing the CAN TX interrupt handler not being called?