Operating System
Windows 11
Commit SHA
Release 0.20.0
Board
nanoCH32V203 & WeActStudio BluePill Plus CH32
Firmware
Here is a repo containing the bare dfu example found in examples/device/dfu that was slightly modified to work with MounRiver Studio II. https://github.com/Devin-goBILDA/CH32V203-TinyUSB-DFU-Issue.
This issue is reproducible with the stock examples/device/dfu example code running on a ch32v203.
What happened ?
I am in the process of creating a DFU bootloader with using both TinyUSB and a CH32V203. I setup TinyUSB with my MounRiver Studio II project and compiled the dfu example code found in examples/device/dfu. I then navigated to https://devanlai.github.io/webdfu/dfu-util/ in order to transfer few small files (512 bytes), that worked flawlessly! I then continued to setup my bootloader project and when it was finally time to send a relatively basic firmware file (roughly 9000-ish bytes) the transfer would hang. Upon using the debugger I noticed that every time it gets hung on a TU_BREAKPOINT in the dcd_stm32_fsdev.c.
Link to code in 0.20.0: dcd_int_handler
void dcd_int_handler(uint8_t rhport) {
uint32_t int_status = FSDEV_REG->ISTR;
/* Commented out Code */
if (int_status & USB_ISTR_PMAOVR) {
TU_BREAKPOINT(); /* <- This is where is breaks */
FSDEV_REG->ISTR = (fsdev_bus_t)~USB_ISTR_PMAOVR;
}
}
Here is exactly where the PMAOVR is defined: USB_ISTR_PMAOVR
#define USB_ISTR_PMAOVR ((uint16_t)0x4000U) /*!< DMA OVeR/underrun (clear-only bit) */
I am not super familiar with the lower level aspects of USB, but I would love to help in any way possible.
How to reproduce ?
How to upload data and cause the crash
- Plug your MCU in via USB and go to https://devanlai.github.io/webdfu/dfu-util/
- Connect to the board, select EEPROM or FLASH (Both lead to the same outcome), select this file: Large File (10240 bytes).txt , then click "Download"
- While transferring the text file it will freeze and display this message "Error during DFU download: DFU GETSTATUS failed: ControlTransferIn failed: NetworkError: Failed to execute 'controlTransferIn' on 'USBDevice': A transfer error has occurred."
Note: I tested the dfu transfer with both dfu-util and the webdfu website, they both resulted in the same outcome.
Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)
Both debug logs ended in a DFU transfer failure. The bottom of the logs is the point at which the communication failed
Debug Log.txt
Debug Log (TU_BREAKPOINT Disabled).txt
Screenshots
I have checked existing issues, discussion and documentation
Operating System
Windows 11
Commit SHA
Release 0.20.0
Board
nanoCH32V203 & WeActStudio BluePill Plus CH32
Firmware
Here is a repo containing the bare dfu example found in examples/device/dfu that was slightly modified to work with MounRiver Studio II. https://github.com/Devin-goBILDA/CH32V203-TinyUSB-DFU-Issue.
This issue is reproducible with the stock examples/device/dfu example code running on a ch32v203.
What happened ?
I am in the process of creating a DFU bootloader with using both TinyUSB and a CH32V203. I setup TinyUSB with my MounRiver Studio II project and compiled the dfu example code found in examples/device/dfu. I then navigated to https://devanlai.github.io/webdfu/dfu-util/ in order to transfer few small files (512 bytes), that worked flawlessly! I then continued to setup my bootloader project and when it was finally time to send a relatively basic firmware file (roughly 9000-ish bytes) the transfer would hang. Upon using the debugger I noticed that every time it gets hung on a TU_BREAKPOINT in the dcd_stm32_fsdev.c.
Link to code in 0.20.0: dcd_int_handler
Here is exactly where the PMAOVR is defined: USB_ISTR_PMAOVR
I am not super familiar with the lower level aspects of USB, but I would love to help in any way possible.
How to reproduce ?
Using MounRiver Studio II
Only using the TinyUSB DFU Example
How to upload data and cause the crash
Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)
Both debug logs ended in a DFU transfer failure. The bottom of the logs is the point at which the communication failed
Debug Log.txt
Debug Log (TU_BREAKPOINT Disabled).txt
Screenshots
I have checked existing issues, discussion and documentation