Android Canbus: Difference between revisions

From Variscite Wiki
(Created page with "{{PageHeader|CAN bus}} {{DocImage|category1=Yocto|category2=VAR-SOM-MX6}} Connect 2 boards with the appropriate cable.<br> Board A CAN_H --- CAN_H Board B Board A CAN_L --- ...")
 
No edit summary
 
(10 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 ==
Connect 2 boards like the following:<br>
<u>Board A</u>  <u>Board B</u>
  CAN_H --- CAN_H
  CAN_L --- CAN_L
  GND ----- GND


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

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