accessory:add-on_boards:multiioboard

Multi I/O Training Board is designed to help one to add or extend various peripheral connections to GPIO pin header that used be done using jumper wires. Separating signals on GPIO header to multiple connections per different type of signals, this will help to easy wiring to peripheral devices and evaluate them. Also this board include several simple components that helps to test or use hardware functions.

Form Factor Board dimension : 90 (L) x 65 (W) x 16 (H) mm
I/O 2x I2C bus (J4 & J7, J7 is dedicated for 128×64 OLED display
1x LED
1x RTC (PCF8563) with backup battery socket (CR1620)
5x tack switches
2x buttons (SW1 is for power & SW2 is for board reset)
1x 2CH ADC input
1x RS232 port
2x SPI connection (J5 & J9)
1x GPIO input/output
1x MOSFET (IRLR2905TRPBF) output (PWM)
1x 5V FAN control output (PWM)
FUNCTIONS GPIO PIN # CONNECTORS GPIO
GPIO I/O SIGNAL 7 J8 GPIO0_PB6
ADC ADC0 37 J6 -
ADC1 40 J6 -
I2C0 SDA 3 J4 GPIO3_PB6
SCL 5 J4 GPIO3_PB5
I2C1 SDA 27 J7 GPIO0_PB4
SCL 28 J7 GPIO0_PB3
SPI MOSI 19 J5 / J9 GPIO3_PC1
MISO 21 J5 / J9 GPIO3_PC2
SCK 23 J5 / J9 GPIO3_PC3
CS0 24 J9 GPIO3_PA1
CS1 26 J5 GPIO2_PB1
#INT 12 J5 GPIO2_PA7
RS232 TX 8 J11 GPIO2_PA4
RX 10 J11 GPIO2_PA3
RTS 31 J11 GPIO2_PB7
CTS 29 J11 GPIO2_PC0
MOSFET output PWM0 15 J10 GPIO0_PC2
FAN control PWM 33 J12 GPIO0_PB5
SPD 12 (J2) J12 GPIO3_PC5
BUTTONS RESET 10 (J2) SW1 -
POWER 9 (J2) SW2 -
KEY0 16 SW3 GPIO2_PB5
KEY1 18 SW4 GPIO2_PB6
KEY2 22 SW5 GPIO2_PB0
KEY3 32 SW6 GPIO2_PB2
KEY4 36 SW7 GPIO2_PB4

The functions in this board can be enabled after loading a dedicated device tree overlays board_multiio to the line start with overlays in /boot/config.ini.

...
overlays="board_multiio"
...

Optional hardware/peripheral that can be attached to other connectors need to be enabled by adding additional device tree overlay files. For example, in order to support 0.96“ 128×64 OLED display through J7, board_multiio_oled is required to add to the end of the line of overlays.

...
overlays="board_multiio board_multiio_oled"
...

In the same manner, WEATHER-BOARD Zero can be supported through the connector J4 by adding board_multiio_shtc1.

...
overlays="board_multiio board_multiio_oled board_multiio_shtc1"
...

CANFD board can be supported through the connector J9 by adding board_multiio_canfd.

...
overlays="board_multiio board_multiio_oled board_multiio_canfd"
...

GPIO is supported through the connector J8.
GPIO PIN is #7.

$ sudo grep PIN_7 /sys/kernel/debug/gpio
gpio-14  (PIN_7               )
Export gpio
$ echo 14 | sudo tee /sys/class/gpio/export
Control signal pin as output
$ echo out | sudo tee /sys/class/gpio/gpio14/direction
$ echo 0 | sudo tee /sys/class/gpio/gpio14/value
Control signal pin as input
$ echo in | sudo tee /sys/class/gpio/gpio14/direction
$ cat /sys/class/gpio/gpio14/value
0


Check overlays in /boot/config.ini

$ cat /boot/config.ini
[generic]
#default_console=ttyFIQ0
overlay_resize=16384
overlay_profile=
overlays="board_multiio"
 
[overlay_custom]
overlays="i2c0 i2c1"
 
[overlay_hktft32]
overlays="hktft32 ads7846"

Multiio supports the spi interface.
See how to control it how to control spi

There are 2 PWM channels that can manage independent power sources and peripherals can be connected to the dedicated connectors.

  • J10 - Wide range power source via MOSFET (IRLR2905)
  • J12 - On board 5V source via BJT(2N7002), this connector can driver 5V cooling fans with speed sensor.
Connecting a peripheral that exceeds the hardware specification will cause the damage the board or the device itself. There please double check the specification before drive the peripheral.

PWM


Check overlays in /boot/config.ini

$ cat /boot/config.ini
[generic]
#default_console=ttyFIQ0
overlay_resize=16384
overlay_profile=
overlays="board_multiio"
 
[overlay_custom]
overlays="i2c0 i2c1"
 
[overlay_hktft32]
overlays="hktft32 ads7846"

External power is required to control a device through this interface, the picture below shows a simple example with Smart Power 3 how the external power can be sourced to the motor through the connector (J10). In practice, one need to be careful of connecting a high voltage/current device to the Smart Power 3 as a power source..


Configure & Use PWM (duty rate: 50%). Must change 'period' first.
PWM is fdd70030.pwm

$ ls -l /sys/class/pwm/
total 0
lrwxrwxrwx 1 root root 0 Nov 10 01:39 pwmchip0 -> ../../devices/platform/fdd70010.pwm/pwm/pwmchip0
lrwxrwxrwx 1 root root 0 Nov 10 01:39 pwmchip1 -> ../../devices/platform/fdd70030.pwm/pwm/pwmchip1
$ echo 0 | sudo tee /sys/class/pwm/pwmchip1/export
$ echo 20000000 | sudo tee /sys/class/pwm/pwmchip1/pwm0/period
$ echo normal | sudo tee /sys/class/pwm/pwmchip1/pwm0/polarity
$ echo 10000000 | sudo tee /sys/class/pwm/pwmchip1/pwm0/duty_cycle
$ echo 1 | sudo tee /sys/class/pwm/pwmchip1/pwm0/enable

FAN

Setup

“board_multio” must be added to /boot/config.ini.

$ cat /boot/config.ini
[generic]
#default_console=ttyFIQ0
overlay_resize=16384
overlay_profile=
overlays="board_multiio"
 
[overlay_custom]
overlays="i2c0 i2c1"
 
[overlay_hktft32]
overlays="hktft32 ads7846"

The PWM node for this interface will be presented to /sys/devices/platform/fdd70030.pwm/pwm/pwmchip1 when the device tree overlay is correctly applied.

$ ls -l /sys/class/pwm/
total 0
lrwxrwxrwx 1 root root 0 Nov 10 01:39 pwmchip0 -> ../../devices/platform/fdd70010.pwm/pwm/pwmchip0
lrwxrwxrwx 1 root root 0 Nov 10 01:39 pwmchip1 -> ../../devices/platform/fdd70030.pwm/pwm/pwmchip1

Checking FAN speed

One can read the spinning speed when the fan connector have a signal pin (usually tapped with yellow wire).

Method 1. Read from a device node in ”/sys“

ls -l /sys/class/hwmon
total 0
lrwxrwxrwx 1 root root 0 Nov 10 01:39 hwmon0 -> ../../devices/virtual/thermal/thermal_zone0/hwmon0
lrwxrwxrwx 1 root root 0 Nov 10 01:39 hwmon1 -> ../../devices/virtual/thermal/thermal_zone1/hwmon1
lrwxrwxrwx 1 root root 0 Nov 10 01:57 hwmon2 -> ../../devices/platform/pwm-fan/hwmon/hwmon2
$ cat /sys/class/hwmon/hwmon2/fan1_input
2221

Method 2. Using a command tool 'lm-sensors'.

$ sudo apt install lm-sensors
$ sensors
pwmfan-isa-0000
Adapter: ISA adapter
Default Fan: 2221 RPM
...


Check overlays in /boot/config.ini

$ cat /boot/config.ini
[generic]
#default_console=ttyFIQ0
overlay_resize=16384
overlay_profile=
overlays="board_multiio"
 
[overlay_custom]
overlays="i2c0 i2c1"
 
[overlay_hktft32]
overlays="hktft32 ads7846"

Set rtc device

RTC device on this board will be presened as /dev/rtc1, not /dev/rtc0, since ODROID-M1S already have on-board RTC device.
In order to manage this RTC, one needs to add files and activate the RTC after rebooting.

Create a file /etc/udev/rules.d/50-rtc.rules with below lines.

$ echo "KERNEL==\"rtc1\", TAG+=\"systemd\"" | sudo tee /etc/udev/rules.d/50-rtc.rules

Create a file /lib/systemd/system/hwrtc.service with below lines.

[Unit]
Description=Synchronise System clock to hardware RTC
DefaultDependencies=no
Wants=dev-rtc1.device
After=dev-rtc1.device
Before=systemd-journald.service time-sync.target sysinit.target shutdown.target
Conflicts=shutdown.target
 
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/hwclock --hctosys --rtc=/dev/rtc1 -v --utc --noadjfile
RestrictRealtime=yes
 
[Install]
WantedBy=sysinit.target

Activating RTC service

$ sudo systemctl enable hwrtc
$ sudo reboot

Checking RTC service

$ sudo service hwrtc status                                                               
_ hwrtc.service - Synchronise System clock to hardware RTC
     Loaded: loaded (/lib/systemd/system/hwrtc.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2023-11-10 01:39:26 UTC; 2min 4s ago
    Process: 316 ExecStart=/sbin/hwclock --hctosys --rtc=/dev/rtc1 -v --utc --noadjfile (code=exited, st>
   Main PID: 316 (code=exited, status=0/SUCCESS)
 
Nov 10 01:39:26 server hwclock[316]: Using the rtc interface to the clock.
Nov 10 01:39:26 server hwclock[316]: Assuming hardware clock is kept in UTC time.
Nov 10 01:39:26 server hwclock[316]: Waiting for clock tick...
Nov 10 01:39:26 server hwclock[316]: ...got clock tick
Nov 10 01:39:26 server hwclock[316]: Time read from Hardware Clock: 2023/11/10 01:39:26
Nov 10 01:39:26 server hwclock[316]: Hw clock time : 2023/11/10 01:39:26 = 1699580366 seconds since 1969
Nov 10 01:39:26 server hwclock[316]: Time since last adjustment is 1699580366 seconds
Nov 10 01:39:26 server hwclock[316]: Calculated Hardware Clock drift is 0.000000 seconds
Nov 10 01:39:26 server hwclock[316]: Calling settimeofday(NULL, 0) to lock the warp_clock function.
Nov 10 01:39:26 server hwclock[316]: Calling settimeofday(1699580366.000000, NULL) to set the System tim>
lines 1-16/16 (END)...skipping...                                              

RTC commands

Display the RTC time

$ sudo hwclock -r

Set the system time from the RTC

$ sudo hwclock -s

Set the RTC from the system time

$ sudo hwclock -w

Check overlays in /boot/config.ini

$ cat /boot/config.ini
[generic]
#default_console=ttyFIQ0
overlay_resize=16384
overlay_profile=
overlays="board_multiio"
 
[overlay_custom]
overlays="i2c0 i2c1"
 
[overlay_hktft32]
overlays="hktft32 ads7846"


Input device test with 'evtest'

KEYPAD is input device. Run evtest

$ ls -l /dev/input/by-path/platform-key_pad-event
lrwxrwxrwx 1 root root 9 Nov 10 01:09 /dev/input/by-path/platform-key_pad-event -> ../event2
$ sudo apt install evtest
$ sudo evtest --grab /dev/input/event2
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "key_pad"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 28 (KEY_ENTER)
    Event code 103 (KEY_UP)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 108 (KEY_DOWN)
Key repeat handling:
  Repeat type 20 (EV_REP)
    Repeat code 0 (REP_DELAY)
      Value    250
    Repeat code 1 (REP_PERIOD)
      Value     33
Properties:
Testing ... (interrupt to exit)

Check overlays in /boot/config.ini

$ cat /boot/config.ini
[generic]
#default_console=ttyFIQ0
overlay_resize=16384
overlay_profile=
overlays="board_multiio"
 
[overlay_custom]
overlays="i2c0 i2c1"
 
[overlay_hktft32]
overlays="hktft32 ads7846"

Grant tty access to user

$ sudo usermod -aG dialout $USER
$ sudo reboot

Configure tty access to user

$ stty -F /dev/ttyS0 9600 -cstopb -parenb

Read and Write characters

# read
$ cat /dev/ttyS0
 
# write
$ echo "123" > /dev/ttyS0
OLED display itself is not included in the package of this board. Therefore, you need to purchase a 1.2” OLED with SSD1306 controller and correct pin order.


Check overlays in /boot/config.ini
Add “board_multiio_oled” in /boot/config.ini and reboot board.

$ cat /boot/config.ini
[generic]
#default_console=ttyFIQ0
overlay_resize=16384
overlay_profile=
overlays="board_multiio board_multiio_oled"
 
[overlay_custom]
overlays="i2c0 i2c1"
 
[overlay_hktft32]
overlays="hktft32 ads7846"
$ sudo reboot

See here for Weather-board Zero


Check overlays in /boot/config.ini

$ cat /boot/config.ini
[generic]
#default_console=ttyFIQ0
overlay_resize=16384
overlay_profile=
overlays="board_multiio weather_board_zero"
 
[overlay_custom]
overlays="i2c0 i2c1"
 
[overlay_hktft32]
overlays="hktft32 ads7846"


Install package "lm-sensors"

$ sudo apt update
$ sudo apt install lm-sensors


Run command: sensors

$ sensors
shtc1-i2c-0-70
Adapter: rk3x-i2c
temp1:        +28.7_C  
humidity1:     38.6 %RH
 
...


Check overlays in /boot/config.ini

$ cat /boot/config.ini
[generic]
#default_console=ttyFIQ0
overlay_resize=16384
overlay_profile=
overlays="board_multiio board_multiio_canfd"
 
[overlay_custom]
overlays="i2c0 i2c1"
 
[overlay_hktft32]
overlays="hktft32 ads7846"


Configure CAN network

how to configure CAN network is here.

  • accessory/add-on_boards/multiioboard.txt
  • Last modified: 2023/11/30 16:50
  • by steve.jeong