Loading...
Loading...
Debug and synchronize communication between the robocar main controller (Heltec WiFi LoRa 32) and camera module (ESP32-CAM)
npx skill4agent add laurigates/mcu-tinkering-lab dual-controller-sync┌─────────────────────┐ I2C ┌─────────────────────┐
│ Main Controller │◄────────────►│ Camera Module │
│ Heltec WiFi LoRa │ │ ESP32-CAM │
│ │ │ │
│ - AI decisions │ │ - Image capture │
│ - Motor control │ │ - Vision analysis │
│ - LoRa comms │ │ - I2C slave │
└─────────────────────┘ └─────────────────────┘# Build main controller
make robocar-build-main
# Build camera module
make robocar-build-cam
# Or build both
make robocar-build-allmake robocar-monitor-main PORT=/dev/cu.usbserial-0001make robocar-monitor-cam PORT=/dev/cu.usbserial-0002ls -la /dev/cu.usbserial-* /dev/ttyUSB*| Symptom | Possible Cause | Solution |
|---|---|---|
| No response | Wrong address | Verify 7-bit address format |
| Timeout | Missing pull-ups | Add 4.7K resistors on SDA/SCL |
| Corrupted data | Speed too fast | Reduce I2C clock frequency |
| Intermittent | Loose connection | Check wiring |
#define CAMERA_I2C_ADDR 0x55 // 7-bit address#define I2C_SLAVE_ADDR 0x55 // Must match masterMain Controller Camera Module
SDA (21) ◄──────────► SDA (GPIO)
SCL (22) ◄──────────► SCL (GPIO)
GND ◄──────────► GNDesp_log_level_set("i2c", ESP_LOG_DEBUG);i2c_master_cmd_begin(I2C_NUM, cmd, pdMS_TO_TICKS(100));
vTaskDelay(pdMS_TO_TICKS(10)); // Wait for slave to process# Flash main controller first
make robocar-flash-main PORT=/dev/cu.usbserial-0001
# Then flash camera (requires GPIO0 to GND)
# Connect GPIO0 to GND on ESP32-CAM
make robocar-flash-cam PORT=/dev/cu.usbserial-0002
# Disconnect GPIO0 from GND and resetmake robocar-build-allmake robocar-flash-mainmake robocar-flash-cam# Show system info
make robocar-info
# Check environment
make check-environment
# Clean and rebuild
make robocar-clean
make robocar-build-all
# Full dev cycle for main
make robocar-develop-main PORT=/dev/xxx
# Full dev cycle for camera
make robocar-develop-cam PORT=/dev/xxx