In Vs Code: Upload Code Into Bluepill

STM32 Blue Pill is a feature-rich development board based on STM32F103C8T6 processor - a 32-flake ARM Cortex M3 processor running at 72MHz frequency. Unlike the common Arduino board which is easy to use, programming the STM32 Blue Pill can be confusing specially for a new user.

In that location are several ways to program the STM32 Blue Pill with Arduino IDE - some require external hardware, others only need an USB cable. In the following guide, we will embrace three mutual methods of downloading the sketch in Arduino IDE:

  • Arduino HID bootloader
  • ST-Link uniform emulator and programmer
  • USB to 3.3V TTL adapter

Then roll up our sleeves and go started.

Download and install Arduino IDE

The get-go thing yous need to exercise is to download and install the Arduino IDE to your computer. Yous can become the latest version from the official Arduino website: https://world wide web.arduino.cc/en/Main/Software

Follow the link below to install the Arduino IDE:

  • Windows: https://world wide web.arduino.cc/en/Guide/Windows
  • Mac OSX: https://www.arduino.cc/en/Guide/MacOSX

Install STM32 Add together-on to Arduino IDE

In your Arduino IDE, go to File > Preferences

Add the URL below to Additional Board Manager URLs text box:

https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json        

If the text box is not empty, you can separate the URLs with a comma.


Go to Tools > Lath > Boards Manager


Search for STM32 , select latest version and click Install.

There are a few megabytes of data to download and install, then be patient.

Once the installation is completed, quit and restart the Arduino IDE.

i. Arduino bootloader (Windows & Mac OSX)

The STM32 Bluish Pill is pre-flashed with Arduino bootloader which allows you to download the sketch through the Type-C connector.

Annotation: Using JLink / ST-Link dongle or USB to three.3V TTL adapter to program the board volition erase this bootloader.

Setup Arduino IDE

Connect STM32 Blue Pill to your reckoner USB port.

From the Tools > Board > STM32 Board , select Generic STM32F1 series


Select Tools > Board Office Number > Blue Pill F103C8


Under USB Support , select CDC (generic "Serial" supervene upon U(S)Fine art)


Under Upload method , select HID Bootloader 2.ii

Finally select COM port that is assigned to the STM32 Blue Pill. For Windows, yous can check the assigned COM port in Device Manager.

These are your Tool configurations:


Upload sketch

Create new sketch and copy / paste the code below:

/*   Blink onboard LED at 0.i second interval */ void setup() {   // initialize digital pivot PB2 equally an output.   pinMode(PB2, OUTPUT); // LED connect to pivot PB2 } void loop() {   digitalWrite(PB2, High);   // turn the LED on (Loftier is the voltage level)   delay(100);               // look for 100mS   digitalWrite(PB2, LOW);    // turn the LED off past making the voltage Low   delay(100);               // look for 100mS }        

Click on the upload push button to compile and upload the code to STM32 Blue Pill.


Yous should see the bluish LED glimmer at 0.ane 2nd interval.

2. STM32 Emulator And Programmer Dongle (Windows just)

NOTE: Using JLink / ST-Link dongle to program the board will erase the Arduino bootloader.

Install STM32CubeProg

Download and install STM32CubeProg from ST.com: https://world wide web.st.com/en/development-tools/stm32cubeprog.html


Outset the STM32CubeProg. It volition expect like this:


Close the STM32CubeProg.

Connect STM32 Blue Pill to ST-Link compatible Emulator And Programmer dongle

Follow the wiring diagram below to connect the STM32 Blue Pill to ST-Link uniform Emulator And Programmer dongle.

STM32 Blue Pill ST-Link compatible Dongle
GND GND
SCK SWCLK
DIO SWDIO
3V3 3.3V


Connect the dongle to your calculator. NOTE: Do non connect STM32 Blueish Pill to computer via Type-C USB cablevision.

Gear up the STM32 Blue Pill to bootloader mode using both BOOT0 and NRST button:


  • press and hold the BOOT0 button
  • press and release NRST (reset) button to ability cycle the processor
  • release BOOT0 button

Starting time the STM32CubeProg. In the top correct corner, below the Non Connected message, observe the dropdown to the left of the Connect push

Select ST-Link and Click Connect button.


You lot should see the Target information console in the lesser right corner.


Now close the STM32CubeProg and start Arduino IDE.

Setup Arduino IDE

Follow instructions in a higher place to install the STM32 Add-on to Arduino IDE.

Select Tools > USB Support , select None

Ready the Upload method to STM32CubeProgrammer(SWD)


These are your Tool configurations:


Upload sketch

Create a LED blink sketch.

Set the STM32 Blue Pill to bootloader mode using both BOOT0 and NRST button

Click on the upload push to compile and upload the code to STM32 Blue Pill. The uploading speed of using ST_Link dongle is significantly faster than the Arduino bootloader.

In one case the sketch is successfully uploaded, the blue LED should blink at 0.one second interval.

3. USB to three.3V TTL adapter (Windows only)

Annotation: Using USB to 3.3V TTL adapter to program the board will erase the Arduino bootloader.

Install STM32CubeProg

Follow the instructions to a higher place to install STM32CubeProg to your estimator.

Wiring

Follow the wiring digram below to connect the STM32 Blue Pill to USB to 3.3V TTL adapter:

STM32 Blue Pill USB to three.3V TTL Adapter
three.3V 3.3V
GND GND
A10 RX
A9 TX


Connect the adapter to your computer. Annotation: Practise not connect STM32 Blue Pill to computer via Type-C cable.

Setup Arduino IDE

Follow instructions higher up to install the STM32 Add-on to Arduino IDE.

Set the Upload method to STM32CubeProgrammer (Serial)


These are your Tool configurations:


Upload sketch

Create a LED blink sketch.

Set the STM32 Blue Pill to bootloader way using both BOOT0 and NRST button.

Click on the upload button to compile and upload the code to STM32 Blueish Pill.

Once the sketch is successfully uploaded, the bluish LED should glimmer at 0.1 second interval.

baxtercornind.blogspot.com

Source: https://www.sgbotic.com/index.php?dispatch=pages.view&page_id=48

0 Response to "In Vs Code: Upload Code Into Bluepill"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel