CAN Bus performance on TK1

I am testing one CAN interface can0 of TK1 as receiver with other two nodes as CAN senders. The baudrate is 100K. Two senders will emit 8-byte frame every 100ms or 200ms. can0 of TK1 will soon stop receiving date when senders start. It is fine when there is only one sender connected to TK1. However, it still fails if the sending interval is down to 30ms. The data rate is less than 1Mbit/s.
With reloading k20 driver modules, it gets recovered.

#!/bin/sh
rmmod apalis_tk1_k20_can
rmmod apalis_tk1_k20_ts
rmmod apalis_tk1_k20_adc
rmmod gpio_apalis_tk1_k20
rmmod apalis_tk1_k20

sleep 1

modprobe apalis_tk1_k20

We have a similar problem. When the external transmitter sends data with gap less than 12 ms, Apalis CAN controller stops to receive data (data rate is 1 Mbit/s). Test data sending:
cangen can0 -g 12 -I 123 -L 8 -D i -v -v

We can reproduce it and are working on a fix.

@dominik.tx Any updates on the potential fix? - We are also experiencing the same problem with CAN on the TK1.

We’ve working on it, We’ve already implemented some fixes like increades spi peripherla speed in TK1, zero copy mechanism and single trasnfer reads. We’re working on implementing buffering. Patches for kernel are public here:
http://git1.toradex.com/cgit/linux-toradex.git/log/?h=toradex_tk1_l4t_r21.6-next
And patches for k20 firmware are ongoing and will be available here:
http://git1.toradex.com/cgit/freertos-toradex.git/log/?h=apalis-tk1-k20-freertos-v9

We’ll also noticed big impact of cpu freqency scaling/cpu hot plugging on performance, therefore we recommend using performance governor, and possibly even disabling core on/off mechanism in kernel. But we’re still looking for the best configuration.

You can use Toradex Easy Installer to get our nightly builds, I’ll update you when there is a nightly build with first batch of patches.

There is a new test build for CAN performance available here: https://share.toradex.com/ey322cir067fawa (toradex easy installer image) and directly in toradex easy installer via the 3rd party feed.

Build is compatible only with v1.2A modules.

Successfully tested with:
RX (TX from Apalis imx6q) cangen can0 -g 0.5 -I 42A -L 8 -D i -v -v
TX cangen can0 -g 1 -I 42A -L 8 -D i -v -v

And what about v1.1A? When can we expect the update?

New version (comptible with v1.1 and v1.2) is available here:
https://share.toradex.com/14h9rxuz4lliav5
and through toradex easy installer.

You may need to run:

rmmod gpio_apalis_tk1_k20 apalis_tk1_k20_ts apalis_tk1_k20_can apalis_tk1_k20_adc apalis_tk1_k20
mv /lib/firmware/apalis-tk1-k20.bin /lib/firmware/apalis-tk1-k20.bin.old
echo -n "a" > /lib/firmware/apalis-tk1-k20.bin
modprobe apalis_tk1_k20
dmesg | tail
rmmod gpio_apalis_tk1_k20 apalis_tk1_k20_ts apalis_tk1_k20_can apalis_tk1_k20_adc apalis_tk1_k20
mv /lib/firmware/apalis-tk1-k20.bin.old /lib/firmware/apalis-tk1-k20.bin
modprobe apalis_tk1_k20
dmesg | tail

if you’ve tried previous test image.

It works, thanks!

Waiting for the update to be added to mainline OS image.

We’re still doing some fixes, but it will be part of Q1 2018 release planned for end of March. Code should be available ~2 weeks before the release on our git server.