diff --git a/content/Hardware Support/GIGA R1/Burn-the-bootloader-on-GIGA-R1-WiFi.md b/content/Hardware Support/GIGA R1/Burn-the-bootloader-on-GIGA-R1-WiFi.md index 407a0db7..21d57afc 100644 --- a/content/Hardware Support/GIGA R1/Burn-the-bootloader-on-GIGA-R1-WiFi.md +++ b/content/Hardware Support/GIGA R1/Burn-the-bootloader-on-GIGA-R1-WiFi.md @@ -3,63 +3,170 @@ title: "Burn the bootloader on GIGA R1 WiFi" id: 7991505977116 --- -## Before you begin +Learn how to burn (flash) the bootloader on GIGA R1 WiFi. -* Add the **Arduino Mbed OS Giga Boards** to Arduino IDE using the [Boards Manager](https://support.arduino.cc/hc/en-us/articles/360016119519-Add-boards-to-Arduino-IDE). -* [Download and install the STM32CubeProgrammer from STMicroelectronics](https://www.st.com/en/development-tools/stm32cubeprog.html#st-get-software). - * You will be required to provide and validate an email address to get a download link. - * On macOS, you may need to run the executable directly: Right-click the `.app` container and select **Show package contents**, then navigate into `Contents/MacOs`. Double-click the file `SetupSTM32CubeProgrammer-X_Y_Z_macos` executable. +In this article: -## 1. Connect the board in bootloader mode +* [Prepare your GIGA R1 WiFi for bootloader flashing](#prepare) +* [Flash the bootloader with dfu-util (recommended)](#dfu-util) +* [Flash the bootloader with STM32CubeProgrammer](#stm32cubeprogrammer) +* [Troubleshooting](#troubleshooting) -1. With the board unplugged, press the button **BOOT0** and continue to press it. +--- + + + +## Prepare your GIGA R1 WiFi for bootloader flashing + +To burn the bootloader on GIGA R1 WiFi, it needs to be connected in DFU mode: + +1. Connect your GIGA R1 WiFi to your computer using a USB cable. + +1. Find the two push buttons labeled **BOOT0** and **RST** on the board: + +1. Press and hold **BOOT0** button. + + ![The BOOT0 button on Giga R1 WiFi.](img/GIGA-R1-button-BOOT0.png) + +1. Keep the **BOOT0** button pressed down, and press the **RST** button once. + + ![The RST button on Giga R1 WiFi.](img/GIGA-R1-button-RST.png) + +1. Release both buttons. GIGA R1 WiFi will briefly disconnect and reconnect to your computer. + +--- + + + +## Flash the bootloader with dfu-util (recommended) + +If you've installed the **Arduino Mbed OS Giga Boards** package on your computer using the [Boards Manager in Arduino IDE](https://support.arduino.cc/hc/en-us/articles/360016119519-Add-boards-to-Arduino-IDE) or Arduino CLI, you can use the included **dfu-util** tool to flash the bootloader on your GIGA R1 WiFi board. + +### Windows + +1. [Prepare your GIGA R1 WiFI for bootloader flashing](#prepare). + +1. Open **Command Prompt** by right-clicking in the bottom-left corner of the screen and selecting Command Prompt, or by searching for "cmd" in the taskbar. + +1. Copy this command: + + `"%LOCALAPPDATA%\Arduino15\packages\arduino\tools\dfu-util\0.11.0-arduino5\dfu-util" --device ,0x0483:0xdf11 -D "%LOCALAPPDATA%\Arduino15\packages\arduino\hardware\mbed_giga\4.0.6\bootloaders\GIGA\bootloader.bin" -a0 --dfuse-address=0x8000000` + +1. If neccessary, modify the package version number (4.0.6) to whichever is installed. + +1. Right-click inside the Command Prompt window to paste the command, then press Enter to begin flashing the bootloader. + +> **Note:** To use Powershell instead of Command Prompt, copy this command instead: +> +> `&"$Env:LOCALAPPDATA\Arduino15\packages\arduino\tools\dfu-util\0.11.0-arduino5\dfu-util" --device ,0x0483:0xdf11 -D "$Env:LOCALAPPDATA\Arduino15\packages\arduino\hardware\mbed_giga\4.0.6\bootloaders\GIGA\bootloader.bin" -a0 --dfuse-address=0x8000000` + +### macOS + +1. [Prepare your GIGA R1 WiFI for bootloader flashing](#prepare). - ![The BOOT0 button on Giga R1 WiFi.](img/giga-boot0-button.png) +1. Open **Terminal**. You can find it with Spotlight by pressing + Space and typing "Terminal". -2. Keep holding the **BOOT0** button as you connect the Giga R1 WiFi to your computer using a USB C cable. +1. Copy this command: -3. When the ON LED is lit, release the **BOOT0** button. + `~/Library/Arduino15/packages/arduino/tools/dfu-util/0.11.0-arduino5/dfu-util --device ,0x0483:0xdf11 -D ~/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.0.6/bootloaders/GIGA/bootloader.bin -a0 --dfuse-address=0x8000000` - +1. If neccessary, modify the package version number (4.0.6) to whichever is installed. -## 2. Burn the bootloader using STM32CubeProgrammer +1. Select the Terminal window and press + V to paste the command, then press Enter to begin flashing the bootloader. -1. **[Download the bootloader file](https://github.com/arduino/ArduinoCore-mbed/raw/main/bootloaders/GIGA/bootloader.elf)**[^1]. +### Linux -2. Open STM32CubeProgrammer. +1. [Prepare your GIGA R1 WiFI for bootloader flashing](#prepare). -3. Click on the **Open file** tab. +1. Open your computer's command line application (often referred to as shell, terminal, console, prompt or various other names). Look for it in your launcher, or try the Ctrl + Alt + T keyboard shortcut (available on most Linux systems). - +1. Copy this command: + + `~/.arduino15/packages/arduino/tools/dfu-util/0.11.0-arduino5/dfu-util --device ,0x0483:0xdf11 -D ~/.arduino15/packages/arduino/hardware/mbed_giga/4.0.6/bootloaders/GIGA/bootloader.bin -a0 --dfuse-address=0x8000000` + +1. If neccessary, modify the package version number (4.0.6) to whichever is installed. + +1. Select the Terminal window and press Ctrl + ⇧Shift + V to paste the command, then press Enter to begin flashing the bootloader. + +--- + + + +## Flash the bootloader with STM32CubeProgrammer + +If you prefer to use a graphical interface, you can use STM32CubeProgrammer. + +> **Note:** To use STM32CubeProgrammer on macOS, you may need to run the executable directly: Right-click the `.app` container and select **Show package contents**, then navigate into `Contents/MacOs`. Double-click the file `SetupSTM32CubeProgrammer-X_Y_Z_macos` executable. + +1. [Prepare your GIGA R1 WiFI for bootloader flashing](#prepare). + +1. Open STM32CubeProgrammer and click on **Open file**. -4. Navigate to the [Arduino 15 folder](https://support.arduino.cc/hc/en-us/articles/360018448279-Open-the-Arduino15-folder), then select this file: +1. Select the bootloader from one of the following locations: + + * Download the bootloader file and select it from your default download location. + + * If you've installed the Arduino Mbed OS Giga Boards package, you can also find it inside your [Arduino15 folder](https://support.arduino.cc/hc/en-us/articles/360018448279-Open-the-Arduino15-folder). - `packages/arduino/hardware/mbed_giga/3.9.9/bootloaders/GIGA/bootloader.elf` + * **Windows:** `C:\Users\{username}\AppData\Local\Arduino15\packages/arduino/hardware/mbed_giga/4.0.6/bootloaders/GIGA/bootloader.elf` -5. If you get a "Warning: File corrupted. Two or more segments defines the same memory zone" message, ignore it. + * **macOS:** `~/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.0.6/bootloaders/GIGA/bootloader.elf` -6. Set the programmer selection (default: ST-LINK) to **USB**. + * **Linux:** `~/.arduino15/Arduino15/packages/arduino/hardware/mbed_giga/4.0.6/bootloaders/GIGA/bootloader.elf` + +1. If you get a "Warning: File corrupted. Two or more segments defines the same memory zone" message, ignore it. + +1. Set the programmer selection (default: ST-LINK) to **USB**. -7. For the **Port** selection, select your board. To refresh the list, click the update button. +1. For the **Port** selection, select your board. To refresh the list, click the update button. -8. Click on **Connect** button. The connection status should change from "Not connected" to "Connected". +1. Click on **Connect** button. The connection status should change from "Not connected" to "Connected". -9. Click on the **Download** button. If you get another warning message, close it by selecting OK. +1. Click on the **Download** button. If you get another warning message, close it by selecting OK. > **Note:** Click on the left part of the button where it says "Download" (not the arrow, which opens a context menu) -10. The message "File download complete" will appear as a pop-up notification when the download is complete. +1. The message "File download complete" will appear as a pop-up notification when the download is complete. + +1. Disconnect and reconnect GIGA R1 WiFi to your computer. + +--- + + + +## Troubleshooting + +### `dfu-util: No DFU capable USB device available` + +If you see this error, make sure you've followed the steps in [Prepare your GIGA R1 WiFI for bootloader flashing](#prepare). + +### `Cannot open DFU device 0483:df11 found on devnum 2 (LIBUSB_ERROR_NOT_SUPPORTED)` + +If you see this error on Windows, you may be missing the correct driver. + +Follow these steps: + +1. Open Device Manager and locate the **DFU in FS Mode** device under **Other devices**. + * If you can't find it, try selecting **View > Show hidden devices**. + * If a different device appears, such as STM device in DFU Mode (under Universal Serial Bus controller), right-click and select **Uninstall device**. -11. Disconnect the board from the USB-C cable and connect it again. + ![Device Manager.](img/device-manger-dfu-in-fs-mode.png) +1. Right-click on the DFU in FS Mode device and select **Update driver… / Update driver software...** from the context menu. +1. In the wizard, select **Browse my computer for driver software**. +1. Select **Let me pick from a list of device drivers on my computer**. +1. From the list of device classes, select **Universal Serial Bus devices**. If you don’t see it, untick **Show compatible hardware**. +1. Select **WinUsb Device > WinUsb Device**. +1. Click **Next**. +1. Confirm that you want to install the driver. -[^1]: If you've installed the **Arduino Mbed OS Giga Boards** package, you can also find it inside your [Arduino15 folder](https://support.arduino.cc/hc/en-us/articles/360018448279-Open-the-Arduino15-folder). The path is `Arduino15/packages/arduino/hardware/mbed_giga/3.9.12/bootloaders/GIGA/bootloader.elf`. +After installing the driver, try flashing the bootloader with dfu-util again. diff --git a/content/Hardware Support/GIGA R1/img/GIGA-R1-button-BOOT0.png b/content/Hardware Support/GIGA R1/img/GIGA-R1-button-BOOT0.png new file mode 100644 index 00000000..0d59ce0f Binary files /dev/null and b/content/Hardware Support/GIGA R1/img/GIGA-R1-button-BOOT0.png differ diff --git a/content/Hardware Support/GIGA R1/img/GIGA-R1-button-RST.png b/content/Hardware Support/GIGA R1/img/GIGA-R1-button-RST.png new file mode 100644 index 00000000..99274412 Binary files /dev/null and b/content/Hardware Support/GIGA R1/img/GIGA-R1-button-RST.png differ diff --git a/content/Hardware Support/GIGA R1/img/device-manger-dfu-in-fs-mode.png b/content/Hardware Support/GIGA R1/img/device-manger-dfu-in-fs-mode.png new file mode 100644 index 00000000..33ab6825 Binary files /dev/null and b/content/Hardware Support/GIGA R1/img/device-manger-dfu-in-fs-mode.png differ