Picc1101
Connect Raspberry-Pi to CC1101 RF module and play with AX.25/KISS to transmit TCP/IP over the air
Install / Use
/learn @f4exb/Picc1101README
picc1101
Connect Raspberry-Pi to CC1101 RF module and play with AX.25/KISS to transmit TCP/IP over the air.
- picc1101
- Introduction
- Disclaimer
- Installation and basic usage
- AX.25/KISS operation
- Details of the design
Introduction
The aim of this program is to connect a RF module based on the Texas Instruments (Chipcon) chip CC1101 to a Raspberry-Pi host machine. The CC1101 chip is a OOK/2-FSK/4-FSK/MSK/GFSK low power (~10dBm) digital transceiver working in the 315, 433 and 868 MHz ISM bands. The 433 MHz band also happens to cover the 70cm Amateur Radio band and the major drive of this work is to use these modules as a modern better alternative to the legacy Terminal Node Controllers or TNCs working in 1200 baud FM AFSK or 9600 baud G3RUH true 2-FSK modulation at best. Using the Linux native AX.25 and KISS interface to the TNCs it is then possible to route TCP/IP traffic using these modules offering the possibility to connect to the Amateur Radio private IP network known as Hamnet.
Another opportunity is the direct transmission of a Transport Stream to carry low rate live video and this will be studied later.
These RF modules are available from a variety of sellers on eBay. Search for words CC1101 and 433 MHz. The Raspberry-Pi doesn't need to be introduced any further. If you are reading these lines you probably know what it is!
The CC1101 chip implements preamble, sync word, CRC, data whitening and FEC using convolutive coding natively. It is a very nice little cheap chip for our purpose. It has all the necessary features to cover the OSI layer 1 (physical). Its advertised speed ranges from 600 to 500000 Baud (300000 in 4-FSK) but it can go as low as 50 baud however details on performance at this speed have not been investigated. Yet the program offers this possibility.
The CC1101 chip is interfaced using a SPI bus that is implemented natively on the Raspberry-PI and can be accessed through the spidev library. In addition two GPIOs must be used to support the handling of the CC1101 Rx and Tx FIFOs. For convenience GPIO-24 and GPIO-25 close to the SPI bus on the Raspberry-Pi are chosen to be connected to the GDO0 and GDO2 lines of the CC1101 respectively. The WiringPi library is used to support the GPIO interrupt handling.
The CC1101 data sheet is available here.
Disclaimer
You are supposed to use the CC1101 modules and this software sensibly. Please check your local radio spectrum regulations.
For Amateur Radio use you should have a valid Amateur Radio licence with a callsign and transmit in the bands and conditions granted by your local regulations also please try to respect the IARU band plan. In most if not all countries you are not allowed to transmit encrypted data so please do not route SSL traffic like https or ssh. Use plain http or telnet instead.
Installation and basic usage
Prerequisites
This has been tested successfully on a Raspberry Pi version 1 B with kernel 3.12.36. Raspberry Pi version 2 with a 3.18 kernel does not work.
For best performance you will need the DMA based SPI driver for BCM2708 found here After successful compilation you will obtain a kernel module that is to be stored as /lib/modules/$(uname -r)/kernel/drivers/spi/spi-bcm2708.ko
You will have to download and install the WiringPi library found here
The process relies heavily on interrupts that must be served in a timely manner. You are advised to reduce the interrupts activity by removing USB connected devices as much as possible.
Obtain the code
Just clone this repository in a local folder of your choice on the Raspberry Pi
Compilation
You can compile on the Raspberry Pi v.1 as it doesn't take too much time even on the single core BCM2735. You are advised to activate the -O3 optimization:
CFLAGS=-O3 make
The result is the picc1101 executable in the same directory
Run test programs
On the sending side:
sudo ./picc1101 -v1 -B 9600 -P 252 -R7 -M4 -W -l15 -t2 -n5
On the receiving side:
sudo ./picc1101 -v1 -B 9600 -P 252 -R7 -M4 -W -l15 -t4 -n5
This will send 5 blocks of 252 bytes at 9600 Baud using GFSK modulation and receive them at the other end. The block will contain the default test phrase Hello, World!.
Note that you have to be super user to execute the program.
Process priority
You may experience better behaviour (less timeouts) depending on the speed of the link when raising the prioriry of the process. Interrupts are already served with high priority (-56) with the WiringPi library. The main process may need a little boost as well though
Specify a higher priority at startup
You can use the nice utility: sudo nice -n -20 ./picc1101 options...
This will set the priority to 0 and is the minimum you can obtain with the nice commmand. The lower the priority figure the higher the actual priority.
Engage the "real time" priority
You can use option -T of the program to get an even lower priority of -2 for a so called "real time" scheduling. This is not real time actually but will push the priority figure into the negative numbers. It has been implemented with the WiringPi piHiPri method and -2 is the practical lowest figure possible before entering into bad behaviour that might make a cold reboot necessary. Note that this is the same priority as the watchdog.
Program options
<pre><code> -B, --tnc-serial-speed=SERIAL_SPEED TNC Serial speed in Bauds (default : 9600) -d, --spi-device=SPI_DEVICE SPI device, (default : /dev/spidev0.0) -D, --tnc-serial-device=SERIAL_DEVICE TNC Serial device, (default : /var/ax25/axp2) -f, --frequency=FREQUENCY_HZ Frequency in Hz (default: 433600000) -F, --fec Activate FEC (default off) -H, --long-help Print a long help and exit -l, --packet-delay=DELAY_UNITS Delay between successive radio blocks when transmitting a larger block. In 2-FSK byte duration units. (default 30) -m, --modulation-index=MODULATION_INDEX Modulation index (default 0.5) -M, --modulation=MODULATION_SCHEME Radio modulation scheme, See long help (-H) option -n, --repetition=REPETITION Repetiton factor wherever appropriate, see long Help (-H) option (default : 1 single) -P, --packet-length=PACKET_LENGTH Packet length (fixed) or maximum packet length (variable) (default: 250) -R, --rate=DATA_RATE_INDEX Data rate index, See long help (-H) option -s, --radio-status Print radio status and exit -t, --test-mode=TEST_SCHEME Test scheme, See long help (-H) option fpr details (default : 0 no test) --tnc-keydown-delay=KEYDOWN_DELAY_US FUTUR USE: TNC keydown delay in microseconds (default: 0 inactive) --tnc-keyup-delay=KEYUP_DELAY_US TNC keyup delay in microseconds (default: 4ms). In KISS mode it can be changed live via kissparms. --tnc-radio-window=RX_WINDOW_US TNC time window in microseconds for concatenating radio frames. 0: no concatenation (default: 0)) --tnc-serial-window=TX_WINDOW_US TNC time window in microseconds for concatenating serial frames. 0: no concatenation (default: 40ms)) --tnc-switchover-delay=SWITCHOVER_DELAY_US FUTUR USE: TNC switchover delay in microseconds (default: 0 inactive) -T, --real-time Engage so called "real time" scheduling (defalut 0: no) -v, --verbose=VERBOSITY_LEVEL Verbosiity level: 0 quiet else verbose level (default : quiet) -V, --variable-length Variable packet length. Given packet length becomes maximum length (default offRelated Skills
node-connect
346.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
