Open main menu

DAVE Developer's Wiki β

Changes

SBCX-TN-001: Android Things and SPI bus

639 bytes added, 14:04, 9 April 2018
no edit summary
* CPU: based on NXP/Freescale i.MX6 Dual core
* SOM: Axel lite
* carrier board: [[:Category:SBC-AXEL|SBC-AXEL]]
* Android Version: 4.4.3 (Jelly Bean)
* ARM CortexLCD adapter: TI-DF 1.0.0-A8 frequency: 600 MHz* SDRAM size: 512 MByte* SDRAM frequency: 400 MHzCS102015 * HDVICP2 frequency: 306 MHz
==Implementation==
 
TBD
 
=== Managing the device connection ===
In order to open a connection to a particular SPI slave, you need to know the unique name of the bus.
mDevice = null;
} catch (IOException e) {
Log.w(TAG"Error", "Unable to close SPI device", + e.getMessage());
}
}
=== Transferring data ===
Is important to note that async I/O are not supported in userspace at this time [https://www.kernel.org/doc/Documentation/spi/spidev ref].To communicate with the device the following methods are available*<code> void WriteByte(byte symbol)</code> For transfer a byte without reading the response from the device.*<code> void WriteBuffer(byte[] data, int len)</code> For transfer a buffer to the device without processing the response.*<code> void Transfer(byte[] tx_data, byte[] rx_data, int len)</code> For transfer a buffer smaller than the length of the receiving one.*<code> void Transfer(byte[] tx_data, byte[] rx_data) </code> For transfer and read a buffer with the same length.*<code> void Transfer(byte symbol, byte[] rx_data, int len)</code> For transfer a byte and read a buffer of length ''len''.
<pre>
public void sendCommand(SpiDevice device, byte[] buffer) throws IOException {
byte[] response = new byte[buffer.length];
device.transferTransfer(buffer, response, buffer.length);
...
}
</pre>
170
edits