Cov txheej txheem:

Kev daws teeb meem siab PWM teeb liab rau RC Servos Nrog STM32 Cov Khoom Siv: 3 Kauj Ruam
Kev daws teeb meem siab PWM teeb liab rau RC Servos Nrog STM32 Cov Khoom Siv: 3 Kauj Ruam

Video: Kev daws teeb meem siab PWM teeb liab rau RC Servos Nrog STM32 Cov Khoom Siv: 3 Kauj Ruam

Video: Kev daws teeb meem siab PWM teeb liab rau RC Servos Nrog STM32 Cov Khoom Siv: 3 Kauj Ruam
Video: Kev hlub quav tshuaj-LOKY(Official MV ) 2024, Kaum ib hlis
Anonim
Kev daws teeb meem siab PWM teeb liab rau RC Servos Nrog STM32 Devices
Kev daws teeb meem siab PWM teeb liab rau RC Servos Nrog STM32 Devices
Kev daws teeb meem siab PWM teeb liab rau RC Servos Nrog STM32 Devices
Kev daws teeb meem siab PWM teeb liab rau RC Servos Nrog STM32 Devices
Kev daws teeb meem siab PWM teeb liab rau RC Servos Nrog STM32 Devices
Kev daws teeb meem siab PWM teeb liab rau RC Servos Nrog STM32 Devices

Tam sim no, Kuv tab tom tsim RC transmitter/txais raws li SX1280 RF nti. Ib lub hom phiaj rau txoj haujlwm yog tias kuv xav tau 12 ntsis kev pabcuam servo daws teeb meem los ntawm cov pas nrig tawm mus rau servos. Ib nrab vim tias cov digital servos niaj hnub muaj 12 ntsis kev daws teeb meem thib ob lub siab xa tawm siv 12 khoom ib qho lawm. Kuv tau tshawb nrhiav yuav ua li cas kuv thiaj tuaj yeem tsim teeb meem PWM siab rau ntawm STM32 cov cuab yeej. Kuv tab tom siv cov tshuaj dub (STM32F103C8T8) rau lub sijhawm tam sim no.

Kauj Ruam 1: Daim Ntawv Teev Npe

Kho vajtse

  • Txhua lub rooj tsav xwm txhim kho STM32F103 (ntsiav tshuaj xiav, ntsiav tshuaj dub, thiab lwm yam)
  • USB lub txhab nyiaj hluav taws xob ua lub hwj chim
  • STM32 programmer (Segger j-links, ST-LINK/V2, lossis yooj yim st-txuas clone)

Software

  • STM32CubeMX
  • Atollic TrueSTUDIO rau STM32
  • Qhov project los ntawm github

Kauj Ruam 2: Kev Pom Kom Pom Dua

Kev Pom Zoo Dua
Kev Pom Zoo Dua
Kev Pom Zoo Dua
Kev Pom Zoo Dua
Kev Pom Zoo Dua
Kev Pom Zoo Dua

Tej zaum qhov kev daws teeb meem yooj yim tshaj plaws yog siv ib lub sijhawm uas tuaj yeem tsim PWM cov cim, zoo li TIM1-3 ntawm STM32F103. Txog niaj hnub digital servo tus ncej tus nqi tuaj yeem nqes mus rau 5 ms lossis li ntawd, tab sis rau qhov qub analog servo nws yuav tsum yog 20 ms lossis 50 Hz. Yog li, raws li qhov xwm txheej phem tshaj cia peb tsim qhov ntawd. Nrog 72 MHz moos thiab 16 ntsis timer timer daws teeb meem peb yuav tsum teeb tsa lub sijhawm ua ntej rau qhov tsawg kawg 23 thiaj li yuav npog 20 ms tus nqi. Kuv xaiv 24 vim tias tom qab ntawd rau 20 ms Kuv yuav tsum teeb lub txee raws nraim rau 60000. Koj tuaj yeem pom CubeMX teeb tsa thiab tsim tawm 1 thiab 1.5 ms PWM cov cim hauv cov duab. Hmoov tsis zoo, rau 1ms lub sijhawm timer yuav tsum tau teeb tsa rau 3000, uas yuav muab rau peb tsuas yog 11 qhov kev daws teeb meem. Tsis phem, tab sis lub hom phiaj yog 12 ntsis, yog li cia peb sim lwm yam.

