Upload Arduino Sketch to STM32F407 Board

Introduction: Upload Arduino Sketch to STM32F407 Board

I ordered this compact STM32F407 board on Ebay recently, here is one way to get it to work.

All you need is any cheap Serial USB adapter, the Arduino STM32 library from Roger Clark and the free flasher software from ST attached here.

Or you can download it from here (requires an email address) :

https://www.st.com/en/development-tools/flasher-st...

Step 1: Install STM32 Libraries for Arduino

I downloaded the STM32 libraries for Arduino from Roger Clark's Github :

https://github.com/rogerclarkmelbourne/Arduino_STM...

Then unzip in the Arduino hardware folder.

Restart the Arduino software, select the correct hardware :

Generic STM32F407V series

Then write a simple sketch :

void setup() {
  pinMode(PC8, OUTPUT);
}

void loop() {
  digitalWrite(PC8,HIGH);
  delay(10);
  digitalWrite(PC8,LOW);
  delay(10);
}

Press on the "Verify" button (not the upload button). This will compile your sketch.

The binary file is now located in the Temp directory, you can see the path in the Arduino debug Window. (You might have to enable File->Preferences->Show verbose output)

The path is something like :

C:\Users\...\AppData\Local\Temp\arduino_build_146449\example.ino.ino.bin

Step 2: Wiring

I connected these pins from the Serial USB adapter to the board :

3.3V	3.3V (I guess connecting the 5V to 5V would work too)
GND	GND
RXD PA9 TXD PA10

Add a jumper on "BOOT 1" pins (last row)

Step 3: Uploading Sketch

Plug the USB adapter in the computer before starting the Demonstrator GUI.

Step 4: Testing

You now need to change the jumper's position to BOOT 0 and reset the board to run your sketch.

The reset button is the one near the micro USB plug.

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    4 Discussions

    0
    waynoedm
    waynoedm

    1 year ago

    Does the MicroUSB serve any purpose other than power on this board?

    0
    SonSMD
    SonSMD

    Reply 3 months ago

    It can be used as USB CDC (virtual serial port), or USB Mass Storage

    0
    waynoedm
    waynoedm

    Reply 4 weeks ago

    I was just curious why you weren't uploading it via the MicroUSB on the board itself, but using the USB serial adapter. Any particular reason for that?

    0
    SonSMD
    SonSMD

    Reply 4 weeks ago

    You can do that but it's a little bit more complicated. First, you need to upload a bootloader to the board using a USB Serial Adapter or an ST-Link programmer, then you can upload sketches directly to the board using the onboard micro USB connector.