I can't get my custom STM32F407 board's USB to work - Page 1
Forum section: electronics / projects

author: iamericmin
author_rank: Contributor
timestamp: December 15, 2020, 04:10:20 pm
content: Hello guys,I am currently making a scratch-built STM32 board. I soldered on an STM32F407VET6 onto a QFP100 breakout board and I'm wiring together a minimal system on a through-hole protoboard. I used this schematic(https://stm32-base.org/assets/pdf/boards/original-schematic-STM32F407VET6-STM32_F4VE_V2.0.pdf) of a cheap STM32 board I bought as a reference design and also constantly referred to ST's official design guidelines, linked at the bottom of this post. I believe I made a proper "minimal setup" required for my STM32 to run properly. However, when I plug it into my computer, nothing is detected. I know I have the proper USB drivers installed because my STM32 discovery board works fine. Here is what I've done so far:- check my STM32 soldering job for any shorts. I don't see any.- I took a multimeter and probed through my circuit, checking all signal lines such as USB, the 8MHz and 32KHz crystals, power supply, etc.- I added 2.2uf caps to each of the two VCAP pins, connecting the other legs to ground. Also added 22Ohm resistors to the USB signals. 22pf caps to the 8MHz crystal, 12pf caps for the 32KHz crystal.- added switches for BOOT0, BOOT1 and a reset button, and they all work as they should according to my multimeter. I also checked multiple times to make sure the boot config jumpers were in the right position.- checked if all my resistors have the proper values. They do.Here's what I didn't do so far:- I don't have an oscilloscope or signal probe, so I can't actually check for a pulse of any kind. The only visual feedback I get is the LED from my power supply, which works fine.- I didn't add a JTAG/SWD header. I figured I wouldn't need it since for now, I just want to see if my laptop detects the STM32's USB DFU mode when it's plugged in.- I didn't add all the decoupling caps to each of the VDD/VSS pins on my chip. I figured it's not absolutely necessary for function, since I've gone without them in AVR chips many times without issues.After many hours of head-scratching and frustration, I'm gassed out. I can't possibly think of anything else I might've missed. Maybe my chip is defective/fried, but I didn't do anything to it that could've fried it. So please, help a brother out! I am pretty new to STM32s, so thank you for staying with me and any help is appreciated!Thanks!ST's design guide for STM32f407https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwjb-onr8M_tAhVEMd4KHQJ8A9sQFjAAegQIAxAC&url=https%3A%2F%2Fwww.st.com%2Fresource%2Fen%2Fapplication_note%2Fdm00115714-getting-started-with-stm32f4xxxx-mcu-hardware-development-stmicroelectronics.pdf&usg=AOvVaw38_sGpoASxqYhiRULvV579P.S. I figured photos wouldn't be much help at all since my wiring job is absolutely atrocious and it wouldn't give any useful info. But if y'all want it, I can certainly post it here. Oh also, in case you're curious, I'm making this custom board to prototype my design for a custom PCB using the same chip.

author: moffy
author_rank: Super Contributor
timestamp: December 16, 2020, 10:54:55 am
content: I would definitely mount a JTAG/SWD header and use a JTAG/SWD debugger programmer.1. You also need to check that the oscillator is oscillating and that power/gnd is getting to the appropriate pins.

author: Jeroen3
author_rank: Super Contributor
timestamp: December 16, 2020, 12:07:47 pm
content: Can you at least see the power usage jump up and down?When in bootloader mode it should check and reboot continously.See 26.1.2 Bootloader selection:https://www.st.com/resource/en/application_note/cd00167594-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf

author: prasimix
author_rank: Unknown
timestamp: December 16, 2020, 12:16:22 pm
content: It is not clear did you connect Vdda, Vref section or not. As far as I know STM will not start without that.

author: iamericmin
author_rank: Contributor
timestamp: December 16, 2020, 12:30:53 pm
content: Quote from: moffy on December 16, 2020, 10:54:55 amI soldered a pin header for the SWD signals and tried programming it through my STM32 discovery board's built-in programmer, with no luck. I get errors saying, "no debug probe attached" or something like that. I'll try restarting my computer to see if it changes anything, since it seems like an issue with my computer, not the debugger. Also, I can't check if my oscillator is oscillating since I would need an oscilloscope for that, which I don't have. I've checked and i'm sure all the power lines are going to their right spots. The chip doesn't get hot when powered.

author: iamericmin
author_rank: Contributor
timestamp: December 16, 2020, 12:41:02 pm
content: Ok now it doesn't even power up, and I have yet to still find why my board isn't working. I'm starting to think it's just my bad soldering job since I followed the official schematics for ST's discovery board.

author: moffy
author_rank: Super Contributor
timestamp: December 16, 2020, 03:58:20 pm
content: What is the current consumption? Do you have a multimeter that can measure Hz? If so can you hook up a divider to the MCU clock and measure the frequency? You need to give quantitative measurements to get the help you want.

author: prasimix
author_rank: Unknown
timestamp: December 16, 2020, 07:22:03 pm
content: Quote from: iamericmin on December 16, 2020, 12:30:53 pmIf you didn't flash firmware that explicitly define use of HSE you cannot see anything with the scope by probing oscillator crystal.

author: aheid
author_rank: Regular Contributor
timestamp: December 16, 2020, 08:24:15 pm
content: Is the crystal and capacitors on the proto board or directly on the breakout board somehow? I seem to recall talk of the STM32 being a bit sensitive to the capacitance when it comesto getting the crystal to oscillate. Wonder if having it on the proto board would add too much capacitance.Not my area of expertise though, and besides matters little if it doesn't even power up...

author: aheid
author_rank: Regular Contributor
timestamp: December 16, 2020, 08:26:48 pm
content: Quote from: prasimix on December 16, 2020, 07:22:03 pmThe USB boot loader tries to configure the HSE clock, at least as far as I could figure from the docs. Assuming the boot pins are set right it.

author: poorchava
author_rank: Super Contributor
timestamp: December 16, 2020, 08:46:51 pm
content: IIRC old discovery boards (F407 is an old part) had an old version of STLink, which has some atrocious shit done in the driver (something like mass storage device communicating over custom service commands in SCSI interface).Try another board. I'd get one of Nucleo boards. They all have STLink v2 or newer and the cheapest L0 and F0 boards go for about 10€.First get connected with a debugger, then debug stuff. If your debugger is correctly recognized and pc talks to it fine, but you still can't connect to the uC - don't count on it working in bootloader mode - something's wrong with hardware design.Every STM32 has a document on ST website called 'Getting started with [part family] hardware design'. Use it as a checklist for what the uC actually needs to work properly.Short version: hook up all VDD, VDDA, VREF and VBAT pins to 3.3V, all VDD, VDDA, VREF- and BOOT0 to gnd. If uC has VCAP pins, then connect capacitor as recommended by hardware design guide (usually 2u2 or 4u7 MLCC). Decouple all power pins with 100n to GND + have bigger cap (like 10u) close by. For USB check if your uC has internal 1k5 pull-up on D- or D+ (i can't remember which - but some STMs don't have it inside and it's required for device to get detected by the host)Hook up swclk, swdio gnd and reset to your STLink. It should work. I have literally dead-bugged a 176pin wfp that way and it worked.

author: thm_w
author_rank: Super Contributor
timestamp: December 16, 2020, 10:27:09 pm
content: Quote from: iamericmin on December 15, 2020, 04:10:20 pmPhotos are always welcomed.

author: iamericmin
author_rank: Contributor
timestamp: December 17, 2020, 12:49:14 am
content: Quote from: poorchava on December 16, 2020, 08:46:51 pmYour answer gives me a lot of hope. I have one more STM32F4 laying around, and I will give it another go, doing everything you just said. Also, I know the USB lines require differential pairing, so do I need to twist them together? How would I match their impedance since this is not a PCB?Thank you guys. Y'alls advice mean so much to me!

author: tonyh88
author_rank: Regular Contributor
timestamp: December 17, 2020, 02:24:38 am
content: +1 for posting pictures and schematic of what you did exactly. You will need to do this schematic for your future board anyway . It would help alot

author: iamericmin
author_rank: Contributor
timestamp: December 17, 2020, 08:22:47 am
content: Quote from: tonyh88 on December 17, 2020, 02:24:38 amI've attached a PDF of the schematic. unfortunately I can't add pictures since the file size is too large, and I doubt they'll be of any help. My wiring is very messy.For my actual PCB, I will add IO pins, an SPI flash chip, micro SD socket, and a lipo charging circuit.