Page 1 of 1

[SOLVED] Maple DFU Bootlader 2.0 upload code

Posted: Tue Mar 10, 2020 3:58 pm
by Shumnee
Hey!

Having troubles with Bluepill board with Maple DFU Bootlader 2.0.
I'm using latest Arduino_STM32 core and Arduino IDE v.1.8.12.
I successfully burned the bootloder with ST-Link v2 and "boot0" pin high, installed drivers from Arduino_STM32-master\drivers\win, connected micro-USB. Device manager showed me "Maple DFU" (with no COM port it brackets).
Now in Arduino IDE if I choose Board->Generic STM32 F1 series and Upload method->Maple DFU Bootlader 2.0, get this error message:

Code: Select all

Resetting to bootloader via DTR pulse
Reset via USB Serial Failed! Did you select the right serial port?
Searching for DFU device [1EAF:0003]...
Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming...

dfu-util - (C) 2007-2008 by OpenMoko Inc.
This program is Free Software and has ABSOLUTELY NO WARRANTY

Couldn't find the DFU device: [1EAF:0003]
timeout waiting for COM9 serial
I also tried older package "http://dan.drown.org/stm32duino/package ... index.json" with "generic_boot20_pc13.bin" bootloader, Device Manager shows "Maple Serial (COM#)" and code uploads successfully through USB.
But I need latest Arduino_STM32 core since it based on HAL libraries. How can I burn my Bluepill with USB connector in this case, what settings should be installed? Maybe can use another method of uploading through USB?
Any help would be great!

Re: Maple DFU Bootlader 2.0 upload code

Posted: Tue Mar 10, 2020 5:52 pm
by ag123
if you use roger's (libmaple) dfu usb boot loader with the official core. compile the sketch, i.e. click verify.
press reset before you click download, once it starts blinking you have 6 seconds to click download.

that DTR magic sequence is a feature of libmaple (roger's) core. only if you make a libmaple sketch compile do you get that DTR magic sequence.

Re: Maple DFU Bootlader 2.0 upload code

Posted: Tue Mar 10, 2020 6:22 pm
by Shumnee
Nah, that didn't work.
IDE clearly wants my bluepill to be recognized as COM-port. With "maple_mini_boot20.bin" burned in cannot achieve that :(

Re: Maple DFU Bootlader 2.0 upload code

Posted: Tue Mar 10, 2020 6:32 pm
by ag123
there are some steps needed on windows to 'enable' (it looks like 'install' the dfu driver but is really just enable) dfu on windows
check out the wiki in roger's core, there are some steps to follow

Re: Maple DFU Bootlader 2.0 upload code

Posted: Tue Mar 10, 2020 8:39 pm
by Juraj
you don't need boot0 HIGH for programming with a programmer. the jumper is for ROM bootloader listening on Serial. did you return the jumper to LOW position?

and then there was this problem viewtopic.php?f=59&t=218

Re: Maple DFU Bootlader 2.0 upload code

Posted: Wed Mar 11, 2020 7:40 am
by BennehBoy
ag123 wrote: Tue Mar 10, 2020 5:52 pm that DTR magic sequence is a feature of libmaple (roger's) core. only if you make a libmaple sketch compile do you get that DTR magic sequence.
This should also work with STM's core, I know as I helped port the code to detect this from STM32GENERIC -> https://github.com/danieleff/STM32GENER ... _if.c#L257

Frederic has made it a bit more elegant since the original PR and abstracted it into a hook, see the code here -> https://github.com/stm32duino/Arduino_C ... _if.c#L225

And here -> https://github.com/stm32duino/Arduino_C ... otloader.c

Re: Maple DFU Bootlader 2.0 upload code

Posted: Wed Mar 11, 2020 8:35 am
by stevestrong
Shumnee wrote: Tue Mar 10, 2020 3:58 pm But I need latest Arduino_STM32 core since it based on HAL libraries.
Just to clarify some things:
The Arduino_STM32 core is libmaple based: https://github.com/rogerclarkmelbourne/Arduino_STM32
The official core from STM is Arduino_Core_STM32 and is based on HAL: https://github.com/stm32duino/Arduino_Core_STM32

And you did not tell us which board are you using.

Re: Maple DFU Bootlader 2.0 upload code

Posted: Wed Mar 11, 2020 8:56 am
by fpiSTM
@stevestrong
Shumnee wrote: Tue Mar 10, 2020 3:58 pm I'm using latest Arduino_STM32 core and Arduino IDE v.1.8.12.
It is mentioned in the OP , and it use dandrown boards packages

anyway it seems there is a confusion about the HAL usage.

Re: Maple DFU Bootlader 2.0 upload code

Posted: Wed Mar 11, 2020 10:18 am
by Shumnee
Thanks all for replies!
OK, here's what I did exactly:
- downloaded and installed official core from STM "Arduino_Core_STM32" https://github.com/stm32duino/Arduino_Core_STM32;
- burned "generic_boot20_PC13.bin" bootloader with ST-Link (boot0 is 0, boot1 is 0);
- plug usb, Device Manager sees "Maple Serial (COM7)";
- uploaded HelloWorld.ino sketch (Upload method->Maple DFU Bootlader 2.0);
- some chaotic random pushes on reset;
- now Device Manager sees "STM Serial (COM9)";
- uploaded sketch again through COM9, It works.

Sketch was

Code: Select all

void setup() {
  pinMode(PC13, OUTPUT);
  Serial.begin(9600); // Through micro-USB
  Serial1.begin(9600); // A9 is TX, A10 is RX
  //Serial2.begin(9600); // A2 is TX, A3 is RX
  //Serial3.begin(9600); // B10 is TX, B11 is RX
}

void loop() {
  HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
  delay(200);                
  Serial.println("beep"); 
  Serial1.println("beep"); 
  //Serial2.println("beep"); 
  //Serial3.println("beep"); 
}
Serial2 or 3 gives me error "undefined reference to `Serial2'" (they worked with Roger's libmaple based "Arduino_STM32" core) - maybe someone knows why?
Didn't manage to work with "maple_mini_boot20.bin", for the rest I guess problem kinda solved

Upd.: Had to define:
HardwareSerial Serial2(PA3,PA2);
HardwareSerial Serial3(PB11,PB10);

Re: [SOLVED] Maple DFU Bootlader 2.0 upload code

Posted: Wed Mar 11, 2020 11:48 am
by fpiSTM
Enable the USB CDC to the menu then you will be able to flash again