kien truc co ban cua stm32-arm cortex m3

Download Kien Truc Co Ban Cua STM32-ARM Cortex M3

Post on 03-Jan-2016

2.389 views

Category:

Documents

25 download

Embed Size (px)

TRANSCRIPT

  • Kin trc c bn ca SMT32 - ARM Cortex M3 www.arm.vn

    Trang 1 Author: ARMVN

    Kin trc c bn ca STM32_ARM Cortex M3

    ARM Vietnam 3/18/2010

  • Kin trc c bn ca SMT32 - ARM Cortex M3 www.arm.vn

    Trang 2 Author: ARMVN

    Mc Lc Mc Lc ....................................................................................................................... 1Chng 1 ...................................................................................................................... 6GII THIU ............................................................................................................... 6

    1.1 Cortex l g?....................................................................................................... 61.2 Mt vi c im ni bt ca STM32 ............................................................. 9

    1.2.1 S tinh vi .................................................................................................. 101.2.2 S an ton ................................................................................................ 111.2.3 Tnh bo mt ........................................................................................... 111.2.4 Pht trin phn mm .............................................................................. 121.2.5 Dng Performance v Access ca STM32 ............................................ 12

    Chng 2 .................................................................................................................... 14TNG QUAN V CORTEX ................................................................................... 14

    2.1 Cc phin bn kin trc ARM ....................................................................... 142.2 B x l Cortex v n v x l trung tm Cortex ........................................ 152.3 n v x l trung tm Cortex (Cortex CPU) ............................................... 15

    2.3.1 Kin trc ng ng (Pipline) ................................................................ 152.3.2 M hnh lp trnh (Programmers model) ............................................ 16

    2.3.2.1 Thanh ghi XPSR .............................................................................. 182.3.3 Cc ch hot ng ca CPU .............................................................. 192.3.4 Tp lnh Thumb-2 .................................................................................. 212.3.5 Bn b nh (Memory Map) .............................................................. 222.3.6 Truy cp b nh khng xp hng (Unaligned Memory Accesses) ..... 242.3.7 Di Bit (Bit Banding) .............................................................................. 25

    2.4 B x l Cortex ............................................................................................... 282.4.1 Bus ............................................................................................................ 282.4.2 Ma trn Bus ............................................................................................. 292.4.3 Timer h thng (System timer) .............................................................. 292.4.4 X l ngt (Interrupt Handling) ............................................................. 302.4.5 B iu khin vector ngt lng nhau (Nested Vector Interrupt Controller) ......................................................................................................... 30

    2.4.5.1 Phng php nhp v thot khi mt ngoi l ca NVIC (NVIC Operation Exception Entry And Exit) ........................................................ 322.4.5.2 Cc ch x l ngt cao cp (Advanced Interrupt Handling Modes) ............................................................................................................ 33

    2.4.5.2.1 Quyn u tin ngt (Interrupt Pre-emption) ......................... 332.4.5.2.2 K thut Tail Chaining trong NVIC ....................................... 34

    2.4.5.3 Cu hnh v s dng NVIC ............................................................. 352.4.5.3.1 Bng vector ngt (Exception Vector Table) ........................... 35

    2.5 Cc ch nng lng .................................................................................. 402.5.1 Cch i vo ch nng lng thp ca CPU Cortex ........................ 40

  • Kin trc c bn ca SMT32 - ARM Cortex M3 www.arm.vn

    Trang 3 Author: ARMVN

    2.5.2 Khi h tr g li CoreSight .................................................................. 42Chng 3 .................................................................................................................... 45PHN CNG C BN CHO MT THIT K THC T ............................... 45

    3.1 Kiu ng gi chip v kiu chn linh kin .................................................... 453.3.1 S mch phn cng c bn ................................................................ 47

    Chng 4 .................................................................................................................... 48KIN TRC H THNG CA ARM CORTEX ................................................. 48

    4.1 Cu trc b nh .............................................................................................. 494.2 Ti a hiu nng .............................................................................................. 504.2.1 Vng Kha Pha(Phase Lock Loop) ............................................................ 514.2.1.1 Cu hnh cho bus ....................................................................................... 534.2.2 Flash Buffer .................................................................................................. 544.2.3 Direct Memory Access ................................................................................. 55

    Chng 5 .................................................................................................................... 61NGOI VI.................................................................................................................. 61

    5.1 Ngoi vi a dng.............................................................................................. 615.1.1 Cc cng I/O a dng .............................................................................. 61

    5.1.1.1 Chc nng thay th(Alternate Function) ........................................ 635.1.1.2 Event Out ........................................................................................... 64

    5.1.2. Ngt ngoi(EXTI).................................................................................... 645.1.3 ADC ........................................................................................................... 66

    5.1.3.1 Thi gian chuyn i v nhm chuyn i ..................................... 665.1.3.2 Analogue WatchDog ......................................................................... 695.1.3.3 Cu hnh ADC ................................................................................... 695.1.3.4. Dual mode ......................................................................................... 71

    5.3.1.4.1. C hai khi ADC cng hot ng cng ch Regular hoc Injected....................................................................................................... 715.3.1.4.2. C hai khi cng hot ng 2 ch Regular v Injected xen k.......................................................................................................... 725.3.1.4.3. Hot ng xen k nhanh v chm Regular ............................. 725.3.1.4.4. Ch kch hot thay th ......................................................... 735.3.1.4.5. Kt hp ng b ha Regular v kch hot thay th ............. 735.3.1.4.6. Kt hp ng b ha Injected v xen k Regular .................. 73

    5.1.4. B nh thi a nhim v nng cao ....................................................... 745.1.4.1. B nh thi a nhim ..................................................................... 74

    5.1.4.1.1 Khi Capture/Compare ............................................................. 755.1.4.1.2 Khi Capture .............................................................................. 755.1.4.1.3 Ch PWM Input .................................................................... 765.1.4.1.5 Ch One Pulse ....................................................................... 78

    5.1.4.3 ng b ho cc b nh thi........................................................... 785.1.5 RTC v cc thanh ghi Backup ................................................................ 79

    5.2 Kt ni vi cc giao tip khc ........................................................................ 80

  • Kin trc c bn ca SMT32 - ARM Cortex M3 www.arm.vn

    Trang 4 Author: ARMVN

    5.2.1 SPI ............................................................................................................. 805.2.2 I2C ............................................................................................................. 825.2.3 USART ...................................................................................................... 835.2.4 CAN ........................................................................................................... 855.2.5 USB ............................................................................................................ 88

    Chng 6 .................