CAN bus on M4 core - imx7

I am trying to test CAN communication from the M4 processor. These are the steps I followed:

1-CAN bus connection to DB9 - CAN (Top DB9)

2- Correct compilation of flexcan_network (freertos-colibri-imx7 / examples / imx7_colibri_m4 / driver_examples / flexcan / flexcan_network /)

3- Loading the application to the M4 processor from u-boot (ok):

Colibri iMX7 # fatload mmc 0: 1 $ {loadaddr} flexcan_network.elf
Colibri iMX7 # bootaux $ {loadaddr}

4-I connect the pins CAN 188 (can2.Rx) and 178 (can2.Tx) to the x38 CAN connector.

With this configuration I do not see any messages on debug console (UARTB).

I already verified that the CAN bus has no errors. LED12 (CAN RX) flashes when the CAN bus is connected.

I also verifed that the program on the M4 starts running.

Pins 188 and 178 exit through the User Extension X3 port, specifically 188 through A20 and 178 through B12, is this correct?

The default muxing in FreeRTOS does mux SODIMM 188/178 as CAN2 TX/RX, so that part should be fine.

  • SODIMM 188 is ADDR_16 available on X3-A20
  • SODIMM 178 is DATA_30 available on X3-B12

So yes, this is correct.

Note: You can get the schematics of the Colibri Evaluation Board from our developer website.

ok, seems to be everything ok but I can’t see any CAN message through the output console (UARTB).
Is there any documentation of the flexcan.h library? because I was looking into freescale web but didn´t found nothing.

In the example I saw this line of code:

/* Setup Rx MsgBuf to receive Frame. */
 rxMsgBufPtr->idStd = RX_IDENTIFIER;

#define RX_IDENTIFIER 0x321

is this a filter id for received messages? and is this only for standar id (11-bit)? because my CAN bus is extended (29-bit).

I found and error when setting the baudrate (250 kHz). So now I can:

  • Send std messages
  • Receive std messages
  • Send extended messages

but can´t received extended messages, could you guide me in the configuration of flexcan.h for this purpose? I couldn`t find any documentation in freescale about flexcan.h


Unfortunately I am not that familiar with CAN. We haven’t tested the extended frame format, I am not sure why that fails.

There is some documentation in the doc/ folder of the FreeRTOS release:

Otherwise the i.MX 7Dual Reference Manual has detailed description of the FlexCAN controller.

ok, I already read the documentation in the FreeRTOS folder but there is nothing about extended frames. I will try with Freescale support.

is the flexcan.h from Freescale?


Yes, flexcan.h is from NXP.