cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mx_muc
Visitor
Visitor
6,101 Views
Registered: ‎10-28-2016

CAN on Zynq PS

Hello,

 

i have an issue regarding the CAN bus from Zynq 7020 device.

 

vivado_can.JPG

 

vivado_can2.JPG

 

These are my settings in vivado. When I create an internal loopback in the PL, as mentioned in AR 55133, i can send and receive CAN messages from CAN0 to CAN1 with the canutils (precompiled binarys from http://www.wiki.xilinx.com/Linux+CAN+driver).

 

Now i try to route the CAN0 controller to my external hardware. When I try to send a message, the controller crashes an there is no traffic on the wire.

 

I double checked the CAN registers @0xe0008000 and i think they should be fine until i try to send something. I execute the following commands to initialize the controller and send a message:

 

login[1139]: root login on 'ttyPS0'
root@dev:~# canconfig can0 bitrate 125000
xilinx_can e0008000.can can0: bitrate error 0.0%
can0 bitrate: 124999, sample-point: 0.750
root@dev:~# canconfig can0 start
can0 state: ERROR-ACTIVE
root@dev:~# canconfig can0
can0 bitrate: 124999, sample-point: 0.750
can0 bittiming:
tq: 2000, prop-seq: 1 phase-seq1: 1 phase-seq2: 1 sjw: 1, brp: 200
can0 state: ERROR-ACTIVE
can0 restart-ms: 0
can0 ctrlmode: loopback[OFF], listen-only[OFF], tripple-sampling[OFF],one-shot[OFF], berr-reporting[OFF]
can0 clock freq: 99999999
can0 bittiming-constants: name xilinx_can,
tseg1-min: 1, tseg1-max: 16, tseg2-min: 1, tseg2-max: 8,
sjw-max 4, brp-min: 1, brp-max: 256, brp-inc: 1,
root@dev:~# 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)
Interrupt:22

root@dev:~# cansend can0 -i 0x12 0x34 0x56 0x78
interface = can0, family = 29, type = 3, proto = 1
root@dev:~# canconfig can0
can0 bitrate: 124999, sample-point: 0.750
can0 bittiming:
tq: 2000, prop-seq: 1 phase-seq1: 1 phase-seq2: 1 sjw: 1, brp: 200
can0 state: BUS-OFF
can0 restart-ms: 0
can0 ctrlmode: loopback[OFF], listen-only[OFF], tripple-sampling[OFF],one-shot[OFF], berr-reporting[OFF]
can0 clock freq: 99999999
can0 bittiming-constants: name xilinx_can,
tseg1-min: 1, tseg1-max: 16, tseg2-min: 1, tseg2-max: 8,
sjw-max 4, brp-min: 1, brp-max: 256, brp-inc: 1,
root@dev:~# ifconfig can0
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP NOARP MTU:16 Metric:1
RX packets:31 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:31 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:248 (248.0 B) TX bytes:3 (3.0 B)
Interrupt:22

Before I execute the "cansend" command the CAN registers have those values:

xsdb% mrd 0xe0008000 10
E0008000: 00000002
E0008004: 00000000
E0008008: 000000C7
E000800C: 00000001
E0008010: 00000000
E0008014: 00000000
E0008018: 00000098
E000801C: 00006020
E0008020: 00000FC3
E0008024: 00000000

 

After the send command:

xsdb% mrd 0xe0008000 10
E0008000: 00000000
E0008004: 00000000
E0008008: 00000000
E000800C: 00000000
E0008010: 00000000
E0008014: 00000000
E0008018: 00000001
E000801C: 00006000
E0008020: 00000000
E0008024: 00000000

 

 Does maybe somebody has the same issue or a solution?

 

Thank you!!!

 

 

0 Kudos
5 Replies
pvenugo
Moderator
Moderator
6,044 Views
Registered: ‎07-31-2012

Hi,

 

Could you check same using baremetal SDK example template available?

 

Regards

Praveen


-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
mx_muc
Visitor
Visitor
6,029 Views
Registered: ‎10-28-2016

Hi pvenugo!

 

Thanks for your reply. I ran the SDK peripheral selftest example:

 

This is the output regarding CAN0:

 

 Running CanPsPolledExample() for ps7_can_0...
CanPsPolledExample PASSED

 Running Interrupt Test  for ps7_can_0...
CanPsIntrExample PASSED

It seems to be okay. I think in this selftest example also only loopback mode is verified, isnt it? Do you have maybe other ideas?

 

Best regards

0 Kudos
pvenugo
Moderator
Moderator
5,931 Views
Registered: ‎07-31-2012

Hi,

 

Can you verify as in this link http://www.wiki.xilinx.com/Linux+CAN+driver?

 

Regards

Praveen


-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
mx_muc
Visitor
Visitor
5,893 Views
Registered: ‎10-28-2016

Hi,

 

I already tried those steps...

 

 

Best regards

0 Kudos
julian.bauer
Participant
Participant
5,801 Views
Registered: ‎11-18-2016

you could create your own can-bus if you use both can instances of the zynq device. therefore you have to connect both Tx with an AND to Rx of the first CAN-device and for the secound device the same with a secound AND:

 

can-bus.png

 

then you can verify your internal logic. if everything is right, you can route it throught your PL to the hardware can controller

can-bus.png
0 Kudos