cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F302 CAN interrupt handling

paul2
Senior
Posted on November 30, 2017 at 09:59

Hi,

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

http://www.keil.com/download/docs/351.asp

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?

Thanks

#can-stm32f302-interrupt #can-communitation
1 REPLY 1

Sorry, bumping old zombie unanswered threads off my feed

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..