This is a serial port driver for Silicon Labs Si4455 Sub-GHz transciver.
The goal of this driver is to removing wires between central(linux) device and remote serial devices/sensors, but keeping the original user software. It represents regular serial interface for the user space.
[0] - Datasheet: https://www.silabs.com/documents/public/data-sheets/Si4455.pdf
Additional readings:
- [1] - AN 692 Si4355/Si4455 PROGRAMMING GUIDE
- [2] - AN796 WIRELESS DEVELOPMENT SUITE GENERAL DESCRIPTION
- [3] - EZRadio REVB1A API
- [4] - EZRadio REVC2A API
- [5] - Using PART_INFO command to identify EZRadio/PRO part number
Table of contents
sudo apt install git bc bison flex libssl-dev libncurses5-dev
git clone https://github.com/dministro/linux-serial-si4455
cd linux-serial-si4455/src/linux/drivers/tty/serial
make -C/path/to/kernel/source
M=$(pwd) modules
You can see the required parameters in silabs,si4455.yaml
To generate radio configuration, the Silicon Labs Wireless Development Suite is required.
Before you start, see ref: [2]
- Start WDS
- Select Simulate radio option on startup screen
- Select Si4455 and revision you have in Select Radio dialog
It is important to select the proper revision, because the generated configuration is different between revision B1 and C2.
- Select Radio Configuration Application in Application Manager
- Select Bidirectional packet project in Radio Configuration Application dialog.
- Make your project specific configuration.
You can find some configuration file under wds_examples directory - Click Generate source than choose Save custom radio configuration header file
cd fw
make FW_NAME=test.bin \
RADIO_CONFIG=../wds_examples/radio_config_si4455_revb1_ook_bidirectional_packet_15.h \
firmware
The resulting configuration file path: build/test.bin
Parameters:
- RADIO_CONFIG: path to radio configuration header generated by WDS
- FW_NAME: the resulting file name
- FW_PREFIX: firmware installation path in case of firmware-install rule.
default: /lib/firmware
Rules:
- firmware: compiles the firmware binary file
- firmware-install: firmware rule plus installs the firmware binary under the given FW_PREFIX
The driver instances are comes up under /dev
as
/dev/ttySSi
X
, where X
is the index of instance.
The driver supports only:
- Char size: 8 bits
- Handshake: None or RTSCTS.
RTSCTS preferred
The si4455 driver uses configuration parameters and maintains statistics inside sysfs filesystem.
current_rssi
Path:
/sys/class/tty/ttySSi
X
/device/current_rssi
Description:
Shows the latest rssi value measured by chip.
To convert the value to dBm. See chapter 3.2.1. Received Signal Strength Indicator in [0]
package_size
Path:
/sys/class/tty/ttySSi
X
/device/package_size
Description:
Shows or stores the package size.
The new value applied immediately.
Variable package size (package_size = 0)
rx_channel
Path:
/sys/class/tty/ttySSi
X
/device/rx_channel
Description:
Shows or stores the receive channel index.
The new value applied immediately.
tx_channel
Path:
/sys/class/tty/ttySSi
X
/device/tx_channel
Description:
Shows or stores transmit channel index.
The new value will be used on next data transmit.
tx_timeout
Path:
/sys/class/tty/ttySSi
X
/device/tx_timeout
Description:
Shows or stores the transmit timeout.
The new value will be used on next data transmit.
The si4455 driver maintains statistics inside debugfs filesystem.
cts_error_count
Path:
/sys/kernel/debug/spi
X
.Y
/si4455/cts_error_count
Description:
The numer of cts timeouts. In case of cts timeout, the driver reinitialize the chip.
tx_error_count
Path:
/sys/kernel/debug/spi
X
.Y
/si4455/tx_error_count
Description:
The number of tx timeouts. In case of tx timeout, the driver restarts the last data transmission.
chip_rev Path:
/sys/kernel/debug/spi
X
.Y
/si4455/partinfo/chip_rev
Description:
The value of CHIPREV field in PART_INFO structure.
See PART_INFO command details in [3] or in [4]
rom_id Path:
/sys/kernel/debug/spi
X
.Y
/si4455/partinfo/rom_id
Description:
The value of ROMID field in PART_INFO structure.
See PART_INFO command details in [3] or in [4]
See ref [5]
part Path:
/sys/kernel/debug/spi
X
.Y
/si4455/partinfo/part
Description:
The value of PART field in PART_INFO structure.
See PART_INFO command details in [3] or in [4]
See ref [5]
Wiring:
Raspberry Pi | Function | Color | ZETA-433 |
---|---|---|---|
17 | 3V3 | red | 4 |
19 | SPI0 MOSI | yellow | 10 |
21 | SPI0 MISO | orange | 11 |
23 | SPI0 SCLK | green | 9 |
25 | GND | black | 2 |
26 | SPI0 CE1 | grey | 12 |
38 | GPIO 20 interrupt | brown | 5 |
40 | GPIO 21 shutdown | white | 3 |
To compile si4455 kernel module on a Raspbian target the proper version of kernel source is required.
See: https://github.com/RPi-Distro/rpi-source
sudo apt install git bc bison flex libssl-dev libncurses5-dev
For the setup above:
cd rpi_setup
make \
OL_BUS=0 \
OL_DEV=1 \
OL_SDN=21 \
OL_IRQ=20 \
OL_PACKAGE_SIZE=0 \
RADIO_CONFIG=../wds_examples/radio_config_si4455_revc2_ook_bidirectional_packet_variable.h \
all
Parameters:
- OL_BUS: spi bus index
default: 0 - OL_DEV: spi device index
default: 1 - OL_SDN: shutdown gpio index
default: 21 - OL_IRQ: interrupt gpio index
default: 20 - OL_PACKAGE_SIZE: package size configured in WDS. 0 means variable package size.
default: 15 - OL_TX_CHANNEL: transmit channel
default: 3 - OL_RX_CHANNEL: receive channel
default: 3 - OL_TX_TIMEOUT: transmit timeout(ms)
default: 100 - RADIO_CONFIG: path to radio configuration header generated by WDS
- OL_FW_NAME: generated firmware file name.
default: si4455_spi$(OL_BUS)_$(OL_DEV).ez.bin
Rules:
- driver: compiles the kernel module(si4455.ko)
- driver-install: driver rule plus copies the
si4455.ko
under/lib/modules/$(uname -r)/extra
, then invokes depmod.
Requires: root privilages - firmware: compiles the firmware binary file
- firmware-install: firmware rule plus installs the firmware binary under
/lib/firmware
.
Requires: root privilages - overlay: generates and compiles device tree bindings overlay.
Generated overlay name(underoutput/overlay/build
): si4455_spi$(OL_BUS)_$(OL_DEV).dtbo - overlay-install: overlay rule plus installs the overlay under
/boot/overlays
.
Requires: root privilages - boot-configure: enables the spi port and adds the overlay in
/boot/config.txt
.
Requires: root privilages - install: driver-install, firmware-install and overlay-install rules.
Requires: root privilages - all: install and boot-configure rules.
Requires: root privilages
BOM:
- 1 × breadboard
- 1 × Raspberry Pi 3 Model B
- 2 × FM ZETA DIP TRANSCEIVER MODULE
- some jumper wire to connectting parts
Wiring:
Raspberry Pi | Function | ZETA-433 #0 | ZETA-433 #1 |
---|---|---|---|
17 | 3V3 | 4 | 4 |
19 | SPI0 MOSI | 10 | 10 |
21 | SPI0 MISO | 11 | 11 |
23 | SPI0 SCLK | 9 | 9 |
25 | GND | 2 | 2 |
24 | SPI0 CE0 | 12 | - |
16 | GPIO 23 interrupt | 5 | - |
18 | GPIO 24 shutdown | 3 | - |
26 | SPI0 CE1 | - | 12 |
38 | GPIO 20 interrupt | - | 5 |
40 | GPIO 21 shutdown | - | 3 |
For ZETA-433 #0:
cd rpi_setup
make \
OL_BUS=0 \
OL_DEV=0 \
OL_SDN=24 \
OL_IRQ=23 \
OL_PACKAGE_SIZE=0 \
RADIO_CONFIG=../wds_examples/radio_config_si4455_revc2_ook_bidirectional_packet_variable.h \
all
For ZETA-433 #1:
cd rpi_setup
make \
OL_BUS=0 \
OL_DEV=1 \
OL_SDN=21 \
OL_IRQ=20 \
OL_PACKAGE_SIZE=0 \
RADIO_CONFIG=../wds_examples/radio_config_si4455_revc2_ook_bidirectional_packet_variable.h \
all
After compiling, restart is required to load overlays.
If probe success after boot, dmesg:
The new devices are under /dev
:
If the new devices are visible under /dev
, they are ready to use as a serial device.
Testing with minicom or tio: