2022-10-13 05:11 PM
Hi
I'm new to STM32, I'm jumping from Arduino, and I'm out of my depth, perhaps I can humbly ask for some help.
I've done basic projects with the Nucleo board, and I wanted to give a try with a simple code on a barebone chip
I have this STM32F401CBU6 on UFQFPN-48, mounted on a Proto-Advantage SMT to Breadboard adapter, naked, just the MCU, no decoupling capacitors, pull-down resistors, etc., just naked.
I intend to put it on my breadboard, power it with a 3.3V Power Supply, and program it to blink a LED.
The code will be written with the CubeIDE and loaded via a Nucleo 64 reference board UM1724, which has an integrated STLink that according to the documentation, can be decoupled for the onboard STM32 target (by removing some header pins) and then used to program an external STM32 via SWD
Chapter 3.13 of the IC F401xB datasheet (that is the external MCU I'm using) talks about the power scheme, and I was wondering:
To just power on the MCU and receive SDW program, do I need to provide power to all VDDs or just VBAT?
What would be the bare minimum circuit that would let me read/write registers, load firmware, etc?
I know, out of my depth, but perhaps I can find my way in this maze.
Solved! Go to Solution.
2022-10-15 04:02 PM
Forgot to say, I can power this with the 3.3V output from a Nucleo 64 board, or from a buck converter I have.
The buck converter is model DPS5005 fed by a 14.4V Li-ion 4S pack I made myself. Definitely not lab-grade, but perhaps enough.
These are the specs of the DPS5005:
---------
Input voltage: 6-55V
Output voltage: 0V-50.00V
Output current: 0-5.000A
Output power: 0-250W
Output voltage resolution: 0.01V
Output current resolution: 0.001A
Output Voltage accuracy: +/- (0.5% + 1 digit)
Output Current accuracy: +/- (0.5% + 2 digits)
2022-10-16 02:19 AM
Put a 4-pin connector for programming/debug: Vdd, SWDIO, SWCLK and GND.
You only need 2 boot modes - user Flash and system ROM, selected with BOOT0. Pull it low with 20..100k resistor. Pull BOOT1 low with 100k.
Put at least one LED on the board connected to some port pin. Think of serial port at least.
Still, it won't be any better than the BluePIll.
A good, cost-effective alternative to BluePill with Chinese STM32F103-alike chip is the BlackPill with (hopefully) real STM32F401 at < 3.5 USD. F401 has USB bootloader, so no other stuff (like ST-Link or USB-serial) is required to program it.
2022-10-16 03:20 AM
> Put a 4-pin connector for programming/debug: Vdd, SWDIO, SWCLK and GND.
I would add NRST, too.
I would also think about the role of VDD - it may be a power connection, or it may be just so that the STLink can measure the target's VDD (which influences programming algorithm at low voltages, or with the galvanic-decoupled STLink it provides the required output level), or it may be unwanted (if both STLink and the target connects this pin to their respective power rails while both being powered from a different source).
You may want to put signals on this connector in a particular order, eg. as they are on the Nucleo board. Even if you want to put them to some other order, it's a good idea to place GND in between SWDIO and SWCLK, so that it shields one from the other if a flat cable is used.
Don't use long cables, 15 cm should be mostly it.
But if you don't intend to build a PCB, just use the breadboard, these remarks are not that important.
OTOH, I hate solderless breadboards and recommend you to avoid them.
> Pull BOOT1 low with 100k.
BOOT1 = PB2, see datasheet.
As long as you don't intend to use the bootloader, just ground BOOT0 and you can forget about BOOT1.
> didnt think about that, how easy/hard is it to spot a fake?
I don't know, I don't have first-hand experience. Based on what I read (including the link I gave and other related threads on that forum), some fakes are very convincingly looking. They may be OK for hobby use, but ST's tools understandably try to detect them and refuse to work with them.
JW
2022-10-16 05:04 AM
Ill add two more pins on the debug interface.
(Found my BOOT1 pin, as pointed out by another commenter here, the datasheet says it was PB2)
2022-10-16 05:14 AM
NRST is there, I added a cap and a momentary switch. I will put them in the same order, with GND in between. I dont intend to do a PCB with this schematic, but Ill keep in mind your suggestion regarding length, etc.
2022-10-16 10:00 PM
If you have bad luck and MCU wil be a counterfeit, it is posible desold it and sold oriinal MCU.
2022-10-17 04:13 PM
Any suggestions regarding my VREF+ ? is the connection correct in my schematics?
2022-10-17 08:59 PM
Finally !!. It worked!
I was able to power up my STM32F401CBU6 MCU "minimum circuit" and program it with a Nucleo 64 acting as ST-Link.
At first, I was getting "Error: failed to erase memory" when flashing from CubeIDE, and I was not being able to remove the write protection on the chip with CubeProgrammer using my Mac, so I used the old STLink Utility on a Windows PC and was able to remove the write protection and then erase the whole chip,, after that, the CubeIDE worked like a charm, and also the CubeProgrammer
I took some of the suggestions from this thread and experimented a bit. I realized that I didn't need the reset button, just a cap to ground, and I also didn't need the BOOT0 switch, pulling down BOOT0 was enough.
I added a LED with a current limiting resistor so I could check if my toggle-a-led code worked (I'm using the HAL library)
Here is the video:
The blink works without the Nucleo board, I just left it there for show and because I'm using 3.3V from it.
This is my final schematic,, in case anyone at some point wishes to try the same thing I did:
Thanks everyone !!!! Now that I have a barebone MCU working, I will move forward to other tests.