[SOLVED] Custom Board Issues with STM32Generic Bootloader

If you made your own board, post here, unless you built a Maple or Maple mini clone etc
User avatar
primateio
Posts: 61
Joined: Sun Sep 20, 2015 11:17 pm
Location: Midland, Tx
Contact:

[SOLVED] Custom Board Issues with STM32Generic Bootloader

Postby primateio » Sun Sep 20, 2015 11:46 pm

I made a custom board for dev purposes for a larger project I am planning. Basically I cloned the maple mini but used a STM32F103C8 instead of a CB because I got a deal and wont need the extra space. I have the button and LED the same. Button on BOOT0 and PB8, pulled down with the button switching to high. The LED is PB1 and drives on high. I was going to originally put all the USB hardware that is on the Mini, but I saw the STM32duino bootloader, and I wanted to play around and use that instead. Smaller BOM = happier me. There wasn't a variant compiled with the LED and Button pins, so I made my own custom one and compiled it. For the USB, I have a 22 ohm resistor inline on each line (D+, D-) and a 1.5k pullup on D+.

For some reason, when I tried to flash the board with the Python STM32 loader, per the instructions on LeafLabs' website, the led didn't work, although it said it flashed it successfully. Nothing worked. When I plugged it into my Windows 10 laptop via USB, it did not recognize the device (yes, both drivers are installed and tested with a Maple Mini). The USB device says "Unknown USB Device (Invalid Device Descriptor)" in the device manager.

Finally, I tried loading the bootloader using the stm32loader.exe per instructions on the github wiki, and now the led is behaving properly. Quick blinks followed by slower blinks and keeps blinking. However, I keep getting the USB device not recognized and the "Unknown USB Device (Invalid Device Descriptor)" in the device manager no matter what I do.

So now I am down to trying to find the problem. I don't have a scope, I am just a hobbyist. I have checked my design, and it is just like the maple mini except the changes mentioned above, and I used a single LDO for both Analog and digital power. All solders look good, I have a lot of experience hand soldering these small component. I did spend a little more time soldering the STM32 IC because those chips have such a small pitch, it is hard to hand solder, but I don't think I was on them to long.

Anyone have any ideas, or maybe a suggestion of what to try?
Last edited by primateio on Mon Sep 21, 2015 11:26 pm, edited 1 time in total.

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

Re: Custom Board Issues with STM32Generic Bootloader

Postby mrburnette » Mon Sep 21, 2015 2:26 am

Take DC Voltage readings and compare your board to the Maple Mini: two tests, one after powering-up and one in bootloader mode.

Hopefully, something will show up in the comparisons.

Ray

User avatar
primateio
Posts: 61
Joined: Sun Sep 20, 2015 11:17 pm
Location: Midland, Tx
Contact:

Re: Custom Board Issues with STM32Generic Bootloader

Postby primateio » Mon Sep 21, 2015 4:19 am

Thanks mrburnette, ill try that tomorrow. It is getting late and I am tired of messing with this for tonight.

An update though. I can successfully load sketches on to the board via serial using Arduino. Everything I have tried works great, so I am less suspecting of a power issue. However, the uploads were dodgy at first. They work great if I manually wire BOOT0 to 3v3 and toggle reset to ground. So I am guessing my buttons may not be working right or have cold solders. When I designed the button part in Eagle CAD, I didn't leave much room for hand soldering them and I might have gotten a bad solder. I will rework them tomorrow. However, even manually toggling the pins, even though getting a 100% successful serial upload rate with Arduino and stm32flash.exe, I cannot get the bootloader working, even after numerous reflashing with this method.

I noticed another thing. When I tried to run a sketch with PWM on a non PWM pin with an external LED (accident), The sketch didn't start immediately. On reset, it behaved exactly the way it does when going into what I thought was the bootloader. The onboard LED blinks rapidly. Now, I am beginning to think that is an error of some kind and the bootloader was never initializing.

