[SOLVED] Problems with the bootloader

STM32duino bootloader aka Maple bootloader
bianchifan
Posts: 78
Joined: Sun Oct 18, 2015 1:27 pm
Location: W'tal, Germany

[SOLVED] Problems with the bootloader

Post by bianchifan » Tue Jan 10, 2017 10:18 am

Uploading sketches via ST-Link is still easy goin :)
Using bootloader instead still same old ... :((

From time to time - maybe 20-30% - the loader doesn't find its beliked DFU although the port is still visible/listed
z1.jpg
z1.jpg (94.03 KiB) Viewed 941 times
EVERY time DFU is found there is a reset problem at the end.
z2.jpg
z2.jpg (94.73 KiB) Viewed 941 times
The system enumerates up to 4 times until the connection becomes stable.
Synchronizing a terminal is horrible, only practical way is a restart of IDE's serial monitor after the connection became stable.

stevestrong
Posts: 1601
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Blue pill's Bootloader - what's goin' on .. ???

Post by stevestrong » Tue Jan 10, 2017 10:43 am

Which OS?

bianchifan
Posts: 78
Joined: Sun Oct 18, 2015 1:27 pm
Location: W'tal, Germany

Re: Blue pill's Bootloader - what's goin' on .. ???

Post by bianchifan » Tue Jan 10, 2017 11:03 am

stevestrong wrote:Which OS?
Win7-64 (on Ubuntu something went wrong on updating Arduino 1.8 :( )

User avatar
Pito
Posts: 1522
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Blue pill's Bootloader - what's goin' on .. ???

Post by Pito » Tue Jan 10, 2017 12:08 pm

The resetting error at the end should be ok people say. I saw it when in "good period" and "bad period" too.
I have periods where the upload works 99% fine, and periods where I have to press reset during upload all the time (with a correct USB clock). Still thinking what could be the cause for such changes in the DFU mood. Win7-64 here, latest hw, USB3.0, USB2.0.
Pukao Hats Cleaning Services Ltd.

stevestrong
Posts: 1601
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Blue pill's Bootloader - what's goin' on .. ???

Post by stevestrong » Tue Jan 10, 2017 12:41 pm

I had problems mostly when the executed code blocks the on-chip USB serial to work, i.e. nested ISRs.
But most of the time is the Java running in the Win10 background which becomes unstable...

User avatar
mrburnette
Posts: 1803
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Blue pill's Bootloader - what's goin' on .. ???

Post by mrburnette » Tue Jan 10, 2017 1:13 pm

Even the Maple Mini will fail on Windows once-in-a-while. While I have not been on Windows in a year, my very well tuned Win8.1 box used to fail perhaps 4 or 5 time per 100 (guess ... I did not count every failure.) Just when you though everything was perfect - poof, an upload FU.

Point is, it is not a Red_Pill, Blue_Pill, Black_Pill, or Maple Mini issue ... it is the technology. If you must have 100% upload reliability, you are using the wrong technology. While Linux hosting is better IMO than Windows 8/10, it is still not perfect; an occasional hiccup will happen.

My overall recommendation:
--> Develop and test on a Maple Mini, the de facto standard
--> Migrate/Port to the Red/Blue/Black boards for inexpensive projects and deployments where having a bootloader is of no value

Ray

User avatar
RogerClark
Posts: 6877
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Blue pill's Bootloader - what's goin' on .. ???

Post by RogerClark » Tue Jan 10, 2017 9:18 pm

The way the bootloader and Core reset the USB is basically a hack that we had to use because the Blue Pill etc do not have the necessary additional hardware to reset the USB correctly.
This hack, breaches the USB spec, so is not guaranteed to work.

The Blue Pill also has another design fault as it uses a 10k USB pull up resistor, but the USB spec requires 1.5k

The Maple mini has the additional USB reset hardware, and uses the correct pull up, and is therefore far more reliable.


I use all sorts of MCUs for work, and find even expensive commercial SWD programmers sometimes fail to upload, and I am forced to powercycle the MCU, and try again.

dackley
Posts: 12
Joined: Mon Jul 17, 2017 9:43 pm

Re: Blue pill's Bootloader - what's goin' on .. ???

Post by dackley » Mon Jul 17, 2017 10:38 pm

Hopefully someone has already solved/fixed this issue - but I wasn't able to find such a solution.
ISSUE:
I have a similar problem with the Blue Pill bootloader running on Windows 10 x64.
I downloaded the generic_boot20_pc13.bin per the instructions at http://wiki.stm32duino.com/index.php?ti ... bootloader.
Before loading the first sketch, the Blue Pill shows up in the Device Manager as "Atmel USB Device - Maple DFU" device. But the Arduino v1.8.3 IDE expects/requires the Blue Pill to be a virtual COM port device to download a sketch (i.e. "Ports(COM & LPT) - COMx" under the Device Manage).
In searching the web I found a suggestion to "push reset button after the sketch has compiled and before the download starts". With luck one can push the reset button at the right time during the Arduino compile/download process to make this work. Then, once one has successfully downloaded their first sketch, the Blue Pill shows up in as a "Ports(COM & LPT) - COMx" device. This allows the Arduino IDE to properly download any subsequent sketch. The problem seems to be that on reset the bootloader expects a sketch to be present before it forces the re-enumeration to switch from being a "Maple DFU" device to a "virtual COM" device, which is what the Arduino IDE expects/requires for downloading a sketch.
SUGGESTION:
Eliminate this initial sketch download issue/problem by Including a dummy sketch (e.g. simply blinks the LED) as part of the bootloader download process. Thus on reset the bootloader will always find a sketch to run and will always force a re-enumeration to switch from being a "Maple DFU" device to a "virtual COM" device.

User avatar
RogerClark
Posts: 6877
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Blue pill's Bootloader - what's goin' on .. ???

Post by RogerClark » Tue Jul 18, 2017 12:19 pm

The idea of including a dummy sketch has already been discussed.

I have a method to do this, but I don't have time to make the change at the moment

universam10
Posts: 19
Joined: Sun Jan 03, 2016 8:35 am
Location: Germany

Re: Blue pill's Bootloader - what's goin' on .. ???

Post by universam10 » Tue Jul 18, 2017 9:09 pm

I can confirm, I always have to press the reset button on the blue pill for the upload process to find the dfu.
I'm on Win10/64Bit

From my work on IT i know that MS changed the USB driver framework on W10/64Bit and a lot of low level stuff is broken or behaves now differently. I would bet that the hack doesn't work anymore like it used to.

Post Reply