# chip_test_example Tests for LR1121 LoRa, ICM-20948 IMU, u-blox GPS on Raspberry Pi Zero W 2. Header-only drivers, kernel ioctls, no external libs. --- ## Wiring ### LR1121 (SPI0) | Module | Pi GPIO | Pi pin | |--------|---------|--------| | SCK | GPIO11 | 23 | | MOSI | GPIO10 | 19 | | MISO | GPIO9 | 21 | | NSS | GPIO8 | 24 | | BUSY | GPIO24 | 18 | | NRESET | GPIO25 | 22 | | DIO9 | GPIO4 | 7 | | DIO8 | GPIO23 | 16 | Enable: `sudo raspi-config` → Interfaces → SPI → Yes → reboot ### ICM-20948 (I2C1) | Module | Pi GPIO | Pi pin | |--------|---------|--------| | SDA | GPIO2 | 3 | | SCL | GPIO3 | 5 | | AD0 | GND → addr 0x68 / VCC → addr 0x69 | Enable: `sudo raspi-config` → Interfaces → I2C → Yes → reboot ### u-blox GPS (UART0) | Module | Pi GPIO | Pi pin | |--------|---------|--------| | TX | GPIO15 | 10 | | RX | GPIO14 | 8 | Enable: `sudo raspi-config` → Interfaces → Serial Port → login shell: No, hardware: Yes → reboot --- ## Build ```sh sudo apt install g++ make make ``` Run verbose first so you see exactly where it fails: ```sh sudo ./lora_rx -v --433 sudo ./imu_test -v ./gps_test -v ``` --- ## LoRa debug ```sh ls /dev/spidev0.0 # SPI on? sudo ./lora_rx -v --433 # step labels show exactly which command hangs ``` If it hangs at `Calibrate` — that's a TCXO config issue. Try in order: ```sh sudo ./lora_rx -v --433 --tcxo-none # skip TCXO entirely (crystal mode) sudo ./lora_rx -v --433 --tcxo-27 # TCXO 2.7V sudo ./lora_rx -v --433 --tcxo-33 # TCXO 3.3V (default) ``` The one that gets past "Calibrate done" is your module's config. Use the same TCXO flag on TX and RX. If using the 2.4 GHz antenna instead: ```sh sudo ./lora_rx -v --24 sudo ./lora_tx -v --24 ``` --- ## IMU debug ```sh sudo i2cdetect -y 1 # 0x68 or 0x69 must show sudo ./imu_test -v # auto-detects both addresses sudo ./imu_test -v -r # raw 16-bit values ``` Nothing on i2cdetect: I2C not enabled, wrong wiring, or no pull-ups on SDA/SCL. --- ## GPS debug ```sh ls -la /dev/serial0 stty -F /dev/serial0 38400 raw && cat /dev/serial0 # raw NMEA bytes ./gps_test -v -a # all sentences ./gps_test -b 9600 # try different baud ``` --- ## TCXO voltage reference | Flag | Value | Voltage | |------|-------|---------| | `--tcxo-none` | 0xFF | no TCXO (crystal) | | `--tcxo-27` | 0x05 | 2.7V | | `--tcxo-33` | 0x07 | 3.3V | | `--tcxo-v N` | 0x00–0x07 | raw byte |