Android Canbus: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_N7.1.1_1.0.0_VAR-SOM-MX6}}}} <!--
--> {{#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}} Android Canbus}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Android}} __toc__
--> {{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__
 
==Hardware Setup ==


== Hardware setup ==
Connect 2 boards like the following:<br>
Connect 2 boards like the following:<br>
  <u>Board A</u>  <u>Board B</u>
  <u>Board A</u>  <u>Board B</u>
   CAN_H --- CAN_H
   CAN_H --- CAN_H
   CAN_L --- CAN_L
   CAN_L --- CAN_L
   GND ----- GND
   GND ----- GND


==Software Setup==
== Software setup ==
Android releases comes with the canutils pre-installed.
Android releases comes with the canutils pre-installed.
Please use below commands either via serial terminal or via adb shell.  
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 #A:<br>  
On board A:<br>  
<pre>
# candump can0
$ cansniffer can0
</pre>


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


== Canbus at Framework - Android Java application ==
== CAN bus at Framework - Android Java application ==
- If you want the application to use the canbus, you must port the framework level changes<br>
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>
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