MCP2515 CAN Data loss

It seems request_threaded_irq() in mcp251x.c is hardcoded to use 50 priority value.
You can double check the yocto source.

https://code.woboq.org/linux/linux/kernel/irq/manage.c.html#__setup_irq

@jyijyi ,
Let me try to change the value and compile the kernel .
I will keep you updated on the same .

I can change the IRQ priority to 51 by modifying ./kernel/kernel/irq/manage.c :

root@swi-mdm9x28-wp:~# ps -eo pid,pri,rtprio,cmd | grep irq
3 19 - [ksoftirqd/0]
20 91 51 [irq/47-cpr]
133 91 51 [irq/31-tsens_in]
140 91 51 [irq/43-7864900.]
141 91 51 [irq/42-mmc0]
148 91 51 [irq/205-modem]
1593 19 - grep irq

Hi @jyijyi ,
Yes I was also able to change the priority but unfortunately that is not helping me improve the performance . Below is the output from same with priority level increased to 80

root@swi-mdm9x28-wp:~# ifconfig can0
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:8229 errors:2178 dropped:0 overruns:0 frame:2178
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:65832 (64.2 KiB) TX bytes:0 (0.0 B)

root@swi-mdm9x28-wp:~# vi 80_SPICAN.txt
root@swi-mdm9x28-wp:~# ps -eo pid,pri,rtprio,cmd | grep ‘mcp’
2873 120 80 [irq/131-mcp251x]
2874 39 - [mcp251x_wq]
7242 19 - grep mcp

You can still notice the loss .
Data sent = 9157
Data received = 8229

Then that might not be the root cause, is this a hardware problem?

Hi @jyijyi ,
We have this issue in MangoH-Red as well . Not sure if the hardware is the real problem

Regards

  • Ak

i have a hardware here, but cannot make the can0.
Can you show me how to make it work on mangoh red board?

e.g.
can you attach your .update for mangoh layer?
also can you share your start_can.sh?

Hi @jyijyi ,
Please find the .update file in the below G-drive link and Let me know your observations after testing the same .

=> https://drive.google.com/file/d/19Z8DkeABdh6OKDgxF8y3HzRVd4OVHLtD/view?usp=sharing

Regards

  • AK

is your update file for WP76 R13?
I cannot run start_can.sh

@jyijyi ,
Yes It was for R13 . What device you are running it on ? Any error from start_can.sh ?

after updating your image, it will change the legato version to 18.10.3:

root@swi-mdm9x28-wp:~# legato version
19.02.0_4cb954265427b8c2c668a010ff5be274
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# update /tmp/red.wp76xx.update
Unpacking package: 100% ++++++++++++++++++++++++++++++++++++++++++++++++++
Applying update: 100% ++++++++++++++++++++++++++++++++++++++++++++++++++
SUCCESS
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# update-ld-cache: Updating ld.so.cache using [/legato/systems/current/lib]…
update-ld-cache: Updating /etc/ld.so.cache …
update-ld-cache: Removing stale mount [/etc/ld.so.cache]…
root@swi-mdm9x28-wp:~# legato v[ 406.876022] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x64 MSTR_STS:0x0d1343c8 OPER:0x00000010
[ 406.891060] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x64 MSTR_STS:0x0d1343c8 OPER:0x00000010
[ 406.907151] LTC2941 6-0064: ltc2941 read_reg failed!
[ 406.911471] LTC2941 6-0064: Could not read status register
ersion
18.10.3_7929f0e4460a52fdbc8634bdb0aa30f9
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# legato version
18.10.3_7929f0e4460a52fdbc8634bdb0aa30f9
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# ./start_can.sh
“./start_can.sh board [slot]” where board is “green” or “red” and slot is “0” or “1”
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# ./start_can.sh red 0
Unload of module can_iot.ko has been successful.
sh: write error: Device or resource busy
sh: write error: Device or resource busy
Load of module can_iot.ko has been successful.
Cannot find device “can0”
ifconfig: SIOCGIFFLAGS: No such device
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~#

Hi @jyijyi ,
I think it was based on R12 . Please verify the settings in SW401 on MangoH Board

  • Regards
    Ak

I tried on R12 with your image, it keeps on resetting.

BTW, what should be the SW401 on your mangoh board?

Hi @jyijyi ,
Can you try with R16 based mangoh .update image uploaded in the below link .
https://drive.google.com/file/d/1KJ2JzO9GqglE8B2FYI3dozSSYp0ewd9j/view?usp=sharing

Onto the SW401 Settings PINS 1,3,5,8 were ON . You can give a try using a different hardware as well

Regards

  • AK

I did not test your .update file, instead I change another mangoh red board, now it is working fine on FW R13 with my own .update file.

Do I need to connect other HW in order to reproduce your problem?

root@swi-mdm9x28-wp:~# legato version
19.02.0_87cc5f813301994d76389339c0e37301
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# cm info
Device: WP7609
IMEI: 359782080100373
IMEISV: 6
FSN: WA803370311610
Firmware Version: SWI9X07Y_02.28.03.05 000000 jenkins 2019/07/08 11:04:16
Bootloader Version: SWI9X07Y_02.28.03.05 000000 jenkins 2019/07/08 11:04:16
[ 242.455077] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x3a MSTR_STS:0x0c1300c8 OPER:0x00000090
[ 242.471196] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x3a MSTR_STS:0x0c1300c8 OPER:0x00000090
MCU Version: 002.011
PRI Part Number (PN): 9908102
PRI Revision: 001.000
Carrier PRI Name: GENERIC
Carrier PRI Revision: 002.073_000
SKU: 1103843
Last Reset Cause: Reset, User Requested
Resets Count: Expected: 407 Unexpected: 0
root@swi-mdm9x28-wp:~# ./start_can.sh red 0
[ 134.431354] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister can0
[ 134.460434] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister can0
Unload of module can_iot.ko has been successful.
sh: write error: Device or resource busy
sh: write error: Device or resource busy
Load of module can_iot.ko has been successful.
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# ifconfig can0
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# candump can0
interface = can0, family = 29, type = 3, proto = 1
^C

@jyijyi ,
Yes you need a PEAK CAN or similar hardware to reproduce it . You can also use another setup with can IOT card and have a small script to send 4-5 CAN frames every 10ms .
say for example :-1

cansend can0 01a#11223344AABBCCDD
cansend can0 02a#22334455AABBCCDD
cansend can0 03a#33445566AABBCCDD
cansend can0 04a#44556677AABBCCDD

I only have one CAN IOT card, can it do a loopback test in order to reproduce your issue?

Hi @jyijyi ,
Loop back testing is not straight forward in case of CAN so its better to have an independent hardware for testing .

Have you tried on two mangoh boards to isolate if the PEAK CAN device?
BTW, I saw there is a switch on the board for tunning, have you tried that?

Hi @jyijyi ,
I had tried with two MangoH boards and onto the switches we currently have 120ohm termination which has nothing to do with data loss . Can you loop in someone from talon ?