# CAN Monitor for Flipper Zero Flipper Zero application for monitoring CAN sniffer statistics from Raspberry Pi 5 via UART. ## Features - Real-time display of CAN sniffer statistics - Shows: IP address, total frames, pending frames, processed frames - Connection status indicator - Compatible with Unleashed firmware (0.84e and later) ## Hardware Connection ### Wiring (RPI5 <-> Flipper Zero) ``` RPI5 GPIO Flipper Zero GPIO ----------- ----------------- TX (GPIO 14) --> RX (Pin 14) RX (GPIO 15) <-- TX (Pin 13) GND --> GND ``` **Note:** Cross TX/RX connections (RPI TX -> Flipper RX, RPI RX -> Flipper TX) ### Flipper Zero GPIO Pinout ``` Pin 13 = TX (USART) Pin 14 = RX (USART) Pin 8/11/18 = GND ``` ### RPI5 GPIO (using /dev/ttyAMA0) ``` GPIO 14 = TX (Pin 8) GPIO 15 = RX (Pin 10) GND = Pin 6, 9, 14, 20, 25, 30, 34, 39 ``` ## Building the Application ### Prerequisites 1. Clone Flipper Zero firmware: ```bash git clone --recursive https://github.com/DarkFlippers/unleashed-firmware.git cd unleashed-firmware ``` 2. Copy the `flip_monitor` folder to `applications_user/`: ```bash cp -r /path/to/carpibord/flip_monitor applications_user/can_monitor ``` 3. Create icon (10x10 PNG, 1-bit): ```bash # Create icons/can_monitor.png (10x10 pixels, black & white) # You can use any image editor or online tool ``` ### Build ```bash # Build the FAP ./fbt fap_can_monitor # Or build all external apps ./fbt fap_dist ``` The compiled `.fap` file will be in `build/f7-firmware-D/.extapps/can_monitor.fap` ### Install Copy the `.fap` file to your Flipper Zero SD card: ``` SD Card/apps/GPIO/can_monitor.fap ``` ## RPI5 Configuration ### 1. Enable UART Add to `/boot/config.txt`: ``` enable_uart=1 dtoverlay=uart0 ``` Reboot after changes. ### 2. Install pyserial ```bash pip install pyserial ``` ### 3. Configure CAN Sniffer Add to `can_sniffer/config.json`: ```json { "flipper": { "enabled": true, "device": "/dev/ttyAMA0", "baudrate": 115200, "send_interval": 1.0 } } ``` Or use environment variables: ```bash export CAN_SNIFFER_FLIPPER__ENABLED=true export CAN_SNIFFER_FLIPPER__DEVICE=/dev/ttyAMA0 ``` ### 4. Run CAN Sniffer ```bash cd can_sniffer/src python main.py ``` ## Protocol The RPI5 sends text-based statistics over UART: ``` STATS:ip=192.168.1.100,total=12345,pending=100,processed=12245\n ``` Fields: - `ip` - RPI5 IP address - `total` - Total CAN frames received - `pending` - Frames in processing queue - `processed` - Successfully processed frames ## Troubleshooting ### No connection 1. Check wiring (TX/RX crossed correctly) 2. Verify UART is enabled on RPI5: `ls -la /dev/ttyAMA0` 3. Check config: `flipper.enabled = true` 4. Test UART manually: ```bash # On RPI5 echo "STATS:ip=test,total=1,pending=0,processed=1" > /dev/ttyAMA0 ``` ### Permission denied on /dev/ttyAMA0 Add user to dialout group: ```bash sudo usermod -a -G dialout $USER # Then logout and login again ``` ### Flipper shows "Waiting..." - Stats are sent every 1 second (configurable) - Connection timeout is 5 seconds - Check if CAN sniffer is running ## License MIT License