FX30 with (WP77xx) with Talon mangOH CAN interface

Hi all,
I am trying to setup the CAN iot card from talon into the FX30 image.
For this purpose I have just created a system which includes the kernel module which was found in this repo:

moduleSearch:
{
$LEGATO_ROOT/drivers/mangoh/can_common
}

kernelModules:
{
can_iot.mdef
}

I can compile the system and to deploy to the target, but once I runt he start_can.sh I get the error:
Unload of module can_iot.ko has been successful.
sh: write error: Device or resource busy
Aug 19 01:30:13 fx30s user.info Legato: INFO | supervisor[895]/supervisor T=main | kernelModules.c le_kernelModule_Unload() 1784 | Requested to unload module ‘can_iot.ko’.
Aug 19 01:30:13 fx30s user.info Legato: INFO | supervisor[895]/supervisor T=main | kernelModules.c le_kernelModule_Unload() 1826 | Unloading module, ‘can_iot.ko’, was successful.
Could not load the required module, can_iot.ko. (LE_FAULT)
See the device log for details.
Cannot find device “can0”
ifconfig: SIOCGIFFLAGS: No such device
root@fx30s:~# Aug 19 01:30:14 fx30s user.info Legato: INFO | supervisor[895]/supervisor T=main | kernelModules.c le_kernelModule_Load() 1720 | Requested to load module ‘can_iot.ko’.
Aug 19 01:30:14 fx30s user.info Legato: INFO | supervisor[895]/supervisor T=main | kernelModules.c ExecuteCommand() 244 | Execute '/sbin/insmod /legato/systems/current/modules/can_iot.ko ’
Aug 19 01:30:14 fx30s user.crit Legato: CRT | supervisor[895]/supervisor T=main | kernelModules.c ExecuteCommand() 295 | /sbin/insmod /legato/systems/current/modules/can_iot.ko exited with error code 8.
Aug 19 01:30:14 fx30s user.err Legato: =ERR= | supervisor[895]/supervisor T=main | kernelModules.c le_kernelModule_Load() 1758 | Load module, ‘can_iot.ko’, failed. (LE_FAULT)
Aug 19 01:30:14 fx30s user.err kernel: [ 1023.175549] can_iot: version magic '3.18.140 preempt mod_unload ARMv7 p2v8 ’ should be '3.18.44 preempt mod_unload ARMv7 p2v8 ’

I can only find reference to the WP76 so I am wondering if the same process applies to the WP77.
I am stuck now so any help or reference would help.

did you use the correct toolchain for the compilation?
Seems the version check has problem:

Aug 19 01:30:14 fx30s user.err kernel: [ 1023.175549] can_iot: version magic '3.18.140 preempt mod_unload ARMv7 p2v8 ’ should be '3.18.44 preempt mod_unload ARMv7 p2v8 ’

[wp77xx] Toolchain dir = /opt/swi/SWI9X06Y_02.32.02.00/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi

maybe it is not for FX30S.
The latest FW for FX30S is R9.

do you have a link to that FW?
Because this is the latest toolchain for 64bits I have found online…

No, I don’t have as the latest package from LEAF is for the R9 FW (FX30catM)

https://source.sierrawireless.com/resources/airlink/software_downloads/fx30-firmware/fx30-firmware-catm/#sthash.PzmOrYM1.dpbs

Ok, so this is a problem with the toolchain not matching the latest firmware revision?
How do I solve this?

I don’t know if this is the root cause, but you can downgrade your module to the official one and use the toolchain in LEAF.

ok, I have actually manually installed my dev environment, have also installed leaf but I am working within the legato workspace and suing the “source bin./configlegatoenv”.
Leaf is installed but I am not running the leaf init…

So… using the toolchain for the wp77xx: ( FX30 and FX30S CatM)
[wp77xx] Toolchain dir = /opt/swi/SWI9X06Y_02.32.02.00/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi
which firmware should I downgrade to?
If I ssh into the FX30S and run the cm info all I see this is the firmware actually loaded into the target:
Firmware Version: SWI9X06Y_02.32.02.00 c2e98c jenkins 2019/08/30 07:28:21*

which should match with the toolchain I am using, right?

according to “leaf search”, the latest one is “swi-fx30-catm_1.0.0”

oh, I understand but I am not currently using leaf…
So my question is, if I am using the right toolchain and this matches the firmware in the target, this should not be a problem, correct?
I can start using leaf, that is not a problem, but I would rather get the the bottom of this problem first as this is only one part of the application and I am working on something else as well…
So I can save some time.

as said before, I don’t know if this is the root cause, but worth to give a try to match the version check.

if I do a leaf search for the wp77 target, this is what I see.
latest one is
swi-wp77_3.4.0 │ SDK for WP77 (Release 12 + Legato 20.04.0) │ latest,installed,wp77xx,dev
Which is what I have installed

