GitHub repository: https://github.com/loboris/ESP32_CC1101CC1101 is a low-cost sub-1 GHz transceiver designed for very low-power wireless applications. The circuit is mainly intended for the ISM (Industrial, Scientific and Medical) and SRD (Short Range Device) frequency bands at 315, 433, 868, and 915 MHz, but can easily be programmed for operation at other frequencies in the 300-348 MHz, 387-464 MHz and 779-928 MHz bands.
The RF transceiver is integrated with a highly configurable baseband modem. The modem supports various modulation formats and has a configurable data rate up to 600 kbps.
CC1101 provides extensive hardware support for packet handling, data buffering, burst transmissions, clear channel assessment, link quality indication, and wake-on-radio.
The main operating parameters and the 64- byte transmit/receive FIFOs of CC1101 can be controlled via an SPI interface. In a typical system, the CC1101 will be used together with a microcontroller and a few additional passive components.
The CC1190 850-950 MHz range extender [21] can be used with CC1101 in long range applications for improved sensitivity and higher output power.
How to build
Configure your esp32 build environment as for other esp-idf examples
Clone the repository
Code: Select all
git clone https://github.com/loboris/ESP32_CC1101_Library.git
Navigate to CC1101 Example configuration and set CC1101 and example parameters:
Code: Select all
make menuconfig
Code: Select all
make all && make flash
You will need two ESP32 boards and a pair of CC1101 modules, any one will work:
https://www.google.com/search?q=CC1101& ... zmUvvLkcAC
Tested with cheap one from eBay
Connect the CC1101 to the ESP32 SPI interface. SPI pin configuration can be changed, see componnents/cc1100/libcc1100.h for detailes.
Example application creates two tasks, one for transmitting and one for receiving.
The transmitting task sends the current time stamp and current temperature measured by CC1101.
The receiving task prints received data when it is available.
Example output:
Code: Select all
I (0) cpu_start: App cpu up.
I (1732) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (1802) heap_alloc_caps: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM
I (1864) heap_alloc_caps: At 3FFB2558 len 0002DAA8 (182 KiB): DRAM
I (1927) heap_alloc_caps: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (1991) heap_alloc_caps: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (2056) heap_alloc_caps: At 40088374 len 00017C8C (95 KiB): IRAM
I (2119) cpu_start: Pro cpu start user code
I (2273) cpu_start: Starting scheduler on PRO CPU.
I (578) cpu_start: Starting scheduler on APP CPU.
I (3634) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:0
Library: Ver 0.2
Mode: 2 GFSK 38.4 KBd
Frequency: 3 868 MHz
Channel: 1
Power: -10 dB
My_Addr: 3
CC1101 Temperature: 33.4
I (4702) [CC1101 RXtask]: === CC1101 RX TASK STARTED on core 1 ===
I (5702) [CC1101 TXtask]: === CC1101 TX TASK STARTED on core 1 ===
W (5702) [CC1101 TXtask]: ---------------------------TX---------------------------
I (5795) [CC1101 TXtask]: [1/1] OK; Tx_Time: 30 ms [RSSI: -97 LQI: 43 CRC: OK]
W (5795) [CC1101 TXtask]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^TX^^^^^^^^^^^^^^^^^^^^^^^^^^^
W (10884) [CC1101 RXtask]: ---------------------------RX---------------------------
I (10893) [CC1101 RXtask]: [1/1] Rx_Time: 9 ms TX_Timecode: 2056759 ms Temperature: 20.4 RSSI: -99 LQI: 47 CRC: OK
W (10893) [CC1101 RXtask]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^RX^^^^^^^^^^^^^^^^^^^^^^^^^^^
W (15702) [CC1101 TXtask]: ---------------------------TX---------------------------
I (15791) [CC1101 TXtask]: [2/2] OK; Tx_Time: 30 ms [RSSI: -97 LQI: 44 CRC: OK]
W (15791) [CC1101 TXtask]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^TX^^^^^^^^^^^^^^^^^^^^^^^^^^^
W (20980) [CC1101 RXtask]: ---------------------------RX---------------------------
I (20988) [CC1101 RXtask]: [2/3] Rx_Time: 8 ms TX_Timecode: 2066855 ms Temperature: 20.4 RSSI: -98 LQI: 42 CRC: OK
W (20989) [CC1101 RXtask]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^RX^^^^^^^^^^^^^^^^^^^^^^^^^^^
W (25797) [CC1101 TXtask]: ---------------------------TX---------------------------
I (25886) [CC1101 TXtask]: [3/3] OK; Tx_Time: 30 ms [RSSI: -97 LQI: 44 CRC: OK]
W (25886) [CC1101 TXtask]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^TX^^^^^^^^^^^^^^^^^^^^^^^^^^^
Code: Select all
I (0) cpu_start: App cpu up.
I (1732) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (1803) heap_alloc_caps: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM
I (1864) heap_alloc_caps: At 3FFB2558 len 0002DAA8 (182 KiB): DRAM
I (1928) heap_alloc_caps: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (1992) heap_alloc_caps: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (2057) heap_alloc_caps: At 40088374 len 00017C8C (95 KiB): IRAM
I (2119) cpu_start: Pro cpu start user code
I (2273) cpu_start: Starting scheduler on PRO CPU.
I (578) cpu_start: Starting scheduler on APP CPU.
I (3634) [CC1101]: NVS Initialized
I (3634) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:0
W (3638) [CC1101]: New default parameters saved to NVS.
I (3643) [CC1101]: ADC channel: 0 [GPIO: 36]
I (3648) [CC1101]: SPI: speed=5000000 native pins: true
I (3653) [CC1101]: SPI initialized
I (3659) [CC1101]: CC1100 Reset
I (3662) [CC1101]: Partnumber: 00 Version: 14
I (3668) [CC1101]: Initialization done.
Library: Ver 0.2
Mode: 2 GFSK 38.4 KBd
Frequency: 3 868 MHz
Channel: 1
Power: -10 dB
My_Addr: 3
Cfg_reg:
06 2e 80 07 57 43 3e 0e 45 03
01 06 00 21 65 6a ca 83 13 a0
f8 34 07 0c 19 16 6c 43 40 91
02 26 09 56 03 a9 0a 00 11 61
00 59 7f 3f 81 3f 0b
PaTable:
03 17 1d 26 50 86 cd c0
I (3699) [CC1101]: Started.
ADC: 3104 Voltage: 824.7 mV
Temperature: 32.8
ADC: 3104 Voltage: 824.7 mV
Temperature: 32.8
I (5820) [CC1101 RXtask]: === CC1101 RX TASK STARTED on core 1 ===
W (6143) [CC1101 RXtask]: ---------------------------RX---------------------------
RX_FIFO: 0a 03 03 00 22 54 8c 8b 63 a6 41 d5 ac
I (6145) [CC1101]: RSSI: -99 LQI: 2c CRC: OK
TX_FIFO: 05 03 03 41 63 6b
I (6159) [CC1101]: ACK sent.
I (6159) [CC1101 RXtask]: [1/1] Rx_Time: 16 ms TX_Timecode: 2249868 ms Temperature: 20.8 RSSI: -99 LQI: 44 CRC: OK
W (6167) [CC1101 RXtask]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^RX^^^^^^^^^^^^^^^^^^^^^^^^^^^
W (6175) [CC1101 RXtask]: NEXT TX time adjusted
I (6820) [CC1101 TXtask]: === CC1101 TX TASK STARTED on core 1 ===
W (11220) [CC1101 TXtask]: ---------------------------TX---------------------------
ADC: 3107 Voltage: 825.5 mV
Temperature: 33.2
TX_FIFO: 0a 03 03 00 00 29 cd 68 ac 04 42
RX_FIFO: 05 03 03 41 63 6b d6 ad
I (11310) [CC1101]: [ACK!] RSSI: -99 LQI: 2d CRC: OK
I (11310) [CC1101]: SEND OK after 0 retries.
I (11311) [CC1101 TXtask]: [1/1] OK; Tx_Time: 32 ms [RSSI: -99 LQI: 45 CRC: OK]
W (11320) [CC1101 TXtask]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^TX^^^^^^^^^^^^^^^^^^^^^^^^^^^
W (16146) [CC1101 RXtask]: ---------------------------RX---------------------------
RX_FIFO: 0a 03 03 00 22 7b a0 8b 63 a6 41 d9 ad
I (16149) [CC1101]: RSSI: -97 LQI: 2d CRC: OK
TX_FIFO: 05 03 03 41 63 6b
I (16163) [CC1101]: ACK sent.
I (16163) [CC1101 RXtask]: [2/3] Rx_Time: 17 ms TX_Timecode: 2259872 ms Temperature: 20.8 RSSI: -97 LQI: 45 CRC: OK
W (16171) [CC1101 RXtask]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^RX^^^^^^^^^^^^^^^^^^^^^^^^^^^
W (21228) [CC1101 TXtask]: ---------------------------TX---------------------------
ADC: 3100 Voltage: 823.6 mV
Temperature: 32.4
TX_FIFO: 0a 03 03 00 00 50 e5 65 a9 01 42
RX_FIFO: 05 03 03 41 63 6b d7 ab
I (21318) [CC1101]: [ACK!] RSSI: -98 LQI: 2b CRC: OK
I (21318) [CC1101]: SEND OK after 0 retries.
I (21319) [CC1101 TXtask]: [2/2] OK; Tx_Time: 32 ms [RSSI: -98 LQI: 43 CRC: OK]
W (21328) [CC1101 TXtask]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^TX^^^^^^^^^^^^^^^^^^^^^^^^^^^