Talon CAN bus IoT Expansion


#1

I’m developing a project on FX30s. I’m pretty new to this and would like to know how to enable the CAN bux IoT card.
I found a few instructions on how to enable it with MangOH Red, but still couldn’t find anything for the FX30.

Thank you very much!


#2

Hi cporto,
The canbus iot card isn’t officially supported on the FX30, so there isn’t a document available. Have you tried the mangOH instructions? The kernel configuration should be the same. However, there are differences with the IOT UART and GPIO. Let me know if you need more information.

BR,
Chris


#3

Hi!

I would like to help and share my experience developing using the Talon CAN bus IoT Expansion Board.

Even though it is not officially supported, I was able to make it work using a little bit of different information that I found online.
Here are the steps required to enable it on FX30S, I use the Developer Studio for Windows:

  1. First you will need to create a new system project and add the CAN modules. I got the CAN modules from Mangoh project, https://github.com/mangOH/mangOH/tree/master/linux_kernel_modules
    I just downloaded the whole linux_kernel_modules folder and added that to my system project.

  2. Added this lines to the .SDEF based on the Mangoh project:

kernelModules:
{
$CURDIR/linux_kernel_modules/can_common/can_iot
$CURDIR/linux_kernel_modules/can_9x15/can
$CURDIR/linux_kernel_modules/can_9x15/can-bcm
$CURDIR/linux_kernel_modules/can_9x15/can-raw
$CURDIR/linux_kernel_modules/can_9x15/can-dev
$CURDIR/linux_kernel_modules/can_9x15/vcan
$CURDIR/linux_kernel_modules/can_9x15/mcp251x
}

  1. Compile the project and flash the unit. Restart the unit and you will see the modules under /legato/system/current/modules

  2. Now you need to enable the board. Create a script to initialize the CAN board and enable it. Also based on Mangoh project and some other posts that shared the right ports mapping between Mangoh Red and FX30. This script needs to be executed every time the system is restarted. You can automate that process.

#!/bin/sh

export PATH=$PATH:/sbin

drv_file=find /legato/systems/current/modules/ -name "*mcp251x.ko"
drv=basename $drv_file
# remove the driver
rmmod $drv

#Take IoT card out of reset
echo 6 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio6/direction
echo 1 > /sys/class/gpio/gpio6/value

# Enable level shifter on the CAN IoT card
echo 33 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio33/direction
echo 1 > /sys/class/gpio/gpio33/value

modprobe can &&
sleep 3 &&
modprobe can-dev &&
sleep 3 &&
modprobe can-raw &&
sleep 3 &&
modprobe mcp251x &&
sleep 3

# Bring driver back & iproute2 add in CAN
insmod $drv_file
ip link set can0 type can bitrate 500000 triple-sampling on
ifconfig can0 up

  1. You can see that device is available if you do “ifconfig”

Hope it helps future people working on similar projects.

Best,
Caio Porto


#4

What versions did you use for toolchain, legato, and Developer Studio? Are they from this page?
https://source.sierrawireless.com/resources/airlink/software_downloads/fx30-firmware/fx30-firmware/

I got errors about “CopyF” the first time i tried to build. I fixed the errors by changing “CopyF” to “CopyFile” in legato/framework/tools/mkTools/buildScriptGenerator/moduleBuildScript.cpp then building a new mk executable using yocto. Did you have to fix mk also?

The toolchain for the FX30 does not recognize some of the newer syntax in the mdef files from the mangOH kernel modules. I removed the unrecognized commands and added a path to the prebuilt kernel modules. This has allowed the project to build but the modules do not appear on the FX30 after uploading the new image. How did you work around this?


#5

Hi @jrm06c,

I used Developer Studio 5.3.1, Legato R16 (18.6.1), Toolchain 2.2.3.
I downloaded the Toolchain and Lgeato through the Developer Studio using the Packages section.

I didn’t have to do any changes other than was I posted there. I tried also with Legato R16.1 and worked as well.


#6

So you didn’t have any problems using the newer Legato framework and toolchain on the FX30?

I’m asking because everything I’ve seen posted about this says to use the sources found here:
https://source.sierrawireless.com/resources/airlink/software_downloads/fx30-firmware/fx30-firmware/