Wiren Board 6.7-6.9.1: Low-level hardware handling

Материал из Wiren Board

Introduction

This article is intended primarily for developers of third-party software for Wiren Board controllers.

The easiest and most convenient way to work with the controller hardware is via MQTT, by contacting wb services: wb-mqtt-gpio, wb-mqtt-adc, wb-mqtt-gpio, etc. wb- services allow you to work with hardware through a unified interface MQTT and hide hardware differences between hardware revisions controllers.

Work bypassing the standard wb- services is usually used when the software is running on different Linux controllers from different vendors, and work through the corresponding kernel interfaces is already implemented in the software. This article contains a description of the peripherals needed to work with them through the standard kernel interfaces. When working with kernel interfaces, don't forget to disable the corresponding wb- service.

Most of the peripherals described in this article are also described in the /wirenboard node in the controller's Device Tree. Services wb-mqtt-gpio, wb-mqtt-adc, etc. take the description of the peripherals from there, reading the description every time the controller starts. This method is also preferred for third party software to maintain compatibility with past and future hardware revisions hardware.

Working with GPIOs in Linux

GPIO (General-purpose input / output - general-purpose input / output) is an electrical circuit contact that can take one of two logical states - one or zero. The user can set and read the GPIO state.

In different devices, a high logic level can be represented by different voltages - keep an eye on this. In Wiren Board controllers, the logical unit is 3.3 V.

WARNING: do not directly connect signals with a voltage greater than 3.3V to the controller's GPIO! If you need to connect a device that produces a signal with a higher voltage, use matching circuits. In some cases, if the signal voltage is not more than 5 V, then it is possible to match the signals through a 20 kΩ resistor.

For working with GPIO on Linux, see kernel documentation. You can also read the obsolete instruction in our Wiki - Working with GPIO.

For other controller versions see GPIO tables of different controller versions.

Посмотреть таблицу GPIO можно командой cat /sys/kernel/debug/gpio, или в разделе ниже.

GPIO terminals