Protocol decoder:cc1101
|
| |
| Name | CC1101 |
|---|---|
| Description | Low-power sub-1GHz RF transceiver chip |
| Status | supported |
| License | GPLv2+ |
| Source code | decoders/cc1101 |
| Input | spi |
| Output | — |
| Probes | — |
| Optional probes | — |
| Options | — |
The cc1101 protocol decoder supports the protocol spoken by the Texas Instruments CC1101 sub-1GHz transceiver chips.
Hardware
Modules with these chips can be purchased fairly inexpensive from various online marketplaces. Most (all?) have an 8-pin header with the following pinout:
| Pin | Function |
|---|---|
| 1 | VCC |
| 2 | GND |
| 3 | MOSI |
| 4 | CLK |
| 5 | MISO |
| 6 | GDO2 |
| 7 | GDO0 |
| 8 | CSn |
Protocol
The chip uses the standard SPI protocol and pins (CSn, SCK, MOSI, MISO), with the additional GDO0 and GDO2 pins. They are configurable and can be used to inform the SPI master about the completion of a packet reception/transmission.
SPI commands can have variable length, the CSn signal has to stay low during the whole command, and then go high after the last byte. The first byte of a command defines the type of the command, the chip always outputs its internal status register at the beginning. The following bytes are dependent on the command type, can be register values to write into the chip or payload data to send, or empty bytes that are ignored if the command only reads the output of the chip.
Decoder
The cc1101 decoder stacks on top of the SPI decoder and decodes the commands to the chip and the responses of the chip, and also issues warnings for wrong/incomplete commands.
Some decoded commands in PulseView:
sigrok-cli can be used to decode the capture in the following way:
$ sigrok-cli -i sigrok-dumps/spi/cc1101/cc1101-read-write.sr \
-P spi:clk=CLK:mosi=MOSI:miso=MISO:cs=CS,cc1101 -A cc1101
cc1101-1: Status = 10; STATE is RX, 0 bytes available in RX FIFO
cc1101-1: Status read: PKTSTATUS (38) = 30
cc1101-1: Strobe SIDLE
cc1101-1: Status = 1F; STATE is RX, 15 bytes free in TX FIFO
cc1101-1: Status = 0F; STATE is IDLE, 15 bytes free in TX FIFO
cc1101-1: Write: PKTCTRL1 (07) = 4C
cc1101-1: Status = 00; STATE is IDLE, 0 bytes free in TX FIFO
cc1101-1: Read: PKTCTRL1 (07) = 4C
cc1101-1: Status = 0F; STATE is IDLE, 15 bytes free in TX FIFO
cc1101-1: Write: MCSM2 (16) = 1C
cc1101-1: Status = 00; STATE is IDLE, 0 bytes free in TX FIFO
cc1101-1: Read: MCSM2 (16) = 1C
cc1101-1: Status = 0F; STATE is IDLE, 15 bytes free in TX FIFO
cc1101-1: Write: WOREVT1 (1E) = 2F
cc1101-1: Status = 00; STATE is IDLE, 0 bytes free in TX FIFO
cc1101-1: Read: WOREVT1 (1E) = 2F
cc1101-1: Status = 0F; STATE is IDLE, 15 bytes free in TX FIFO
cc1101-1: Write: WOREVT0 (1F) = 65
cc1101-1: Status = 00; STATE is IDLE, 0 bytes free in TX FIFO
cc1101-1: Read: WOREVT0 (1F) = 65
cc1101-1: Status = 0F; STATE is IDLE, 15 bytes free in TX FIFO
cc1101-1: Write: WORCTRL (20) = 78
cc1101-1: Status = 00; STATE is IDLE, 0 bytes free in TX FIFO
cc1101-1: Read: WORCTRL (20) = 78
cc1101-1: Strobe SWORRST
cc1101-1: Status = 0F; STATE is IDLE, 15 bytes free in TX FIFO
cc1101-1: Strobe SWOR
cc1101-1: Status = 0F; STATE is IDLE, 15 bytes free in TX FIFO
The status response is decoded.