🛠 Configuring Digital I/O (DIO) on the BIWCL-PAT
Objectifs
This tutorial aims to master the Digital Input/Output (DIO) interface of the BIWCL-PAT single-board computer. Unlike classic microcontroller GPIOs, this industrial board exposes a dedicated 8-bit DIO header, ideal for switching logic signals in automation environments. We will configure these pins to light an LED (output) and read a switch state (input) under Linux, a key skill for integrating simple peripherals without using USB or serial.
Matériel nécessaire
- BIWCL-PAT board (BIOS locked for integrated peripheral access).
- DC 12V Power Supply (within 9-24V range).
- One momentary push button (NO).
- One LED with current-limiting resistor (or industrial LED module).
- Male-female Dupont cables.
- Monitor connected via HDMI or DisplayPort for Linux terminal.
- OS: Ubuntu 24.04 LTS (pre-installed or via USB).
Étapes
- Header Identification: Locate the 8-bit DIO connector on the board. It is usually a male pin header (2x4 or 1x8) near the serial ports. Consult specific technical documentation to identify GND, 3.3V/5V (if available), and the 8 IO lines. Note that logic levels may require level shifters if driving external 24V loads.
- Output Wiring (LED): Connect the LED cathode to a GND pin on the DIO header. Connect the LED anode (via resistor) to the DIO_OUT_1 pin. Ensure correct polarity.
- Input Wiring (Button): Connect one pin of the push button to a GND pin. Connect the other pin to the DIO_IN_1 pin. Use an internal pull-up resistor if supported by the Linux driver, or an external pull-up to 3.3V/5V to avoid floating states.
- sysfs Access (Linux): Open a terminal. DIO interfaces are often exposed via
/sys/class/gpio. Identify corresponding GPIO numbers viadmesg | grep gpioor the manufacturer's mapping table. Export pins if necessary:
echo <num_gpio_output> > /sys/class/gpio/export
echo <num_gpio_input> > /sys/class/gpio/export
- Direction Configuration: Set the output pin to write mode and input to read mode:
echo out > /sys/class/gpio/gpio<num_gpio_output>/direction
echo in > /sys/class/gpio/gpio<num_gpio_input>/direction
- Output Test: Turn on the LED by writing 1 to the value file:
echo 1 > /sys/class/gpio/gpio<num_gpio_output>/value
The LED should light up. Write 0 to turn it off.
- Input Reading: Press the button and read the state:
cat /sys/class/gpio/gpio<num_gpio_input>/value
The state should toggle between 0 and 1 depending on pull-up/down configuration.
Vérification
The LED must turn on and off on command. The value read on the input pin must toggle when pressing the button. If it fails, check physical connections, board power, and ensure the appropriate kernel module (e.g., gpio-bios or specific Intel driver) is loaded (lsmod | grep gpio).
Pour aller plus loin
For critical applications, avoid cat polling and use interrupts via epoll or libraries like libgpiod. For analog signals or complex protocols, explore the integrated RS232/422/485 serial ports or I2C/SPI interfaces if exposed via specific headers or M.2 adapters.