$ leaf search wp77
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
│ 36 packages - Filter: only master and “wp77” │
├─────────────────┬─────────────────────────────────────────────┬─────────────────────────────┤
│ Identifier │ Description │ Tags │
╞═════════════════╪═════════════════════════════════════════════╪═════════════════════════════╡
│ swi-wp77_1.0.0 │ SDK for WP77 (Release 9 + Legato 18.03.0) │ wp77xx,stable │
│ swi-wp77_1.2.0 │ SDK for WP77 (Release 9 + Legato 18.05.0) │ wp77xx,dev │
│ swi-wp77_1.2.1 │ SDK for WP77 (Release 9 + Legato 18.05.1) │ wp77xx,dev │
│ swi-wp77_1.3.0 │ SDK for WP77 (Release 9 + Legato 18.06.0) │ wp77xx,dev │
│ swi-wp77_1.3.1 │ SDK for WP77 (Release 9 + Legato 18.06.1) │ wp77xx,dev │
│ swi-wp77_1.3.5 │ SDK for WP77 (Release 9.1 + Legato 18.06.1) │ wp77xx,stable │
│ swi-wp77_1.4.0 │ SDK for WP77 (Release 9.1 + Legato 18.07.0) │ wp77xx,dev │
│ swi-wp77_1.4.2 │ SDK for WP77 (Release 9.1 + Legato 18.07.1) │ wp77xx,dev │
│ swi-wp77_1.5.0 │ SDK for WP77 (Release 9.1 + Legato 18.08.0) │ wp77xx,dev │
│ swi-wp77_1.6.0 │ SDK for WP77 (Release 9.1 + Legato 18.09.0) │ wp77xx,dev │
│ swi-wp77_1.6.1 │ SDK for WP77 (Release 9.1 + Legato 18.09.1) │ wp77xx,dev │
│ swi-wp77_1.6.2 │ SDK for WP77 (Release 9.1 + Legato 18.09.2) │ wp77xx,dev │
│ swi-wp77_1.7.0 │ SDK for WP77 (Release 9.1 + Legato 18.10.0) │ wp77xx,dev │
│ swi-wp77_1.7.4 │ SDK for WP77 (Release 9.1 + Legato 18.10.1) │ wp77xx,dev │
│ swi-wp77_1.7.8 │ SDK for WP77 (Release 9.1 + Legato 18.10.2) │ wp77xx,dev │
│ swi-wp77_1.7.10 │ SDK for WP77 (Release 9.1 + Legato 18.10.3) │ wp77xx,dev │
│ swi-wp77_1.9.0 │ SDK for WP77 (Release 9.1 + Legato 19.01.0) │ wp77xx,dev │
│ swi-wp77_1.10.0 │ SDK for WP77 (Release 9.1 + Legato 19.02.0) │ wp77xx,dev │
│ swi-wp77_1.11.0 │ SDK for WP77 (Release 9.1 + Legato 19.04.0) │ wp77xx,dev │
│ swi-wp77_2.0.0 │ SDK for WP77 (Release 11 + Legato 18.09.2) │ wp77xx,stable │
│ swi-wp77_2.0.1 │ SDK for WP77 (Release 11 + Legato 18.09.3) │ wp77xx,dev │
│ swi-wp77_2.0.2 │ SDK for WP77 (Release 11 + Legato 18.09.4) │ wp77xx,dev │
│ swi-wp77_2.1.1 │ SDK for WP77 (Release 11 + Legato 18.10.3) │ wp77xx,dev │
│ swi-wp77_2.3.0 │ SDK for WP77 (Release 11 + Legato 19.01.0) │ wp77xx,dev │
│ swi-wp77_2.4.0 │ SDK for WP77 (Release 11 + Legato 19.02.0) │ wp77xx,dev │
│ swi-wp77_2.5.0 │ SDK for WP77 (Release 11 + Legato 19.04.0) │ wp77xx,dev │
│ swi-wp77_2.7.0 │ SDK for WP77 (Release 11 + Legato 19.07.0) │ wp77xx,dev │
│ swi-wp77_3.0.0 │ SDK for WP77 (Release 12 + Legato 19.07.0) │ wp77xx,stable │
│ swi-wp77_3.0.1 │ SDK for WP77 (Release 12 + Legato 19.07.1) │ wp77xx,dev │
│ swi-wp77_3.1.0 │ SDK for WP77 (Release 12 + Legato 19.09.0) │ wp77xx,dev │
│ swi-wp77_3.2.0 │ SDK for WP77 (Release 12 + Legato 19.10.0) │ wp77xx,dev │
│ swi-wp77_3.2.1 │ SDK for WP77 (Release 12 + Legato 19.10.1) │ wp77xx,dev │
│ swi-wp77_3.3.0 │ SDK for WP77 (Release 12 + Legato 19.11.0) │ wp77xx,dev │
│ swi-wp77_3.3.1 │ SDK for WP77 (Release 12 + Legato 19.11.1) │ wp77xx,dev │
│ swi-wp77_3.3.2 │ SDK for WP77 (Release 12 + Legato 19.11.2) │ wp77xx,dev │
│ swi-wp77_3.4.0 │ SDK for WP77 (Release 12 + Legato 20.04.0) │ latest,installed,wp77xx,dev │
└─────────────────┴─────────────────────────────────────────────┴─────────────────────────────┘

if you are going to use WP77 FW instead of official FX30 FW R9.1, then you can treat it as a WP77 module

I am lost… :slight_smile: and I need to understand what I am doing…
So the whole reason to use leaf is to work outside of the legatoworkspace and still to have access to the CLI commands.
If I am using leaf, is the compiler still using the same toolchain?
leaf status
┌─────────────────────────────────────────────────────────────────────────────────────────┐
│ Workspace: /*****/mySystemAws │
╞═════════════════════════════════════════════════════════════════════════════════════════╡
│ Profile: FX30stable [current] (sync) │
├──────────┬─────────────────────┬────────────────────────────────────────────────────────┤
│ Packages │ Identifier │ Description │
├──────────┼─────────────────────┼────────────────────────────────────────────────────────┤
│ Included │ swi-fx30-catm_1.0.0 │ SDK for FX30-CATM (Release 9.1.1.013 + Legato 18.06.1) │

I have run the mksys and then uploaded the files to the target, still same result when I run the start_can.sh

just to make this obvious, this is how I have defined my system:

#include “$LEGATO_ROOT/default.sdef”

moduleSearch:
{
$LEGATO_ROOT/drivers/mangoh/can_common
$LEGATO_ROOT/drivers/mangoh/can_9x07
}

kernelModules:
{
mcp251x.mdef
can_iot.mdef
//can.mdef
//can-dev.mdef
//can-bcm.mdef
//can-raw.mdef
//vcan.mdef
}

you can install the toolchain which is in this path
owner@ubuntu:~/leaf/leaf-data/wp77$ ls /home/owner/leaf/leaf-data/wp77/wp77-toolchain
environment-setup-armv7a-neon-poky-linux-gnueabi
manifest.json
site-config-armv7a-neon-poky-linux-gnueabi
sysroots
toolChainExtractor.sh
version-armv7a-neon-poky-linux-gnueabi

And the usual legato framework will be in this path:
/home/owner/leaf/leaf-data/wp77/fx30-catm-legato

So now you have the toolchain, legato framework, and your mangoh source for your compilation.

so to install this toolchain:
poky-swi-ext-glibc-x86_64-meta-toolchain-swi-armv7a-neon-toolchain-swi-SWI9X06Y_02.32.02.00.sh
in this folder which I have created
~/leaf/leaf-data/wp77

then to setup the leaf on this folder:
~/leaf/leaf-data/wp77$ leaf setup FX30 -p swi-fx30-catm_1.0.0

and then at this point I move the folder where my system is here and compile again…?
Can I ask what is going to be the difference?
If I am using the same toolchain??

I think you got the wrong toolchain version.
The toolchain for swi-fx30-catm_1.00 should be wp77-toolchain_SWI9X06Y_02.18.05.00-linux64.

owner@ubuntu:~/leaf/leaf-data/wp77$ ls
fx30-catm-image fx30-catm-linux-image swi-vscode-support
fx30-catm-legato swi-fx30-catm wp77-modem-image
fx30-catm-legato-image swi-legato wp77-toolchain
owner@ubuntu:~/leaf/leaf-data/wp77$ ls ./wp77-toolchain
environment-setup-armv7a-neon-poky-linux-gnueabi
manifest.json
site-config-armv7a-neon-poky-linux-gnueabi
sysroots
toolChainExtractor.sh
version-armv7a-neon-poky-linux-gnueabi
owner@ubuntu:~/leaf/leaf-data/wp77$ ls ./wp77-toolchain -l
lrwxrwxrwx 1 owner owner 61 Aug 20 12:08 ./wp77-toolchain -> /home/owner/.leaf/wp77-toolchain_SWI9X06Y_02.18.05.00-linux64

Hi there,
You need to build the kernel and the module using the same toolchain. The simplest is to rebuild the FX30 yocto image with canbus enabled.

To do this pull the swi-fx30-catm_1.0.0 leaf identifier to get the R9.1 source code.

The stock WP77 code will run on an FX30 but peripheral functions won’t work.

If you’re able to wait another week or 2, the R11 release is just about ready.

BR,
Chris