MTCDP I/O Control using mts-io
Most of the peripheral I/O on the MTCDP 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. |
| eth0-enabled | Enable or disable the ethernet PHY. |
| extserial-dcd | Carrier Detect on the external serial port |
| extserial-ri | Ring Indicator on the external serial port |
| extserial-dsr | Data Set Ready on the external serial port |
| extserial-dtr | Data Terminal Ready on the external serial port (added in CoreCDP 1.0.2) |
| led-cd | Set the carrier detect led. |
| led-sig1 | Set the signal strength led 1. |
| led-sig2 | Set the signal strength led 2. |
| led-sig3 | Set the signal strength led 3. |
| led-status | Set the status led. [Compiled out by default. Controllable through /sys/class/leds/status/] |
| radio-reset | Reset the radio. Write a 0 to this file to reset the radio. |
| reset | Value of reset button. |
| reset-monitor | Monitor the reset button. Takes 3 values [PID short-signal long-signal]. Short signal is the signal to send on a click. Long signal is the signal to send on a hold (> 3 seconds). PID is the PID of the process to signal when the reset button is pressed. If using mts-io-sysfs, remember to wrap the 3 values in quotes since the argument is one string. |
| led-sdk-a | Same as led-status. |
| led-sdk-b | Same as led-cd. |
| led-sdk-c | Same as led-sig1. |
| led-sdk-d | Same as led-sig2. |
| led-sdk-e | Same as led-sig3. |
The following I/O controls apply to R1.0 Hardware and require CoreCDP 1.1.1 or greater
| dout0 | Sets or clears the dout0 output pin |
| dout1 | Sets or clears the dout1 output pin |
| dout2 | Sets or clears the dout2 output pin |
| dout3 | Sets or clears the dout3 output pin |
| dout4 | Sets or clears the dout4 output pin |
| dout5 | Sets or clears the dout5 output pin |
| dout6 | Sets or clears the dout6 output pin |
| dout7 | Sets or clears the dout7 output pin |
| din0 | Reads the state of the din0 pin |
| din1 | Reads the state of the din1 pin |
| din2 | Reads the state of the din2 pin |
| din3 | Reads the state of the din3 pin |
| din4 | Reads the state of the din4 pin |
| din5 | Reads the state of the din5 pin |
| din6 | Reads the state of the din6 pin |
| din7 | Reads the state of the din7 pin |
| adc0 | Reads data from the adc0 register and triggers a new conversion. Value is between 0 and 0x1FFh. Data read is from previous conversion. |
| adc1 | Reads data from the adc1 register and triggers a new conversion. Value is between 0 and 0x1FFh. Data read is from previous conversion. |
| adc2 | Reads data from the adc2 register and triggers a new conversion. Value is between 0 and 0x1FFh. Data read is from previous conversion. |
| adc3 | Reads data from the adc3 register and triggers a new conversion. Value is between 0 and 0x1FFh. Data read is from previous conversion. |
Examples using mts-io-sysfs script
Print value of LED B, then turn it on
$ mts-io-sysfs show led-sdk-b 0 $ mts-io-sysfs store led-sdk-b 1
Print Board Temperature
$ mts-io-sysfs show board-temperature 38
Set External Output 3
$ mts-io-sysfs store dout3 1
Read External Input 6
$ mts-io-sysfs show din6 0
Control RI pin on external serial port
$ mts-io-sysfs show extserial-ri 1 $ mts-io-sysfs store extserial-ri 0 $ mts-io-sysfs show extserial-ri 0
Set up the reset-monitor for handling reset button events by sending signals to PID 2000 when the reset button is pressed. Send SIGUSR1 (10) on a short press and SIGUSR2 (12) on a long press (more than 3 seconds).
$ mts-io-sysfs store reset-monitor '2000 10 12'
Examples using sysfs directly
Print value of LED B, then turn it on
$ cd /sys/devices/platform/mtcdp/ $ cat led-sdk-b 0 $ echo 1 > led-sdk-b
Print Board Temperature
$ cd /sys/devices/platform/mtcdp/ $ cat board-temperature 38
Set External Output 7
$ cd /sys/devices/platform/mtcdp/ $ echo 1 > dout7
Read ADC 2
$ cd /sys/devices/platform/mtcdp/ $ cat adc2 340