stm32duino / Arduino_Core_STM32

STM32 core support for Arduino
https://github.com/stm32duino/Arduino_Core_STM32/wiki
Other
2.8k stars 967 forks source link

Maple upload broken #2436

Closed maxgerhardt closed 2 months ago

maxgerhardt commented 3 months ago

Describe the bug When selecting a Bluepill STM32F103C8 and the Mapple Bootloader 2.0 from here, the STM32Duino core fails to use the correct USB PID/VID of 0x1EAF:0x003 and instead uses 0x0483:0xdf11. Upload subsequently fails to find the correct device.

To Reproduce No source code relevant. Blinky sketch for PC13.

Steps to reproduce the behavior:

  1. Use ST-Link or USB-to-UART adapter to first mass erase the flash
  2. Burn in generic_boot20_pc13.bin
  3. Reboot the Bluepill, "Maple DFU" device shows up (asssumes driver is installed
  4. Select Bluepill C8 and Maple Bootloader 2.0 in the Tool settings
  5. Hit upload
  6. See an invocation of
    "C:\Users\Max\AppData\Local\Arduino15\packages\STMicroelectronics\tools\STM32Tools\2.2.2/win/busybox.exe" sh "C:\Users\Max\AppData\Local\Arduino15\packages\STMicroelectronics\tools\STM32Tools\2.2.2/maple_upload.sh" COM1 2 0x0483 0xdf11 "C:\Users\Max\AppData\Local\Temp\arduino\sketches\68F814A2F7381590CAB9CFF90ED55329/sketch_jun16a.ino.bin"

Get hit with failure

No DFU capable USB device found

(no wonder if you select teh wrong VID/PID)

Expected behavior Uploading with the Maple bootloader actually uses the right PID/VID

Screenshots None

Desktop (please complete the following information):

Board (please complete the following information):

Additional context Add any other context about the problem here.

maxgerhardt commented 3 months ago

And wtf is this doing

https://github.com/stm32duino/Arduino_Core_STM32/blob/b24801b4b473649fb6d5bc51c22a69a64d45b732/boards.txt#L2526-L2528

It spells 0xLEAF but L for sure is not a hexadecimal number, it should be 1EAF

maxgerhardt commented 3 months ago

Oh lookie lookie there, when I change

https://github.com/stm32duino/Arduino_Core_STM32/blob/b24801b4b473649fb6d5bc51c22a69a64d45b732/platform.txt#L113-L114

to be

upload.vid=0x1eaf
upload.pid=0x0003

I do get a successfull upload

grafik

maxgerhardt commented 3 months ago

So obviously, when Tools -> Upload Method --> Maple DFU Bootloader 2.0 is selected, it should use 1EAF:0003 as the VID:PID for DFU-Util. This is probably even irregardless of the selected chip (doesn't matter whether "Generic STM32F103C8" or "Bluepill C8", since the Maple DFU bootloader will always show up as that VID:PID. I'm not sure what this core here is doing using that other 0x0483:0xdf11, because that is the generic "STM Device in DFU Mode" VID/PID, not the one for Maple.

grafik

I'm a bit baffled that the most popular Bluepill board with the most popular USB bootloader can't be used in this core out of the box-

fpistm commented 2 months ago

Hi @maxgerhardt Thanks for reporting this

And wtf is this doing

A typo mistake, sorry for this. I've made a lot of changes to feat new Arduino specification. I've tested the Blue Pill but when rebased and squashed several branches I've made a mistake. I'm only human so please be comprehensive....

I'm a bit baffled that the most popular Bluepill board with the most popular USB bootloader can't be used in this core out of the box-

Same here, this kind of comment is really not constructive and only your opinion. It is a community project and all contributions are welcome (PR, review, discussions,...). Doing my best (alone) ...

Fixed by #2440.