cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
joseer
Voyager
Voyager
1,372 Views
Registered: ‎07-06-2016

CAN bus on zynqMP

Jump to solution

Hello,

I can't get the CAN driver to work in a zynMP device the steps I followed are similar to the ones in this topic

But when I boot petalinux I've got:

 

root@petalinux:/dev# dmesg | grep can
[    4.537448] vcan: Virtual CAN interface driver
[    4.550478] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    5.272471] can: controller area network core (rev 20170425 abi 9)
[    5.282944] can: raw protocol (rev 20170425)
[    5.287180] can: broadcast manager protocol (rev 20170425 t)
[    5.292805] can: netlink gateway (rev 20170425) max_hops=1
[    5.578775] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    5.762307] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    6.094055] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    6.112014] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    6.143677] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    6.160939] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    6.313941] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    6.432130] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    6.497870] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    6.531858] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    6.562910] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    6.593899] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    6.775193] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13
[    7.148501] xilinx_can ff060000.can: failed to add to PM domain pd-can0: -13

 

And oviously I have not can0 device in /dev.

Any ideas what is wrong/missing?

 

0 Kudos
1 Solution

Accepted Solutions
joseer
Voyager
Voyager
1,231 Views
Registered: ‎07-06-2016

I finally worked out how to work with the CAN network from a petalinux application, I've followed the linux CAN documentation  and I've got a simple application sending and receiving packages through CAN.

View solution in original post

0 Kudos
4 Replies
stephenm
Xilinx Employee
Xilinx Employee
1,349 Views
Registered: ‎09-12-2007

Can you post the complete boot log?

0 Kudos
joseer
Voyager
Voyager
1,344 Views
Registered: ‎07-06-2016

Hi @stephenm,

Thanks for your reply, please find attached the boot log.

 

0 Kudos
joseer
Voyager
Voyager
1,258 Views
Registered: ‎07-06-2016

Hi,

I've finally managed to make some progress with next input in the system-user.dtsi:

 

  can0 {
   compatible = "xlnx,zynq-can-1.0";
   status = "okay";
  };

 I've got the error can0 failed with error -22:

[    4.538726] vcan: Virtual CAN interface driver
[    4.547560] xilinx_can can0: invalid resource
[    4.551162] xilinx_can: probe of can0 failed with error -22
[    5.259766] can: controller area network core (rev 20170425 abi 9)
[    5.270251] can: raw protocol (rev 20170425)
[    5.274480] can: broadcast manager protocol (rev 20170425 t)
[    5.280106] can: netlink gateway (rev 20170425) max_hops=1

But I've got it as network device:

root@petalinux:~# 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:11
(.........)

And after testing it:

root@petalinux:~# ip link set can0 type can bitrate 1000000
[  862.218326] xilinx_can ff060000.can can0: bitrate error 0.0%
root@petalinux:~# ip link set can0 up
root@petalinux:~# cansend can0 -i 0x14 0x33 0x88
interface = can0, family = 29, type = 3, proto = 1

I've checked on the other side and It seems to receive  the data fine, so it works.

How could I operate (setup, send and receive  packages) the CAN bus from C code or linux application?  

 

 

0 Kudos
joseer
Voyager
Voyager
1,232 Views
Registered: ‎07-06-2016

I finally worked out how to work with the CAN network from a petalinux application, I've followed the linux CAN documentation  and I've got a simple application sending and receiving packages through CAN.

View solution in original post

0 Kudos