diff --git a/README.md b/README.md index 3c4c1c2..2311326 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,94 @@ # cat-tracker -A multi-function application designed to run on a pi node. When used in a mesh network, this app will help track your cat with a CC2500 based radio collar, using complementary CC2500 based radio modules interfaced with your Pi. \ No newline at end of file +A multi-function application designed to run on a pi node. When used in a mesh network, this app will help track your cat with a CC2500 based radio collar, using complementary CC2500 based radio modules interfaced with your Pi. + +The implementation here uses CC2500 register values which intend to mimic my [Girafus M07A](https://www.girafus.com/en-en/collections/peilsender/products/ersatzteil-basismodul-fur-girafus%C2%AE-pro-track-tor-katzen-hunde-haustier-kleintier-sucher) unit. This unit is paired with my associated [tracker](https://www.girafus.com/en-en/collections/peilsender/products/extra-sender-tag-fur-den-girafus%C2%AE-pro-track-tor-haustier-hund-katze-kleintier-finder-sucher-ortung) + +## CC2500 datasheet +[cc2500.pdf](./cc2500.pdf) + +## CC2500 to Raspberry Pi GPIO Pin Mapping + +| CC2500 Pin | Function Description | Raspberry Pi GPIO Pin | GPIO Number | +|------------|------------------------------------------------------|-------------------------------|-------------| +| GND | Ground | Pin 6 | - | +| VCC | 3.3V Power (⚠️ **Do not use 5V**) | Pin 1 or Pin 17 | - | + +### SPI Connections + +| CC2500 Pin | Function | Raspberry Pi GPIO Pin | GPIO Number | +|------------|----------|-------------------------------|-------------| +| SI | MOSI | Pin 19 | GPIO 10 | +| SCK | SCLK | Pin 23 | GPIO 11 | +| CSN | CE0 (Chip Select) | Pin 24 | GPIO 8 | +| SO | MISO | Pin 21 | GPIO 9 | + +### Optional Pins + +| CC2500 Pin | Function | Raspberry Pi GPIO Pin | GPIO Number | +|------------|-------------------------------------------|-------------------------------|-------------| +| GDO0 | Interrupt/Data Ready | Pin 12 | GPIO 18 | +| GDO2 | Additional Interrupt/Data Line | Pin 22 | GPIO 25 | + +### Power Amplifier Pins (If Applicable) + +| CC2500 Pin | Function | Raspberry Pi GPIO Pin | Notes | +|------------|-------------------------------------------|-------------------------------|----------------------------------------| +| PA_EN | Control Power Amplifier (Optional) | Any GPIO Pin | Connect if amplifier control is needed | +| PA_EX | Reserved | Not Connected | Only connect if required | + +## Reverse Engineering the Registers + +### SmartRF Studio + +#### Install +[SmartRF Studio](https://www.ti.com/tool/SMARTRFTM-STUDIO#downloads) will automatically generate a configuration for the CC2500 Radio based on some RF parameters +* A free registration and login is required to download this app from Texas Instruments +* The app seems to run well via `wine` on linux. I chose to install it on an actual Windows OS, then copy the binaries. + +#### Copy Register JSON template +When this is installed, copy the code export json file to help export the initial register configuration in a JSON format + +```bash +cp srfexp_json.xml "~/Documents/Texas Instruments/SmartRF Studio v7/codeexport/." +# Example copy command for linux+wine +``` + +#### Understanding necessary RF Parameters +In SmartRF Studio, open the CC2500 Device Controller under the 2.4 GHZ list. + +At the time of writing, it is believed this device uses 250 kBaud MSK encoding. We will choose this option. + +Next we need to figure out the Base Frequency, Channel numbers, and Channel Spacing +![smart_rf](./images/smart_rf.png) + +### Singal Capture +I have captured the initial signal emitted by the handheld unit when it is first powered on. To do this, I have used a HackRF SDR + gqrx application on linux. + +The known frequency range is 2400 – 2483.5 MHz, and my SDR has a 20 MHZ bandwidth. I choose sweep for signals by tuning the following frequencies +| Sweep # | Center Frequency | Center Frequency (kHz) | Approx. Coverage (MHz) | Approx. Coverage (kHz) | +|---------|------------------|-------------------------|-------------------------|-----------------------------| +| 1 | 2410 MHz | 2,410,000 kHz | 2400 – 2420 MHz | 2,400,000 – 2,420,000 kHz | +| 2 | 2430 MHz | 2,430,000 kHz | 2420 – 2440 MHz | 2,420,000 – 2,440,000 kHz | +| 3 | 2450 MHz | 2,450,000 kHz | 2440 – 2460 MHz | 2,440,000 – 2,460,000 kHz | +| 4 | 2470 MHz | 2,470,000 kHz | 2460 – 2480 MHz | 2,460,000 – 2,480,000 kHz | +| 5 | 2483.5 MHz | 2,483,500 kHz | 2473.5 – 2483.5 MHz | 2,473,500 – 2,483,500 kHz | +#### Signal 0 +2.431258000 GHz | 2431258.000 kHz +![signal_0](./images/signals/signal0.png) +#### Signal 1 +2.447257000 GHz | 2447257.000 kHz +![signal_1](./images/signals/signal1.png) +#### Signal 2 +2.450225000 GHz | 2450225.000 kHz +![signal_2](./images/signals/signal2.png) +#### Signal 3 +2.471275000 GHz | 2471275.000 kHz +![signal_2](./images/signals/signal2.png) + +#### Signal Summary + + + +## Run +`python3 read.py` \ No newline at end of file diff --git a/images/signals/signal0.png b/images/signals/signal0.png new file mode 100644 index 0000000..3a0ece2 Binary files /dev/null and b/images/signals/signal0.png differ diff --git a/images/signals/signal1.png b/images/signals/signal1.png new file mode 100644 index 0000000..65f7494 Binary files /dev/null and b/images/signals/signal1.png differ diff --git a/images/signals/signal2.png b/images/signals/signal2.png new file mode 100644 index 0000000..d1213d7 Binary files /dev/null and b/images/signals/signal2.png differ diff --git a/images/signals/signal3.png b/images/signals/signal3.png new file mode 100644 index 0000000..ea414dd Binary files /dev/null and b/images/signals/signal3.png differ diff --git a/images/smart_rf.png b/images/smart_rf.png new file mode 100644 index 0000000..dfe8a88 Binary files /dev/null and b/images/smart_rf.png differ diff --git a/read.py b/read.py index cae7495..a4d6bf9 100644 --- a/read.py +++ b/read.py @@ -14,7 +14,7 @@ global MASKS global ACCESS def asb (a): - return int(b,16) + return int(a,16) def strobe(command): """Send a command strobe to CC2500""" @@ -42,25 +42,6 @@ def read_register(addr): response = spi.xfer2([READ_SINGLE | addr, 0x00]) return response[1] -def init_cc2500(): - spi.open(0, 0) # Bus 0, CE0 (Pin 24) - spi.max_speed_hz = 2000000 # Safe start speed - spi.mode = 0b00 # SPI mode 0 - - print("Sending SRES (reset)...") - spi.xfer2([SRES]) - time.sleep(0.1) - - print("Sending SNOP (no-op)...") - status = spi.xfer2([SNOP])[0] - print(f"Status byte: 0x{status:02X}") - - print("Reading VERSION register...") - version = read_register(0x31) - print(f"CC2500 VERSION register: 0x{version:02X}") - - spi.close() - def send_packet(data): # Flush TX FIFO strobe(0x3B) # SFTX diff --git a/srfexp_json.xml b/srfexp_json.xml new file mode 100644 index 0000000..8f83de9 --- /dev/null +++ b/srfexp_json.xml @@ -0,0 +1,14 @@ + + + + + + + +
+ + + + +