STM32F103C8Tx Setup on Mac

  1. Install STM32CubeIDE and create a STM32 project
  2. Search for the STM32F103C8, select it and click next.

  3. In the Project Setup name your project, select preferred target language and click finish.
  4. In System Core select RCC and set High Speed Clock (HSE) and Low Speed Clock (LSE) to Crystal/Ceramic Resonator.

  5. In System Core select SYS, set Debug to Serial Wire and Timebase Source to TIM1

  6. In Pinout View click on the PC13 and select GPIO_Output.
    In GPIO Mode and Configuration select PC13 and select a label in the User Label textfield.

  7. In the Clock Configuration change the HCLK to 72 MHz.

  8. In the Project Manager->Code Generator select Generate peripheral initialization as a pair of ‘.c/ .h’ files per peripheral.

  9. Go to Project->Generate Code

    The source code can now be viewed in your STM32 project.

We are almost there! Now we need to write some code for making the LED blink. Open main.c and add the code below. If you don’t remember the label name you used for the PIC13 open the main.h file and find out!

  while (1)
   HAL_GPIO_TogglePin(MyLed_GPIO_Port, MyLed_Pin);
    /* USER CODE BEGIN 3 */

The next step is to flash the the target (STM32F103C8Tx).

I will be using the programmer ST-LINK V2.
The ST-LINK/V2 is an in-circuit debugger and programmer for the STM8 and STM32 microcontroller families.

Connect the ST-link v2 to the target and flash the target by clicking on the Debug button or by using the menu Run->Debug.

Your debugger configuration should look like the image below.

Happy coding 🙂

Leave a Reply

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