Yog lawm Yog tias kuv yuav xaiv lub micro tswj nrog 32 ntsis timer txee, zoo li STM32L476 qhov kev daws teeb meem no tuaj yeem siab dua thiab qhov teeb meem yuav raug daws.

Tab sis ntawm no, Kuv xav tawm tswv yim txog kev daws teeb meem uas yuav ntxiv kev daws teeb meem txawm tias nyob ntawm STM32F103.

Kauj Ruam 3: Cascading Timers rau Siab Daws Teeb Meem

Cascading Timers rau Siab Daws Teeb Meem
Cascading Timers rau Siab Daws Teeb Meem
Cascading Timers rau Siab Daws Teeb Meem
Cascading Timers rau Siab Daws Teeb Meem
Cascading Timers rau Siab Daws Teeb Meem
Cascading Timers rau Siab Daws Teeb Meem

Qhov teeb meem tseem ceeb nrog kev daws teeb meem yav dhau los yog tias tus lej tus lej (20 ms) yog qhov siab dua piv rau qhov tsim tawm PWM teeb liab tiag tiag (nruab nrab ntawm 1 thiab 2 ms), yog li peb tau nkim qee cov khoom muaj txiaj ntsig rau seem 18 ms thaum peb tos tus ncej tom ntej Qhov no tuaj yeem daws tau los ntawm cascading timers siv lub sijhawm txuas txuas rau kev ua haujlwm.

Lub tswv yim yog tias kuv yuav siv TIM1 ua tus tswv los tsim tus ncej tus nqi (20 ms) thiab TIM2, TIM3 txhawm rau tiv nrog PWM cov cim ua qhev. Thaum tus tswv ua rau cov qhev lawv tsuas tsim lub PWM teeb liab hauv ib hom mem tes. Yog li kuv tsuas xav tau npog 2 ms hauv cov sijhawm ntawd. Hmoov zoo koj tuaj yeem cascade cov timers nyob rau hauv kho vajtse yog li qhov synchronization no tsis xav tau kev cuam tshuam los ntawm tus txheej txheem thiab nws yog qhov tseeb heev ib yam, kev ntxhov siab nyob hauv cheeb tsam ps. Koj tuaj yeem pom CubeMX teeb tsa ntawm cov duab.

Raws li koj tuaj yeem pom kuv xaiv 3 raws li prescalar yog li rau 2 ms Kuv xav tau teeb 48000 hauv lub sijhawm timer. Qhov no muab rau peb 24000 rau 1 ms uas yog qhov tseeb ntau dua qhov peb xav tau rau 14 qhov kev daws teeb meem. Tadaaaaaa…

Thov ua tibzoo saib lub vijtsam oscilloscope hauv kab lus qhia txog qhov kawg. Cov channel 3 (ntshav) yog tus tswv lub sijhawm cuam tshuam uas yuav ua rau cov salves los tsim ib qho mem tes. Channel 1 thiab 4 (nqaj daj thiab ntsuab) yog qhov tseeb PWM cov cim tsim los ntawm cov sijhawm sib txawv. Nco ntsoov tias lawv nyob ua ke tab sis lawv tau sib txuas ntawm cov kab tom qab, uas yog vim PWM hom 2. Qhov no tsis yog teeb meem, vim tias PWM tus nqi rau qhov tshwj xeeb servo tseem raug.

Lwm qhov txiaj ntsig ntawm qhov kev daws teeb meem no yog txhawm rau hloov tus nqi yuav txhais tau tias hloov lub sijhawm hauv TIM1 nkaus xwb. Txog niaj hnub digital servos koj tuaj yeem nqes mus rau 200-300 Hz, tab sis thov tham nrog servo phau ntawv qhia yog tias koj xav tau lub suab zoo.

Pom zoo: