Cov txheej txheem:

Yuav Ua Li Cas Ernie: 11 Kauj Ruam
Yuav Ua Li Cas Ernie: 11 Kauj Ruam

Video: Yuav Ua Li Cas Ernie: 11 Kauj Ruam

Video: Yuav Ua Li Cas Ernie: 11 Kauj Ruam
Video: Tupao Xiong & Nhia Chang - Kuv Tsis Paub Yuav Ua Li Cas (Original) 2024, Kaum ib hlis
Anonim
Yuav Ua Li Cas Ernie
Yuav Ua Li Cas Ernie

Nov yog kev qhia yuav ua li cas tsim Ernie, koj lub suab tsis zoo hauv qab cov neeg hlau, siv Zybo Board. Nws yuav npog yuav ua li cas: tsim ib qhov haujlwm hauv Vivado, tsim PWM-zoo li servo tsav tsheb hauv FPGA, cuam tshuam nrog ob lub suab ntsuas, tsim lub sijhawm sib txawv ntawm IP tuaj txog, siv freeRTOS, thiab khiav zybo tawm lub roj teeb pob. Nov yog peb qhov haujlwm kawg rau Chav Kawm Ua Haujlwm Sijhawm Tiag (CPE 439) ntawm Cal Poly SLO.

Cov npe khoom:

  • 1 - ZYBO Zynq 7000 Pawg Neeg Saib Xyuas Kev Txhim Kho
  • 2 - Parallax Nruam Kev Sib Hloov Servo
  • 2 - Suab Sensor (SparkFun Suab Ntes)
  • 1 - 5v Lithium Ion USB roj teeb pob (rau pawg thawj coj saib)
  • 4 - AA roj teeb (rau servos)
  • 1 - AA roj teeb pob (w/ 4 lub roj teeb qhov)
  • 1 - Micro USB cable
  • 1 - Daim ntawv qhia zaub mov
  • ntau - Txiv neej rau Txiv neej Hlau
  • 1 - Servo chassis

Software yuav tsum tau:

  • Xilinx Vivado Design Suite 2016.2
  • Digilent Adept 2.16.1 Cov

Kauj Ruam 1: Teeb tsa Txoj Haujlwm hauv Vivado rau Ernie

Teeb tsa Txoj Haujlwm hauv Vivado rau Ernie
Teeb tsa Txoj Haujlwm hauv Vivado rau Ernie
Teeb tsa Txoj Haujlwm hauv Vivado rau Ernie
Teeb tsa Txoj Haujlwm hauv Vivado rau Ernie
Teeb tsa Txoj Haujlwm hauv Vivado rau Ernie
Teeb tsa Txoj Haujlwm hauv Vivado rau Ernie
  1. Tus wizard yuav tshwm sim
  2. Nyem Tom ntej no
  3. Tom ntej no lub npe project

    1. Tsis txhob siv lub npe lossis txoj hauv kev uas muaj chaw nyob hauv nws !!!!!
    2. Qhov no yuav yog qhov haujlwm RTL.
  4. Peb tsis xav kom qhia cov peev txheej
  5. Nyem Tom ntej no, peb tau mus rau Tshooj nplooj. Peb siv ZYNQ XC7Z010-1CLG400C.

    1. Vivado tsis muaj Zybo teev tseg raws li ib qho ntawm nws tau npaj ua ntej pawg thawj coj. Xaiv: "ntu" tom qab ntawd tshawb rau xc7z010clg400-1.
    2. Yog tias koj xaiv qhov tsis raug los ntawm kev ua yuam kev koj tuaj yeem hloov pauv tau yooj yim: Cov Cuab Yeej -> Qhov Chaw Haujlwm -> Dav thiab nyem cov dots mus rau sab xis ntawm "Project Device"
  6. Nyem Tsim Tsim Tsim.

    Lub npe nws tsim_1 rau tam sim no

  7. Koj yuav pom kab ntsuab uas hais tias Ntxiv IP, nyem rau nws.
  8. Nrhiav Zynq.

    1. Ob npaug nias ZYNQ7 Ua Txheej Txheem,
    2. Qhov thaiv no yuav tshwm nyob rau hauv peb cov qauv tsim.
  9. Koj yuav pom lub bar ntsuab uas hais tias Run Block Automation, nyem rau nws.
  10. Rub tawm zybo_zynq_def.xml hauv qab no.
  11. Hauv Vivado, nyem "Ntshuam XPS Chaw" thiab xaiv "zybo_zynq_def.xml"

    Qhov no ua ntej tshaj tawm Vivado thaiv kev teeb tsa nrog txhua Zybo pawg thawj coj ua cov khoom siv sab hauv thiab tus lej ua haujlwm

  12. Ob npaug nyem rau ntawm ZYNQ thaiv.

    1. MIO Configuration

      1. Pab Timer 0 (nyob rau hauv Daim Ntawv Thov Txheej Txheem Chav - img 1)
      2. Pab kom Watchdog (nyob rau hauv Application Processor Unit- img 1)
      3. Pab kom GPIO-> GPIO MIO (nyob rau hauv Application Processor Unit - img 2)
      4. Pab kom GPIO-> ENET Pib dua (hauv I/O Peripherals- img 2)
    2. Clock Configuration

      Lov tes taw FCLK0 (hauv qab PL Npuag Clocks - img 3)

  13. Nyem Ok.
  14. "Khiav Thaiv Automation" tam sim no.

    Yuav muaj qee cov lus nug txog cov cim, hais OK

  15. Nyem "Tsim HDL Wrapper".

    Peb yuav xav luam daim ntawv qhwv tsim los tso cai rau cov neeg siv kho

  16. Nyem OK.

Kauj Ruam 2: Tsim Ernie's PWM hauv Vivado

Tsim Ernie's PWM hauv Vivado
Tsim Ernie's PWM hauv Vivado
Tsim Ernie's PWM hauv Vivado
Tsim Ernie's PWM hauv Vivado

Cov kauj ruam no yuav tsim PWM IP nrog cov tswv yim xa los ntawm AXI lub tsev qiv ntawv.

  1. Tsim AXI GPIO thaiv los ntawm txoj nyem rau tom qab, thiab nyem "ntxiv IP"

    ntaus "AXI_GPIO" rau hauv kab ntawv tshawb nrhiav, thiab xaiv pob khoom no

  2. Rov kho dua tus IP los ntawm ob npaug nias qhov tshiab axi_gpio_0 thaiv

    1. hauv qab GPIO, teeb tsa GPIO dav rau 2. Cov khoom no yuav yog PWM_ON teeb liab los tsav txhua PWM tus qauv piv txwv.
    2. nyem "pab kom dual channel"
    3. hauv qab GPIO 2, teeb tsa GPIO dav rau 2. Cov khoom no yuav yog PWM_FW teeb liab los teeb tsa cov lus qhia ntawm txhua tus qauv PWM piv txwv.
  3. Txoj cai nyem rau ntawm axi_gpio_0 qhov chaw nres nkoj tso npe GPIO, thiab xaiv "Ua Sab Nraud"

    1. Nyem rau ntawm qhov tso tawm tshiab sau tias GPIO, thiab mus rau "khoom" tab ntawm sab laug toolbar, thiab hloov lub npe rau PWM_ON
    2. Nyem rau ntawm qhov tso tawm tshiab sau tias GPIO2, thiab mus rau "khoom" tab ntawm sab laug toolbar, thiab hloov lub npe rau PWM_FW
  4. Xaiv Khiav Kev Sib Txuas Automation hauv daim npav ntsuab saum toj ntawm daim duab thaiv.

    Yog tias koj txuas cov chaw nres nkoj ntawm tus kheej, AXI chaw nyob yuav tsis teeb tsa, ua rau muaj teeb meem kev sib txuas lus tom qab

  5. Hauv Flow Navigator Pane, xaiv qhov project manager -> Ntxiv Sources los tsim qhov kev cai IP tshiab

    1. xaiv "ntxiv lossis tsim cov peev txheej tsim", thiab ntaus tom ntej
    2. nyem "tsim cov ntaub ntawv", hloov cov hom ntaub ntawv mus rau "SystemVerilog", thiab ntaus "pwm" rau hauv cov npe ntawv teb, tom qab ntawd nyem OK
    3. nyem Ua Ntej
    4. tsis quav ntsej Define Module window los ntawm nias OK (peb yuav sau dua cov no tom qab)

      yog nws nug yog tias koj paub tseeb, nyem Yog

  6. Hauv cov peev txheej tab, ob npaug nias rau pwm.sv (nyob hauv "Tsim Cov Qauv/tsim_1_wrapper")

    Luam/muab tag nrho SystemVerilog code los ntawm cov ntaub ntawv pwm.txt txuas hauv qab no

Kauj Ruam 3: Tsim Ernie's TDOA hauv Vivado

Tsim Ernie's TDOA hauv Vivado
Tsim Ernie's TDOA hauv Vivado
Tsim Ernie's TDOA hauv Vivado
Tsim Ernie's TDOA hauv Vivado

