Beta Draft: 2016-07-11
To access any device from the preconfigured peripheral list, the following permission is required:
jdk.dio.DeviceMgmtPermission(%Name%:%ID%);
You can find the names and IDs for specific devices in the tables that follow in this appendix. You must also specify an action. An empty string means open
.
The tables use the following legend:
Device ID: an integer identifier that can be used to open the device with the methods of the DeviceManager
class.
Device Name: the string name of a device that can be used to open it by name with the methods of the DeviceManager class
.
Mapped: all hardware-related information regarding a peripheral, such as physical location, mapping, or port. This information enables the user to determine the peripheral's location on a target board.
Configuration: properties that are passed to the specific DeviceConfig
constructor to open the peripheral by ID or name. The configuration can be used to open the peripheral using the DeviceManager
with the appropriate configuration.
The galileo_pin_config.sh
script configures the Linux sysfs interface for designating the GPIO/I2C/SPI/UART protocols for different GPIO pins.
The galileo_pin_config.sh
script resides in the /bin
directory and must be run before running any IMlet that uses the DIO API. This script configures the kernel sysfs interface for the supported DIO interfaces and designates the corresponding pins as specified :
GPIO - 6 output pins (D2,D3,D6,D7,D8,D9) and 6 Input pins (D4,D5,A0,A1,A2,A3)
I2C - A5(SCL), A4(SDA) and dedicated SCL, SDA pins
SPI - D13(MCLK), D12(MISO), D11,(MOSI), D10(CS)
UART - D0(RX), D1(TX)
Watchdog (software implementation)
You need to run this script only once per a boot session. Therefore it is recommended that you add this script to the /etc/profile
or .bashrc
to enable running the galileo_pin_config.sh
script automatically at login time.
The Reference Pin Diagram for Java ME Device I/O API on the Intel Galileo Gen2 board is shown in this section.
Figure A-1 Intel Galileo Reference Pin Diagram for Java ME Device I/O API
The following GPIO pins are preconfigured.
Devicel ID | Device Name | Mapped | Configuration |
---|---|---|---|
1 |
GPIO1, GPIO0.13, D2 |
|
|
2 |
GPIO2, GPIO0.14, D3 |
|
|
3 |
GPIO3, GPIO0.6, D4 |
|
|
4 |
GPIO4, GPIO0.0, D5 |
|
|
5 |
GPIO5, GPIO0.1, D6 |
|
|
6 |
GPIO6, GPIO0.38, D7 |
|
|
7 |
GPIO7, GPIO0.40, D8 |
|
|
8 |
GPIO8, GPIO0.4, D9 |
|
|
9 |
GPIO9, GPIO48.0, A0 |
|
|
10 |
GPIO10, GPIO50.0, A1 |
|
|
11 |
GPIO11, GPIO52.0, A2 |
|
|
12 |
GPIO12, GPIO54.0, A3 |
|
GPIO Default Values
Consider the following default values concerning GPIO on the Intel Galileo Gen2 board.
Unassigned gpio.GPIOPIN.initValue
is 0 (false).
Unassigned gpio.GPIOPIN.controllerNumber
is 0.
Unassigned gpio.GPIOPIN.direction
is GPIOPinConfig.MODE_INPUT_PULL_DOWN
.
Unassigned gpio.GPIOPIN.trigger
is GPIOPinConfig.TRIGGER_NONE
.
Configured GPIO Pins Directions
galileo_pin_config
script configures 12 GPIO pins as follows:
Output pins: D2, D3, D6, D7, D8, D9
Input pins: D4, D5, A0, A1, A2, A3, A4
Note:
The specified pin directions are fixed for using the DIO API in Java ME applications. IMlets must use the GPIO pins in the specified directions otherwise the correct results are not guaranteed.For connecting SPI devices to the Intel Galileo Gen2 board, modify the grub.conf
file as described in Editing the grub.conf File.
Consider the following implementation notes concerning SPI on the Intel Galileo Gen2board.
SPI Pins are configured as follows:
D13 (Master Clock)
D12 (Master In Slave Out)
D11 (Master Out Slave In)
D10 (Slave Select/Chip Select)
There are no onboard SPI devices on the Intel Galileo Gen2 board.
Device ID | Device Name | Mapped | Configuration |
---|---|---|---|
200 |
PCA9547 |
|
Please note the following items about I2C on the Intel Galileo Gen2 board.
There is one onboard I2C GPIO multiplexer switch at the address 0x70.
The configured Pins are A4 (SDA) and A5 (SDL).
The following UART devices are preconfigured:
Device ID | Device Name | Mapped | Configuration |
---|---|---|---|
100 |
ttyS0, UART0 |
controllerName = ttyS0
|
|
101 |
ttyS1, UART1 |
|
Please note the following items about UART on the Intel Galileo Gen2.
Only two UART controllers are supported on the Intel Galileo Gen2device.
UART Default values
Consider the following default values concerning UART on the Intel Galileo Gen2 board.
Unassigned uart.UART.baudRate
is 9600.
Unassigned uart.UART.parity
is 0.
Unassigned uart.UART.dataBits
is 8.
Unassigned uart.UART.stopBits
is 1.
Unassigned uart.UART.flowControl
is FLOWCONTROL_NONE
.
Device I/O configuration file structure is based on the JSON data interchange format with a few distinctions.
General File Data Format
/appdb
directory and has the name daapi_config.json
. Based on the JSON data interchange format, the Device I/O configuration file has the following distinctions:
A string is quoted only if it contains a space.
A value can be only a string, object, or array.
UTF–8 is the only supported encoding.
For more information about the JSON data interchange format, see www.json.org.
Configuration Hierarchy
An unnamed global object that contains two other sections. It begins with { (left brace) and ends with } (right brace).
configs
: a container for all configuration objects
defaults
: a container for default properties grouped by peripheral packages
All the sections are mandatory even if there is no content as shown in the following example.
{ configs: {} defaults: {} }
The configs Section
The configs
section contains a collection of key/value pairs named properties, where the key is an ID assigned to a configuration (see Device I/O 1.1 API specification) and the value is an object that contains information specific for the described configuration. The configuration must contain at least the deviceType
property that points to the peripheral class to which this configuration applies. The value of the deviceType
property is a shortened form of the peripheral class name. The rest of the properties are device specific. Property names must conform with the Device I/O 1.1 API specification. The name
field can be an array of names to support name aliases.
Example A-1 Example of GPIOPin Device Configuration
An example below shows a valid configuration description. Note that it is mandatory that the deviceType
and name
field values are set.
10 : { deviceType : gpio.GPIOPin, id:1, deviceNumber : 1, pinNumber : 5, direction : 1, mode:4, name :[LED_1,GPIO6.6,GPIO0] initValue:0, }
The defaults Section
The defaults
section provides default values for some properties and also additional information required for the construction of a peripheral instance. The main purpose of this section is to reduce the amount of information provided by the configs
section and thus to decrease the file size. The same requirement for key naming applies to the . The properties are grouped by the shortened name of peripheral class for which they may be used. For example, uart.UARTConfig
is a group for the com.oracle.deviceaccess.uart.UARTConfig
property object.
Example A-2 Example of the daapi_config.json File
Refer to the following daapi_config.json
file example.
{ configs: { 13: { deviceType: atcmd.ATDevice, name: EMUL, properties : [“com.oracle.sms=true”] }, 15: { deviceType: uart.ModemUART, deviceNumber: 1, name: COM1, baudRate: 9600, dataBits: 7, }, }, defaults: { uart.UARTConfig: { baudRate:115200, parity:0, dataBits:8, stopBits:1, flowControl:0, }, }