From bluepill + breadboard to pcb. What do I need for the mcu? - Page 1
Forum section: electronics / projects

author: Moriambar
author_rank: Unknown
timestamp: November 09, 2021, 10:38:58 pm
content: Hi.I hope I picked the right section.Anyhow I've experimented with my bluepill with success and now, since I have ~10 of its mcus (bought some time ago) I want to transfer the design to a pcb. I never did this with the stm32 and I only have limited experience with avr.DISCLAIMER:I won't need either the usb support nor the rtcc nor the boot jumpers.So I have a couple of questions to design the final circuit:crystal oscwhen I do my attiny stuff I usually use a couple of 20pF caps from both of the pins of the xtal to gnd, is this correct for the stm32 too? I remember I've seen this design somewhere on the internet, but I don't trust the sourceRTCdo I need to set up the rtc with its crystal or can I avoid it, since I do not plan to use it?BOOT0/1I never used a bootloader and my jumpers have always stayed on 0-0. Can I just tie the pins to GND or do I need some kind of pull down resistor?decouplingI've seen many VDDs and VSSs on the chip: I assume I can tie all the VSS together and the VDDs too; I also imagine that near each vdd pin I need ~100nF decoupling cap right? Do I also need a decoupling cap between vcc and gnd near the swd headers (which I'll use to program the mcu)?powerI am planning to power the circuit from a primary (I'll ask in the future) which will be at 3.6V. Is this ok for the mcu? (the other components are 5V tolerant so no problem there).I am a beginner after allany other things I should be careful about?Thanks

author: langwadt
author_rank: Super Contributor
timestamp: November 09, 2021, 11:36:59 pm
content: you can skip the RTC xtal if you don't need ityou can tie the boot pins directly to ground, but resistors are nice to have if you ever need the boot pins3.6V is pushing it, that is right at maximum allowedelse just copy the schematic of a bluepill removing the parts you don't need

author: rcbuck
author_rank: Frequent Contributor
timestamp: November 10, 2021, 06:26:41 am
content: Attached is a partial schematic of a project I just completed. I developed and programmed the initial project on a blue pill board.The schematic only shows the power connections, programming connections, and crystal oscillator connections. No RTC connections as I didn't need them. You could add a push button switch between pin 7 and ground for manual reset purposes. I would at least put a single pin post or connection pad there. You may need it for programming purposes. I know the ST-LINK/V2 programming tool needs that connection. You don't need a pullup resistor for NRST as there is a built-in one.If you plan on using battery backup you will need a connection to pin 1 for that.

author: Moriambar
author_rank: Unknown
timestamp: November 10, 2021, 07:05:05 am
content: Thanks. Very clear. And I appreciate the schematic: it's just what I needed!

author: Moriambar
author_rank: Unknown
timestamp: November 10, 2021, 07:12:32 am
content: Quote from: rcbuck on November 10, 2021, 06:26:41 amThanks again for the schematic.One question though: I can see boot0 tied to GND, but boot1 (I believe is PB2) is left floating... why is that? Does that pin come in handy only when boot0 is tied to vcc?thanks

author: rcbuck
author_rank: Frequent Contributor
timestamp: November 10, 2021, 07:49:42 pm
content: See attachment. This is from AN2586.

author: rcbuck
author_rank: Frequent Contributor
timestamp: November 11, 2021, 09:00:15 pm
content: One thing to be aware of with the STM32F1 series is output writes disable pullup resistors if they are enabled. That bit me when I first started working on my project. Luckily DavidAlfa provided the answer in this discussion:https://www.eevblog.com/forum/microcontrollers/stm32-bluepill-gpio-write-affects-gpio-input-level/msg3559233/#msg3559233I first implemented the macro that he suggested. But on my second version of the board design I decided it was easier just to use external pullup resistors and not have to worry about using a macro. Part of that decision was based on finding out the inputs are sensitive to stray magnetic fields when using the internal pullups. The internal resistors are nominally 40K ohms. I found that if I had 6 inches of wire running to an external switch bringing my hand near the switch would sometimes make the STM32F103 detect a switch closure. I use 10K external pullup resistors on my board and the problem went away.

author: Moriambar
author_rank: Unknown
timestamp: November 11, 2021, 09:08:12 pm
content: Quote from: rcbuck on November 11, 2021, 09:00:15 pmthanks.Actually when breadboarding the project I noticed that the pullup was not working but I hooked in a [insert 1-10k] resistor and everything worked fine, so I plan for the resistor in the end project (I have many [insert 1-10k] smd parts to spare).But I think your advice is very helpful regardless