[go: up one dir, main page]

0% found this document useful (0 votes)
63 views21 pages

Embeded System Lab + Code

The document outlines the objectives and technical specifications of experiments conducted in the Mechatronics Engineering department, focusing on the STM32F4 microcontroller. It includes details on configuring peripherals, programming for LED control, and implementing communication protocols like UART. The experiments aim to enhance understanding of embedded systems and their applications in real-time processing and signal conversion.

Uploaded by

sourav paul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
63 views21 pages

Embeded System Lab + Code

The document outlines the objectives and technical specifications of experiments conducted in the Mechatronics Engineering department, focusing on the STM32F4 microcontroller. It includes details on configuring peripherals, programming for LED control, and implementing communication protocols like UART. The experiments aim to enhance understanding of embedded systems and their applications in real-time processing and signal conversion.

Uploaded by

sourav paul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 21
, . . 7 Page No,_—C)__ Department of Mechatronics Engineering ixyx. 2 Trtro dueling The sTMa2EA Mieroenbrdlen, Ral of STmienoelectrunics STM 9. Lawily . Peecane s an ARM Gowler — M4 Cone Wh an FEU, Tanning at toomtk, Eqiped uh StL KG flash amd loeb SRAM, F] provides ample Memory Fon Gomples appliesction s- Key pert pheral: indude a 1O2-b ADe with 16 eharmels, «> (2bit Dre and mulfiole mers Capable of PW | generation, mmaving 4 suitable fon preeise Signal entra). Commantection Intrfnees —US®, OTH. oe, SPI and ART — alloy Seamless Conmectivity lows pouen nedes, an RIC with boaek up battery Support , and seequrtty ophm: tire Rash memory “Protection wave re STM-A2F 4h Weal Fox High penformsnce » emery y— eftiei ent embeded Systems Apel eat ang : | | | i ; 7 Page Na, be — Department of Mechatronics Engineering. txjxs 2 Obyectivess 1 To become Lowillian uilh the fam— Contes M4 based SIMS2F41 Mey anebtleelure amd ‘Ye vnain featunes. Ne To gain Minow ledge and CooRgune basie Peniphends Sud as APL. | itl, To write Simple Pregnayn to Gortvecl on LED sand trespmd yo a push bubfen ‘Vnecct, TdiTechnieal cpeciti catims, + Coxet fn Corker — 4 with Fleecting Faint Uriet (Fp) + Cloey speeds Up to Wott + Bus speeds ANG (ABd vance High: Panfonmanee Bus) ARG, = S62 , APB tote MoH > + Memory 1 SI2KB Flash memory, 128Kb SRAM Pq Khulna Univercitw OF Enainoorina 2 Tach ~1- -- - 0d . . ¥ ‘ Page No, ——>—__ Department of Mechatronics Engineering xpxo 2. | *Rwen Supply: Dou te dev. | «Timens £ 10 mens bal, including DQ advanced Centro| mens and qeneral~ Puripose Ahmeny wih Pum Copalbtity , -fleslegt ta. bit Ade with 16 channels, 10, it Dae low ‘amaley oeetoul. @ Communi ection Trlerfaees + — USB 20 OTH =~ Ox Spl Bay L2e =%% USART, 2x ORT > Real-Time Clock (Rd) 7 Low-power RTC with backup bedteny Support. f Openctiny Tempererture. Ranges —40% + 435¢ ™™_ Khulna University Of Enaineerina & Technalaay 0m , . . Page No: | Department of Mechatronics Engineering apie * Bwer Suoply : Q.0u te B6V. | 1 @Timens ¢ 10 mens -blal, induding DZ. advanced eantrol timenc and general Purpose Hmen: tafih pain Capa bolity » Analog t I bit Ape with té chawnels, 1a it DAE Tn “analeg cutout. 2 Communi ection Tnlerfaees : — USB 20 OTA - Ox SPI Bigg 10S Sy USART, 2x ORT * Real-Time Clem (Rie) 7 Low- powen RTE with backup | beteny Support. ‘ Operating “Tempereclurce Fanges —40% to 435% Khulna University ¢ of # Engineering & Technology Page No. 04 _ tment of Mechatronics Engineering xpso—¢1__— obes - Red a Switeh Shale on (C5 and based on that sureh | stems on She LED at PAS ind mndin (ad) } Ree > AHBI |= Ox5 3 U/ Ende the clocxs for APTOR andere ApIOA—> modtR | 6x4002, [1 Seq PAS as duread @ploe + MODER S=~ Ox4oo: [sa Pes as teu ubile (2) 1 if (Gere > IDR £620)3 u chew 4 Ake scdtteh om pes GplOA > ODR=Ox205 11 Turn on (he LED alsel 3 ODR= Ox005 J] Tuna ef the Len Page No. $ ' 4 Depa tment of Mechatronics Engineering ep.x.— Gonelu sions he ARM Corer based STM32 FA sricno controler loa Wheodueed in Shs lab. We configured @Plos - Wrote asic program hy dentrel an LED ond observed the behaviour of the pushbulton mput. he lab Rovided a clean uerdereanding, of Agen Comtex | aienweanbralien intreduction in erabeded system, | ee ee , _ Page No. Department of Mechatronics Engineering ex.s. —— ntrwdeetions tatermuply ane a encticel feahne in Smbe ded Systern hat allow he enienseonbedlens to Desped on external events immediately . “This lab demersteales the ‘tenglementatin on teamed Mntermupl Of the STMAAN — Wiero confallen. A bute te conned to pad ond configured to he Jviggened on an input ond — Gawing LED ot PBS fy Linh 5 times, The “expetimert Highlights the use Of GPT’ pins, ‘intermupl hardlirg amma efeien LED arbre sting Soflsare delays ees G To wvdenstand amd Configure Gere Pins fen Tpat and output LneHenalities. ({) To. lean how te een enable amd handle exlerend inka on STM ADEA. wa Khulna University Of Engineering & Technology . f i : a Page Department of Mechatronics Engineering i. @® To implement a Simple Puogram thal links ay LED Aye -ymes upon — bruellen No. No.. PMess Using Infensugl driven \egte. sim |—€) Lah a as F Include * Sbm 90 FAN. h” Void GPT Tit CY Tica) ae Ree ALBIENR. |= 0x 004! Ree APIO — MoPER 4= Oxo PLO BA ModER | = GMNo4 GIO 9 OTY PLR 8 =OEE FETEF § G18 OSPEEDR 1605 : 1 APIO PUPPR 8 =O ©; Tone ] | | 3 Khulna University Of Engineering & Technology epartment of Mechatronics Engineering sur. Noid Exid © ) \ Ree A APOLENR \= Ox 400) SHSCRA > EMRIAT = ex 000! Ex!T > Ame 2 @102 EXT] SROTSR |= Ox lo! AvI¢ = ISERLO] \=6,8 000003 NVIE > IPDA = & 20! Void dey Cint 4) fort (t=0: Cg wth doo ¢ te} { Noid EXT4_ WANDYER (void) ‘f (IAPR $ 6xi0) { Ton Coo,” gs 4 oe) GPIOOPR A= Ontos { deley (206) } Khulna University Of Engineering & Technology CKURFT —————e Department of Mechatronics Engineering j..n. ink main ) | vahile \ OPO (5 BT_TQ 5 Discussim! “he ‘alerauet Arima vier tte Oar nanad—e the SIMBL EAL Loy Senfigucing Pas to Tmeut on “nlerisupt Arig gered ant the LED om pes blink & | limes. “the esde cls indleluder deby fimchanalty to wave the Wlinving Light vigble fo Yee eyes: ~The intent te heavily used fr periphena | onmection = on PACU. : use of wntenupls | nelusiong “this lab demenstrafed the @ belt press, Gontel om ED tn terpmwe to ————— sasatog ees - wag Page No. partment of Mechatronics Fngirel ee Tnlroduchions The systic Hmen ts a dedicated 24: Wd dom dourter Ie ineleded in the (nm Gorrlex— M4 Cone, Which is present im Ahe SMS LEAL rniero conbrre les. 44 Gy primanily used fon gerene ing Ye delays, Paniodic iwlerruep}e ard system Ame Neepieg. This men dpenates easel on the System cloex ard provider om efficient enethed fax time bared event \hamling without Telying a the Sdhwane delay loops, which eonbe inefferent and — epu-intensive. . Tm embelel systems precise ming Is enutial Fox sinious apelieations Such as asx Scheduling Ruse Width Modulation, and Realtime elon funciendities The Sritie tHmen en be emfiguned te generale Yeriolie intenwupls on executing delays valk wrinimum Gu overhead Wie makes Wa pre fenned Hates. - HA Teale Gppliealtgas” 14 vniero emtrall en ono gramming, j ‘ Page No._———— Expt No._—_—_— epartment of Mechatronics Engineering nechvess () Te uvderstond dhe Araclleriaklies of Ve Syste Timea In STM92F4\) (i) To Comfigune amd Wwe SyiTieg Timmer fe delay evenation (il) To Umplement a Simple delay feove¥en sie Systick Using embeded @ Zade Implementation’ SysTiag Contiol cond Stehus Reafsten § © a : Metts yn Reseed | Reseed, pene STE RA eas cle TICNIOT cour Fag Lksouree. bis UF Resenved BF Count leg (1s:3] = Ruenved. — = —— garsauttas esa _ _ epartment of Mechatronics tanita AN a Deleiy achived «awk Aix i clk | pe fon Leng deley, vy Load value = O-1 re a3 \ = 15,999 _ | Was 8 Fao8 fe a Ne Waid? Th Delay Yunetion: Nid delay_ms (int €) { tw = Wea0000% Hoa J I calculating She step Syliex LORD = NUE [1 Load the vehie fon delay, SySTicn —» VAL = 0 ; {Reset the cunnent value, S7Siee— €1RL = 0.52 |] Enable the Spilin with System deck while (4) 4 if (SpiTeg 2 TRE &x 10000) [I eheex the eaFlag bRGO SySTeg > IRL =9 5 \ \prteak $ roysouutas, — 94 ( . ‘ i Page No, partment of Mechatronics Engineering 1.x. inl wan) d | | Rec AUBL Ls Gels GLO > MODER \= 6400! While Ct’) { b GPION VOPR |= Ox 200 } [/tenning on LED delay-sas (la08) + M326 delay | GPpIOA > ODR = & 00+ I[ Aesx%og off LeD delay ms (1000) 5 ly canes Page No. gine ering Expt No The ralag - Yor Wigital eonvenen wae Ave) is 0 exifiecd Phen Perighenal in vwiertoeonbadlent , era bling the conversion of eroalog Signale wlo digital values fon processing. In kis Lab, we exploned ADC Comligariakion ard dake aeqpisition using the — SIMS2 FAL vyienodenlradllen the god wast to wihalize Ape Reidenc, mead analog inputs ond uvdenstend the inal boeken Nandoane and: aiw hrmuane, Obsectves; G)Te eonfigune jhe STM 72FAU ADE peripheral using register laren Prog Mararnin g. Gylogel sel up clock amd APIO selling dF gar leer fonetimalites. : Gi) Te Read dhe analog ‘imeut and process the Conversion Tesult. 4 ; Page No, Department of Mechatronics Engineering exy.x — Te idewkhy and tnostleshuel — cornea enitens in fire Configucces} en, Code H ineude * Ghevgahayn! oil ADE Init) { Ree APBAENR [FG (005 //Enable AdCd Clock Rees AUTEM RI= Ox 91 (/ Enable. XoRT A G@PIOA > MopER le & tO Wi Enabling pin AS % input. Lh Ave Cenfaurakien ave, — ERL =0 1 He OFF pet — CR [-t 3 // Ae in Continounde Ape! — SOR, Aarts |] ADL —= CRo/=G& 15 |] Ae on iMmoinc ) { Avett C3 Aner 2 eRe K 840000600; |! Fable. Comerision lo. * A é Page N¢ epartment of Mechatronics Engineering init thiledo { while (1 (NEI sR ¥ 62) {Heit cob eonveres on Malad Real = ADRA DR; Discusstan ¢ Reliable AVE operakon om SIM2 Ikequirces Proper Synfax, Cdibnaton, and confi guaection . The anginal Gade may Some- times ted te enmon- To Chen the ertron “he data Megi stent owt be named corned ly, By Fellouing these practices ensures Geeunate Ade pentrronance, aenclusion. Tn Ws Lah experiment we parfonmed ADE mperatens on 4 raleg Signal amd process i+ then Stone if “analy dala” wiewiaile, “Tis doe n STMIOLY Meu. The channd war CYL at thence Page No. epartment of Mechatronics Engineering x.xio —— introduction : Grivensal Asyncbvrenes — Reeeiven Finansvii Mer (vee) "© G@ widely used Senial Communi cation prolocal in embeded Sy slem ¢ fon data exchange between crferu wileatzns| and pe peniphenal devices ~thic Lab explores UART Go rigeretion oo M92 FL iene eantredlen wily foeusing on “Kegir Lert Kevel programming te encble avd disable ARI omd PexcBeemeal asic — data Sending and Reeiving operation. This experdment tnvelver —Iwikializing alo PINs, Gonfigucaing VART Probeol and \igie Control dak transmPsson , Obvyectives 3 G) Teo Urlershard UART proloed and Ws application, GO) To Comtigune GPIO ‘and VART ttegisten ba serial Communi cation, (@) Vo inplement VERT inbidectin omd date sending. cmd trearvnifting operations « Page No. tment of Mechatronics Engineering xx. le Implementations Ab indde © then 90 Pyeh" HUA Tikalzection (ygner, Pa =k, PAS= Re) { “Ende eloevs Ree = APBIENR |= G. 20000! — {/ Encbles UART Clock Rees AWBLENR \=t 1 IL Enables GPlo clocw. Moerfiguring PA2 Cx) amd PAS (R) as allermate Fonction. GPLOAS MODER 4~ (Gy E24) 5 GPIA> MODER |= Orage! GeIOA — AR To} \= 9300" (0 em Figusing Ushere (eta ,* $600 baud) UGART — BRR = 606835 -[/Ben= tee 0.0683 16 x9460 0 Endoling trams writen Gs), Tedver (Q) and USART (UE) uspera. = ert I= (6x4 481 6, 20000) } ' i Page No, Apartment of Mechatronics Engineering xy.so I Sending a chanaclen Via Unt | Noid ART. Send (chant date) | ubile (. (Usmera~ se 686 8 .20)) + Hunting fa Xe Ny USARTLS DR, = dale 3 lV Receving chanecln Nia \aet Noid UART. Receive (dean vid) stile () (usnriam srs 6520)) 5 HU RKNE Peg | Tetum USART DRS int main ) \ Ree > AKBLENR |= GD! GPIOB MoptR [=4,4005 |] Pas pm LED ppt Trt (5 ‘ i ‘ Page No. Aartment of Mechatronics Engineering expr UARTR Send Ca‘) 5 UART_send Col): UART. Send @\n')! while.) ghan Veeey ed = VAR teceived (35 it Creeived == 8) { GPIB MoPR= 40 5 [I loggle. Led. Diseussion @ FORE inhateclier on stun “embgares Pha Oy) al Page fo Mennale Function # (a7) fin Usneta, Sele a howd stele of 9600 CBRR= G0C84), and enables ~the franinitir GE), Teeeeiver’ (RE) and ART Peer Paupheral. The ede sert Hard ard when it pecelve & the the LED Togdes ab PRS. The cole enables bidtnee tien al

You might also like