I did notice something that I believe may be part of, if not the entire problem. When I run the STM32flash.exe to load the bootloader, it reports 128kb flash when the c8 only has 64kb. This might not be an issue, but it is the first thing I have found that doesn't add up. I am going to recheck all of my configs and recompile the bootloader tomorrow and see if I can find anything else.

SIDE NOTE
For some reason, I assumed that the generic STM32F103c boards had the same pin map as the maple mini since they are based on the maple mini and use the same IC. They do not ha ha. I was wondering why my leds were not working yet serial was. A quick for loop toggling each pin and reporting the pin being toggled told me they were different quickly. I rewrote my own variant based on the generic F103c but with a maple mini pinmap. Solved the issue. I might make some pinmap graphics to add to the github readme or wiki when I get this solved so others dont run into the same issue.

enif
Posts: 32
Joined: Wed Jul 29, 2015 4:49 pm
Location: Switzerland
Contact:

Re: Custom Board Issues with STM32Generic Bootloader

Postby enif » Mon Sep 21, 2015 4:42 am

As to your side note: I also ran into the same problem with the difference in the pin numbering between the Maple Mini and the (generic) Blue Pill, see here.

victor_pv
Posts: 1091
Joined: Mon Apr 27, 2015 12:12 pm

Re: Custom Board Issues with STM32Generic Bootloader

Postby victor_pv » Mon Sep 21, 2015 4:59 am

Windows will show unknown usb device if the board usb port is not working right for ANY reason.
Could be enumeration, could be the wrong speed in the usb peripheral, could be something wrong in the code...

I would check that your multimeter measures exactly 22ohm from the usb connector contacts to the MCU corresponding pins, and do not measure short to VCC or GND.
And on D+ check that you measure 1.5k to Vcc.

Check that you are connecting the right mcu pins for D- and D+, perhaps at some point you design got the mcu pins connected to the wrong usb lines.
Are you using a 8Mhz xtal? if not, you need to make changes to your pll multiplier to make sure you run the MCU at 72Mhz, otherwise the usb peripheral will not work. It can work with a main clock of 48Mhz too, but you need to change the usb clock divider in the code too. Those are the only 2 valid speeds for the USB peripheral to get the right clock.

I dont remember if the bootloader by default works with a button active high or active low. Check what the mini schematic shows, whatever the mini has is the default. That can be changed though, I have done it for some boards that had the buttons the opposite way.

Also, I compiled one or 2 times with gcc 4.9, and the bootloader did not work. I never looked into it and just compiled with 4.8.3 and that worked fine.

To discard any compilation errors, I would upload one of the compiled bootloaders for generic boards from Roger's repo. We modified the bootloader to enabled the internal pull or pull down for the button, so if a pin is left floating, it will read like button not pressed, so you can use a bootloader compiled for a button in a different pin and leave the pin floating, and the bootloader should still work fine. And specially should be detected by windows, no matter what with the button.
By the way, you installed and tested your maple drivers with a maple board right? just to confirm the drivers actually work and load right.

Finally, about the 128kb, that is a nice free upgrade courtesy of ST. All the c8 we have checked so far had 128KB in reality, enjoy ;)

User avatar
primateio
Posts: 61
Joined: Sun Sep 20, 2015 11:17 pm
Location: Midland, Tx
Contact:

Re: Custom Board Issues with STM32Generic Bootloader

Postby primateio » Mon Sep 21, 2015 11:25 pm

victor_pv wrote:Also, I compiled one or 2 times with gcc 4.9, and the bootloader did not work. I never looked into it and just compiled with 4.8.3 and that worked fine.


YES!!! I compiled with cygwin with 4.9. I also compiled the pa9 bootloader and tried that with no success early on, so I assumed it was a hardware problem. I just tried the precompiled pa9 on github and it worked flawlessly. So I assume this is the problem, or some other compilation issue. Thank you so much!!

I am having hell installing the older version of the gcc-core on cygwin, I am going just do it through windows or on a linux machine now. At least now I know the problem. I owe you a beer.

User avatar
primateio
Posts: 61
Joined: Sun Sep 20, 2015 11:17 pm
Location: Midland, Tx
Contact:

Re: [SOLVED] Custom Board Issues with STM32Generic Bootloader

Postby primateio » Tue Sep 22, 2015 3:38 am

UPDATE:
I tried compiling with windows, but the make file has flags like rm and the like that kept throwing errors. I have WinAVR installed for the make command, but it still didnt work. So I installed gcc-arm-none-eabi 4.8 into cygwin using instructions here http://andybrown.me.uk/2015/03/22/stm32dev-windows/ on step two. Then, I was able to compile my new bootloader variant. I uploaded it to both boards I soldered up and it works flawlessly now. Thank all of you for all of your help. I am new to ARM and the STM32 and I learned a lot through the past 3 days of messing with this.

Here is a picture of my new, fully working boards.
Image

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

Re: [SOLVED] Custom Board Issues with STM32Generic Bootloader

Postby mrburnette » Thu Sep 24, 2015 3:25 pm

Nice design, primateio..

is the BOM less than the Maple Mini clone? Or, are there physical attributes of your board that moved you into the custom boards? Maybe a bit smaller? Hard to tell from the pix. Of course, I do understand the desire to just do this stuff because one can :D

Ray

User avatar
primateio
Posts: 61
Joined: Sun Sep 20, 2015 11:17 pm
Location: Midland, Tx
Contact:

Re: [SOLVED] Custom Board Issues with STM32Generic Bootloader

Postby primateio » Thu Sep 24, 2015 5:03 pm

mrburnette wrote:Nice design, primateio..

is the BOM less than the Maple Mini clone? Or, are there physical attributes of your board that moved you into the custom boards? Maybe a bit smaller? Hard to tell from the pix. Of course, I do understand the desire to just do this stuff because one can :D

Ray


The BOM is less. The maple mini uses 36 components, my design uses 21 (I put a jumper across 2 resistors, it was initially 23) so that is 58% of the maple mini BOM count . I went with a single ldo instead of 2. That also removes a few capacitors. The LDO can output 500 ma which leaves much more room for connecting external peripherals sharing the 3.3v power supply (although more noise for the adc). I designed it for the new stm32duino bootloader instead of the maple mini because the maple mini required quite a few component to handle usb initialization. So the maple mini used 11 components including capacitors, resistors, and transistors, while this design uses 3 resistors only for usb. It does not have protection or a vin port for power supply, (the intention to only supply power from usb or 5v rail exclusively) which removes the need for 2 diodes.

I didn't use all the pins. The ones omitted are for JTAG, and I didn't break out the usb or led pins, because, well, why? I wanted the board to be the same form factor as the Teensy 3.1, which it is. I wanted to preserve the pinout, but I didn't on this one.

However, the main reason I built it is because I am going to be building more advanced boards with built in tft screens, wifi, sd cards, 3g modems, and the like, and I wanted to make sure my more minimal design worked, that my components I chose worked, that I could get the bootloader to work on this minimum usb hardware, and to gain a general understanding of the components and bootloader.

madias
Posts: 812
Joined: Mon Apr 27, 2015 11:26 am
Location: Vienna, Austria

Re: [SOLVED] Custom Board Issues with STM32Generic Bootloader

Postby madias » Thu Sep 24, 2015 6:38 pm

Ok, you built the minimalist mini :)
As I see on your photos, you use very much solder on the smd parts. Have you ever tried something like this? ---> http://www.aliexpress.com/item/HK-MECHA ... 59211.html
Since I use this for smd I wont miss it anymore! Just a little(!) paste on each contact on the blank pcb, place the component, solder it, ready! Even a 64-pin STM32 is soldered within one minute.


Return to “Custom design boards”

Who is online

Users browsing this forum: No registered users and 1 guest