Difference between revisions of "DESK-XZ7-L/Peripherals/CAN"

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "<section begin=History/> {| style="border-collapse:collapse; " !colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History |- !style="border-le...")
 
(Peripheral CAN)
 
(3 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
|-
 
|-
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000"|2023/01/23
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000"|2024/01/23
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000"|DESK-XZ7-L-1.0.1 release
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000"|DESK-XZ7-L-1.0.1 release
 
|-
 
|-
Line 13: Line 13:
 
<section begin=Body/>
 
<section begin=Body/>
  
== CAN ==
+
== Peripheral CAN ==
  
CAN is available on the <code>J24</code> connector. This device is routed through the PL.
+
CAN is routed through the PL using the TCL scripts for the [[DESK-XZ7-L/Development/Creating_and_building_the_Vivado_project#CAN0_and_UART0_routing_example_project | Vivado project example]] here below:
  
{| class="wikitable"
+
* <code>recreate_prj_bora_BASE.tcl</code>
|-
+
* <code>recreate_prj_boralite_BASE.tcl</code>
! Physical device !! Processor's resource !! Connector !! Type !! Notes
+
* <code>recreate_prj_boralite_NAND.tcl</code>
|-
+
* <code>recreate_prj_borax_BASE.tcl</code>
| CAN BUS || CAN0|| J24 || differential CAN bus ||
+
 
|-
+
===Accessing the peripheral ===
|}
 
  
The following commands can be issued from command line in order to send and receive CAN frames:
+
====Linux messages at boot time====
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
Line 35: Line 34:
 
[    0.768236] can: netlink gateway - max_hops=1
 
[    0.768236] can: netlink gateway - max_hops=1
 
</pre>
 
</pre>
 +
 +
====Enable the interface and check status====
 +
 +
The following commands can be issued from command line in order to send and receive CAN frames:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
Line 46: Line 49:
 
[1] 298
 
[1] 298
 
root@bora:~# interface = can0, family = 29, type = 3, proto = 1
 
root@bora:~# interface = can0, family = 29, type = 3, proto = 1
 +
</pre>
  
 +
==== Usage with [https://github.com/linux-can/can-utils/tree/master can-utils] ====
 +
<pre class="workstation-terminal">
 
root@bora:~# cansend can0 -i 0x7ff 00 01 02 03 04 05 06 07
 
root@bora:~# cansend can0 -i 0x7ff 00 01 02 03 04 05 06 07
 
interface = can0, family = 29, type = 3, proto = 1
 
interface = can0, family = 29, type = 3, proto = 1
Line 64: Line 70:
 
<section end=Body/>
 
<section end=Body/>
  
----
+
[[Category:BORA]] [[Category:BORA Xpress]] [[Category:BORA Lite]]
 
 
[[Category:BORA]]
 

Latest revision as of 13:41, 26 January 2024

History
Issue Date Notes
2024/01/23 DESK-XZ7-L-1.0.1 release


Peripheral CAN[edit | edit source]

CAN is routed through the PL using the TCL scripts for the Vivado project example here below:

  • recreate_prj_bora_BASE.tcl
  • recreate_prj_boralite_BASE.tcl
  • recreate_prj_boralite_NAND.tcl
  • recreate_prj_borax_BASE.tcl

Accessing the peripheral[edit | edit source]

Linux messages at boot time[edit | edit source]

root@bora:~# dmesg | grep -i can
[    0.545770] CAN device driver interface
[    0.752012] can: controller area network core
[    0.761010] can: raw protocol
[    0.763989] can: broadcast manager protocol
[    0.768236] can: netlink gateway - max_hops=1

Enable the interface and check status[edit | edit source]

The following commands can be issued from command line in order to send and receive CAN frames:

root@bora:~# canconfig can0 stop
can0 state: STOPPED
root@bora:~# canconfig can0 bitrate 500000
can0 bitrate: 500000, sample-point: 0.875
root@bora:~# canconfig can0 start
can0 state: ERROR-ACTIVE
root@bora:~# candump can0 &
[1] 298
root@bora:~# interface = can0, family = 29, type = 3, proto = 1

Usage with can-utils[edit | edit source]

root@bora:~# cansend can0 -i 0x7ff 00 01 02 03 04 05 06 07
interface = can0, family = 29, type = 3, proto = 1
<0x7ff> [8] 00 01 02 03 04 05 06 07
<0x000> [8] ff fe fd fc fb fa f9 f8
root@bora:~# cansend can0 -i 0x7ff 00 01 02 03 04 05 06 07
interface = can0, family = 29, type = 3, proto = 1
<0x7ff> [8] 00 01 02 03 04 05 06 07
<0x000> [8] ff fe fd fc fb fa f9 f8
root@bora:~# cansend can0 -i 0x7ff 00 01 02 03 04 05 06 07
interface = can0, family = 29, type = 3, proto = 1
<0x7ff> [8] 00 01 02 03 04 05 06 07
<0x000> [8] ff fe fd fc fb fa f9 f8
root@bora:~#