Cov txheej txheem:

Teeb Up Blue Pill Board hauv STM32CubeIDE: 8 Kauj Ruam
Teeb Up Blue Pill Board hauv STM32CubeIDE: 8 Kauj Ruam

Video: Teeb Up Blue Pill Board hauv STM32CubeIDE: 8 Kauj Ruam

Video: Teeb Up Blue Pill Board hauv STM32CubeIDE: 8 Kauj Ruam
Video: 20 MOMENTS YOU WOULDN'T BELIEVE IF NOT FILMED 2024, Hlis ntuj nqeg
Anonim
Teeb Up Blue Pill Board hauv STM32CubeIDE
Teeb Up Blue Pill Board hauv STM32CubeIDE
Teeb tsa Blue Pill Board hauv STM32CubeIDE
Teeb tsa Blue Pill Board hauv STM32CubeIDE

Blue Pill yog qhov pheej yig heev pob txha liab qab ARM pawg thawj coj loj. Nws muaj STM32F103C8 raws li nws cov txheej txheem uas muaj 64 kbytes ntawm flash thiab 20 kbytes ntawm RAM nco. Nws khiav mus txog 72 MHz thiab yog txoj hauv kev pheej yig tshaj plaws kom nkag mus rau hauv ARM kos software tsim.

Feem ntau piv txwv cov phiaj xwm thiab yuav piav qhia lub phiaj xwm Blue Pill board siv Auduino ib puag ncig. Thaum qhov no ua haujlwm thiab yog txoj hauv kev pib nws muaj nws cov kev txwv. Ib puag ncig Arduino tso cai rau koj me ntsis los ntawm cov khoom siv kho vajtse - uas yog nws lub hom phiaj tsim. Vim li no koj yuav tsis tuaj yeem ua kom zoo dua ntawm txhua tus yam ntxwv ntawm tus txheej txheem muab, thiab kev koom ua ke lub sijhawm ua haujlwm tiag tiag tsis txhawb nqa. Qhov no txhais tau tias Arduino ib puag ncig tsis tau siv dav hauv kev lag luam. Yog tias koj xav ua txoj haujlwm hauv kev txhim kho software txhim kho, Arduino yog qhov chaw pib zoo, tab sis koj yuav tsum tau txav mus thiab siv kev txhim kho ib puag ncig uas siv kev lag luam. ST pab tau zoo ib puag ncig kev txhim kho pub dawb rau lawv cov txheej txheem hu ua STM32CubeIDE. Qhov no tau siv dav hauv kev lag luam, yog li nws yog qhov zoo uas yuav txav mus rau.

Txawm li cas los xij, thiab qhov no yog qhov loj txawm li cas los xij, STM32CubeIDE yog qhov nyuaj txaus ntshai thiab yog ib qho txaus ntshai ntawm kev siv software. Nws txhawb nqa txhua tus yam ntxwv ntawm txhua tus ST tus txheej txheem thiab tso cai rau lawv teeb tsa kom zoo, uas koj tsis tuaj hla hauv Arduino IDE vim tias nws ua tiav rau koj.

Koj yuav tsum teeb tsa koj lub rooj tsavxwm ua thawj kauj ruam hauv STM32CubeIDE. IDE paub txog ST tus kheej cov laug cam txhim kho thiab teeb tsa lawv rau koj, tab sis Blue Pill, thaum siv tus txheej txheem ST, nws tsis yog ST khoom, yog li koj nyob ntawm koj tus kheej ntawm no.

Cov lus qhia no coj koj mus rau txheej txheem teeb tsa koj li Blue Pill board, ua kom muaj chaw nres nkoj txuas, thiab sau qee cov ntawv. Nws tsis ntau, tab sis nws yog thawj kauj ruam tseem ceeb.

Khoom siv

STM32CubeIDE - rub tawm los ntawm ST lub vev xaib. Koj yuav tsum sau npe thiab nws yuav siv sijhawm me ntsis los rub tawm.

Ib daim ntawv Blue Pill board. Koj tuaj yeem tau txais lawv los ntawm eBay. Koj xav tau ib qho uas muaj cov txheej txheem ST tiag rau nws vim qee qhov tsis ua. Hauv ebay zoom rau ntawm daim duab thiab nrhiav ST logo ntawm tus txheej txheem.

ST-LINK v2 debugger/programmer muaj los ntawm ebay rau ob peb phaus.

FTDI TTL rau USB 3.3V cov kab hluav taws xob rau cov zis thiab 2 tus txiv neej rau poj niam lub taub hau xov hlau txuas nws.

Ib txoj haujlwm davhlau ya nyob twg zoo li PuTTY.

Kauj Ruam 1: Tsim Txoj Haujlwm Tshiab

Tsim Txoj Haujlwm Tshiab
Tsim Txoj Haujlwm Tshiab
Tsim Txoj Haujlwm Tshiab
Tsim Txoj Haujlwm Tshiab
  1. Pib STM32CubeIDE thiab tom qab ntawv los ntawm cov ntawv qhia zaub mov xaiv Cov Ntaub Ntawv | Tshiab | STM32 Project.
  2. Hauv Tus lej Tshawb Nrhiav lub thawv nkag STM32F103C8.
  3. Hauv MCUs/MPUs List koj yuav tsum pom STM32F103C8. Xaiv kab no raws li hauv daim duab saum toj no.
  4. Nyem Tom ntej no.
  5. Hauv qhov Project Setup dialog muab koj lub npe ua haujlwm.
  6. Tawm txhua yam ntxiv raws li nws yog thiab nyem Ua Ntej. Koj qhov haujlwm yuav tshwm rau sab laug hauv qhov Project Explorer pane.

Kauj Ruam 2: Kho Tus Txheej Txheem

Kho tus Txheej Txheem
Kho tus Txheej Txheem
Kho tus Txheej Txheem
Kho tus Txheej Txheem
Kho tus Txheej Txheem
Kho tus Txheej Txheem
Kho tus Txheej Txheem
Kho tus Txheej Txheem
  1. Hauv qhov Project Explorer pane qhib koj qhov haujlwm thiab ob npaug nyem rau.ioc ntawv.
  2. Ntawm qhov Project & Configuration tab nthuav System Core ces xaiv SYS.
  3. Nyob rau hauv SYS Hom thiab Kev teeb tsa hauv Debug nco-down xaiv Serial Wire.
  4. Tam sim no xaiv RCC hauv Cov Txheej Txheem Txheej Txheem teev cia saum SYS koj xaiv saum toj no.
  5. Hauv RCC Hom & Kev teeb tsa los ntawm Kev Kub Ceev (HSE) nco-down xaiv Crystal/Ceramic Resonator.
  6. Tam sim no nyob hauv Pawg dua, qhib Kev Sib Txuas thiab xaiv USART2.
  7. Nyob rau hauv USART2 Hom thiab Kev teeb tsa los ntawm Hom poob-xaiv xaiv Asynchronous.
  8. Tam sim no xaiv Clock Configuration tab thiab mus rau theem tom ntej.

Kauj ruam 3: Kho lub moos

Kho lub moos
Kho lub moos

Tam sim no koj tuaj yeem pom daim duab moos uas txaus ntshai, tab sis nws tsuas xav tau teeb tsa ib zaug. Qhov no nyuaj tshaj plaws los piav qhia ntawm no raws li daim duab yog qhov nyuaj. Txhua yam uas koj xav tau hloov pauv tau hais nyob hauv daim duab saum toj no.

  1. Blue Pill board los nrog 8 MHz siv lead ua ntawm lub rooj tsavxwm thiab qhov ntawd yog dab tsi lub moos teeb tsa daim duab teeb tsa tsis raug, yog li peb tsis tas yuav hloov qhov ntawd.
  2. Hauv qab PLL Source Mux xaiv qhov xaiv qis, HSE.
  3. Tsuas yog rau txoj cai teeb tsa PLLMul rau X9.
  4. Txhawm rau sab xis dua hauv System Clock Mux xaiv PLLCLK.
  5. Txhawm rau sab xis dua hauv APB1 Prescalar xaiv /2.
  6. Qhov ntawd yog nws. Yog tias koj pom ib feem ntawm daim duab qhia meej hauv ntshav koj tau ua qee yam tsis raug.

Kauj ruam 4: Txuag thiab Tsim

  1. Txuag lub.ioc teeb tsa nrog Ctrl-S. Thaum koj raug nug yog tias koj xav tsim cov cai xaiv yog (thiab zuam Nco Kuv qhov kev txiav txim siab kom koj tsis raug nug txhua lub sijhawm). Koj tuaj yeem kaw cov ntaub ntawv.ioc
  2. Tam sim no ua tus tsim los ntawm cov ntawv qhia zaub mov Project | Tsim Project.

Kauj Ruam 5: Ntxiv Qee Cov Cai

Ntxiv Ib co Cai
Ntxiv Ib co Cai
Ntxiv Ib co Cai
Ntxiv Ib co Cai

Tam sim no peb yuav ntxiv qee qhov chaws siv lub chaw nres nkoj uas peb teeb tsa.

  1. Hauv Project Explorer qhib Core / Src thiab ob npaug nias main.c txhawm rau kho nws.
  2. Scroll cia kom txog thaum koj pom lub ntsiab () muaj nuj nqi thiab ntxiv cov lej qhia hauv qab no tsuas yog hauv qab cov lus / * USER CODE BEGIN 3 * / tom qab ntawd rov tsim dua.

HAL_UART_Transmit (& huart2, (uint8_t *) "Nyob zoo, ntiaj teb! / R / n", 15U, 100U);

Tom ntej no nws txuas lub kho vajtse thiab muab nws mus.

Kauj Ruam 6: Txuas Txuas Cov Khoos Phis Tawj

Txuas Txuas Cov Khoos Phis Tawj
Txuas Txuas Cov Khoos Phis Tawj
Txuas Txuas Cov Khoos Phis Tawj
Txuas Txuas Cov Khoos Phis Tawj

Txuas ST-LINK v2

ST-LINK v2 yuav tsum tau los nrog 4 xaim poj niam rau poj niam header ribbon cable. Koj yuav tsum ua cov kev sib txuas hauv qab no:

Blue Pill rau ST-LINK v2

GND to CSY

CLK to SWV

DIO to SWV

3.3 rau 3.3V

Saib thawj daim duab saum toj no.

Txuas tus Serial Cable

Yog tias koj rov qab mus rau.ioc cov ntaub ntawv thiab saib daim duab duab ntawm sab xis koj yuav pom tias UART2's Tx kab nyob ntawm tus pin PA2. Yog li txuas tus lej cim npe PA2 ntawm Blue Pill board rau kev txuas nrog cov xaim daj ntawm FTDI Serial cable. Kuj txuas ib qho ntawm Blue Pill tus pin hauv av (sau G) mus rau cov xaim dub ntawm FTDI cov xov txuas.

Saib daim duab thib ob saum toj no.

Kauj ruam 7: Debugging

Debugging
Debugging
Debugging
Debugging

Txuas koj hauv FTDI Serial cable thiab tua hluav taws xob txuas ntawm 115200 baud. Tom qab ntawd ntsaws rau hauv koj li ST-LINK v2 thiab koj npaj txhij mus.

  1. Los ntawm STM32CubeIDE xaiv Khiav | Debug. Thaum Debug li kev sib tham tshwm tuaj xaiv STM32 Cortex-M C/C ++ Application thiab OK.
  2. Thaum qhov Kho Kom Zoo Dua dialog pops up cia li nias OK.
  3. Tus debugger yuav tawg ntawm thawj kab ntawm lub ntsiab (). Los ntawm cov ntawv qhia zaub mov xaiv Khiav | Rov pib dua thiab tshawb xyuas cov lus hauv lub davhlau ya nyob twg.

Kauj Ruam 8: Ua Ntau Ntxiv

Qhov ntawd yog nws, koj thawj daim ntawv thov STM32CubeIDE tau teeb tsa thiab ua haujlwm. Qhov piv txwv no tsis ua ntau - tsuas yog xa qee cov ntaub ntawv tawm ntawm qhov chaw nres nkoj.

Txhawm rau siv lwm cov khoom siv sab nrauv thiab sau cov tsav tsheb rau cov cuab yeej sab nraud koj yuav tsum daws qhov kev hloov kho uas txaus ntshai dua! Txhawm rau pab, Kuv tau tsim cov kab ke STM32CubeIDE piv txwv cov phiaj xwm uas teeb tsa thiab siv tag nrho cov khoom siv ntawm Blue Pill tus txheej txheem hauv qhov yooj yim kom nkag siab cov phiaj xwm. Lawv txhua tus qhib qhov chaw thiab koj muaj kev ywj pheej ua txhua yam koj xav tau nrog lawv. Txhua qhov khoom siv sab nraud tau teeb tsa thiab tom qab ntawd muaj tus qauv coj los siv nws nyob hauv kev sib cais (ze li!) Yog li koj tuaj yeem mob siab rau kom tau txais ib qho khoom siv ib leeg mus ib zaug.

Kuj tseem muaj cov tsav tsheb rau cov cuab yeej sab nraud los ntawm EEPROM cov chips yooj yim rau ntsuas lub siab, ntawv nyeem thiab duab nraaj LCD, SIM800 tus qauv rau TCP, HTTP thiab MQTT, keypads, xov tooj cua modules, USB thiab tseem koom nrog FatFS, SD phaib thiab FreeRTOS.

Lawv txhua tus tuaj yeem pom hauv Github ntawm no …

github.com/miniwinwm/BluePillDemo

Pom zoo: