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 | Set the state of the reset pin on the ethernet PHY. A value of 0 holds the reset line active. Note: this does not put the PHY into a low power state. |
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. (See note below this table for MTCDP-H5) |
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. |
/usr/sbin/radio-reset-h5
(rather than using the standard mts-io method). This script disables all USB host ports while the radio is reset. If the script is not used, the radio will fail to reset and will not function until properly reset.
The following I/O controls apply to R1.0 Hardware and require CoreCDP 1.1.1 or greater
dout0 | Sets or clears the External Output 0 output pin |
dout1 | Sets or clears the External Output 1 output pin |
dout2 | Sets or clears the External Output 2 output pin |
dout3 | Sets or clears the External Output 3 output pin |
dout4 | Sets or clears the External Output 4 output pin |
dout5 | Sets or clears the External Output 5 output pin |
dout6 | Sets or clears the External Output 6 output pin |
dout7 | Sets or clears the External Output 7 output pin |
din0 | Reads the state of the External Input 0 pin |
din1 | Reads the state of the External Input 1 pin |
din2 | Reads the state of the External Input 2 pin |
din3 | Reads the state of the External Input 3 pin |
din4 | Reads the state of the External Input 4 pin |
din5 | Reads the state of the External Input 5 pin |
din6 | Reads the state of the External Input 6 pin |
din7 | Reads the state of the External Input 7 pin |
adc0 | Reads data from the Analog Input 0 pin and triggers a new conversion. Value is between 0 and 1023 decimal (0x3FFh). |
adc1 | Reads data from the Analog Input 1 pin and triggers a new conversion. Value is between 0 and 1023 decimal (0x3FFh). |
adc2 | Reads data from the Analog Input 2 pin and triggers a new conversion. Value is between 0 and 1023 decimal (0x3FFh). |
adc3 | Reads data from the Analog Input 3 pin and triggers a new conversion. Value is between 0 and 1023 decimal (0x3FFh). |
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