Program a bare STM32F103C8T6

I have some questions about programming the STM32 of the title. It is the chip one can find on the blue pill.

I am designing a PCB. I decided to go for this STM because it has more IO than the atmega328 and is more affordable than the atmega2560. It is also in the basic stocklist of JLCPCB (always a pro) I used to use MCP23017 IO extenders for more IO, but.. chip shortages.. and shift registers do not suffice.

Anyways. If I make a PCB with the STM32 what do I need? I noticed an 8MHz crystal. I read that all these chips get a bootloader from the factory? If I breakout the Tx and Rx pins, can I simply 'just program' it using a ftdi usb-ttl converter? I already configured the IDE with the proper cores.

Or do I need something like an ST-Link programmer or something?

Kind regards,

Bas

The chip data sheet and application notes describe the programming protocols in detail. They also include information on the minimal MCU circuit requirements, so study that material very carefully. See also web pages like Introduction to Programming STM32 ARM Cortex-M 32-bit Microcontrollers (Updated 2022)

ST sells programmers for the bare chip.

That's right you can load firmware from the correct serial pins.
What is your level of hardware design experience? The way you introduced the 8MHz crystal suggests you are very inexperienced. Do you know that microprocessor design is an advanced topic in electronics?

Something you didn't mention, you will have to deal with, it's a 3.3V part. So you can only apply 5V signals to the pins that are designated "5V tolerant". Some are, some are not. Any device that you send its output to, must be able to accept 3.3V level signals.

https://www.electronicshub.org/getting-started-with-stm32f103c8t6-blue-pill/#Hardware_Requirements_for_the_Project

I recommend equipping your board with the SWCLK and SWDIO pins with 3.3V and ground on a header, so you can use an ST-Link. It's sooooo much easier to use than the serial.

Also if you don't need the USB, consider the 32G0xx series, they will be cheaper in quantity and probably even more so in future.

...and even the G4xx series which is much more powerful and has more peripheral features, the cost has really dropped on those...

It would also be worth a look at some schematics of boards using that processor .
It might also be worth looking at making a board where your desired Arduino ( blue pill ?) compatible plugs in - this is a good first step .

It isn't just about the schematic. A good MCU design depends also on a really good PCB layout. Another challenge for a beginner...

1 Like

To use the DFU upload capability built into the chip, you need ST-Link. The cheap clones work fine in my experience.

To use the serial pins or USB you need to burn a bootloader with ST-Link. Thus I've never really seen the point of doing it this way.

Can you please keep 'assumptions' like this to yourself :smiling_face_with_tear: :smiling_face_with_tear: :smiling_face_with_tear:

I merely saw this picture and 'assumed' it needed (could work with) an 8Mhz crystal. I only thought of using an STM32 today and figured I could ask somebody who has more experience with these things. I haven't laid my hands on one myself.

Another challenge for a beginner...

Thankfully I am not entirely a beginner. I have working SMT assembled boards, not that much I must confess but I do have one with a working an atmega328P and many with attiny. And I expect one with a buck converter delivered soon. I do have much more expericence with THT, but I loath soldering more than anything.

I recommend equipping your board with the SWCLK and SWDIO pins with 3.3V and ground on a header, so you can use an ST-Link. It's sooooo much easier to use than the serial.

Exactly the tip I was hoping to find :smiley: . I typically use a 2x3 ICSP header in 1.27mm pitch in combination with a pogopin clamp. The pogopin has jumper cables so I can do the same with a different pinout and STM programmer.

This is the list to pick from... today. These prices don't upset me that much. It isn't €0,40 anymore like in good ol' days.. but it beats €10+ of the 2560 :smiling_face_with_tear: :smiling_face_with_tear: :smiling_face_with_tear:

I am still in the component picking and placing phase. This how the board currently look like. I copied the buck converter from my previous project. So must test that first.

That huge space in the middle used to accomdate an atmega 2560

Kind regards,

Bas

Sure, although you have confirmed it in the following paragraph. Mainly, since the default response would be to go read some STM literature and data sheets, and you didn't mention anything about that.

I've already delivered free help to your door. It was obviously a mistake. Best way to keep my advice to myself in this case, and not forget your username, is to just block you permanently. Welcome to the list.

3 Likes

The whole reason that boards like the Blue Pill exist is that ST published a workable Reference Design, which you can find here: https://www.st.com/resource/en/application_note/an2586-getting-started-with-stm32f10xxx-hardware-development-stmicroelectronics.pdf

+1. Many amateurs do not appreciate having their blatant pretenses exposed.

Redesign it.

All components that generate heat should have free air around them.

You have not stated what the components are on your mock up, but there is one with a large heatsink area sat next to a wire block.

Ralph Bacon.......
https://www.youtube.com/watch?v=UW6IMeotnWw

Best way to keep my advice to myself in this case, and not forget your username, is to just block you permanently. Welcome to the list.

I am sorry to hear that.

+1. Many amateurs do not appreciate having their blatant pretenses exposed

I do not care about being wrong about something. I really don't. But there are different ways of reacting to wrong statements.

Instead of throwing personal assumptions about somebody you know nothing about which may or may not be true you can also simply address the false statement instead.

Besides I thought I was communicating it half decently that the assumption was not appreciated. So I am really sorry if I hurt your feeling, that was not my intention. English is not my first language :pensive:

It is true that I am inexperienced with stm-32 chips. Like I said, I'm new to those. But I felt I was being accused of.. well

+1. Many amateurs..

this.. So to blow up like this. I personally think is a bit over exaggerated. But if it makes you sleep any better, I don't mind. I wish you the best and thank you for the help you provided.

To use the serial pins or USB you need to burn a bootloader with ST-Link. Thus I've never really seen the point of doing it this way.

Funny that you say this in the forum about the most famous USB programmable boards :smiley:
I figured it would not be a completely useless add-on as this would allow other users to perform an update via the arduino IDE. The design in question may actually get more than one firmware version to handle different roles.

You have not stated what the components are on your mock up, but there is one with a large heatsink area sat next to a wire block.

It is still an L298 :see_no_evil: I know it is obsolete by now (not to mention the price of the SMD variant). But I am still looking for a replacement. I want to draw only 1A per channel. I thought it would not heat up significantly with that load but your are right. (I am in need for a configurable load for testing this). Like I said, I am still positioning and picking components. I also want the ability to use a heatsink (if needed)

Kind regards,

Bas

You can program and run the chip without a crystal. for programming both a ST-Link dongle and/or a Serial adapter can be used.

In fact this is what I sometimes use. The ST-link is my preferred programmer (no changing of Boot-0 pin required) and then the serial adapter for some debugging.

Don't forget the decoupling capacitors between all the VCC and GND pin-pairs.

Sidenote.
In my experience it is almost impossible to buy Bluepills with the original STM processor. I got them with the CKS and/or Gigadevice clones. For most applications not an issue, but just that you know. I have no experience with JLCPCB as component vendor, but would assume they provide what you order as they also sell the Gigadevice brand

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.