|
| 1 | +# BeagleV-Fire Platform Support |
| 2 | + |
| 3 | +ESP-Hosted support for BeagleV-Fire (Microchip PolarFire SoC RISC-V platform). |
| 4 | + |
| 5 | +## Hardware |
| 6 | + |
| 7 | +- **Board**: BeagleV-Fire |
| 8 | +- **SoC**: Microchip PolarFire SoC (RISC-V) |
| 9 | +- **Interface**: SPI0 |
| 10 | +- **ESP32**: Any ESP32 module (ESP32-WROOM-32, DevKitC, etc.) |
| 11 | + |
| 12 | +## Pin Connections |
| 13 | + |
| 14 | +| Function | ESP32 GPIO | ESP32 Physical Pin | BeagleV-Fire Pin | BeagleV GPIO | Description | |
| 15 | +| -------------- | ---------- | ------------------ | ---------------- | ------------ | --------------- | |
| 16 | +| **SPI MOSI** | GPIO 13 | D13 | P9_18 | SPI0_MOSI | SPI Master Out | |
| 17 | +| **SPI MISO** | GPIO 12 | D12 | P9_21 | SPI0_MISO | SPI Master In | |
| 18 | +| **SPI CLK** | GPIO 14 | D14 | P9_22 | SPI0_CLK | SPI Clock | |
| 19 | +| **SPI CS** | GPIO 15 | D15 | P9_17 | SPI0_CS0 | SPI Chip Select | |
| 20 | +| **Handshake** | GPIO 26 | D26 | P8_03 | 512 | MSS GPIO_2[0] | |
| 21 | +| **Data Ready** | GPIO 25 | D25 | P8_04 | 513 | MSS GPIO_2[1] | |
| 22 | +| **Reset** | EN | EN | P8_05 | 514 | MSS GPIO_2[2] | |
| 23 | +| **Ground** | GND | GND | P9_1 or P9_2 | GND | Common Ground | |
| 24 | + |
| 25 | +## Configuration Details |
| 26 | + |
| 27 | +### Hardware Configuration |
| 28 | + |
| 29 | +- **SPI Interface**: SPI0 on BeagleV-Fire |
| 30 | +- **GPIO Chip**: MSS GPIO_2 (base 512) |
| 31 | +- **Reset Pin**: GPIO 514 (configured in `beaglev_init.sh`) |
| 32 | +- **Handshake Pin**: GPIO 512 (configured in `spi/esp_spi.h`) |
| 33 | +- **Data Ready Pin**: GPIO 513 (configured in `spi/esp_spi.h`) |
| 34 | + |
| 35 | +## Files in This Directory |
| 36 | + |
| 37 | +- **beaglev_init.sh** - Modified initialization script for BeagleV-Fire |
| 38 | +- **beaglev-esp-hosted.dts** - Device tree overlay for SPI configuration |
| 39 | +- **patches/esp_spi.h.patch** - GPIO pin modifications |
| 40 | + |
| 41 | +## Quick Setup |
| 42 | + |
| 43 | +### 1. Apply Device Tree Overlay |
| 44 | + |
| 45 | +```bash |
| 46 | +# Compile overlay |
| 47 | +dtc -O dtb -o beaglev-esp-hosted.dtbo -b 0 -@ beaglev-esp-hosted.dts |
| 48 | + |
| 49 | +# Copy to firmware directory |
| 50 | +sudo cp beaglev-esp-hosted.dtbo /lib/firmware/ |
| 51 | + |
| 52 | +# Apply overlay |
| 53 | +sudo mkdir -p /sys/kernel/config/device-tree/overlays/esp-hosted |
| 54 | +echo beaglev-esp-hosted.dtbo | sudo tee /sys/kernel/config/device-tree/overlays/esp-hosted/path |
| 55 | + |
| 56 | +# Verify |
| 57 | +cat /sys/kernel/config/device-tree/overlays/esp-hosted/status # Should show "applied" |
| 58 | +ls /dev/spidev0.0 # Should exist |
| 59 | +``` |
| 60 | + |
| 61 | +### 2. Apply GPIO Pin Patch (Optional) |
| 62 | + |
| 63 | +If not already applied in your fork: |
| 64 | + |
| 65 | +```bash |
| 66 | +cd ~/esp-hosted |
| 67 | +patch -p1 < esp_hosted_ng/host/platforms/beaglev-fire/patches/esp_spi.h.patch |
| 68 | +``` |
| 69 | + |
| 70 | +Or manually edit `esp_hosted_ng/host/linux/host_driver/esp32/spi/esp_spi.h`: |
| 71 | + |
| 72 | +```c |
| 73 | +#define HANDSHAKE_PIN 513 // Changed from 22 |
| 74 | +#define SPI_DATA_READY_PIN 514 // Changed from 27 |
| 75 | +``` |
| 76 | +
|
| 77 | +### 3. Copy Init Script |
| 78 | +
|
| 79 | +```bash |
| 80 | +cp esp_hosted_ng/host/platforms/beaglev-fire/beaglev_init.sh \ |
| 81 | + esp_hosted_ng/host/beaglev_init.sh |
| 82 | +chmod +x esp_hosted_ng/host/beaglev_init.sh |
| 83 | +``` |
| 84 | + |
| 85 | +### 4. Build and Load Driver |
| 86 | + |
| 87 | +```bash |
| 88 | +cd esp_hosted_ng/host |
| 89 | +sudo ./beaglev_init.sh spi |
| 90 | +``` |
| 91 | + |
| 92 | +### 5. Verify |
| 93 | + |
| 94 | +```bash |
| 95 | +# Check module loaded |
| 96 | +lsmod | grep esp32_spi |
| 97 | + |
| 98 | +# Check interface |
| 99 | +ip link show wlan0 |
| 100 | + |
| 101 | +# Test WiFi |
| 102 | +sudo iw dev wlan0 scan |
| 103 | +``` |
| 104 | + |
| 105 | +## Platform Differences vs Raspberry Pi |
| 106 | + |
| 107 | +| Aspect | Raspberry Pi | BeagleV-Fire | |
| 108 | +| --------------- | ----------------------- | ------------------ | |
| 109 | +| Architecture | ARM | RISC-V | |
| 110 | +| Build | ARCH=arm, CROSS_COMPILE | ARCH=riscv, native | |
| 111 | +| Handshake GPIO | 22 | 513 | |
| 112 | +| Data Ready GPIO | 27 | 514 | |
| 113 | +| Reset GPIO | 6 | 512 | |
| 114 | +| GPIO Tool | raspi-gpio | Device tree | |
| 115 | +| SPI Driver | bcm2835 | spi-microchip-core | |
| 116 | + |
| 117 | +## Automated Setup |
| 118 | + |
| 119 | +For automated setup, see: https://github.com/YOUR-ORG/s0-wifi-setup |
| 120 | + |
| 121 | +## Troubleshooting |
| 122 | + |
| 123 | +**No /dev/spidev0.0**: |
| 124 | + |
| 125 | +```bash |
| 126 | +# Load SPI modules |
| 127 | +sudo modprobe spidev |
| 128 | +sudo modprobe spi-microchip-core |
| 129 | +sudo modprobe spi-microchip-core-qspi |
| 130 | + |
| 131 | +# Reboot if needed |
| 132 | +sudo reboot |
| 133 | +``` |
| 134 | + |
| 135 | +**Module won't load**: |
| 136 | + |
| 137 | +```bash |
| 138 | +# Check kernel headers |
| 139 | +ls /lib/modules/$(uname -r)/build/include/linux/module.h |
| 140 | + |
| 141 | +# If missing, rebuild kernel headers |
| 142 | +``` |
| 143 | + |
| 144 | +**No wlan0 interface**: |
| 145 | + |
| 146 | +```bash |
| 147 | +# Check ESP32 is powered and connected |
| 148 | +# Check kernel logs |
| 149 | +dmesg | grep -i esp |
| 150 | + |
| 151 | +# Look for "ESP peripheral capabilities" |
| 152 | +``` |
| 153 | + |
| 154 | +## Performance |
| 155 | + |
| 156 | +- **WiFi Throughput**: 5-10 Mbps (SPI limited at 10 MHz) |
| 157 | +- **Latency**: 20-50 ms |
| 158 | +- **SPI Speed**: Default 10 MHz (configurable to 20 MHz in device tree) |
| 159 | + |
| 160 | +## Notes |
| 161 | + |
| 162 | +- Bluetooth requires `bluetooth` kernel module (not in default BeagleV kernel) |
| 163 | +- WiFi works independently of Bluetooth |
| 164 | +- SPI speed can be increased to 20 MHz for better performance (experimental) |
| 165 | + |
| 166 | +## Support |
| 167 | + |
| 168 | +For issues specific to BeagleV-Fire integration: |
| 169 | + |
| 170 | +- Issues: https://github.com/YOUR-ORG/esp-hosted/issues |
| 171 | +- Tag: `platform:beaglev-fire` |
0 commit comments