Close
0%
0%

Wing's STM32 Dev Board

A small project to build a STM32 development board using KiCad

Similar projects worth following
# Quick Overview

So I've been playing with Bluepill and Blackpill boards that one can buy online for a few bucks. However, I wanted to "roll my own".

Using KiCad, I went with a 50mm x 50mm board layout which fits in nicely with many PCB production services. I also wanted to make use of the small SMT/SMD components, so I went with a service which also performs pick and place assembly.

# What's On The Board

The board I'm working on features the following:

* STM32F302 ARM microcontroller.
* QMA7981 I2C IMU
* TCA6424 I2C->24GPIO Expander
* CH340G USB->UART interface
* Buzzer
* LED indicators
* USB connector for serial control
* USB connector for DFU access to STM32
* 2.54mm spaced headers
* Ability to accept multiple sources of power without conflicts or issues.

  • Reproduce the typical USB => USB/UART IC => STM32 programming flow.
  • This involves the control of the BOOT and nRESET pins. This is normally facilitated via DTR/RTS.
  • Provide LOTS of GPIO for the STM32 IC in the form of an expander. TCA6424 in this case.
  • Provide a sensor. An IMUU in this case.
  • Provide a breakout for the communication channels on the STM32.
  • Provide a means of having multiple concurrent USB/power sources plugged in without things going _boom_.

  • 1 × STM32F302C8T6 32bit ARM M4 MCU
  • 1 × QMA7981 I2C controlled IMU
  • 1 × CH340G USB to UART controller IC. Using the DTR and DTS lines to control Boot/nRESET
  • 1 × TCA6424 I2C controlled 24 pin GPIO expander.
  • 1 × SMD Piezo Buzzer

View all 10 components

  • Designing V2

    WingTechCorner03/02/2021 at 19:00 0 comments

    Feb 28th, 2021

    So I have been banging my head against the board programming aspect and I have a horrible fear that I have other shorts elsewhere affecting I2C operation. Taking a break from this, I decide to redo the V1 design and create a better V2 design. Better meaning better layout and hopefully no shorts. -_-;;

    So, where the V1 board had headers sort of scattered all over, in V2, I move all of the headers off to the sides.

    The USB connectivity and the power supply, routing, and capacitor banks are all at the top of the board. By redoing the CH340G portion and the Schottky diodes, I was able to regain some additional space.

    M3 Mounting Holes

    Also, in line with my other 50mm x 50mm board designs, I've added M3 plated holes in the corners. On 50mm square boards, I place the mounting holes at +/- 21mm from the center lines of the boards. This means the centers are 4mm inset from the sides. I went with the KiCad plated holes with vias encircling the central hole. I feel this gives the mounting points more strength. Since I don't electrically connect anything to the posts, there are no accidental short issues.

    Focus on Communication Bus Breakouts

    For the side headers, what gets broken out are:

    * 3V3

    * GND

    * UART 1,2,3

    * I2C 1,3

    * SPI

    * DAC

    * BOOT

    * nRESET

    I wanted to make sure that I would be able to communicate as much as possible with the outside world. Since all of the function assigned pins can also be used as direct GPIO pins, there was nothing lost in this approach.

    Activity Indicators

    Another issue I had with V1 was that there was little to no way to tell what, if anything, was happening. With V2, in addition to the USB power indicators, I have also added LED indicators for the following activities:

    * UART1 RX/TX

    * UART2 RX/TX

    * UART3 RX/TX

    * BOOT

    * nRESET

    Dedicated Header for 24 x GPIO

    The 24 GPIO pins that come from the TCA6424 go to its own dedicated 2x12 header at the bottom of the board. This makes the overall design more compact and allows the TCA6424 wires to not interfere with the other components on the board.

    By moving all of the traces to the back surface, the top can be used to route other traces between the left and right of the board as well as allow for the mounting of SMD/SMT parts.

    Buttons. Gotta Have Buttons

    Another addition in the V2 design was the addition of a BOOT and nRESET button... for when you just can't get the stupid UART to do the right thing, or you forget which polarity things are... just use the buttons. Life is too short.

    Putting The IMU Front and Center

    So in V1, I just put the IMU where I had space. With V2, I placed the IMU in the direct center of the board, then built things around that. This ensured that the IMU would behave consistently if one were to tilt the board/etc.

    Cute Cat Graphic!

    And finally, I added a cute cat graphic derived from a photograph of one of our cats.

    Final Resulting Design

    So this is the final design that was sent off for creation.

    Update log entry to be made once it arrives.

  • Physical Board In Hand.... Design Flaws

    WingTechCorner03/02/2021 at 18:38 0 comments

    Feb 14th, 2021



    So received the V1 STM32 board from JLCPCB. And gotta say... it looks amazing.

    JLCPB does great work and I love their customer service reps, all of whom have been quick to answer questions and address any of my concerns. +100 for these folks.

    Now, this is the first board I made and ordered where the USB connectors were installed by JLCPCB's new though hole part service! Woot!

    And I have to say, I really like the build quality. I did end up touching up the USB ports with some additional solder, but that's just me being paranoid. 


    Design Flaw

    However, shortly after powering on the board, I realized I had made some kind of mistake in my design. The USB port heated up as did the VREG and the surrounding PCB. What!?

    Like any good maker, I started double checking everything and even checked to see if JLCPCB might have gotten something swapped up. But nope. After about half an hour of peering at the design file and doing ohm meter readings, I found that while doing copper pour/fills, I had assumed that one fill would respect the other. That was not the cast and I ended up shorting 3V3 and GND. Doh!!

    Using the first board as the sacrificial board, I started to scrap away at connection points that I believed were the primary regions of the shorts. It took about 3-4 tries involving scraping, ohm meter testing, and looking at the PCB routing. In all, I think I spent an hour on this before I was able to get the short to not be a short. At least, enough to get the board to power on without over heating and shutting down the USB port.

    Once that was done, I had to figure out the DTR and DTS arrangement that my particular setup resulted in, since it didn't work with the OpenOCD and other default board settings.

    In the end, I just added a custom line entry into the Platformio.ini configuration file for the upload. The call goes out to stm32flash and makes use of the DTR/DTS signalling to get the chip into programming mode. For the curious, this is what I went with:

    upload_command = stm32flash -w $SOURCE -R -i '-dtr,rts,-rts:dtr,rts,-rts' $UPLOAD_PORT

    So with this, when I do a '--target=upload' it will upload the compiled BIN file up to the board. I was able to upload and download the firmware just fine. So yay!

    However, I couldn't get anything to work. I2C was either broken or something. The Serial.printf(s) were also not returning anything. Tried various serial speeds and no dice.

    The head bumping part of the figuring out what is broken started..... 

  • V1 Board Design

    WingTechCorner03/02/2021 at 18:22 1 comment

    Feb 4th, 2021

    So work started on this board through some discussions with my friend Mitchell. We had been bouncing ideas around about what one could stick onto a board and I started sketching out the board. At some point, I started calling it a kitchen sink and wondered what else we could add onto the board. So the final design has a few different types of components on the board.

    Because the cost bump ups at most PCB services happens after you exceed 50mm x 50mm. So this board fits on a 50mm x 50mm footprint. 

View all 3 project logs

Enjoy this project?

Share

Discussions

Ahmed Sherif wrote 07/26/2023 at 21:22 point

Great Design !
One Question though, how do you connect the CH340G to the STM32?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates