meta-udoo
meta-udoo copied to clipboard
CAN not working as expected NEO
Hi with the new version of yocto (since u-boot fslc) i have some trouble with can bus. With the older version if i did this (with two shell connected to the card) : first shell :
root@udooneo:~# sudo ip link set can0 type can bitrate 125000 loopback on
root@udooneo:~# sudo ifconfig can0 up
root@udooneo:~# candump can0
on the second shell :
root@udooneo:~# cansend can0 500#1E.00.10
root@udooneo:~# cansend can0 450#1E.00.20
i obtain this on the first :
can0 500 [3] 1E 00 10
can0 450 [3] 1E 00 20
all work fine !
Now try to reproduce the same with the new image (uboot fslc) :
First shell :
root@udooneo:~# sudo ip link set can0 type can bitrate 125000 loopback on
root@udooneo:~# sudo ifconfig can0 up
root@udooneo:~# candump can0
interface = can0, family = 29, type = 3, proto = 1
second shell :
root@udooneo:~# cansend can0 500#1E.00.10
interface = can0, family = 29, type = 3, proto = 1
root@udooneo:~# cansend can0 450#1E.00.20
interface = can0, family = 29, type = 3, proto = 1
i obtain this result :
<0x001> [1] f4
<0x001> [1] c2
Now we can see a new line interface = can0, family = 29, type = 3, proto = 1 I didn't understand what's happen ? This is due to u-boot fslc ? ...
edit : tested the on last secoA62/quad build and work fine. The problem is just present on neo apparently ...
after another test, if i send the message like this :
root@udooneo:~# cansend can0 -i 0x500 0x10 0x20 0x30
i obtain this :
<0x500> [3] 10 20 30
another point, on the older build, cansend --version give :
Usage: cansend <device> <can_frame>.
and on the newer :
cansend 4.0.6
It seems that the version of canutils or libsocketcan has changed ... strange
Tested today with oscilloscope and peakcan (on another PC). We have a BUSHEAVY error in PCAN-view. I have a signal with oscilloscope but is not good, perhaps a problem with the clock ... @fmntf , just a question, did you make some special modifications in your u-boot-imx for neo flexcan please ?
Sorry, no CAN support in U-Boot.
Thanks for your answer !
@modjo756 Did you figure out how to fully support CAN?
No for the moment CAN not working ...
@cyrilfr your work on kernel 4.1 looks really promissing. When I find some time I'll try to integrate your changes into my layer. At the moment I have some difficulties to test CAN due to a missing endpoint.
Just build an image (minimal/command line) with morty branch and your layer @graugans and CAN is not working, i have this error :
root@udooneo:~# ip link set can0 type can bitrate 125000 loopback on
root@udooneo:~# ifconfig can0 up
root@udooneo:~# candump can0
interface = can0, family = 29, type = 3, proto = 1
socket: Address family not supported by protocol
@cyrilfr , did you try with can with morty Branch ?
For information i use kernel 3.14 and disable M4, with ifconfig -a i have this :
`root@udooneo:~# ifconfig -a
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)
Interrupt:142
can1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
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)
Interrupt:143
`
Some progress, we need to use can-utils and not canutils (see in /images/udoo-image-full-cmdline.bb), now when i launch candump (in kernel 3.14, i suppose this works with kernel 4.1 i will test it tomorrow) i have this :
socket: Address family not supported by protocol
and in dmesg :
[ 208.250295] flexcan 2090000.can can0: writing ctrl=0x0e313005
[ 218.374684] can: no symbol version for sock_register
[ 218.379687] can: Unknown symbol sock_register (err -22)
Ok, today i tried with kernel 4.1 and it work if i disable M4 core ! (perhaps a problem like describe here). Now retry with kernel 3.14.56, disable m4 core but already the same error announced in my precedent post ... Help are welcome ! edit : After some test with kernel 3.14.56 (disable M4, ttyMCC driver, back to previous kernel commit ...) impossible to resolve this issue ! For the moment, it's necessary to use kernel 4.1.15 to have CAN working without M4 processor ...
on kernel 4.1.15 i have this with dmesg :
[ 166.523431] flexcan 2090000.can can0: writing ctrl=0x0e312005 [ 172.291815] can: controller area network core (rev 20120528 abi 9) [ 172.302486] NET: Registered protocol family 29 [ 172.321485] can: raw protocol (rev 20120528)
@fmntf and @graugans if you have an idea ...
@modjo756 do you have a kernel 4.1 recipe around? Can you provide a link?
@graugans , see here (just created one)
Today, i'm back to krogoth branch and last revision of kernel 3.14.56 and CAN works if i disable or remove scketch from M4 (i don't know why on Morty branch this didn't work on kernel 3.14) ... There is probably a conflict with default arduino spi pins and CAN pins on A9 like describe on neoDocs :
ECSPI 5 has the same pin order, function, and position as Arduino UNO. By default it is assigned to the Arduino 101-compatible M4 core.
I have open an issue on gitHub for this. I hope @ektor5 or @UDOOboard can have a look on this ...