38.6.9 Interrupts

The CAN has the following interrupt sources:

  • Access to Reserved Address
  • Protocol Errors (Data Phase / Arbitration Phase)
  • Watchdog Interrupt
  • “bus off” Status
  • Error Warning & Passive
  • Error Logging Overflow
  • AHB Bus Error (BERR)
  • Message stored to Dedicated Rx Buffer
  • Timeout Occurred
  • Message RAM Access Failure
  • Timestamp Wraparound
  • Tx Event FIFO statuses (Element Lost / Full / Watermark Reached / New Entry)
  • Tx FIFO Empty
  • Transmission Cancellation Finished
  • Timestamp Completed
  • High Priority Message
  • Rx FIFO 1 Statuses (Message Lost / Full / Watermark Reached / New Message)
  • Rx FIFO 0 Statuses (Message Lost / Full / Watermark Reached / New Message)

Each interrupt source has an interrupt flag associated with it. The interrupt flag register (IR) is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing ‘1’ or disabled by writing ‘0’ to the corresponding bit in the interrupt enable register (IE). Each interrupt flag can be assigned to one of two interrupt service lines.

An interrupt request is generated when an interrupt flag is set, the corresponding interrupt enable is set, and the corresponding service line enable assigned to the interrupt is set. The interrupt request remains active until the interrupt flag is cleared, the interrupt is disabled, the service line is disabled, or the CAN is reset. Refer to the IR register for details on how to clear interrupt flags. The interrupt request lines are connected to the Nested Vector Interrupt Controller (NVIC). All interrupt requests from the peripheral are sent to the Nested vector Interrupt Controller NVIC. Using the CAN FD interrupt requires the interrupt controller to be configured first. The user must read the IR register to determine which interrupt condition is present.

The CAN has one non-maskable interrupt source:

  • AHB Bus Error (BERR)

The BERR bit (ERROR<0>) in the error interrupt flag register (ERROR) is set when the interrupt condition occurs. The bus error (BERR) interrupt flag is assigned to the ERROR interrupt service line.

The error interrupt request is generated when the BERR interrupt flag is set. The interrupt request remains active until the interrupt flag is cleared, or the CAN is reset. The interrupt request is sent to the NVIC.

Note: Interrupts must be globally enabled for interrupt requests to be generated.