Cov txheej txheem:

STM32F407VET6 Black Board thiab MicroPython: 3 Kauj Ruam
STM32F407VET6 Black Board thiab MicroPython: 3 Kauj Ruam

Video: STM32F407VET6 Black Board thiab MicroPython: 3 Kauj Ruam

Video: STM32F407VET6 Black Board thiab MicroPython: 3 Kauj Ruam
Video: STM32F407VET6 BLACK BOARD ILI9341 FSMC BENCHMARK 2024, Kaum ib hlis
Anonim
STM32F407VET6 Black Board thiab MicroPython
STM32F407VET6 Black Board thiab MicroPython

QHIA

Kuv tau hla hla pheej yig STM32F407 board los ntawm AliExpress

Kuv txiav txim siab sim nws nrog MicroPython.

STM32F407 zoo nkauj npaum li tus tswj xws li STM32F405 siv

thawj pyboard, tab sis tig tawm ntawm MicroPython nplooj ntawv rub tawm muaj DFU cov ntaub ntawv rau STM32F407 tshawb pom pawg thawj coj. Cov ntawv ntawd kuv tau sim ntawm Black board thiab nws ua haujlwm zoo nkauj tshwj tsis yog qee lub luag haujlwm prom 'pyb' lub tsev qiv ntawv.

Yog li nws zoo dua los siv 'tshuab' lub tsev qiv ntawv kom ntau li ntau tau.

Yog tias koj tsis xav tos ob peb lub lis piam ua ntej pawg thawj coj dub tuaj txog, xaj thawj lub rooj tshawb nrhiav tab sis nws kim dua ob zaug.

Muaj cov ntawv qhia yuav ua li cas rau nruab MicroPython ntawm STM32F4Discovery.

Khoom siv

STM32F407VET6 kev txhim kho lub rooj tsav xwm dub

Kauj ruam 1: SOFTWARE

Rub tawm DFU cov ntaub ntawv rau STM32F4 Discovery board. Rub tawm DfuSe USB lub cuab yeej hloov kho lub cuab yeej los ntawm STMicroelectronics lub vev xaib. Txhawm rau ua qhov ntawd koj yuav tsum tso npe dawb tus account. Nruab DfuSe cov cuab yeej ntawm koj lub computer.

Kauj Ruam 2: Tau txais daim phiaj npaj

Tau txais daim phiaj npaj
Tau txais daim phiaj npaj

Muaj ob tus neeg dhia ntawm lub rooj tsav xwm txuas tus pin BT0 thiab BT1 rau GND. Tsiv BT0 mus rau 3.3V (saib daim duab). Qhib "DfuSe Qhia Tawm" cuab yeej, txuas lub rooj tsavxwm rau USB. Koj yuav tsum pom nyob rau sab saum toj sab laug lub thawv '' STM ntaus ntawv hauv USB hom '', dua li hauv qab txoj cai nyem '' Xaiv '', xaiv rub tawm DFU cov ntaub ntawv thiab nyem '' UPGRADE ''. Tsiv BT0 jumper rov qab rau GND thiab rov txuas USB cable. PYBFLASH grive yuav tsum tshwm ntawm koj cov ntaub ntawv kaw lus. Koj tuaj yeem nyeem thawj MicroPython PDF "Kev saib xyuas thiab pub mis ntawm Pythons ntawm Redmond Zoo."

Kauj Ruam 3: Pib PROGRAMMING

Tam sim no koj tuaj yeem pib muaj kev lom zem nrog MicroPython. Koj tuaj yeem sau koj cov haujlwm hauv ib qho ntawv sau, txawm tias Windows Notepad. Kuv nyiam thawj Pyton 3 IDE. Qhib PYBFLASH tsav thiab qhib main.py los ntawm nws hauv koj cov ntawv sau. Cia peb pib nrog qhov yooj yim LED blink program. Muaj ob lub LEDS ntawm lub rooj tsavxwm cim D2 thiab D3 txuas nrog PA6 thiab PA7 tus pin ntawm tus tswj. Sau qhov program yooj yim no hauv koj phau ntawv kho lus:

ntshuam tshuab, sijhawm #import micropython cov tsev qiv ntawv

coj = tshuab. Pin ('A6', tshuab. Pin. OUT) #muab tus pin PA6 raws li tso tawm

thaum Muaj Tseeb: #infinite loop

led.low () #switch coj rau

time.sleep (1) #tso coj mus rau ib pliag

led.high () #switch coj tawm

time.sleep (1) #tso nws tawm rau ib pliag

Txuag cov ntaub ntawv main.py rau koj lub rooj tsavxwm, nias lub pob pib dua LED D2 yuav tsum pib ntsais muag. Txoj hauv kev zoo tshaj los rov pib dua lub rooj tsavxwm yog los ntawm kab hais kom ua hauv REPL. Txhawm rau rub tawm thiab teeb tsa Putty. Txhawm rau siv Putty tau txais COM tus lej chaw nres nkoj rau pawg thawj coj los ntawm Tswj vaj huam sib luag> Tus thawj tswj ntaus ntawv. Thaum koj tau txais kev sib txuas, siv cov keyboard luv 'CTRL' + 'C' kom tsis txhob khiav qhov haujlwm ua ntej txuag qhov haujlwm tshiab thiab 'CTRL' + 'D' kom rov pib dua lub rooj tsavxwm tom qab txuag qhov program. Kuv pom tias yog txoj kev nyab xeeb tshaj plaws kom txuag tau thiab rov pib dua MicoPython cov haujlwm tsis yog tsuas yog txuas thiab rov txuas USB cable (thaum lub sijhawm txheej txheem no PYBFLASH tsav tuaj yeem ua tsis tau) Tam sim no, thaum kawg, cia ua LEDS D2 thiab D3 ntsais lwm qhov thiab nrawm dua:

ntshuam tshuab, sijhawm

coj = tshuab. Pin ('A6', tshuab. Pin. OUT)

led1 = tshuab. Pin ('A7', tshuab. Pin. OUT)

thaum Muaj Tseeb:

coj.low ()

sijhawm.s pw (0.5)

coj.high ()

sijhawm.s pw (0.5)

coj1.low ()

sijhawm.s pw (0.5)

coj1.high ()

sijhawm.s pw (0.5)

PS Koj tuaj yeem tau txais cov ntaub ntawv ntau ntxiv txog STM32F407 Black board ntawm GitHub thiab yog tias koj paub nrog Linux koj tuaj yeem sau DFU cov ntaub ntawv rau pawg tshwj xeeb no. Kuv tsis tau sim qhov ntawd. Kuv tsis muaj Linux tshuab tam sim no ua haujlwm.

Muaj kev lom zem nrog MicroPython!

Pom zoo: