Cov txheej txheem:

STM32 "Blue Pill" Progmaming Via Arduino IDE & USB: 8 Kauj Ruam
STM32 "Blue Pill" Progmaming Via Arduino IDE & USB: 8 Kauj Ruam

Video: STM32 "Blue Pill" Progmaming Via Arduino IDE & USB: 8 Kauj Ruam

Video: STM32
Video: Плата с STM8 STM8S103F3P6 и Arduino IDE 2024, Kaum ib hlis
Anonim
SWB 32
SWB 32

Sib piv STM32F pawg thawj coj ua qauv qauv (piv txwv li Blue Pill) rau nws cov txee ntawm Arduino yog qhov yooj yim pom ntau npaum li cas cov peev txheej nws muaj, uas qhib ntau txoj hauv kev tshiab rau IOT cov phiaj xwm.

Qhov tsis zoo yog qhov tsis muaj kev txhawb nqa rau nws. Qhov tseeb tsis tshua muaj kev txhawb nqa, tab sis nws tau nthuav tawm ntau hauv ntau lub rooj sab laj, blog thiab pawg ntawm lwm nplooj ntawv. Ntau yam twb dhau los lawm.

Kuv yuav piav qhia kuv cov kev paub kom tau txais ib daim ntawv no tsis yog teeb tsa los ntawm Arduino IDE tab sis kuj dhau ntawm nws ua hauv USB txuas.

Kuv kuj yuav qhia yuav ua li cas upload Bootloader siv ST-Txuas V2.

Kauj Ruam 1: Qhov:

Qhov
Qhov
Qhov
Qhov

Koj yuav xav tau qee qhov:

  1. Thawj qhov koj yuav xav tau yog qhov tseeb, ST32F103 pawg thawj coj ua qauv. "Blue Pill" yog qhov nws paub nyob ib puag ncig, thiab koj tuaj yeem yuav nws rau tus nqi pheej yig hauv ntau lub khw eCommerce.
  2. ST-Txuas V2 Module
  3. Mov ci board thiab dhia cables

Kauj ruam 2: Software Koj Yuav Tsum Tau:

