Agenda
- Install an OS on a coupler
- Default coupler configuration
- Test connection between a Coupler and a MOD-IO device
Requirements
- a host laptop machine for flashing image to SD card
- a coupler and attached to it a MOD-IO device
- a Micro-SD card with minimal capacity of 16Gb
- an USB OTG cable for serial connection to coupler
Goal
At end of this how to you will have a coupler device with an operating system (OS) which you can use in your automation project. This OS will contain the bare minimum of tools needed.
Install an OS on a coupler
Please follow this procedure on you laptop machine in order to flash image to SD card. First we need to download the Debian 12 which is the currently supported image from the coupler board producer.
Step 1: Download Debian 12
# if you use rPLC coupler with STMP157-OLinuXino-LIME2 board
ivan@t470:~$ wget https://images.olimex.com/release/stm32-lime/STM32MP1-OLinuXino-LIME-bookworm-base-20260323-113959.img.7z
# if you use rPLC coupler with A20-OLinuXino-LIME2 board
ivan@t470:~$ wget https://images.olimex.com/release/a20/A20-OLinuXino-bookworm-base-20260323-113959.img.7z
Step 2: Extract archive
ivan@t470:~$ 7z e <downloaded_file>.img.7z
Step 3: Flash image to your micro SD card
Using balenaEtcher (or any other tool) flash extracted .img file to your SD card Put the SD card into Lime2 board and NOT into STMP15X-SHIELD! Power up Lime2 wait till you see a green light at the board (maybe you do not see green light at all). Connect to serial connection over USB OTG cable from your laptop
(if you use dd to flash an image to sd card)
root@t470:~$ dd if=<downloaded_file>.img of=/dev/YOUR_DEVICE bs=64k oflag=dsync status=progress
Note: the initial first boot of your board might take 2-3 minutes. This happens only once!
Make sure that coupler is properly connected to your local LAN (either over RJ45 cable or Wifi). Take a note of assigned IPv4 address of the coupler as you will later connect over ssh to it You are done. Host machine should no longer be needed.
Default coupler configuration
Please follow this procedure
Step 4: Login into coupler and update base software
ssh olimex@<ipv4_address>
(password: is olimex. Please immediately change default username and password)
Update software of coupler
olimex@stm32mp1-olinuxino:~# sudo bash
root@stm32mp1-olinuxino:~# apt update
root@stm32mp1-olinuxino:~# apt upgrade
Step 5: Enable overlays and restart
Select following overlays: stm32mp1-hdmi.dtbo and stm32mp1-shield.dtbo from command below
root@stm32mp1-olinuxino:~# olinuxino-overlay
root@stm32mp1-olinuxino:~# reboot now
Step 6: Test connection between a Coupler and a MOD-IO device
These steps assure that the coupler can switch on / off relays of attached MOD-IO. Please follow the following steps:
# switch ON all relays, you should hear a ticking noise and relays led should change color to GREEN
root@stm32mp1-olinuxino:~# i2cset -y -f 1 0x58 0x10 0x0F
# switch OFF all relays, you should hear a ticking noise and relays led should become OFF
root@stm32mp1-olinuxino:~# i2cset -y -f 1 0x58 0x10 0x00
Step 7: Add swap file (optional)
Note: this steps is needed only in case you want to compile and thinker the rPLC coupler application.
root@stm32mp1-olinuxino:~# dd if=/dev/zero of=/swapfile bs=1024 count=2097152
root@stm32mp1-olinuxino:~# chown root:root /swapfile
root@stm32mp1-olinuxino:~# chmod 0600 /swapfile
root@stm32mp1-olinuxino:~# mkswap /swapfile
root@stm32mp1-olinuxino:~# swapon /swapfile
Step 8: Boot from eMMC (if available, optional)
Note: in case your board has eMMC memory (Flash-e16Gs16M chip) then you can move micro sd card to EMMC memory entirely using following command.
1. add to /boot/boot.cmd (in start of file)
setenv mmc_bootdev 1
2. sd -> flash
root@mwc-1:/boot# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
3. Copy filesystem to flash memory
root@stm32mp1-olinuxino:~# olinuxino-sd-to-emmc
Finally reboot and check root filesystem is on flash device
Step 9: enable HDMI(if available, optional)
Note: you can enable HDMI our if your board do have such a port.
root@stm32mp1-olinuxino:~# olinuxino-display
Success
With this the minimal coupler OS configuration is over.