How to program STM32F103C8T6

rdl_stm32_development_board_3

A few months ago i bought a very cheap but very fast micro controller the STM32F103C8T6. You can run simple sketches very easy by following the steps below.

1. Go to arduino.cc and download the latest Arduino IDE (.zip) and extract it. You can also download the Arduino IDE .exe file and install it to your PC.

2. Go here and download the file, extract it and copy the Arduino_STM32-master to your Arduino/hardware folder that you extract in the first step. If you have downloaded the .exe file then go to C:\Programs\Arduino\hardware.

3. Run the Arduino IDE, choose settings: ‘Board: Generic STM32F103C series‘ ‘Variant: STM32F103C8 (20k RAM, 64k Flash)’ ‘Upload method: Serial‘ ‘Port: <the COM port of your USB-to-serial adapter>’

4. Go to File->Exampls A_STM32_Exampls->Digital->Blink and change the PB1 to PC13.

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  Most Arduinos have an on-board LED you can control. On the Uno and
  Leonardo, it is attached to digital pin 13. If you're unsure what
  pin the on-board LED is connected to on your Arduino model, check
  the documentation at http://arduino.cc
 
  This example code is in the public domain.
 
  modified 8 May 2014
  by Scott Fitzgerald
 
  Modified by Roger Clark. www.rogerclark.net for Maple mini 25th April 2015 , where the LED is on PB1
 
 */
 
 
// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin PB1 as an output.
  pinMode(PC13, OUTPUT);
}
 
// the loop function runs over and over again forever
void loop() {
  digitalWrite(PC13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100);              // wait for a second
  digitalWrite(PC13, LOW);    // turn the LED off by making the voltage LOW
  delay(100);              // wait for a second
}

5. Put Boot1 to 1 by moving the jumper for 0 to 1, Press the Reset buttoand hit Upload on the Arduino IDE. After uploading if all went well the LED will blink every 100ms. Put Boot1 to 0 again so the next time you power up the micro controller the program will star automatically.

You can also try to read an analog value. Go to File->Exampls A_STM32_Exampls->Analog->AnalogInSerial. Change the const int analogInputPin = 15; to const int analogInputPin = PA0; and hit upload. Open the Serial Monitor on the Arduino IDE, the value will be from 0 to 4095, it has 4 times the resolution of an arduino.

 

 

By Dimitris Xarir

6 Comments on “How to program STM32F103C8T6

Leave a Reply

Your email address will not be published. Required fields are marked *