Software Koj Yuav Tsum Tau
Software Koj Yuav Tsum Tau
Software Koj Yuav Tsum Tau
Software Koj Yuav Tsum Tau
Software Koj Yuav Tsum Tau
Software Koj Yuav Tsum Tau
  1. Ua ntej tshaj plaws, Arduino IDE. Yog tias koj tseem tsis tau rub nws, qhov no yog qhov txuas: https://www.arduino.cc/en/Main/Software. Kuv sim cov lus qhia no nrog version 1.8.11, 1.8.12, thiab app version, uas ua haujlwm nkaus xwb rau Windows 8 thiab 10. Kuv yuav tsis npog qhov kev teeb tsa software no, thaum muaj ntau cov ntaub ntawv nyob ib puag ncig yuav ua li cas.
  2. Los ntawm STM qhov chaw koj yuav xav tau cov software hauv qab no. Nws yog qhov tsim nyog los tsim tus as khauj:

    1. ST-Txuas V2 windows driver:
    2. STM32-Link Utility (https://my.st.com/content/my_st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-link004.html).
  3. Tom qab ntawd nws yog lub sijhawm los rub tawm Boot loader. Nov yog qhov uas yuav tso Blue Pill txuas rau lub computer USB. Nov yog qhov txuas rau qhov no:

Daim ntawv ceeb toom koj tseem yuav xav tau ntxiv cov laug cam rau Arduino IDE. Kuv yuav piav qhia ntxaws yuav ua li cas.

Kauj Ruam 3: STM32F103 Cov Qauv Txheej Txheem Txheej Txheem, Blue Pill

STM32F103 Cov Qauv Txheej Txheem Txheej Txheem, Blue Pill
STM32F103 Cov Qauv Txheej Txheem Txheej Txheem, Blue Pill
STM32F103 Cov Qauv Txheej Txheem Txheej Txheem, Blue Pill
STM32F103 Cov Qauv Txheej Txheem Txheej Txheem, Blue Pill
STM32F103 Cov Qauv Txheej Txheem Txheej Txheem, Blue Pill
STM32F103 Cov Qauv Txheej Txheem Txheej Txheem, Blue Pill

Tam sim no piav qhia luv luv txog STM32F103 pawg thawj coj saib, paub los ntawm "Blue Pill".

Nov yog qhov khoom siv qhib, zoo ib yam li Arduino Nano (yuav luag zoo ib yam). Koj tuaj yeem pom ntau qhov kev tsim khoom sib txawv, tab sis lawv ua raws cov txheej txheem ze heev, txawm tias teeb meem.

Koj tuaj yeem nug: Yog nws zoo li Arduino Nano, vim li cas kuv thiaj yuav tsum txav mus rau lwm yam khoom kho vajtse?

Teb yog yooj yim. Zoo li kuv tau hais los lawm, yog tias koj txoj haujlwm xav tau Faster Micro maub los, nrog GPIO ntau dua (33 hauv tag nrho), ntau dua thiab/lossis meej ADC cov tswv yim (10 tawm tswv yim x 12 Cov teeb meem daws teeb meem), ntau qhov tso tawm analog (15), kev sib txuas lus ntau ntxiv, thiab lwm yam; qhov no yog lub micro tswj koj xav tau.

Saum toj no muaj tus pin tawm thiab daim duab qhia chaw.

Tam sim no, qee cov lus qhia:

  1. Nov yog 3V3 micro tswj. Txawm hais tias qee tus pin yog 5V tiv taus, Kuv hais kom khaws cov khoom siv qib siab hauv 3V3, lwm qhov ntse koj tuaj yeem kib koj Blue Pill.
  2. Pin's PA11 thiab PA12 tsis muaj, thaum lawv muaj lub luag haujlwm rau USB kev sib txuas lus.
  3. Tham txog USB, Koj yuav pom ntau qhov chaw thiab blog qhia rau Blue Pill muaj qhov tsis raug rub tawm tus nqi tiv thaiv hauv nws cov chaw nres nkoj. Raws li tom qab ntawd, lawv feem ntau 10KΩ hloov ntawm 4, 7KΩ qhov no yuav ua rau USB muaj teeb meem kev sib txuas. Ua siab ncaj, Kuv muaj 3 cov laug cam thiab kuv yeej tsis muaj teeb meem txuas mus rau ib qho ntawm lub laptop ntawd. Yog li, kuv yuav pom zoo tsuas yog ua haujlwm rau nws yog tias koj muaj teeb meem tiag tiag txuas USB rau koj lub khoos phis tawj. Lig Kuv pom qhov kos hauv Circuit Court yog tus tiv thaiv tus nqi no tseeb 10KΩ. Mus rau daim duab…. Solution yog solder 1.5KΩ lossis 1.8KΩ resistor ntawm tus pin PA12 thiab 5V vcc.
  4. Saib ze ntawm daim duab kuj tseem tuaj yeem pom tsis muaj kev tiv thaiv ntawm 5V cov kab hluav taws xob thiab USB 5V. BE CAREFUL OR JUST zam kev siv ntau lub zog siv. Koj tuaj yeem kib koj lub khoos phis tawj USB chaw nres nkoj, yog tias tej zaum koj siv lub zog 5V sab nraud txhais tau tias thaum lub rooj sib tham txuas rau USB.

Kauj Ruam 4: ST LINK V2 USB Adapter

ST LINK V2 USB Adapter
ST LINK V2 USB Adapter
ST LINK V2 USB Adapter
ST LINK V2 USB Adapter
ST LINK V2 USB Adapter
ST LINK V2 USB Adapter
ST LINK V2 USB Adapter
ST LINK V2 USB Adapter

ST LINK V2 yog USB rau SWD adapter, tsim los rau kev debug thiab kev ua haujlwm.

Yog tias koj npaj siab ua haujlwm nrog STM32 nti hauv qhov hnyav, koj yuav xav tau cov cuab yeej no. Nws tso cai rau koj sib txuas lus rau nti ncaj qha ntawm SWB lub taub hau txuas.

Muaj ntau qhov blog thiab qhov chaw nrog cov lus qhia yuav ua li cas thauj khoom siv USB rau TTL adapter, tab sis kuv tsis tuaj yeem pom ib qho siv cov cuab yeej no los thauj khoom boot loader.

Qhov no kuj tseem tso cai rau Blue Pill nrog thawj lub khau raj siv STM32Cube Programmer software (tej zaum kuv yuav tsim cov lus qhia rau yav tom ntej).

Txhawm rau nruab Windows tsav ua raws cov kauj ruam no:

  1. Unzip cov ntaub ntawv rub tawm
  2. Khiav "stlink_winusb_install.bat li Administrator
  3. Nias qhov tseem ceeb tom qab nws ua tiav.
  4. Txuas ST-Txuas V2 rau txhua lub khoos phis tawj USB.

Nco ntsoov: Qhov no yuav teeb tsa USB Device, TSIS yog chaw nres nkoj comm.

Kauj Ruam 5: Sijhawm Pib Ua Haujlwm tiag: Thauj khoom STM32Duino Boot Loader

Lub Sijhawm Pib Ua Haujlwm tiag: Thauj khoom STM32Duino Boot Loader
Lub Sijhawm Pib Ua Haujlwm tiag: Thauj khoom STM32Duino Boot Loader
Sijhawm Pib Ua Haujlwm tiag: Thauj khoom STM32Duino Boot Loader
Sijhawm Pib Ua Haujlwm tiag: Thauj khoom STM32Duino Boot Loader

Thawj yam ua ntej: txuas ST-Txuas rau Blue Pill. Qhov no yog qhov yooj yim heev, thaum ST tus pin tawm tau sau rau ntawm nws rooj plaub.

ST-Txuas Blue Pill SWD Connector

pin2- SWDIO pin2- SWIO (lossis IO hauv qee cov laug cam)

pin 3- GND pin 4- GND

pin 6- SWCLKpin3- SWCLK (lossis tsuas yog CLK)

pin 7- 3.3V pin 1- 3V3

ST-Txuas V2 tus pin tawm yog daim ntawv lo meej dua nws lub cev.

Khiav "STM32 ST-Link Utility" software (tej zaum koj twb tau teeb tsa hauv koj lub khoos phis tawj).

Sai li software rub tawm, nws yuav khaws txhua cov ntaub ntawv hauv Boot0 nco. Yog tias tsis yog, nyem rau hauv "Connec to Device", lub qhov hluav taws xob ntsaws nrog lub cim ntsia liaj qhov rooj. Nws tseem yuav khaws ntau cov ntaub ntawv STM32 nti.

thauj cov ntaub ntawv binary yog qhov yooj yim heev:

  1. Tsiv "Boot0" jumper mus rau "1" txoj haujlwm
  2. Nyem rau hauv "Binary"
  3. Xaiv Bootloader file (.bin)
  4. Hauv cov ntawv qhia zaub mov, nyem rau hauv "Hom Phiaj" thiab "Program".

Qhov no yuav tso cai thauj Boot0 nrog Bootloader tshiab.

  1. Rov qab "Boot0" jumper rau "0" txoj haujlwm
  2. Nias lub khawm pib dua

NCO TSEG: Koj yuav tsis tas yuav txav Boot0 jumper ntxiv mus rau "1" txoj haujlwm los thauj cov haujlwm tsim hauv Arduino IDE.

Kauj Ruam 6: Sijhawm Deal rau Arduino IDE

Sijhawm Deal rau Arduino IDE
Sijhawm Deal rau Arduino IDE

Tej zaum koj yuav pom tom qab thauj khoom "generic_boot20_pc13.bin" koj Blue Pill USB chaw nres nkoj yuav raug lees paub los ntawm lub khoos phis tawj Tus Thawj Saib Xyuas Haujlwm li "Maple Serial (COMx)".

Txhawm rau npaj koj Arduino IDE los daws rau STM32, ua raws cov theem hauv qab no:

Kauj Ruam 7: Sijhawm Deal rau Arduino IDE

Sijhawm Deal rau Arduino IDE
Sijhawm Deal rau Arduino IDE
Sijhawm Deal rau Arduino IDE
Sijhawm Deal rau Arduino IDE
Sijhawm Deal rau Arduino IDE
Sijhawm Deal rau Arduino IDE

Tam sim no koj yuav pom, txuas koj lub USB chaw nres nkoj rau koj lub khoos phis tawj, nws yuav raug lees paub tias "Maple Serial (COMx)".

Tam sim no, cia npaj Arduino IDE rau STM32 programing. Qhib Arduino IDE, yog tias tseem tsis tau qhib nws:

  1. Mus rau File menu thiab xaiv "Preferences". Qhov no yuav qhib qhov Preferences window.
  2. Nyem rau ntawm lub cim ob npaug ze rau "Tus Thawj Saib Xyuas Ntxiv Url" lub thawv ntawv.
  3. Hauv Cov Ntawv Text, luam thiab muab tso rau hauv qab kab ntawv txuas, ib kab: https://dan.drown.org/stm32duino/package_STM32duino_index.jsonhttps://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json Koj yuav xav tau ob lub rooj sib tham teeb tsa hauv cov ntawv txuas ntawd.
  4. Tam sim no mus rau "Cov cuab yeej" ntawv qhia zaub mov thiab xaiv "Tus Thawj Saib Xyuas Haujlwm". Qhov no yuav qhib "Board Manager" Window.
  5. Nco ntsoov "Txhua" raug xaiv hauv "Hom" thiab hauv kab ntawv hom "STM32F1"
  6. Nruab ob qho kev xaiv tshwm sim.

Kauj Ruam 8: Qhov "Gran Finale"

Cov
Cov

Tam sim no, koj tuaj yeem ntaus koj tus lej thiab sau nws.

Txuas koj "Blue Pill" thiab teeb tsa kev teeb tsa zoo li nws nyob hauv daim duab. Nco ntsoov xaiv qhov chaw nres nkoj raug.

Yog li, tam sim no nws tau npaj txhij xa cov cai rau "Blue Pill".

Kuv vam tias nws yuav pab koj!

Pom zoo: