Android Canbus: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{PageHeader|CAN bus}}
<!-- Set release according to "release" parameter in URL and use RELEASE_N7.1.1_1.0.0_VAR-SOM-MX6 as default
{{DocImage|category1=Yocto|category2=VAR-SOM-MX6}}
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_N7.1.1_1.0.0_VAR-SOM-MX6}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Android {{#var:ANDROID_NAME}} {{#var:ANDROID_VERSION}} - CAN bus}} {{DocImage|category1=Android|category2=VAR-SOM-MX6}}[[Category:DART-MX8M]][[Category:DART-MX8M-MINI]][[Category:VAR-SOM-MX8X]][[Category:VAR-SOM-MX8]] __toc__


Connect 2 boards with the appropriate cable.<br>
== Hardware setup ==
[[File:CAN_Bus_Connection.png]]
Connect 2 boards like the following:<br>
 
<u>Board A</u>  <u>Board B</u>
Board A CAN_H --- CAN_H Board B <br>
Board A CAN_L --- CAN_L Board B <br>
  CAN_H --- CAN_H
  CAN_L --- CAN_L
  GND ----- GND


== Software setup ==
Android releases comes with the canutils pre-installed.
Please use below commands either via serial terminal or via adb shell.


Set up the boards by running the following on each of them:<br>  
Set up the boards by running the following on each of them:<br>  
<pre>
# ip link set can0 up type can bitrate 125000
$ ip link set can0 up type can bitrate 125000
</pre>


Then:<br>
Then:<br>
On board #1:<br>  
On board A:<br>  
<pre>
# candump can0
$ cansniffer can0
 
</pre>
On board B:<br>  
# cansend can0 500#1E.10.10


On board #2:<br>  
== CAN bus at Framework - Android Java application ==
<pre>
If you want your application to use the CAN bus, you must port the framework level changes<br>
$ cansend can0 500#1E.10.10
Port https://github.com/zhangjie201412/Flexcan to your android release<br>
</pre>

Latest revision as of 09:52, 1 January 2020

VAR-SOM-MX6 - Android Nougat N7.1.1 - CAN bus

Hardware setup

Connect 2 boards like the following:

Board A   Board B

 CAN_H --- CAN_H
 CAN_L --- CAN_L
  GND ----- GND

Software setup

Android releases comes with the canutils pre-installed. Please use below commands either via serial terminal or via adb shell.

Set up the boards by running the following on each of them:

# ip link set can0 up type can bitrate 125000

Then:
On board A:

# candump can0

On board B:

# cansend can0 500#1E.10.10

CAN bus at Framework - Android Java application

If you want your application to use the CAN bus, you must port the framework level changes
Port https://github.com/zhangjie201412/Flexcan to your android release