$5 STM32F3-duino Development Board

Intro: $5 STM32F3-duino Development Board

The STM32F303Cx 32-bit microcontroller series is really nice. You get a Cortex M4 core with hardware floating point and DSP at 72MHz. You get four 5 MSPS analog-to-digital converters, which can be interleaved to get 18 MSPS (wouldn't that be great for an oscilloscope project?). You get two 12-bit digital-to-analog converters. But it's hard to get a development board for it.

On the other hand, ebay and Aliexpress are full of cheap STM32F103C8T6 boards, in the blue pill and black pill variants, with a solid Arduino core for use in the Arduino IDE, for under $2. The F103C is a nice unit, but you lose the floating point, the DSP, the DAC and the ADC speed is quite a bit lower.

But you can upgrade one of the cheap STM32F103C8T6 boards to a pin-compatible STM32F303CBT6 for about $2.60. All you need is a soldering iron and an STM32F303CBT6 in a QFP-48 package from Aliexpress. Yes, there is surface mount desoldering and soldering with a fine pitch, but it's not that hard. I did it, and it was only my second time ever doing surface mount soldering, and my first time ever doing surface mount desoldering.

What turned out to be harder than soldering was to get the Arduino IDE working with this board, but I'll talk about how to do that, too (Windows 64-bit only, though).

Step 1: Blue Pill or Black Pill?

The STM32F103C8T6 boards on ebay and Aliexpress come in two main varieties: the blue pill and the black pill (there are also some newer boards that are black in color, but have the pinout of the blue pill--that's actually what I used). You can base your choice on this information:

  • The blue pill has additional 5V, VBat, C14 and C15 pins.
  • The black pill has convenient mounting screw holes.
  • The blue pill usually comes with the wrong USB D+ pullup resistor. This can be fixed by putting a parallel resistor between A12 and 3.3V to compensate.
  • The blue pill is slightly narrower.

Software-wise, there is another important difference: the blue pill's LED is on PC13 while the black pill has it on PB12.

I prefer the black pill myself, but if you need the extra pins, you'll want the blue pill. If you opt for the black pill, look at the seller's pictures to ensure it's a real black pill, with mounting screw holes and fewer pins.

Step 2: Assemble Board and Fix Resistor If Needed

Typically, the boards come with pin headers not soldered. At least, I recommend soldering pin headers on the six BOOT0/BOOT1 pins in the middle of the board.

You should check that you have the correct value for the USB D+ pull-up resistor, especially if you have a blue pill. Just measure the resistance between A12 and +3.3V. It should be 1.5K.

On blue pills (and some of the black pills with the blue pill layout) it tends to be 4.7K or 10K. You can fix this either by replacing the SMD resistor on the underside of the board, or by soldering a parallel resistor between A12 and +3.3V. If you have a 4.7K resistor on the board, your parallel resistor should be 2.2K. If you have a 10K resistor, your parallel resistor should be 1.8K (that's what I did).

If you're lucky, your computer might accept a board with the wrong resistor, but it's better to fix it.

Step 3: Order Replacement Chip

If you search, you should be able to get a good deal on the STM32F303CBT6 chips on Aliexpress. Make sure you get one in a square QFP-48 package. The lowest price I can see right now is $2.64 with shipping.

You can also go for the more expensive STM32F303CCT6. The difference is that the CC version has 256K flash and 40K RAM, while the CB version has 128K flash and 32K RAM. The lowest price I can see right now is $4.25.

Step 4: Desolder Old Chip

If you have a hot-air rework station, you can look up a tutorial on how to desolder a QFP package and just do that. I just have a soldering iron (well, a temperature controlled station).

Here's what I did, but please read on for the problems I faced, and for an alternate method that I haven't tried myself.

Important: I made sure to note which direction the dot on the top of the chip's case faces, so your new chip faces the same way. (It turned out that there was also a matching dot silkscreened under the chip on the board, but you can't count on that.)

I preheated my iron (to around 370C) and threaded a thin steel wire (guitar string) under the legs near one side of the chip, keeping my left (I am right-handed) hand on the wire. I then heated the chip's leg closest to my left hand, and gently used pulled the wire a bit away from the chip to bend the leg upward. I continued with the remaining legs, and then the remaining three sides.

This is delicate work. I recommend having the board solidly mounted in a vise (or maybe just screwed to a work bench with the mounting screws if it's a black pill?).

I did have one near "disaster" (not much of a disaster, as the worst case scenario would have been a loss of a $2 board): two of the traces on the board got broken and partly pulled up. I expect I was insufficiently gentle in pulling or not patient enough in heating up the legs.

Afterwards, I very mildly went over the traces with soldering braid to smooth out the pads. It's important not to remove too much solder, as I would use the left-over solder on the pads to solder the new chip. I also had some solder paste and I put it on the broken traces hoping to bridge them to the legs (it worked out fine).

Alternate suggestion: An alternate suggestion from another user on the stm32duino forums was to cut the legs of the chip with an Xacto knife near the plastic case, discard the chip, and then desolder the legs one by one. The user said that this had a lower chance of damaging the traces, which makes sense. I may do that next time, as the chip I removed had its legs bent too much for re-use anyway.

Step 5: Solder New Chip

Add flux (I forgot and things still worked out, but that was luck).

Place new chip with the dot on top facing the same way as the dot on the old chip did.

Carefully align all the legs of the chip with the traces on the board. This is very delicate work. You will want the board to be held very securely in place with a vise or mounting screws. Look carefully and use a magnifying glass. If the legs are partly off the traces, you may get shorts. It is also easy to make an off-by-one error. I used tweezers to manipulate the chip.

Once the chip is in place and aligned well, the rest turned out to be easier than I expected. You can just touch a corner pin with a soldering iron for 3-4 seconds, and then do the same to the opposite pin, being careful not to move the chip. And then repeat for all the pins.

Now, check for shorts between neighboring pins with a multimeter in continuity testing mode. This is hard to do directly with the tiny pins of the chips. But many of the pins are brought out to the board, and that makes it possible to check most of the neighboring pairs. You'll want to refer to the schematics linked here (black pill) or here (blue pill) to see where the neighboring pairs are brought out.

For pins that aren't broken out to the board, you will need to check continuity directly on the chip. The trick I did was this. Suppose I have four pins in order, call them A, B, C and D, and I want to check if B and C are shorted. I put one multimeter probe between A and B and another between C and D, which was much easier than trying just to touch B and C. And then I checked for continuity.

I found one short. I was stressed out dealing with the soldering iron, so I cleaned up the short with an Xacto knife. Maybe desoldering braid would have worked, too.

As a final test, power up the board using the USB port. I recommend not using a computer USB port to power it the first time, so you don't damage your computer if something has gone wrong. If the board's power LED doesn't light, or if something smokes, things have gone wrong.

Step 6: USB Driver

The STM32F303C comes stock with a USB DFU bootloader. To enable the bootloader, use the central BOOT0/BOOT1 pins on the board and the jumpers that should have been included with your board: short the middle BOOT0 (first row) pin to the B0+ pin (right) and the middle BOOT1 (second row) pin to the B1- pin (left).

On Windows, install the zadig libusb driver installer. Run it. Plug the board in. You should now have a drop-down list at the top of the zadig window that includes the USB DFU device, perhaps labeled as STM32 BOOTLOADER. Then choose libusbK from the drop-down box and choose Install Driver.

(I had some trouble with the device not showing up, due to some earlier installed STM drivers that were taking over. I tried deleting those drivers in the device manager, but they kept coming a few seconds after I plugged the device in. Moving fast let me install the libusbK driver.)

Step 7: Arduino IDE

Install the latest Arduino IDE.

In Tools | Boards | Boards Manager, install support for the Arduino Zero (just put Zero in the search, click on the found entry, and then Install). Yes, you aren't working with a Zero, but this will install the right gcc compiler.

Now, download my fork of the STM32GENERIC Arduino core.On Windows, I recommend downloading the zip file, since when I checked out the files (admittedly, with svn), I had some permissions problems with files in the Windows tools directory that needed fixing. Put the branch in Arduino/Hardware/STM32GENERIC (so you'll have folders like Arduino/Hardware/STM32GENERIC/stm32, etc.) where Arduinois your normal sketches folder.

Restart the Arduino IDE. Choose these settings in the Tools menu:

  • Board: Franken BluePill F303C
  • Specific board: Blue/Black F303CB or F303CC, depending on what you have
  • USB: Serial [Virtual COM Port]
  • Upload method: dfu-util

Now write a simple blinky sketch, like:

setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

loop() {
  digitalWrite(LED_BUILTIN, 0);
  delay(200);
  digitalWrite(LED_BUILTIN, 1);
  delay(200);
}

Set the top (BOOT0) jumper to short the center pin with the right pin for upload, plug board into computer, and press the upload button (right arrow in circle).

Then move the BOOT0 jumper to short the center pin with the left pin, and press the reset button on the board to run the sketch.

Your STM32F3 should now be working.

Share

    Recommendations

    • Metalworking Contest

      Metalworking Contest
    • Furniture Contest 2018

      Furniture Contest 2018
    • Fix It! Contest

      Fix It! Contest

    Discussions