graugans / meta-udoo

:heartpulse: openembedded meta layer for the UDOO boards
MIT License
31 stars 19 forks source link

Problem with can bus on neo #12

Closed modjo756 closed 8 years ago

modjo756 commented 8 years ago

When we use a dtb (produce with udoobuntu and device tree editor) file that enable flexcan on neo pin, they have some error during the boot :

see : flexcan error

and : boot log

when we use ifconfig -a, didn't see can0 or can1 like udoobuntu

graugans commented 8 years ago

Sorry, I am busy with real world tasks at the moment I will try to take a look into this soon. CAN you please attach the DTS files?

modjo756 commented 8 years ago

No problem, yes it takes times to play with this cards ... This is the dts files from udoobuntu (in opt/dtweb/dtbkernel/arch/arm/boot/) dts-udoobuntu_CANok_Uart6.tar.gz

modjo756 commented 8 years ago

Ok, i have copied the folder dtbkernel from udoobuntu to my yocto sd card (opt folder). boot the card with yocto and go to dts. I "make dtbs" and copy the dtb generated to /boot/dts-overlay. reboot the card and same problem, no can appears and same problem during the boot ...

graugans commented 8 years ago

To use CAN you'll have to disable the M4 core by adding this to your uEnv.txt

# Enable or Disable the Cortex M4 CPU
# m4_enabled=true|false
# any other value (or if the variable is not specified) will default to "true"
m4_enabled=false

After this I get the CAN interface and there is no more kernel OOPS. Can you please check if in UDOOBuntu the m4 is as-well disabled?

modjo756 commented 8 years ago

I will try this but on udoobuntu there is M4 enabled (arduino working) and CAN enabled ...

graugans commented 8 years ago

So could you please so kind and call md5sum on the m4 firmware files. Maybe I use old ones

modjo756 commented 8 years ago

I suppose you talk about the files on boot folder ?

In udoobuntu :

modjo@Linux-corei5:/media/modjo/boot1$ md5sum m4clean.fw 7aa83b6b25b23cc7d6e92aa757a0920e m4clean.fw modjo@Linux-corei5:/media/modjo/boot1$ md5sum m4startup.fw 32a0519c167f98070956e601764c71df m4startup.fw

In meta-udoo master

modjo@Linux-corei5:/media/modjo/boot2$ md5sum m4clean.fw 7aa83b6b25b23cc7d6e92aa757a0920e m4clean.fw modjo@Linux-corei5:/media/modjo/boot2$ md5sum m4startup.fw 32a0519c167f98070956e601764c71df m4startup.fw modjo@Linux-corei5:/media/modjo/boot2$

graugans commented 8 years ago

I am confused, the CAN interface is only initialized properly when M4 is disabled. This needs more investigation.

modjo756 commented 8 years ago

Yes this strange ... otherwise qtserialbus working on neo

modjo756 commented 8 years ago

Hi graugan, for the problem with can and M4, perhaps we can use this tool tool to enable the M4 after start ? Not present for the moment in yocto. What do you think about this ?

graugans commented 8 years ago

You have an idea where the source is located for this? I guess this is some php5 script.

modjo756 commented 8 years ago

No i need to investigate ...

graugans commented 8 years ago

here we go https://github.com/fmntf/dtweb/blob/master/utils/udoom4ctl it is a PHP5 app. It just sets the value in the uEnv.txt

modjo756 commented 8 years ago

Thanks, this not resolve the problem ...

graugans commented 8 years ago

I have a hunch, it smells like we have to update the kernel version. I just tested with a vanilla UDOOBuntu -> same error like on yocto.... I am updating the UDOObuntu and check after this

graugans commented 8 years ago

No chance on UDOO Neo with UDOObuntu and latest kernel same issues like on Yocto. When M4 is disabled CAN works like a charm :(

graugans commented 8 years ago

I guess I've fixed the CAN issue:

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  
          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 

eth0      Link encap:Ethernet  HWaddr 00:c0:08:8c:2d:86  
          inet addr:192.168.23.125  Bcast:192.168.23.255  Mask:255.255.255.0
          inet6 addr: fe80::2c0:8ff:fe8c:2d86/64 Scope:Link
          inet6 addr: fd6f:be9c:6c36:0:2c0:8ff:fe8c:2d86/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:23 errors:0 dropped:1 overruns:0 frame:0
          TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3090 (3.0 KiB)  TX bytes:10106 (9.8 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:140 (140.0 B)  TX bytes:140 (140.0 B)

wlan0     Link encap:Ethernet  HWaddr de:ad:be:ef:00:00  
          BROADCAST MULTICAST  MTU:1500  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@udooneo:~# 

ATM it looks like a combination of the default M4 firmware, kernel and DeviceTree. After using this sketch as initial FW everything is okay:

void setup(){
    Serial.begin(115200);
    Serial0.begin(115200);

    pinMode(13, OUTPUT);
}

void loop(){
    Serial.print("Hello");
    Serial.print(" ");
    Serial.println("A9!");

    digitalWrite(13, HIGH);
    delay(1000);

    Serial0.print("Hello");
    Serial0.print(" ");
    Serial0.println("world!");

    digitalWrite(13, LOW);
    delay(1000);
}

But now its time for the couch...

modjo756 commented 8 years ago

Congratulation Graugans, i did the same ! I added a sketch on /var/opt/m4 (blink example) and now it works CAN+M4. Need to add a default sketch to yocto ...

graugans commented 8 years ago

I've uploaded one yesterday:https://github.com/graugans/meta-udoo/commit/b873cbfef36f64aa3337a4c938329b3a21cab101

modjo756 commented 8 years ago

Problem solved with your add