Generic board not shown as USB device after installing v2 bootloader

Apple Mac OSX
Chacal
Posts: 13
Joined: Tue Nov 17, 2015 9:21 pm

Generic board not shown as USB device after installing v2 bootloader

Post by Chacal » Tue Nov 17, 2015 9:46 pm

Hello all,

Went through everything I found about OS X, bootloaders & generic boards, but still couldn't get answer to my problem, so here goes..

My setup:
- Generic STM32F103C8T6 board from AliExpress (http://www.aliexpress.com/item/STM32F10 ... 73606.html)
- OS X 10.9.5 on Macbook Pro (MacBookPro10,1)
- Arduino IDE 1.6.5 with STM32 files installed a couple of days ago
- Generic FTDI (clone) adapter from AliExpress

Steps I have taken:
1. Connected the FTDI adapter to the board's A9 & A10 pins
2. Set BOOT0 jumper high, reset the board to get STM's bootloader running
3. Flashed generic_boot20_pc13.bin v2 bootloader to the board successfully (using stm32flash)
4. Set BOOT0 low again
5. Disconnected FTDI adapter from the board (powered off the device)
6. Connected the USB cable

After this I get six(?) fast flashes of the board's LED and then it continues flashing slower (about twice a second maybe?). I presume this is the bootloader "speaking". So as far as I have understood, all is good.

The problem is, however, that on OS X there is nothing shown. "system_profiler SPUSBDataType" doesn't show the board nor is it shown as /dev/tty* or /dev/cu* like the FTDI adapter is. Sure enough the board is not listed in the IDE's Port list.

I read from multiple places that I should upload an empty sketch to the board to get the USB working, but how can I do it as the board is not recognized by the OS at all? (I can upload e.g. Blink sketch just fine using IDE & FTDI cable & Serial upload, but that of course erases the bootloader..)

What have I missed?

Chacal
Posts: 13
Joined: Tue Nov 17, 2015 9:21 pm

Re: Generic board not shown as USB device after installing v2 bootloader

Post by Chacal » Tue Nov 17, 2015 9:58 pm

OK... This turned out to be a simpler problem than I thought.

Just after posting I just thought about trying a different USB cable and voilà it just worked! Apparently the cable I used earlier doesn't have all wires connected or something.. :/

So now I'm able to upload also by selecting "STM32duino bootloader" from the Upload method list. Only manual step left is to hit the board's reset button just at the right time when the sketch starts uploading - otherwise the bootloader is not yet ready or has already started running the previously uploaded sketch.

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

Re: Generic board not shown as USB device after installing v2 bootloader

Post by mrburnette » Tue Nov 17, 2015 10:37 pm

Chacal wrote: <...>
Only manual step left is to hit the board's reset button just at the right time when the sketch starts uploading - otherwise the bootloader is not yet ready or has already started running the previously uploaded sketch.
Even the Maple Mini on Windows (the configuration which is likely the de facto standard) still requires use of the reset on occasions. I've come to just expect that 10% of the time, I'm going to have to manually do something.

Congrats on your build.

Ray

jcw
Posts: 171
Joined: Mon Oct 26, 2015 8:16 am

Re: Generic board not shown as USB device after installing v2 bootloader

Post by jcw » Tue Nov 17, 2015 11:49 pm

mrburnette wrote:I've come to just expect that 10% of the time, I'm going to have to manually do something.
If cars or planes had this failure rate... ;)

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

Re: Generic board not shown as USB device after installing v2 bootloader

Post by RogerClark » Wed Nov 18, 2015 2:21 am

jcw wrote:If cars or planes had this failure rate... ;)
Yes, but that's what they always say about computers.

And if planes had the failure rate of cars, no one would fly in them.

Chacal
Posts: 13
Joined: Tue Nov 17, 2015 9:21 pm

Re: Generic board not shown as USB device after installing v2 bootloader

Post by Chacal » Wed Nov 18, 2015 5:39 am

Chacal wrote:Only manual step left is to hit the board's reset button just at the right time when the sketch starts uploading - otherwise the bootloader is not yet ready or has already started running the previously uploaded sketch.
I fiddled a bit more with this and actually got the auto-reset-before-upload work by just adjusting the delay for the custom upload-reset command in maple_upload script. I had to increase the delay from 750ms to 1200ms, but now it hasn't failed at all (for about 10 or so uploads..)

All in all, as a beginner with STMs, I have to say that I'm very impressed about the work you have done! If I were STM I'd be here 24/7 helping all this effort to lower the barrier of entry to my chips.. :)

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

