adafruit / adafruit/tinyuf2

Windows flashing produces error 0x800701B1

Open
#375 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
471
Forks
248
PR merge metrics
No merged PRs in 30d

Description

### Operating System

Windows 10

### INFO_UF2.TXT

TinyUF2 Bootloader 0.18.1-55-geec497e-dirty - st/cmsis_device_f3 (v2.3.6) st/stm32f3xx_hal_driver (v1.5.6-9-g75cf4fc) tinyusb (0.15.0-566-gf1e006d09)
Model: ST STM32F303 Discovery
Board-ID: STM32F303-Discovery-MB1035D
Date: Jan 31 2024
Flash Size: 0x00040000 bytes

### What happened ?

Flashing on both win10 and win11 can generate the error. In all testing, the flash is successful and the board will reboot into the user application while the error dialog is shown.

However from an end user experience, the "unexpected error" dialog causes unnecessary confusion and worry.

Other uf2 based bootloaders I have tested that do not have this issue:
* https://github.com/adafruit/uf2-samdx1
* https://github.com/adafruit/Adafruit_nRF52_Bootloader
* RP2040 built in bootloader

A quick look into the issue, it could be that the reboot is called within the `tud_msc_write10_complete_cb` callback. By comparison and seems to suggest a reboot after a delay and from the main loop.

### How to reproduce ?

Reset board to bootloader
Drag & drop uf2 user file
Error dialog will popup

### Debug Log

_No response_

### Screenshots

![win_flash_error](https://github.com/adafruit/tinyuf2/assets/16520359/73db6490-7e70-405b-9826-856da7f9f7e6)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the `tud_msc_write10_complete_cb` callback in the bootloader code and compare its reboot timing with the referenced `fat.c` and `utils.c` implementations. Reproduce the drag-and-drop flash on Windows 10 or 11, then verify that the board reboots successfully without showing the 0x800701B1 error dialog.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.