Revision for “ETP 521 Using adb to test SPI between OCURA and DRONA” created on December 19, 2015 @ 20:40:56
Title | ETP 521 Using adb to test SPI between OCURA and DRONA |
---|---|
Content |
<h6>1. PURPOSE / DESCRIPTION</h6>
1.1 To test SPI communication (read and write) between DRONA and OCURA, using adb shell
<h6>2. TEST SET-UP</h6>
2.1 Drona: <a href="https://github.com/Vairdo/DRONA_firmware">https://github.com/Vairdo/DRONA_firmware</a>, version: 816ee47
2.1.1 SPI is slave
2.1.2 Need to connect to ICD to run in debug mode
2.2 OCURA board with android installed
<h6>3. PROCEDURE</h6>
3.1 Create a hex file (binary file) with desired 32 byte
3.1.1 Download HxD: <a href="http://mh-nexus.de/en/hxd/">http://mh-nexus.de/en/hxd/</a> (read/write binary file), and launch it
3.1.2 Set bytes per low to 32, and type in any data you want, then save that (the file extension can be ignored)
<a href="http://wiki.vairdo.com/wp-content/uploads/2015/11/p11.png"><img class="alignnone wp-image-198 size-full" src="http://wiki.vairdo.com/wp-content/uploads/2015/11/p11.png" alt="p11" width="878" height="160" /></a>
3.2 Connect PC to OCURA with USB cable, using command window, type in adb devices to see if the OCURA can be detected. (Refer to ETP 514 for attribute usage)
3.3 Copy the hex file to WiRa:
3.3.1 <em><strong>adb push filename /sdcard/</strong></em>
3.3.2 note that the <em>/sdcard/ directory</em> is not the real SD card, it’s located in the first directory of USB storage
3.4 Type in “<em><strong>adb shell</strong></em>” to enter the command line mode of Android
3.5 Navigate to<em> /sys/bus/spi/drivers/marc_basic/spi0.1</em>
3.6 Enable SPI using <em><strong>echo “-I” > spi</strong></em>
3.7 Write file to transfer (MOSI)
3.7.1 <em><strong>cat /sdcard/filename > transfer</strong></em>
3.7.2 Pause the code (either pause and set any breakpoint)
3.7.3 Check DRONA variable “<em><strong>WRRXPacket</strong></em>” using “New Watch” (See 3.9 the picture in the next page)
3.7.4 The result should be the same as what we have set in the hex file
3.8 Read file to transfer (MISO)
3.8.1 <em><strong>cat transfer > /sdcard/filename</strong> </em>
3.8.2 Copy the file from WiRa to PC (You can enable the USB storage and directly copy the file out
3.8.3 Check if the data in it is correct. If the MOSI data from OCURA is meaningless for DRONA, then OCURA would receive 32 bytes of 0x55 (See 3.10 the picture in the next page)
3.9
<img class="alignnone wp-image-196 size-full" src="http://wiki.vairdo.com/wp-content/uploads/2015/11/p12.png" alt="p12" width="1069" height="597" />
3.10
<a href="http://wiki.vairdo.com/wp-content/uploads/2015/11/p13.png"><img class="alignnone wp-image-197 size-full" src="http://wiki.vairdo.com/wp-content/uploads/2015/11/p13.png" alt="" width="1141" height="156" /></a> |
Excerpt |