Re: Generic board not shown as USB device after installing v2 bootloader

Post by RogerClark » Wed Nov 18, 2015 6:11 am

I had to increase the delay from 750ms to 1200ms
OK.

I deliberately made this configurable (albeit you need to change one of the files, as there appeared to be a maximum and minimum value which would work.

I don't think it worked on my mac with values lower than around 500ms and for some reason (I can't remember why), it may not work if the value is too high.

Its a bit of a hacky work around really, as what I need to do is recompile DFU upload to include a longer timeout value (on OSX and Linux)

On Windows, I"m using the binary that was originally compiled by LeafLabs, who designed the Maple mini, and think they did some modifications to the PC version of dfu-util.exe, which add a internal re-try / timeout.

Unfortunately, I don't think they ever made their mod's public :-(


Anyway, as long as its now working for you....

PS. We've never had any interest or support from STM as far as I know.

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

Re: Generic board not shown as USB device after installing v2 bootloader

Post by mrburnette » Wed Nov 18, 2015 2:55 pm

Chacal wrote: <...>
All in all, as a beginner with STMs, I have to say that I'm very impressed about the work you have done! If I were STM I'd be here 24/7 helping all this effort to lower the barrier of entry to my chips.. :)
I'd be very surprised if STM even had a push-pin for us on their global interest board. Even with a few hundred members and my personal appetite to purchase STM32F103 boards in 10X quantity, our consumption is below the noise level. STM likely gives away more evaluation boards in a month than all of us together would consume in several years.

In my mind, I find it very interesting that China is producing so many varieties of STM32 boards. These inexpensive (cheap) boards surely must be an overflow of mainstream production (of the STM32 uC chips primarily), so the flow of silicon from the fabs to the assembly plants must be healthy.

Ray

jstevewhite
Posts: 2
Joined: Thu Dec 29, 2016 9:06 pm

Re: Generic board not shown as USB device after installing v2 bootloader

Post by jstevewhite » Thu Dec 29, 2016 9:34 pm

Just joined the forum because I have the same problem, and unfortunately it hasn't been resolved by using a different USB cable.

To be clear, I bought a handful of the cheap 'bluepill' boards on ebay to play with. I can program the daylights out of them with the STLink tool (which I also bought). I've made "blink" work, and the like, using upload method "STLink" in Arduino 1.6.13. I wasn't concerned about the stm32duino bootloader as such until I started trying to do serial 'caveman' debugging (Serial.print("oops");). Turned out the stmlink (duh) doesn't seem to expose serial. So I tried disconnecting the power from the STLink and connecting via USB cable.

I set boot0 to 1, flashed generic_boot20_pc13.bin to the board via stlink & openocd (flash write_image erase generic_boot20_pc13.bin 0x08000000). Reset board, not seen by OS, no lights on PC13. Move boot0 back to 0, reset, get the six quick flashes followed by slower flashing. Connect microUSB, no help. Checked the pullup resistor (assumed that it wasn't the problem because it was detected before I started flashing stuff, but checked it anyway). Still nothing.

I can still plug it into the ST-Link and program in a "blink" sketch and have it work, but I've been completely unable to get the bootloader working so I can directly upload via USB, or find a way to see serial output such that I can talk back to myself for rudimentary sketch debugging or output.

Any thoughts or suggestions?

EDIT: ok, so now I've read another post in the forum and discovered that a sketch has to initiate "Serial.begin" before it shows up. I've uploaded a sketch that includes it, and now the device shows up as a Maple Mini again. However, when I try to upload a sketch, i get DFU errors. I tried the "put it in permanent DFU mode" and have tried five or six times "holding reset button until compilation is nearly done then releasing it", but always get DFU error. What am I doing wrong?

Thanks !

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

Re: Generic board not shown as USB device after installing v2 bootloader

Post by Pito » Thu Dec 29, 2016 11:24 pm

Rather an anecdotal input to this topic - for about 2 weeks I've been working with the 103ZET board. No usb disconnect via a transistor, the resistor on the d+ is 4k7. I did maybe 50 uploads and I had to push the reset button always. Few days back I soldered an external sram on it and in order to remove the older and new solder flux I completely washed the board with isopropyl alcohol, inclusive usb connector pads.
From that time the upload works fine, from maybe 30 uploads all (except one or two) ran first time without the need for pushing the reset button.
Still thinking why this change :) - a conductive flux??
Pukao Hats Cleaning Services Ltd.

Post Reply