The RevPi Flat has a 868 MHz transceiver (ISM band) based on the IC “Texas Instruments CC1101”.
The ISM interface is primarily intended for Wireless M-Bus applications according to the EN 13757-4:2005 standard. Here you can either connect a rod antenna directly or an external antenna via an appropriate antenna cable. The radio interface is fed out of the housing similarly to the WLAN/Bluetooth interface via an SMA socket (here, however, “standard polarity”).
The CC1101 is connected to the Compute Module via the SPI bus 0 nCS2 (GPIO6).
Please note that we only provide the hardware interface here. To implement the Wireless M-Bus you must develop your own software.
Currently there is no complete M-Bus library for the CC1101. However, there is a transceiver demo that works on the ISM frequency band for the RevPi Flat. You can enhance this example with an M-Bus application layer implementation to create a full M-Bus library for the RevPi Flat.
- 1 RevPi Flat as transmitter
- 1 RevPi Flat as receiver
Use the following steps to get the CC1101 transceiver demo working on the RevPi Flat.
- Clone the CC1101 driver library from the following GitHub repository:
- Install the pigpio library:
sudo apt-get install pigpio
The driver library for Ti CC1101 on the RevPi Flat uses the pigpio library instead of the WiringPi used in the official version, as the latter is now deprecated.
Make the following changes to the “cc1100_raspi.h” file obtained from the previous step to adapt the pin assignments to the RevPi Flat:
#define SS_PIN 6
#define GDO2 21
The GPIO pin 6 of the Compute Module of the RevPi Flat is connected to the CE of the CC1101.
The GPIO pin 21 of the Compute Module of the RevPi Flat is connected to GDO2 (digital output pin) of the CC1101.
- Download the SPI library of WiringPi from the following source:
- Create a new SPI library for the RevPi Flat based on the SPI library from WiringPi. Rename the files “wiringPiSPI.c” and “wiringPiSPI.h” to “FlatSPI.c” and “FlatSPI.h”.
- Change the function “WiringPiSPISetupMode” to “FlatSPI.c” to open the device “/dev/spidev0.2” as the module CC1101 on CE 2 is available on the RevPi Flat.
- Modify the API in the demo files (cc1100_rasp.cpp, RX_Demo.cpp and TX_Demo.cpp) to use pigpio”s API instead of the WiringPi API.
All functions should be imported from “FlatSPI.h” and “pigpio.h” to make the demo independent from WiringPi.
- Replace the WiringPi API references accordingly.
- Change the SPI access functions to “cc1100_raspi.cpp”. The channel parameter should be 2.
- Change the function “wiringPiSPISetup (0, 8000000)” to “FlatSPISetup (2, 8000000)) < 0)” and ”wiringPiSPIDataRW (0, tbuf, len)” to “FlatSPIDataRW (2, tbuf, len)” accordingly.
- Load a spidev module on the RevPi Flat with “sudo modprobe spidev”. It is required for SPI access in the user area.
- Compile the demo files on the RevPi Flat and run the demos:
gcc -c -o FlatSPI.o FlatSPI.c
g++ -lpigpio -lpthread TX_Demo.cpp cc1100_raspi.cpp FlatSPI.c -o TX_Demo FlatSPI.o
sudo ./TX_Demo -v -a1 -r3 -i1000 -t5 -c1 -f868 -m100
g++ -lpigpio -lpthread RX_Demo.cpp cc1100_raspi.cpp FlatSPI.c -o RX_Demo FlatSPI.o
sudo ./RX_Demo -v -a3 -c1 -f868 -m100
- Download the full source code for the CC1101 transceiver demo for the RevPi Flat here: