Cov txheej txheem:

Yuav Ua Li Cas Siv Debugger ntawm ESP32: 11 Cov Kauj Ruam (nrog Duab)
Yuav Ua Li Cas Siv Debugger ntawm ESP32: 11 Cov Kauj Ruam (nrog Duab)

Video: Yuav Ua Li Cas Siv Debugger ntawm ESP32: 11 Cov Kauj Ruam (nrog Duab)

Video: Yuav Ua Li Cas Siv Debugger ntawm ESP32: 11 Cov Kauj Ruam (nrog Duab)
Video: Yuav ua li cas By Nhia Lor [full version] 2024, Kaum ib hlis
Anonim
Yuav Ua Li Cas Siv Debugger ntawm ESP32
Yuav Ua Li Cas Siv Debugger ntawm ESP32

Koj puas tau xav ua tib zoo saib hauv koj cov cai kom pom tias vim li cas nws thiaj coj tus cwj pwm zoo li nws? Kev lig kev cai hauv ESP32 cov phiaj xwm, koj yuav tsum tau ntxiv cov ntawv luam tawm tsis kawg los sim txiav txim siab seb muaj dab tsi tshwm sim, tab sis muaj txoj hauv kev zoo dua!

Debugger yog ib txoj hauv kev pom dab tsi tshwm sim ntawm qee ntu ntawm koj cov cai thiab sim ua qhov sib txawv sib txawv qhov tseem ceeb yam tsis rov suav koj tus lej, feem ntau qhov no tsis yog qee yam muaj rau peb ntawm cov phiaj xwm kos, tab sis hauv phau ntawv qhia no kuv yuav qhia koj yuav siv nws li cas ntawm ESP32.

Hauv phau ntawv qhia no kuv yuav qhia koj teeb tsa kho vajtse, teeb tsa software thiab qhia piv txwv yooj yim ntawm kev siv lub debugger.

Khoom siv

  • ESP -Prog - Nov yog pawg thawj coj xav tau rau kev debugging

    • Qhov tseeb uas kuv yuav*
    • $ 5 Ib qho pheej yig dua, tab sis kuv tsis tau sim nws*
  • ESP32 uas tawm tus pin 12, 13, 14, 15

    • Adafruit Feather Huzzah32
    • D1 Mini ESP32*
  • [TSIS MUAJ] Debug Shield Kuv muag ntawm Tindie

    • Plaub Huzzah 32
    • D1 Mini ESP32

* = Kev Koom Tes Txuas

Kauj ruam 1: Txheeb Tawm Cov Video

Image
Image

Kuv muaj daim vis dis aus ntawm cov ncauj lus no yog tias koj xav tshuaj xyuas nws.

Ntawm kuv cov channel kuv ib txwm ua ESP8266 thiab ESP32 raws cov vis dis aus, yog li yog koj xav tau cov ntawd, thov txheeb xyuas nws!

Kauj Ruam 2: Kho vajtse - Tshooj & Cov Hluav Taws Xob

Kho vajtse - Tshooj & thaiv
Kho vajtse - Tshooj & thaiv
Kho vajtse - Tshooj & thaiv
Kho vajtse - Tshooj & thaiv
Kho vajtse - Tshooj & thaiv
Kho vajtse - Tshooj & thaiv

Txhawm rau siv tus debugger koj tsuas xav tau ESP-Prog thiab yuav luag txhua lub ESP32 pawg thawj coj (txuas rau cov no hauv qib ua ntej)

ESP-Kev Kawm:

ESP-Prog yog pawg thawj coj tsim los ntawm espressif, tus tsim ESP32 thiab ESP8266 chips. Nws txuas rau JTAG tus pin ntawm ESP32 kom peb siv tus debugger. Nws tseem tuaj yeem siv rau kev tsim ESP32 cov laug cam, tab sis kuv yuav tsis npog qhov ntawd ntawm no.

ESP32 Pawg Thawj Coj:

Koj tuaj yeem siv qhov tseem ceeb ntawm ESP32 pawg thawj coj rau qhov no ib zaug nws ua txhaum JTAG tus pin, uas yog 12, 13, 14 & 15. Kuv tau sim ob qho tib si Adafruit plaub Huzzah32 thiab D1 Mini 32 board thiab lawv ob leeg ua haujlwm tau zoo.

Thov nco ntsoov tias koj tuaj yeem siv tus lej JTAG hauv koj daim duab nrog tus debugger, piv txwv li cov teeb tsa LED ntawm Huzzah32 lub rooj tsavxwm nyob ntawm tus pin 13, yog li koj tsis tuaj yeem siv nws thaum debugging.

Thaiv:

Txhawm rau txuas ESP-Prog mus rau ESP32, tsuas yog siv cov kab lus qhia raws li tau hais hauv daim duab saum toj no. Txheeb nrog daim kab xev daim duab ntawm koj ESP32 pawg thawj coj yog tias koj tsis pom tam sim ntawd cov pins uas tsim nyog raws li qee zaum lawv siv cov npe sib txawv.

Debug Shields:

Cov no yog qhov xav tau, tab sis kuv muag qee cov ntaub thaiv npog ntawm Tindie rau Huzzah32 thiab D1 Mini 32 uas ua txuas ESP-Prog yooj yim heev, nws cuam tshuam cov pins uas tsim nyog rau IDC txuas uas koj tuaj yeem siv cov hlua txuas txuas ncaj qha ntawm ntaub thaiv npog thiab ESP-Prog

Kauj Ruam 3: Kho Vajtse - Teeb Tsav Tsheb

Kho vajtse - Teeb tsa tus tsav tsheb
Kho vajtse - Teeb tsa tus tsav tsheb
Kho vajtse - Teeb tsa tus tsav tsheb
Kho vajtse - Teeb tsa tus tsav tsheb
Kho vajtse - Teeb tsa tus tsav tsheb
Kho vajtse - Teeb tsa tus tsav tsheb

Txhawm rau siv ESP-prog rau kev debugging, peb yuav tsum teeb tsa cov tsav tsheb tsim nyog rau nws. PlatformIO muab qee cov kauj ruam rau qhov ntawd, tab sis kuv yuav hla lub Windows cov kauj ruam hauv phau ntawv qhia no.

  1. Rub tawm thiab teeb tsa FTDI cov tsav tsheb rau ESP-Prog los ntawm no, nqes mus rau sab xis kom rub tawm "teeb tsa ua tau" version kom yooj yim dua.
  2. Rub tawm thiab teeb tsa lub cuab yeej Zadig los ntawm no, qhov no tso cai rau peb teeb tsa cov tsav tsheb uas xav tau rau kev debugging.
  3. Nrog ESP-Prog ntsaws, qhib Zadig
  4. Hauv Zadig daim ntawv thov, hauv qab "Xaiv", nyem "Teev Txhua Yam Khoom"
  5. Qhov poob hauv Zadig tam sim no yuav muaj neeg nyob, xaiv qhov "Dual RS232-HS (Interface 0)" xaiv. Nco ntsoov nws yog interface 0 koj xaiv!
  6. Mus rau sab xis ntawm tus xub ntsuab, "WinUSB" yuav tsum raug xaiv, tom qab ntawd nyem "Hloov Tsav Tsheb"

Thaum qhov ua tiav koj cov tsav tsheb yuav tsum teeb tsa rau siv!

Nco tseg: Yog tias koj hloov chaw nres nkoj USB uas koj tab tom siv rau ESP-Prog, koj yuav tau rov ua cov kauj ruam 3-6 dua. Yog tias koj tau txais qhov yuam kev raws li qhia hauv daim duab saum toj no thaum debugging, koj yuav tsum rov ua cov kauj ruam.

Kauj Ruam 4: Software: Txhim Kho PlatformIO

Software: Txhim kho PlatformIO
Software: Txhim kho PlatformIO
Software: Txhim kho PlatformIO
Software: Txhim kho PlatformIO
Software: Txhim kho PlatformIO
Software: Txhim kho PlatformIO

PlatformIO yog IDE txhawm rau txhim kho nrog ntau yam txheej txheem sib txawv, suav nrog Arduino eco-system. Nws yog qhov nyuaj rau siv ntau dua li qee yam xws li Arduino IDE, tab sis nws muaj zog heev thiab muaj qee qhov tshwj xeeb uas Arduino IDE mob heev tsis nco qab, xws li pib ua tiav.

Nws yog qhov yuav tsum tau ua rau PlatformIO siv tus debugger. Yog tias koj twb paub lawm nrog PlatformIO, xav tias yuav hla dhau ob peb kauj ruam.

  • Rub tawm thiab teeb tsa Visual Studio Code (VS Code) los ntawm qhov txuas muab rau ntawm PlatformIO.org lub vev xaib
  • Qhib VS Code, thiab qhib cov ntawv qhia txuas ntxiv, lub pob tau hais qhia hauv daim duab saum toj no
  • Ntaus "platformio" rau hauv kev tshawb nrhiav, xaiv nws thiab nyem rau nruab.

Kauj Ruam 5: Software: Siv PlatformIO

Software: Siv PlatformIO
Software: Siv PlatformIO
Software: Siv PlatformIO
Software: Siv PlatformIO
Software: Siv PlatformIO
Software: Siv PlatformIO

Siv PlatformIO yog qhov txawv me ntsis dua li siv Arudino IDE, yog li hauv qib no peb tsuas yog npog qhov pib ntawm kev ua piv txwv ntawm kev ua haujlwm ntawm pawg thawj coj.

Qhib Piv Txwv:

  1. Nyem rau Lub Tsev khawm ntawm PlatformIO toolbar (Raws li qhia hauv daim duab)
  2. Nyem rau "Project Piv txwv" khawm
  3. Xaiv qhov "Arduino-blink" piv txwv hauv qab Espressif 32 ntu

Qhov no yuav qhib qhov qauv ntsais ntsais qhov project. Cov txheej txheem ntawm PlatformIO yog qhov zoo sib xws piv rau Arduino txoj haujlwm, yog li cia peb mus dhau qhov pib.

Txoj cai nyob qhov twg?

Txoj cai rau koj txoj haujlwm yuav muab khaws cia rau hauv "src" nplaub tshev, rau qhov piv txwv ntsais koj yuav pom "blink.cpp" cov ntaub ntawv, cov ntaub ntawv no zoo ib yam li koj daim ntawv kos duab (.ino) hauv Arduino project.

Kuv yuav teeb tsa kuv lub rooj tsavxwm li cas?

Kev teeb tsa rau koj txoj haujlwm raug khaws cia hauv "platformio.ini" cov ntaub ntawv hauv koj qhov project. Qhov no yog ib qho uas kuv nyiam tshaj plaws txog PlatformIO piv rau Arduino IDE, nws tsis tau txiav txim siab rau kuv tias cov teeb tsa pawg thawj coj tsis raug khi rau kev kos duab.

Piv txwv.ini muaj cov lus txhais rau ntau lub rooj sib txawv, tab sis kom ua tej yam yooj yim cia peb rho tawm ob nqe lus hauv qab.

Kuv yuav teeb kuv qhov chaw nres nkoj COM nyob qhov twg?

PlatformIO yuav tau txiav txim siab tiag tiag txhawm rau nrhiav qhov tseeb COM chaw nres nkoj los siv, yog li koj tuaj yeem tawm mus yam tsis tau teeb tsa dab tsi rau qhov no. Tab sis yog tias koj muaj ntau lub chaw nres nkoj COM, uas koj yuav ua thaum siv lub debugger, kuv xav tias nws tsim nyog los teeb tsa qhov tshwj xeeb uas koj xav tau. koj tuaj yeem teev qhov twg koj ESP32 nyob hauv "platformio.ini" los ntawm kev ntxiv "upload_port" teeb tsa.

Kuv yuav xa kuv tus lej li cas?

Nyem rau ntawm Upload khawm (lub cim yog tus xub taw qhia sab xis) thiab nws yuav tsum suav sau thiab xa cov cai. Tam sim no koj yuav tsum muaj lub ntsais ntsais LED ntawm koj lub rooj tsavxwm.

Kauj Ruam 6: Debugging: Muaj Peev Xwm Txiv Neej Tawv

Debugging: Muaj peev xwm Txiv tsawb tawv nqaij!
Debugging: Muaj peev xwm Txiv tsawb tawv nqaij!
Debugging: Muaj peev xwm Txiv tsawb tawv nqaij!
Debugging: Muaj peev xwm Txiv tsawb tawv nqaij!
Debugging: Muaj peev xwm Txiv tsawb tawv nqaij!
Debugging: Muaj peev xwm Txiv tsawb tawv nqaij!

Nov yog qee yam uas ntes kuv tawm thaum kuv tab tom npaj qhov no thiab vam tias yuav raug kho los ntawm lub sijhawm koj sim nws, tab sis kuv xav tias nws yog ib qho tseem ceeb kom tawm ntawm no.

Thaum lub sijhawm ua phau ntawv qhia no, qhov hloov tshiab kawg ntawm PlatformIO yog 4.3.0 thiab nws muaj kab laum uas cuam tshuam nrog kev muaj peev xwm daws teeb meem. Ua tsaug uas peb tuaj yeem hloov kho mus rau qhov kev txhim kho tshiab kawg zoo nkauj yooj yim uas daws qhov teeb meem.

Txheeb xyuas ntawm Lub Tsev nplooj ntawv ntawm PlatformIO core, yog tias nws yog "4.3.0", ua raws cov theem hauv qab no.

  1. Ntawm PlatformIO toolbar, nyem lub cim dav hlau
  2. Hauv hom davhlau ya nyob twg: pio upgrade --dev
  3. RestartVS code thiab PlatfromIO yuav tsum tau hloov kho tshiab

Kauj Ruam 7: Debugging: Kev teeb tsa

Debugging: Kev teeb tsa
Debugging: Kev teeb tsa

Peb xav tau kho cov ntaub ntawv "PlatofrmIO.ini" txhawm rau pab kom debug, peb tsuas yog xav ntxiv ob yam rau nws.

debug_tool = esp-prog

Qhov no teev cov cuab yeej debug peb siv.

debug_init_break = tsoo teeb tsa

Nov yog qhov dag peb tau kawm los ntawm Andress Spiess 'video ntawm debugging ntawm ESP32. Nws qhia tus debugger kom nres hauv kev teeb tsa peb daim ntawv thov.

Kauj Ruam 8: Debugging: Pib Debugging

Debugging: Pib Debugging
Debugging: Pib Debugging
Debugging: Pib Debugging
Debugging: Pib Debugging
Debugging: Pib Debugging
Debugging: Pib Debugging
Debugging: Pib Debugging
Debugging: Pib Debugging

Ua ntej peb nkag mus rau hauv nws, peb yuav hloov pauv me me rau cov duab kos uas yuav ua rau nws yooj yim dua los qhia tias koj tuaj yeem ua dab tsi nrog kev debugging.

  1. Tsim qhov hloov pauv tshiab, "int delayTime = 1000;" sab nraum ntawm txhua txoj hauv kev, qhov no yuav ua rau nws hloov pauv thoob ntiaj teb.
  2. Hloov tus lej sab hauv hu ncua hauv lub voj nrog qhov hloov pauv tshiab no: ncua (ncua sijhawm)

Hloov cov cai rau lub rooj tsavxwm ib zaug ntxiv, tom qab ntawd los pib debugging, hauv qhov toolbar, nyem "Run" ces "Start Debugging"

Koj yuav pom cov khoom txav mus rau hauv lub qhov rai qhov rai, tab sis txawm tias thaum ntawd hais tias nws ua tiav, yog tias koj nyem rau ntawm "Debug Console" koj yuav pom nws tseem ua haujlwm, nws yuav siv ob peb feeb kom tiav.

Yog tias txhua yam mus raws li qhov xav tau koj yuav pom lub debugger nres thaum pib teeb tsa.

Kauj Ruam 9: Debugging: Kev Siv Yooj Yim

Debugging: Kev Siv Yooj Yim
Debugging: Kev Siv Yooj Yim
Debugging: Kev Siv Yooj Yim
Debugging: Kev Siv Yooj Yim
Debugging: Kev Siv Yooj Yim
Debugging: Kev Siv Yooj Yim
Debugging: Kev Siv Yooj Yim
Debugging: Kev Siv Yooj Yim

Cia peb npog qee qhov pib ntawm yam koj tuaj yeem ua nrog lub debugger

Tsim Breakpoints:

Qhov kev tawg yog qhov taw tes ntawm koj cov cai uas koj xav kom tus debugger nres. Txhawm rau tsim tus lej txhawm rau nyem rau sab laug ntawm kab kab. Raws li kev qhia tawm, ntxiv qhov kev txiav txim siab rau thawj kab hauv txoj kev ua voj.

Breakpoint Navigation:

Txhawm rau txav nruab nrab ntawm qhov chaw tawg lossis txav mus rau kab kab tom ntej, koj tuaj yeem siv cov cuab yeej uas yuav tshwm nyob rau sab saum toj ntawm lub vijtsam. Nias lub pob "txuas ntxiv" (zoo li lub pob ua si) kom txav mus rau qhov chaw tawg peb nyuam qhuav tsim hauv lub voj.

Tsis Siv Neeg Saib:

Cov hloov pauv hloov pauv tau tso cai rau koj saib xyuas tus nqi ntawm kev hloov pauv thaum lub debugger raug nres ntawm qhov chaw tawg. Txhawm rau ntxiv qhov hloov pauv tshiab saib koj tuaj yeem nyem rau ntawm + icon, tom qab ntawv tsuas yog ntaus lub npe ntawm qhov sib txawv. Raws li qhov ua piv txwv, ntaus hauv qhov sib txawv peb tau ntxiv hauv cov kauj ruam dhau los "delayTime"

Hloov pauv saib:

Koj tseem tuaj yeem pom txhua qhov kev hloov pauv thiab lawv qhov txiaj ntsig uas muaj nyob ntawm koj qhov kev cuam tshuam tam sim no. Txhawm rau ua qhov no, Yog tias koj saib hauv ntu "Ntiaj Teb" koj yuav tsum pom qhov "ncua sijhawm" sib txawv.

Hloov kho Tus Nqi ntawm Cov Qub:

Koj tseem tuaj yeem hloov kho qhov tseem ceeb ntawm kev hloov pauv thiab nws yuav muaj kev cuam tshuam tam sim rau koj tus lej tus cwj pwm. Txhawm rau ua kom pom qhov no, nyem rau ntawm ncua sij hawm ncua sij hawm sib txawv hauv ntu Hloov pauv Tus Saib, thiab hloov tus nqi rau "100". Txhawm rau qhia qhov ua haujlwm no, xiam qhov chaw tawg hauv lub voj los ntawm txhaj rau sab laug ntawm kab kab dua. Nias lub pob txuas mus ntxiv ntawm qhov chaw nres nkoj taw qhia nres. LED ntawm koj ESP32 yuav tsum tam sim no ntsais muag sai dua li ua ntej.

Kauj ruam 10: Teeb meem

Teeb meem
Teeb meem

Kuv pom thaum kuv sim, tias qee lub sijhawm kuv tsis tuaj yeem rub mus rau ESP32 thaum nws txuas nrog ESP-prog, thiab kuv tsis tuaj yeem txheeb xyuas tus qauv vim li cas qhov no tshwm sim, vim tias feem ntau kuv tuaj yeem upload yam tsis muaj tej teeb meem Kuv pom tias kuv tsuas tuaj yeem txuas ESP32 thiab ESP-Prog, upload cov cai rau ESP32 thiab tom qab ntawd txuas lawv dua thiab nws yuav ua haujlwm tau zoo.

Kauj ruam 11: Kev sib cav

Kuv xav tias qhov no yog ib qho cuab yeej zoo heev ntxiv rau lub cuab yeej los pab txheeb xyuas seb yuav muaj dab tsi tshwm sim hauv koj qhov project.

Kuv yuav nyiam hnov yog tias koj pom qhov no muaj txiaj ntsig!. Thov qhia rau kuv paub hauv cov lus hauv qab no, lossis koom nrog kuv thiab ib pawg ntawm lwm tus tsim ntawm kuv li Discord server, qhov uas peb tuaj yeem tham txog cov ncauj lus no lossis lwm tus tsim muaj feem cuam tshuam nrog koj muaj, tib neeg yeej muaj txiaj ntsig zoo yog li nws yog qhov chaw zoo rau dai tawm.

Kuv kuj tseem xav ua tsaug ntau rau kuv Github Sponsors uas pab txhawb qhov kuv ua, Kuv yeej txaus siab rau nws. Yog tias koj tsis paub, Github sib piv cov kev txhawb nqa rau thawj xyoo, yog li yog koj ua tus txhawb nqa lawv yuav phim nws 100% rau ob peb hlis tom ntej. Ua tsaug rau kev nyeem ntawv!

Pom zoo: