CAN support on TK1 (Ixora) and or MX7D (Viola Plus 1.2)

According to some other posts in this forum the CAN bus cannot be used on TK1 at the moment? Is this correct? If so, when will this feature be available? Will there be a dedicated (stable) BSP version including this feature in the near future?

Alternativly i could use the Colibri MX7D on a Viola carrier board. Is it possible to to use CAN with that setup?

We are in the process fixing the remaining issues with CAN on Apalis TK1. On Apalis TK1 we use a external controller to do CAN, which complicates things and puts some limitations on the system.

The i.MX based devices come with integrated CAN controller (FlexCAN). Those internal CAN controller are more capable than the external controller, hence when CAN is crucial I would recommend using a i.MX based device over TK1 if possible. The Colibri iMX7 datasheet chapter 5.24 Controller Area Network (CAN) specifies on which pins the CAN signals are available. You can use SODIMM_55/63 for CAN1 and SODIMM_194/196 for CAN2, all pins are available on the Viola Extension Connector (X9). See also CAN (Linux) and Device Tree Customization.

We also have a test build for Apalis TK1 with CAN support available here:

https://share.toradex.com/2it0uxl9tdtyv3i

Hi - I have tried this build above with Apalis TK1 V1.1 and Ixora V1.1A, however still see behaviour that I receive 1 CAN packet when I run candump can0, and do not see any further packets, nor does the ifconfig packet counter change when I send CAN packets with cansend to that interface.

What is your setup? (what are the bus parameters, what are the remote devices etc.)

Just an appendum, it seems I can still send more CAN packets on some occasion, and they are successfully sent on the bus (and update in packet counters). But for some reason, I don’t see more received packets until I reload the apalis_tk1_k20 module. However, then I also still get only 1 packet.

What is your setup? (what are the bus parameters, what are the remote devices etc.)

Hi Dominik, sorry for the late reply.

We are using SN65HVD235DG4 3.3V transceivers on multiple devices on our bus. I realise that the ADM3053BRWZ are running as 5V transceivers, but from what I read, these should still be compatible.

The interface is setup with:
ip link set up can0 type can bitrate 500000

Just an additional appendum, the test kernel+K20 you supplied definitely is an improvement over the last release.

In the release, then I don’t get any packets, and trying to send CAN commands to can0 gives me a “write: No buffer space available” error. Interestingly, I don’t get that error on can1, but it doesn’t seem to work either.

In the test kernel, I receive only 1 packet, but can often send now seemingly unlimited packets, and all are reaching the devices. Have not yet done very through packet reliability testing though.

There are also a couple of other, probably unrelated issues in the test kernel. (Permission issues with IPv4 sockets and a kernel trace about pasr settings not defined).

Can you test what happens when you connect can0 and can1 interfaces together and try sending and dumping from Linux?

Do you have access to logic analyser? If you do, co you capture incoming packets? Yes, test kernel have some extra features enabled for other tests, they will not be part of our regular release.

Will do some logic analyser tests on Monday. For now:

With the supplied kernel + firmware above:

can0:

Our bus

  • Shows always RX packets: 1

  • Sent packets arrive to our device

  • Sent packets increment the TX packets counter

  • Sent packets are visible on candump can0

  • If candump can0 is running while attaching the cables for first time, then we see this first RX packet, and it is a genuine packet from our bus

Linked bus (CAN1_L <-> CAN2_L, CAN1_H <-> CAN2_H)

  • Shows always RX packets: 0

  • Shows always TX packets: 0

  • Sent packets do not arrive to can1 (candump can1)

  • Sent packets do not increment TX packets counter

  • Sent packets do not show up on candump can0

can1:

Our bus

  • Shows always RX packets: 1

  • Shows always TX packets: 0

  • Sent packets do not arrive to our device

  • Sent packets do not increment TX packets counter

  • Sent packets do not show up on candump can1

Linked bus (CAN1_L <-> CAN2_L, CAN1_H <-> CAN2_H)

  • Shows always RX packets: 0

  • Shows always TX packets: 0

  • Sent packets do not arrive to can0 (candump can0)

  • Sent packets do not increment TX packets counter

  • Sent packets do not show up on candump can1

Behaviour of can1 seems unusual, definitely not matching what we have seen on can0. So I can’t be sure it is working correctly.

With the supplied kernel + firmware above:

can0:

Our bus

  • Shows always RX packets: 1

  • Sent packets arrive to our device

  • Sent packets increment the TX packets counter

  • Sent packets are visible on candump can0

  • If candump can0 is running while attaching the cables for first time, then we see this first RX packet, and it is a genuine packet from our bus

Linked bus (CAN1_L <-> CAN2_L, CAN1_H <-> CAN2_H)

  • Shows always RX packets: 0

  • Shows always TX packets: 0

  • Sent packets do not arrive to can1 (candump can1)

  • Sent packets do not increment TX packets counter

  • Sent packets do not show up on candump can0

can1:

Our bus

  • Shows always RX packets: 1

  • Shows always TX packets: 0

  • Sent packets do not arrive to our device

  • Sent packets do not increment TX packets counter

  • Sent packets do not show up on candump can1

Linked bus (CAN1_L <-> CAN2_L, CAN1_H <-> CAN2_H)

  • Shows always RX packets: 0

  • Shows always TX packets: 0

  • Sent packets do not arrive to can0 (candump can0)

  • Sent packets do not increment TX packets counter

  • Sent packets do not show up on candump can1

OK, thank you for the data. Can you also run this setup with lower speed (125k or even 62.5k)?

There’s a new test image. Please have a look here:
https://www.toradex.com/community/questions/14495/how-can-i-use-canbus-on-apalis-tk1.html