Colíbri iMX7D flexcan doesn't work

I’m testing the flexcan_network example for the colibri iMX7 on the cortex-m4. During the execution process the BOARD_FLEXCAN_HANDLER method / flexcan1 interrupt handler was never executed. The program itself is working correctly except the send and receive interrupt.

Additionally I checked the values of the following internal registers of the cortex-m4 for the flecan 1.

  • CAN_MCR_REG - 0000 0000 0000 0000 0000 0000 0000 1111
  • CAN_CTRL1_REG - 0000 0001 1111 1111 0000 0000 0000 0110
  • CAN_CTRL2_REG - 0000 0000 0000 0000 0000 0000 0000 0000
  • CAN_IMASK1_REG - 0000 0000 0000 0000 0000 0000 0000 0000
  • CAN_IFLAG1_REG - 0000 0000 0000 0000 0000 0000 0000 0000
  • CAN_ESR1_REG - 0000 0000 0000 0100 0100 0010 0101 0110
  • CAN_ECR_REG - at each program iteration the value changes

Does anyone know how to solve this problem or has some advice for a flexcan configuration?

Thanks for the help.

Dear @developerTirol

I was not able to reproduce your problem. I hooked a CAN Analzer (CANdoISO) up to the Evaluation board and was successfully able to transmit and receive messages. Let me describe my setup and point out some common pitfalls…


  1. The Colibri Evaluationboard needs to
    be configured properly. Please refer
    to the document below for details:

  2. On my PC I had 2 terminal programs running: one for
    UARTA, one for UARTB

  3. I booted the Colibri into U-Boot and started a dummy M4 application which does nothing but looping forever. This is my standard procedure to turn on all required clocks, so I can later easily hook up the JTAG debugger.

  4. I started the CAN Analyzer, making sure that

  • The baud rate was correctly set to 125kbps
  • The analyzer was in “normal” mode (not in “ListenOnly”)
  1. I used VSCode to build the flexcan_network project in debug configuration, and to download and run it through the JTAG debugger.

Now I was able to see the debug messages on UARTB, showing that the application was transmitting a CAN message once every second.
Using the CAN analyzer I transmitted messages with ID 0x321 and was able to see on UARTB that these messages were received properly.

DLC=1, mb_idx=0x123
RX MB data: 0x9

DLC=1, mb_idx=0x123
RX MB data: 0xa

DLC=8, mb_idx=0x321
RX MB data: 0xff ff ff ff ff 0 0 0

Further Hints

Some common pitfalls could be:

  • The CAN bus needs to be terminated
  • It is crucial that there is an active second CAN device on the bus. This is required to acknowledge transmitted messages.
  • If you abort the application while running (for example with the debugger), restarting the application is not always sufficient to bring the CAN controller back in a proper state. If you see inproper functioning, I recommend to do a power cycle and start over
  • Linux could possibly lock some resources once it is started. Try to run the application from U-Boot.

Regards, Andy