Cov kauj ruam no yuav tsim TDOA IP uas nws cov zis tuaj yeem nyeem tau ntawm AXI lub tsev qiv ntawv

  1. Tsim AXI GPIO thaiv los ntawm txoj nyem rau tom qab, thiab nyem "ntxiv IP"

    ntaus "AXI_GPIO" rau hauv kab ntawv tshawb nrhiav, thiab xaiv pob khoom no

  2. Rov kho dua tus IP los ntawm ob npaug nias qhov tshiab axi_gpio_1 thaiv

    1. hauv qab GPIO, khij lub npov "All Inputs", thiab teeb tsa GPIO dav rau 32. Lub npav no yuav yog lub sijhawm sib txawv ntawm kev tuaj txog ntawm ob lub ntsuas.
    2. sab hauv lub axi_gpio_1 thaiv, nyem qhov + ib sab ntawm GPIO chaw nres nkoj kom pom gpio_io_i [31: 0].
  3. Txoj cai nyem rau ntawm lub axi_gpio_1 qhov chaw nres nkoj tso npe gpio_io_i [31: 0], thiab xaiv "Ua Sab Nraud"

    Nyem rau ntawm cov ntaub ntawv tshiab sau tias gpio_io_i [31: 0], thiab mus rau "khoom" tab ntawm sab laug toolbar, thiab hloov lub npe rau TDOA_val

  4. Xaiv Khiav Kev Sib Txuas Automation hauv daim npav ntsuab saum toj ntawm daim duab thaiv.

    Yog tias koj txuas cov chaw nres nkoj ntawm tus kheej, AXI chaw nyob yuav tsis teeb tsa, ua rau muaj teeb meem kev sib txuas lus tom qab

  5. Hauv Flow Navigator Pane, xaiv qhov project manager -> Ntxiv Sources los tsim qhov kev cai IP tshiab

    1. xaiv "ntxiv lossis tsim cov peev txheej tsim", thiab ntaus tom ntej
    2. nyem "tsim cov ntaub ntawv", hloov cov hom ntaub ntawv mus rau "SystemVerilog", thiab ntaus "tdoa" rau hauv cov npe ntawv teb, tom qab ntawd nyem OK
    3. nyem Ua Ntej
    4. tsis quav ntsej Define Module window los ntawm nias OK (peb yuav sau dua cov no tom qab)

      yog nws nug yog tias koj paub tseeb, nyem Yog

  6. Hauv cov peev txheej tab, ob npaug nias rau tdoa.sv (nyob hauv "Tsim Cov Qauv/tsim_1_wrapper")

    Luam/muab tag nrho SystemVerilog code los ntawm tdoa.txt cov ntawv txuas hauv qab no

Kauj Ruam 4: Muab qhwv thiab xa tawm Ernie

Wrapping thiab Exporting Ernie
Wrapping thiab Exporting Ernie
  1. Txheeb xyuas tias daim duab thaiv zoo li lub screenshot txuas nrog
  2. Hauv cov peev txheej tab, nyem rau sab xis tsim_1.bd thiab xaiv "Tsim HDL Wrapper …"

    1. Xaiv "Luam theej tawm cov ntawv tso cai rau cov neeg siv kho", tom qab ntawv nyem "OK"
    2. Luam cov cai los ntawm design_1_wrapper.txt txuas hauv qab no, thiab muab tshuaj txhuam nws tso rau qhov chaw tsim tsim_1_wrapper.v chaws
    3. txuag design_1_wrapper.v
  3. Hauv cov peev txheej tab, ob npaug nias ZYBO_Master.xdc cov ntaub ntawv hauv qab Kev txwv/txwv 1

    1. Luam cov cai los ntawm ZYBO_Master.txt txuas hauv qab no, thiab muab nws tso rau qhov chaw ZYBO_Master.xdc uas twb muaj lawm
    2. Nco tseg cov tswv yim/tawm tswv yim hauv qab no:

      1. L15: PWM teeb liab rau lub tshuab laug (Pmod JA2 ntawm Zybo)
      2. L14: PWM teeb liab rau lub cev muaj zog (Pmod JA8 ntawm Zybo)
      3. V12: lub qhov rooj nkag los ntawm lub suab sensor 1 (Pmod JE1 ntawm Zybo)
      4. K16: lub qhov rooj nkag los ntawm lub suab sensor 2 (Pmod JE2 ntawm Zybo)
  4. Hauv Flow Navigator Pane, Nyem "Tsim Bitstream" hauv qhov program thiab Debug

    yog tias koj xav tias nws ua tiav tam sim ntawd, tej zaum tsis yog. tiag, ua ib co tshuaj yej

  5. Nyem File-> Export-> Tsim Kho Vajtse

    Txheeb "suav nrog Bitstream" thiab ntaus OK

  6. Nyem File-> Launch SDK

Kauj ruam 5: Tsim Ernie

Tsev Ernie
Tsev Ernie
Tsev Ernie
Tsev Ernie
  1. Mount lub servo rau servo chassis.
  2. Ua raws li cov ntawv teev tseg rau servos, ua cov hauv qab no:

    1. txuas hauv av ntawm servos rau hauv av pins ntawm Zybo's JA Pmod (saib cov duab txuas txuas ntxiv)
    2. txuas tus pin fais fab ntawm servos rau AA roj teeb pob

      Peb pom tias thaum cov servos txuas nrog Zybo's Vdd, pawg thawj coj kos ntau dhau tam sim no, ua rau pawg thawj coj saib tsis tu ncua

    3. txuas cov lus qhia teeb liab mus rau Zybo qhov tsim nyog tus pin (sab laug: JA2, sab xis: JA8)
  3. teeb tsa lub suab ntsuas mus rau pem hauv ntej ntawm lub chassis, tig mus rau pem hauv ntej, ua kom lawv nyob ze ua ke ntau li ntau tau
  4. siv lub suab sensor cov lus qhia sib txuas los ua ke cov suab ntsuas

    1. xaim av thiab Vdd pins ntawm txhua lub suab ntsuas mus rau hauv av thiab Vdd pins ntawm Zybo's JE Pmod (saib daim duab txuas txuas)
    2. xaim lub suab sab laug lub qhov rooj tus pin rau JE1
    3. xaim lub suab zoo lub qhov rooj tus pin rau JE2

Kauj Ruam 6: Ernie Thawj BSP

Ernie Thawj BSP
Ernie Thawj BSP
Ernie Thawj BSP
Ernie Thawj BSP
  1. Tsim BSP los qhwv lub platform peb nyuam qhuav tsim.

    Koj tuaj yeem tau txais qhov no los ntawm File -> New -> Board Support Package

  2. Tus kws pab tswv yim yuav tshwm tuaj pab koj tsim BSP.

    1. Peb xav kom khi BSP no nrog peb Lub Platform uas peb nyuam qhuav tsim, yog li
    2. Kho vajtse Platform yuav tsum ua kab nrog qhov peb nyuam qhuav tsim (saib img 1)
    3. Peb lub CPU yuav yog _0 CPU.
    4. Nyem tag
    5. Nco ntsoov txheeb xyuas lwip141 rau suav nrog koj bsp hauv lub qhov rais uas tshwm tuaj (saib img 2)

Kauj ruam 7: FreeRTOS'ing Ernie

  1. Rub tawm FreeRTOS tshiab tshaj tawm los ntawm Sourceforge.

    Yog tias rub tawm yog qhov ua tiav, khiav nws los rho tawm FreeRTOS cov ntaub ntawv rau hauv koj cov npe kab ke

  2. Khaws qhov SDK qhib, thiab nyem Cov Ntaub Ntawv -> Ntshuam.
  3. Peb xav nyem General-> Los ntawm Qhov Chaw Ua Haujlwm Uas Muaj, thiab tom qab ntawd peb yuav xav mus rau qhov uas peb rub tawm FreeRTOS.
  4. Peb qhov demo yuav nyob hauv FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702. Thaum xaiv daim nplaub tshev no, peb yuav tsum pom peb qhov haujlwm tshwm sim (peb cov cai (OS), nws yog BSP, thiab HW Platform).

    Tsuas yog Ntshuam RTOSDemo rau hauv koj qhov chaw ua haujlwm tam sim no

  5. Ntawm txhua qhov "xiav" cov phiaj xwm hloov pauv hais txog BSP

    1. Txoj cai nyem thiab xaiv "Hloov Hloov BSP."
    2. Xaiv BSP koj nyuam qhuav tsim rau koj Zybo
    3. Txoj Cai Kho Kom Zoo Dua hauv Xilinx's SDK Blue folders yog cov phiaj xwm phiaj xwm tiag.

Kauj Ruam 8: Ntshuam Ernie's C Code

  1. Hauv RTOSDemo/src phau ntawv teev npe, sau dua qhov qub.c uas twb muaj lawm nrog cov ntaub ntawv main.c txuas ntawm no.
  2. Luam the main_sound.c fiile rau hauv RTOSDemo/src cov npe.

Kauj ruam 9: Debugging Ernie

  1. Xaiv Run -> Debug Configurations
  2. Ntawm sab laug pane tsim qhov System Debugger tshiab
  3. Hauv Target Setup tab,

    xaiv "Rov Pib Dua System" kom ob qho ntawd thiab ps7_init raug xaiv

  4. Tam sim no xaiv Daim Ntawv Thov tab.

    1. Xaiv "rub tawm daim ntawv thov"
    2. Teem lub cortexa9_0 core rau "nres ntawm qhov program nkag"
    3. Nyem Thov thiab Debug.
  5. Txheeb xyuas tias tsis muaj qhov yuam kev hauv txoj kev debugging
  6. Ua kom ze saib ntawm tus neeg hlau, nias lub khawm Rov pib dua kom txog thaum qhov haujlwm ua haujlwm yam tsis muaj qhov cuam tshuam dab tsi
  7. Tam sim no tus neeg hlau yuav tsum tig thiab txav mus rau lub suab nrov nrov. Yay!

Kauj ruam 10: Ua Ernie Autonomous

  1. Thaum koj qhov phiaj xwm tau npaj txhij mus (koj tuaj yeem ua haujlwm yam tsis muaj teeb meem los ntawm kev debugger) koj npaj txhij thauj nws mus rau lub cim xeeb nyem ntawm koj lub rooj tsavxwm.
  2. Tsim qhov hu ua "thawj theem boot loader" (FSBL) txoj haujlwm thiab muaj txhua qhov kev qhia uas koj pawg thawj coj yuav xav tau txhawm rau txhawm rau thauj koj cov phiaj xwm phiaj xwm (cov dej me me thiab OS) ntawm kev pib.

    1. Xaiv: File-> New-> Application Project thiab cov hauv qab no yuav tsum tshwm.
    2. Npe nws yam koj xav tau (piv txwv li “FSBL”)
    3. Xyuas kom lub platform kho vajtse yog qhov koj tab tom ua haujlwm nrog
    4. Nias tom ntej (Tsis txhob nias Finish)
    5. Xaiv Zynq FSBL tus qauv
    6. Nyem tag.
  3. Thaum cov txheej txheem tsim tiav koj yuav paub yog tias txhua yam ua haujlwm yog tias koj pom ob daim ntawv tshiab hauv qab no hauv Project Explorer qhov rai.
  4. Tsim Boot Image Tam sim no koj yuav tsum tsim cov duab Boot.

    1. Txoj cai nyem rau ntawm koj qhov project (hauv qhov no kuv hu ua "RTOSDemo")
    2. Nyem "Tsim khau raj duab" los ntawm qhov nco cia
    3. Yog tias txhua yam txuas nrog kom raug, txoj haujlwm yuav paub cov ntaub ntawv twg nws xav tau thiab lub qhov rais hauv qab no yuav zoo li koj pom hauv qab no (qhov tseem ceeb yog koj muaj 3 ntu hauv ntu Boot duab ntu, bootloader, koj cov ntawv me me, thiab koj cov haujlwm.elf file).

      Yog tias qhov no tsis yog qhov muaj tej zaum tsis raug nrog koj qhov project txuas. Ua kom ntseeg tau tias cov phiaj xwm phiaj xwm tau txuas nrog lawv cov BSPs

    4. Nyem rau "Tsim Duab" khawm
  5. Kauj ruam kawg los ua hauv software yog tam sim no nyem koj cov duab tsim yav dhau los rau hauv pawg thawj coj saib lub cim xeeb

    1. Xaiv los ntawm SDK lub cuab yeej tseem ceeb bar xaiv Xilinx Cuab Yeej-> Txoj Haujlwm Flash Nco
    2. Ua kom ntseeg tau tias lub khoos phis tawj kho vajtse raug xaiv raug xaiv thiab cov duab kab ntawv raug yog taw tes rau qhov. BIN cov ntaub ntawv tsim nyob hauv cov kauj ruam dhau los.
    3. Xaiv "qspi ib leeg" los ntawm hom Flash
    4. Nyem rau "Txheeb xyuas tom qab nyem" txhawm rau ua kom muaj kev ncaj ncees tab sis nws tsis xav tau
  6. Configure Your Board Thaum kawg koj yuav tsum tau pov hwm tias cov laug cam hom kev ua haujlwm jumper (JP5) raug teeb tsa kom raug xaiv los khau raj los ntawm qspi (uas muaj dab tsi koj nyuam qhuav flashed) thaum BootROM tau khiav.
  7. Tam sim no tsuas yog siv lub zog nruab nrab ntawm lub cuab yeej thiab pov hwm "Logic Configuration Done LED" (LED 10) tau teeb ntsuab.

Kauj Ruam 11: Ua Ernie Ntxim Hlub

  1. Plaub
  2. Ntau Fur
  3. Loj qhov muag!
  4. … lub kaus mom sab saum toj

Pom zoo: