|
| 1 | +# Zephyr Board: `b_u585i_iot02a` |
| 2 | + |
| 3 | +The [Discovery Kit for IoT Node with STM32U5 Series](https://www.st.com/en/evaluation-tools/b-u585i-iot02a.html) is a demonstration and development board featuring the **STM32U585AIUx** MCU. |
| 4 | + |
| 5 | +Apart from the SoC, internal 2MB flash (which usually holds the application), there is an external 64MB flash chip (which is usually used for the storage_partition). And also features an 8MB PSRAM which we use for the container memory. |
| 6 | + |
| 7 | +It is well supported by Zephyr, and more information can be found in Zephyr's [B-U585I-IOT02A Discovery kit](https://docs.zephyrproject.org/latest/boards/st/b_u585i_iot02a/doc/index.html) documentation. |
| 8 | + |
| 9 | +## Networking |
| 10 | + |
| 11 | +### Wi-Fi Module Not Supported |
| 12 | + |
| 13 | +The onboard EMW3080 Wi-Fi module is **not supported** by Zephyr. For network connectivity, you **must use an Ethernet shield**. |
| 14 | + |
| 15 | +### Supported Ethernet Shields |
| 16 | + |
| 17 | +The board supports the following Ethernet shields, which connect via **SPI1**: |
| 18 | + |
| 19 | +#### ENC28J60 (Microchip) |
| 20 | + |
| 21 | +- **References**: |
| 22 | + - [Microchip ENC28J60 Datasheet](https://ww1.microchip.com/downloads/en/DeviceDoc/39662e.pdf) |
| 23 | + - [Zephyr ENC28J60 Driver Documentation](https://docs.zephyrproject.org/latest/hardware/peripherals/ethernet.html#microchip-enc28j60) |
| 24 | + |
| 25 | +#### W5500 (WizNet) |
| 26 | + |
| 27 | +- **References**: |
| 28 | + - [WizNet W5500 Datasheet](https://docs.wiznet.io/Product/iEthernet/W5500/Datasheet) |
| 29 | + - [Zephyr W5500 Driver Documentation](https://docs.zephyrproject.org/latest/hardware/peripherals/ethernet.html#wiznet-w5500) |
| 30 | + |
| 31 | +### Hardware Connections |
| 32 | + |
| 33 | +The Ethernet shields connect to the board via **SPI1** (Serial Peripheral Interface bus 1). This is the Ocre supported communication interface for these shields. |
| 34 | + |
| 35 | +#### SPI1 Pin Configuration |
| 36 | + |
| 37 | +All Ethernet shields use the same SPI1 pins on the b_u585i_iot02a board: |
| 38 | + |
| 39 | +| Function | Pin name | STM32U5 pin | Connector | |
| 40 | +| --------- | ------------ | ----------- | --------- | |
| 41 | +| SPI1_NSS | PWM/CS/D10 | PE12 | CN13 | |
| 42 | +| SPI1_SCK | SCK/D13 | PE13 | CN13 | |
| 43 | +| SPI1_MISO | MISO/D12 | PE14 | CN13 | |
| 44 | +| SPI1_MOSI | PWM/MOSI/D11 | PE15 | CN13 | |
| 45 | +| GND | GND | - | CN13 | |
| 46 | +| VCC | 5V | - | CN17 | |
| 47 | + |
| 48 | +#### Important: |
| 49 | + |
| 50 | +Each shield type uses a different interrupt GPIO pin: |
| 51 | + |
| 52 | +- **ENC28J60 Shield**: Interrupt on **PC1** (Pin name: **D8**) on **CN13** |
| 53 | +- **W5500 Shield**: Interrupt on **PD15** (Pin name: **D2**) on **CN14** |
| 54 | + |
| 55 | +### Detailed Connection Instructions |
| 56 | + |
| 57 | +#### Power and Ground |
| 58 | + |
| 59 | +1. Connect shield **GND** pin to any **GND** pin on the board |
| 60 | +2. Connect shield **5V** pin to any **5V** pin on the board |
| 61 | + |
| 62 | +#### SPI1 Connections |
| 63 | + |
| 64 | +3. Connect shield **CS** pin to board **PE12** (SPI1 Chip Select) |
| 65 | +4. Connect shield **CLK** pin to board **PE13** (SPI1 Serial Clock) |
| 66 | +5. Connect shield **MISO**/**SO** pin to board **PE14** (SPI1 Data In) |
| 67 | +6. Connect shield **MOSI**/**SI** pin to board **PE15** (SPI1 Data Out) |
| 68 | + |
| 69 | +#### Interrupt Connection |
| 70 | + |
| 71 | +For **ENC28J60 shields**: 7. Connect shield **INT** pin to board **PC1** |
| 72 | + |
| 73 | +For **W5500 shields**: 7. Connect shield **INT** pin to board **PD15** |
| 74 | + |
| 75 | +More detailed information can be found in [User Manual](https://www.st.com/resource/en/user_manual/um2839-discovery-kit-for-iot-node-with-stm32u5-series-stmicroelectronics.pdf). |
| 76 | + |
| 77 | +## Build Instructions |
| 78 | + |
| 79 | +### Prerequisites |
| 80 | + |
| 81 | +Start with [Getting Started with Zephyr](../../GetStartedZephyr.md) to get a working build environment. |
| 82 | + |
| 83 | +### Building Without Shield (No Networking) |
| 84 | + |
| 85 | +For development or testing without networking: |
| 86 | + |
| 87 | +```bash |
| 88 | +west build -p always -b b_u585i_iot02a src/samples/supervisor/zephyr/ |
| 89 | +``` |
| 90 | + |
| 91 | +### Building with ENC28J60 Ethernet Shield |
| 92 | + |
| 93 | +To build with the ENC28J60 shield: |
| 94 | + |
| 95 | +```bash |
| 96 | +west build -p always -b b_u585i_iot02a --shield enc28j60 src/samples/supervisor/zephyr/ |
| 97 | +``` |
| 98 | + |
| 99 | +Replace `enc28j60` with `wiznet_w5500` if WIZnet W5500 ethernet shield is used. |
| 100 | + |
| 101 | +## Flashing |
| 102 | + |
| 103 | +### First Flash (with Preloaded Images) |
| 104 | + |
| 105 | +To flash the application and preloaded container images in the storage partition: |
| 106 | + |
| 107 | +```bash |
| 108 | +west flash --hex-file build/zephyr/merged.hex |
| 109 | +``` |
| 110 | + |
| 111 | +This writes both: |
| 112 | + |
| 113 | +- Application code to internal flash (2 MB) |
| 114 | +- 16MB of storage partition to external flash (64 MB total) with preloaded WASM images |
| 115 | + |
| 116 | +**Time**: May take 1-2 minutes depending on image size. |
| 117 | + |
| 118 | +For more information about preloaded images, see [Build System Zephyr](../../BuildSystemZephyr.md). |
| 119 | + |
| 120 | +### Subsequent Flashes (Development) |
| 121 | + |
| 122 | +After the first flash with `merged.hex`, you can flash just the application code: |
| 123 | + |
| 124 | +```bash |
| 125 | +west flash |
| 126 | +``` |
| 127 | + |
| 128 | +This only updates the application, leaving the storage partition intact. |
| 129 | + |
| 130 | +## Serial Console |
| 131 | + |
| 132 | +The serial console can be accessed using `picocom`. |
| 133 | +This works both on native Linux and WSL, with a small setup. |
| 134 | + |
| 135 | +### Native Linux |
| 136 | + |
| 137 | +The board usually appears as: |
| 138 | + |
| 139 | +```bash |
| 140 | +/dev/ttyACM0 |
| 141 | +``` |
| 142 | + |
| 143 | +Check with: |
| 144 | + |
| 145 | +```bash |
| 146 | +ls /dev/ttyACM* |
| 147 | +``` |
| 148 | + |
| 149 | +### WSL (Windows Subsystem for Linux) |
| 150 | + |
| 151 | +WSL does not automatically expose USB serial devices. |
| 152 | +You must attach the ST-Link device using `usbipd`. |
| 153 | + |
| 154 | +**1. Install usbipd on Windows** |
| 155 | + |
| 156 | +From PowerShell (Admin): |
| 157 | + |
| 158 | +```bash |
| 159 | +winget install usbipd |
| 160 | +``` |
| 161 | + |
| 162 | +**2. List USB devices** |
| 163 | + |
| 164 | +```bash |
| 165 | +usbipd list |
| 166 | +``` |
| 167 | + |
| 168 | +**3. Attach device to WSL (look for ST-Link / STMicroelectronics)** |
| 169 | + |
| 170 | +```bash |
| 171 | +usbipd attach --busid <BUS_ID> --wsl |
| 172 | +``` |
| 173 | + |
| 174 | +Example: |
| 175 | + |
| 176 | +```bash |
| 177 | +usbipd attach --busid 1-4 --wsl |
| 178 | +``` |
| 179 | + |
| 180 | +**4. Verify in WSL** |
| 181 | + |
| 182 | +```bash |
| 183 | +ls /dev/ttyACM* |
| 184 | +``` |
| 185 | + |
| 186 | +You should now see: |
| 187 | + |
| 188 | +```bash |
| 189 | +/dev/ttyACM0 |
| 190 | +``` |
| 191 | + |
| 192 | +### Connect to the serial console |
| 193 | + |
| 194 | +Open the serial console |
| 195 | +Run picocom with 115200 baud (default Zephyr): |
| 196 | + |
| 197 | +```bash |
| 198 | +picocom -b 115200 /dev/ttyACM0 |
| 199 | +``` |
| 200 | + |
| 201 | +Exit with: |
| 202 | + |
| 203 | +```bash |
| 204 | +Ctrl + A, then Ctrl + X |
| 205 | +``` |
| 206 | + |
| 207 | +## Test Network Connectivity |
| 208 | + |
| 209 | +If the steps above were followed, you should see in the console: |
| 210 | + |
| 211 | +```bash |
| 212 | +ethernet@0: Link up |
| 213 | +``` |
| 214 | + |
| 215 | +The board automatically gets an IPv4 address, to see it type in the console: |
| 216 | + |
| 217 | +```bash |
| 218 | +ocre:~$ net iface |
| 219 | +``` |
| 220 | + |
| 221 | +**Output:** |
| 222 | + |
| 223 | +```bash |
| 224 | +Interface eth0 (index 1) |
| 225 | +=========================== |
| 226 | +Device : ethernet@0 |
| 227 | +Link state: UP |
| 228 | +IPv4 unicast addresses (1): |
| 229 | + 192.168.18.17/255.255.255.0 DHCP preferred |
| 230 | +``` |
| 231 | + |
| 232 | +## References |
| 233 | + |
| 234 | +- [Zephyr B-U585I-IOT02A Documentation](https://docs.zephyrproject.org/latest/boards/st/b_u585i_iot02a/doc/index.html) |
| 235 | +- [Board Schematics and Datasheet](https://www.st.com/en/evaluation-tools/b-u585i-iot02a.html) (available from ST) |
| 236 | +- [Supervisor Sample Documentation](../../samples/supervisor.md) |
| 237 | + |
| 238 | +See the main documentation for: |
| 239 | + |
| 240 | +- [Zephyr Build System](../../BuildSystemZephyr.md) |
| 241 | +- [Get started Zephyr](../../GetStartedZephyr.md) |
0 commit comments