You are on page 1of 4

RESEARCH ARM STM32 MICROCONTROLLER AND EDITE PRACTICE

LESSONS NGHIN CU VI IU KHIN ARM STM32 V VIT CC BI THC


HNH
Nguyen Dinh Phu
HCM University of Technical Education
ABSTRACT: The generation microcontroller constantly growing to meet the control requirements,
data processing is growing. The 8-bit microcontrollers are common in control applications in
industrial and civil products, 16-bit microcontrollers with the ability to meet higher than 8-bit
microcontroller line, however control requirements, the volume of data processed as images of
biological control devices, entertainment devices such as digital cameras, tablets, computer-guided
navigation, ... then 8-bit microcontrollers and 16-bit will not meet due to insufficient memory space
to store data, not fast enough to handle the data, ... to meet such requirements, the generation of
microcontrollers was born 32 bit driver, generation of microcontroller is the most popular ARM.
TM TT:
Cc th h vi iu khin ngy cng pht trin khng ngng nhm p ng cc yu cu iu
khin, x l d liu ngy cng ln. Cc vi iu khin 8 bit rt ph bin trong cc ng dng iu
khin trong cng nghip cng nh cc sn phm dn dng, cc vi iu khin 16 bit vi kh nng p
ng cao hn so vi dng vi iu khin 8 bit, tuy nhin vi cc yu cu iu khin, khi lng d
liu x l nh hnh nh trong cc thit b iu khin sinh hc, cc thit b gii tr nh my chp nh
k thut s, my tnh bng, my nh v dn ng, th cc vi iu khin 8 bit v 16 bit s khng
p ng c do khng khng gian b nh cha d liu, khng nhanh x l d liu,
p ng c cc yu cu th cc th h vi iu khin 32 bit ra i, dng vi iu khin ph
bin nht l ARM.
T kha: ARM: Acorn RISC Machine
I.

Gii thiu:

Cc th h vi iu khin 8 bit, 16 bit c


kh nng phc v iu khin cho cc yu
cu iu khin nh v n gin vi lng d
liu x l khng ln, khng c hnh nh.
Vi cc thit b iu khin cng nh cc
thit b gii tr ngy nay th lun trang b mn
hnh hin th kch thc ln cho php hin th
c hnh nh v c mn cm ng iu

khin.
Vi mn hnh c th hin th c hnh
nh th khi d liu ln v tc x l phi
nhanh, khi vi iu khin 8 bit hay 16 bit s
khng kh nng iu khin, ch c dng
vi iu khin t 32 bit tr ln mi c kh nng
p ng c.
II.

Gii php ngh:


1. Nghin cu vi iu khin 32 bit:

a.

Tm tt lch s ARM

ARM c thnh lp vo nm 1990 bi


Advanced RISC Machines Ltd, mt cng ty
lin doanh ca Apple Computer, Acorn
Computer Group, v VLSI Cng ngh. Nm
1991, ARM gii thiu h vi x l ARM6 v
VLSI c cp php u tin.
Sau , cc cng ty khc, bao gm Texas
Instruments,
NEC,
Sharp,
v
ST
Microelectronics, c cp php thit k vi x
l ARM, m rng cc ng dng ca b vi x l
ARM vo in thoi di ng, a cng my
tnh, h tr cc thit b s c nhn (PDA), h
thng gii tr gia nh, v nhiu sn phm tiu
dng khc.

Hnh 1-1: Cc sn phm gii tr dng vi iu


khin ARM.
B vi x l Cortex-M3 l n v x l
trung tm (CPU) ca mt chip vi iu khin.
Ngoi ra, cn c s lng cc thnh phn khc
c yu cu cho vi iu khin hon ton da
vo vi x l Cortex-M3.
Sau khi cp php cho nh sn xut chip
vi x l Cortex-M3, h c th t cc b vi x
l Cortex-M3 trong cc thit k bn dn ca
h, thm b nh, thit b ngoi vi, u vo/ra
(I/O), v cc tnh nng khc.
Chip da vo vi x l Cortex-M3 t cc
nh sn xut khc nhau s c kch c khc
nhau v b nh, khc nhau v chng loi, khc
nhau v thit b ngoi vi, v khc nhau v cc
tnh nng.

Hnh 1-2: Cu trc vi i khin ARM dng li


Cortex-M3.
b. Cu trc ARM
Cortex-M3 l vi x l 32-bit, c ng
d liu 32-bit, bank thanh ghi 32-bit, v cc
giao din b nh 32-bit - xem hnh 1-3.

Hnh 1-3: Cu trc c bn ca ARM CortexM3.


B vi x l c kin trc Harvard: c bus
giao tip b nh chng trnh v b nh d
liu c lp. iu ny cho php truy cp d
liu v lnh din ra cng mt lc nn hiu sut
ca b vi x l tng ln.
B vi x l Cortex-M3 c cc thanh ghi
t R0 n R15, xem hnh 1-4.

Hnh 1-4: Cc thanh ghi ca ARM Cortex-M3.


B vi x l Cortex-M3 c bn b nh
c nh nh hnh 1-5.
Vi x l Cortex-M3 c tng cng 4 GB

khng gian a ch. M chng trnh c th


c lu trong vng nh m, lu trong vng
nh SRAM, hoc cc vng nh RAM bn
ngoi. Tuy nhin, tt nht l lu m chng
trnh trong vng nh m bi v vi s sp xp
ny th n m lnh v truy cp d liu c
thc hin ng thi trn hai giao din bus
ring bit.
Vng nh SRAM l b nh ni. Truy cp
vo vng nh SRAM ny c thc hin thng
qua cc bus giao din h thng. Trong vng
nh ny, mt phm vi 34-MB c nh ngha
l vng nh bit-band. Trong vng nh 34-bitband, mi a ch t (32 bit) i din mt 1 bit
trong vng 1 MB bit-band.

Hnh 1-5: Bn b nh ca Cortex


M3.
B vi x l Cortex-M3 c cu trc
pipeline ba tng. Cc tng ca ng ng bao
gm:
n lnh, gii m lnh, v thc hin lnh
nh hnh 1-6.

Hnh 1-6: ng ng lnh 3 tng ca


Cortex_M3.
Hnh 1-7 trnh by r cc giao din bus
kt ni cc thnh phn vi nhau:

Hnh 1-7. S khi chi tit h thng vi


x l Cortex-M3.
Cc ngun dao ng:
C nhiu ngun xung clock khc nhau
c dng cp ngun xung clock h thng.
Ngun xung clock ca b dao
ng HSI (HSI oscillator clock)
Ngun xung clock ca b dao
ng HSE (HSE oscillator clock)
Ngun xung clock PLL
Cc thit b c 2 ngun xung clock ph
theo sau:
Mch dao ng RC bn trong tn
s thp 40kHz (LSI RC) dng
cp cho b nh thi gim st c
lp v b RTC c dng t
ng nh thc CPU khi ch
ngng/ch ch.
Mch dao ng thnh anh gn
thm bn ngoi tn s thp
32768Hz (LSE crystal) dng
cp cho b thi gian thc (Real
time clock RTCCLK).
2. Nghin cu kit vi iu khin 32 bit:
Cu hnh kit ARM bao gm cc thng tin
v vi iu khin ARM ang s dng v cc kt
ni giao tip gia vi iu khin ARM vi cc
ngoi vi c trn kit ngi c c th s
dng 1 cch hiu qu.
Kit c thit k vi rt nhiu ngoi vi
trong bao gm 1 s ngoi vi c bn v cc
ngoi vi giao tip phc tp nh USB v
Ethernet, giao tip SD, gii m MP3,
Kit vi iu khin ARM STM32F103VC
c hnh nh nh hnh 1-8:

Hnh 1-8. Kit ARM Cortex M3 STM32F


103VET.
3. Thit k bi thc hnh:
Bi thc hnh c thit k theo tng
module:
Cc bi thc hnh cho module led n
v nt nhn n.
Cc bi thc hnh cho module LCD.
Cc bi thc hnh cho module mn
cm ng.
Cc bi thc hnh cho module ADC.
Cc bi thc hnh thi gian thc.
Cc bi thc hnh giao tip th nh,
MP3, m thanh.
III. Kt lun
Nhm nghin cu l thuyt dng vi
iu khin ARM Cortex-M3, bin son ti liu
l thuyt, vit cc chng trnh thc hnh cho
Kit vi iu khin ARM Cortex-M3
STM32F103VE.
Qua nghin cu l thuyt nhm nm
bt c cu trc ca dng vi iu khin ARM
32 bit ang ngy cng ph bin c dng lm
chip CPU trong cc h thng iu khin phc
tp cng nh trong cc thit b gii tr x l
cc d liu c kch thc ln.
Kt qu nghin cu l cc ti liu v l
thuyt c ng gip ngi nghin cu sau
nh cc sinh vin c 1 ti liu nhanh chng

tip cn v lm ch c th ng dng 1 cch


nhanh chng. Ti liu c th phc v cho ging
dy mn hc vi x l nng cao.
Cc bi thc hnh bin son t n gin
n phc tp, c trnh by v gii thch r
rng tng lnh cng nh tng hm c lin quan
trong cc th vin, gip cho sinh vin c th
hc nhanh, khng mt nhiu thi gian my m
nghin cu.
Cc bi thc hnh LCD v mn cm ng
touch dng hin th hnh nh v iu khin
bng cm ng chm cho Sinh vin cc bi hc
ca mnh rt gn gi vi nhiu ng dng trong
thc t.

Ti liu tham kho


[1]

[2]
[3]
[4]
[5]
[6]
[7]
[8]

Joseph Yiu, The definitive guide to the ARM


cortex-m3 second edition, Newnes, 2010
ARM, Cortex-M3, technical reference
manual, 2006, PDF
ARM, v7-M architecture Application level
reference manual, 2006, PDF
RM0008, reference manual, 2009, PDF
ARM, Cortex-M4 processor, technical
reference manual, 2009, PDF
UM0427 uswr manual, 2007, PDF
Geoffrey Brown, Discovering the STM32
Microcontroller, 2014
Hitex, development tools, The insiders
guide to the STM32 ARM Based
Microcontroller, 2008