MT100EOCG I/O Control using mts-io
Most of the peripheral I/O on the MT100EOCG is accessible through the mts-io package. This package provides a device driver (mts_io) which exposes a sysfs interface to the user at /sys/devices/platform/mtcdp. You can control the I/O directly by manipulating the files in this directory, or you can use the provided sysfs wrapper program (mts-io-sysfs). mts-io-sysfs is just a bash script which reads from and writes to files in the sysfs platform directory.
/sys/devices/platform/mtcdp:
| board-temperature | Read the board temperature in Celsius. Typically reads between 33 and 39 degrees when unit is at room temperature. |
| radio-reset | Reset the radio. Write a 0 to this file to reset the radio. |
| eth0-enabled | Enable or disable the ethernet PHY. |
| extserial-dcd | Carrier Detect on the external serial port |
| extserial-dtr | Data Terminal Ready on the external serial port |
| rsersrc | Radio Serial Source (G2 model only). Defaults to 0, which means the G2 cellular radio is connected to the processor and is accessible on /dev/ttyS1 as normal. If set to 1, the radio serial pins are connected to the external serial pins on the 80-pin connector (TXD_1, RXD_1, etc). This allows AT commands to be sent to the radio from the external serial port. |
| led1 | Set LED1 |
| led2 | Set LED2. By default, this is a status LED and is controllable through /sys/class/leds/status/ |
| led3 | Read LED3. This is connected to the LS (line status) pin on the cellular radio and is read-only. |
| led4 | Set LED4 |
| led5 | Set LED5 |
| led6 | Set LED6 |
| gpo1 | Sets or clears the GPO1 output pin |
| gpo2 | Sets or clears the GPO2 output pin |
| gpo3 | Sets or clears the GPO3 output pin |
| gpo4 | Sets or clears the GPO4 output pin |
| gpi5 | Reads the state of the GPI5 pin |
| gpi6 | Reads the state of the GPI6 pin |
| gpi7 | Reads the state of the GPI7 pin |
| gpi8 | Reads the state of the GPI8 pin |
| gpi9 | Reads the state of the GPI9 pin |
| gpi10 | Reads the state of the GPI10 pin |
| gpio11 | Sets/reads the state of the GPIO11 pin |
| gpio12 | Sets/reads the state of the GPIO12 pin |
| adc0 | Reads data from the adc0 register and triggers a new conversion. Value is between 0 and 1023 decimal (0x3FFh). |
| adc1 | Reads data from the adc1 register and triggers a new conversion. Value is between 0 and 1023 decimal (0x3FFh). |
| adc2 | Reads data from the adc2 register and triggers a new conversion. Value is between 0 and 1023 decimal (0x3FFh). |
| adc3 | Reads data from the adc3 register and triggers a new conversion. Value is between 0 and 1023 decimal (0x3FFh). |
Examples using mts-io-sysfs script
Print value of LED1, then turn it on
$ mts-io-sysfs show led1 0 $ mts-io-sysfs store led1 1
Print Board Temperature
$ mts-io-sysfs show board-temperature 38
Set GPO3
$ mts-io-sysfs store gpo3 1
Read GPI6
$ mts-io-sysfs show gpi6 0
Examples using sysfs directly
Print value of LED1, then turn it on
$ cd /sys/devices/platform/mtcdp/ $ cat led1 0 $ echo 1 > led1
Print Board Temperature
$ cd /sys/devices/platform/mtcdp/ $ cat board-temperature 38
Set GPO2
$ cd /sys/devices/platform/mtcdp/ $ echo 1 > gpo2
Read ADC 2
$ cd /sys/devices/platform/mtcdp/ $ cat adc2 340