Cortex-M3 Application


 
* Update history

- 2013.6.19 : Ãʱâ Release




 
1. STM32F10x Overview
   1.1 STM32F10x Block Diagram
   1.2 STM32F10x Memory Map
   1.3 STM32F10x Boot Modes
2. STM32F103VC Dragon°³¹ßº¸µå ¼Ò°³
   2.1 Features
3. ÇÁ·Î±×·¥ ´Ù¿î·Îµå ¹æ¹ý
   3.1 JTAGÀ» ÀÌ¿ëÇÑ ´Ù¿î·Îµå ¹æ¹ý
   3.2 STM32F ½Ã¸®ÁîÀÇ internal ISP(UART0) ¸¦ ÀÌ¿ëÇÑ ¹æ¹ý



 



1. STM32F10x Overview
1.1 STM32F10x Block Diagram

Cortex-M3 Core¸¦ Based·Î ÇÏ¿© ICode, DCode, System Bus ¿Í ¿¬°áÀÌ µÇ¾î Àִ°ÍÀ» º¼¼ö ÀÖ½À´Ï´Ù.

Cortex-M3

Cortex-M3 Core´Â ARM»ç¿¡¼­ ¶óÀ̼¾½ÌÇÑ °ÍÀÌ°í À§ÀÇ ±×¸²¿¡¼­ Vendor Defined Specfic ºÎºÐÀº ST Microeclectonics»ç¿¡¼­ ±¸ÇöÇÑ °ÍÀÔ´Ï´Ù. Bus Matrix¸¦ ÅëÇؼ­ AHB system bus¿Í Cortex-M3 Core °¡ ¿¬°áµÇ¾î ÀÖ°í APB1, APB2 bus°¡ AHB bus¿¡ ¿¬°áµÇ¾î ÀÖ½À´Ï´Ù.

1.2 STM32F10x Memory Map

Cortex-M3

Cortex-M3 ÀÇ ¸Þ¸ð¸®¸ÊÀº Architecture Defined µÇ¾î ÀÖ°í, 4GBÀÇ ¸Þ¸ð¸® °ø°£À» Access ÇÒ¼ö ÀÖ½À´Ï´Ù. Architecture Â÷¿ø¿¡¼­ Memory Map ÀÌ Á¤ÀÇ µÇ¾î Àֱ⠶§¹®¿¡ °°Àº Cortex-M3¸¦ ±â¹ÝÀ¸·ÎÇÑ CPUµé »çÀÌ¿¡¼­´Â S/W °³¹ß°ú Æ÷ÆÃÀ» ½±°Ô ÇÒ¼ö ÀÖ½À´Ï´Ù. ±×¸®°í Memory Map¿¡¼­ À¯½ÉÈ÷ ºÁ¾ßÇÒ ºÎºÐÀº Bit-Band regionÀÌ Á¸ÀçÇÏ°í ÀÖ´Â ¿µ¿ªÀÔ´Ï´Ù.

-STM32F103VC CPUÀÇ Memory layout
  0x0800.0000 ~ 0x0801.FFFF ( FLASH )
  0x2000.0000 ~ 0x2000.BFFF ( SRAM )
  0x4000.0000 ~ 0x4002.3FFF ( Peripheral Memory Map )
  0xE000.0000 ~ 0xE00F.FFFF ( Cortex-M3 Internal Peri. )

1.3 STM32F10x Boot Modes

STM32F ½Ã¸®ÁîÀÇ CPU´Â 3°¡Áö ¸ðµå·Î ºÎÆÃÀ» ÇÒ ¼ö ÀÖ½À´Ï´Ù.

Cortex-M3

- User Flash memory : ÀϹÝÀûÀÎ Normal booting ÀÔ´Ï´Ù. STM32F CPUÀÇ Internal Flash(0x0 or 0x8000000) ¿¡¼­ ºÎÆÃÀ» ÇÏ´Â °ÍÀÔ´Ï´Ù.
- System memory : STM32F CPUÀÇ Internal System memory¸¦ ÀÌ¿ëÇؼ­ ºÎÆÃÀ» ÇÕ´Ï´Ù. ÀÌ ¸ðµå·Î ºÎÆÃÀ» Çϸé CPU¿¡ ÀÖ´Â ³»ºÎ ºÎÆ®·Î´õ¿¡ ÀÇÇؼ­ USART0°¡ ÃʱâÈ­°¡ µÇ°í ST »ç¿¡¼­ Á¦°øÇÏ´Â ST Flashloader ÇÁ·Î±×·¥À» ÀÌ¿ëÇؼ­ bin(or hex) ½ÇÇà À̹ÌÁö¸¦ User Flash memory ¿µ¿ª¿¡ ´Ù¿î·Îµå ÇÒ ¼ö ÀÖ½À´Ï´Ù. JTAG Àåºñ°¡ ¾øÀ» °æ¿ì USART0À» ÀÌ¿ëÇؼ­ ÇÁ·Î±×·¥À» ǻ¡ÇÒ¶§ À¯¿ëÇÏ°Ô »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.
- Embedded SRAM : Internal RAM¿¡¼­ ºÎƼÀ» ½ÃÀÛÇÏ°Ô ÇÕ´Ï´Ù. ÀÌ·¸°Ô ÇÏ·Á¸é Startup Äڵ忡¼­ Vector Table offset À§Ä¡¸¦ RARM¿¡ À§Ä¡Çϵµ·Ï Register ¼³Á¤À» ÇØÁÖ¾î¾ß ÇÕ´Ï´Ù.
Cortex-M3

À§ÀÇ ±×¸²Àº ¿ì¸®°¡ ½Ç½À¿¡ »ç¿ëÇÒ Dragon °³¹ßº¸µåÀÇ BOOT ¸ðµå ȸ·Îµµ ÀÔ´Ï´Ù.

2. STM32F103VC Dragon°³¹ßº¸µå ¼Ò°³
2.1 Features

CPU Module - STM32 Rabbit CPU ¸ðµâ »ç¿ë
CPU STM32F103VCT6 Cortex-M3 Core(LQFP-100)
SRAM 32KB internal SRAM
Flash 128KB internal Flash memory
ISP 1 x ISP ¸ðµå Àüȯ Á¡ÆÛ
UART 1 x UART( UART0)
LEDs 1 x User LED, 1 x Power LED
Reset Button 1 x Reset Button
JTAG 20Pin JTAG interface
Size(W x H) 68.4mm x 69.1mm(W x H)
È®ÀåÆ÷Æ® STM32F103VCT6ÀÇ ¸ðµç Æ÷Æ®°¡ 2 x 2.54 mm À¸·Î ³ª¿Í ÀÖ½À´Ï´Ù.
Bottom Board - Hardware Features
Àü¿ø 5V DC Àü¿ø(¿Ü°æ:5.5mm, ³»°æ:2mm), USB, USB to Serial Æ÷Æ®¸¦ ÅëÇؼ­ Àü¿ø°ø±Þ °¡´É
RS232 1 x USB2Serial Æ÷Æ® ³»Àå
1 x DB9 ½Ã¸®¾ó Æ÷Æ® ( MAX232 )
USB 1 x USB 2.0 Full speed
LCD 1 x 2.4, 4.3, 7.0 inch TFT ÅÍÄ¡ LCD ÀÎÅÍÆäÀ̽º
1 x 1602 Char LCD ÀÎÅÍÆäÀ̽º
1 x 12864 ±×·¡ÇÈ LCD ÀÎÅÍÆäÀ̽º
MP3 1 x VS1003B SPI Interface
RF 1 x nRF24L01 SPI Interface
AHRS 1 x AHRS Sensor Interface
LEDs 3 x User LED, 1 x Power LED
Buttons 5 x User Button, 1 x Wakeup button
CAN 1 x CAN ( VP230 )
RS485 1 x RS485 ( SP3485 )
SD Memory 1 x 4bit SD memory card interface
Adjustable Resiter 1 x ADC test
EEPROM 1 x IIC EEPROM
Backup Battery 1 x Backup battery holder
Buzzer 1 x Buzzer
ADC 2 x ADC Input( ADC12 In8, In9 )
DAC 1 x DAC
Size(W x H) 155 x 110 mm

Cortex-M3

3. ÇÁ·Î±×·¥ ´Ù¿î·Îµå ¹æ¹ý
3.1 JTAGÀ» ÀÌ¿ëÇÑ ´Ù¿î·Îµå ¹æ¹ý
3.1.1 ST-Link/V2

(1) ST-Link USB Driver Download and install
- http://www.st.com/web/en/catalog/tools/PF258167

Cortex-M3

(2) ST-Link Utility Download and install
- http://www.st.com/web/en/catalog/tools/PF258168

Cortex-M3

(3) ST-Link/V2 Utility Program ¼³Ä¡
- STM32 ST-LINK Utility_v2.5.0.exe

Cortex-M3

Cortex-M3

Cortex-M3

Cortex-M3

(4) ST-Link/V2 USB µå¶óÀ̹ö ¼³Ä¡
- st-link_v2_usbdriver.exe

Cortex-M3

Cortex-M3

Cortex-M3

Cortex-M3

Cortex-M3

- Windows7 ÀÇ °æ¿ì ÀåÄ¡ µå¶óÀ̹ö°¡ ÀÚµ¿À¸·Î ¼³Ä¡ µÇÁö ¾ÊÀ» °æ¿ì¿¡ µå¶óÀ̹ö ¼ÒÇÁÆ®¿þ¾î ¾÷µ¥ÀÌÆ®¸¦ ¼öÇà ÇÕ´Ï´Ù.

Cortex-M3

Cortex-M3

Cortex-M3

Cortex-M3

Cortex-M3

(4) ST-Link/V2 Firmware upgrade

Cortex-M3

(5) Program Fusing with ST-Link/V2

ST-Link/V2ÀÇ 20ÇÉ JTAG CableÀ» Dragon °³¹ßº¸µåÀÇ CPU ¸ðµâ¿¡ ÀÖ´Â 20ÇÉ JTAG ¹Ú½º Çì´õ¿¡ ¿¬°á ÇÏ°í ST-Link Utility ¿¡¼­ "Mode Setting"
¸Þ´º¿¡¼­ "SWD" ¸ðµå·Î ¼³Á¤ ÇÕ´Ï´Ù. ÀϹÝÀûÀ¸·Î´Â STM32F ½Ã¸®Áî¿¡¼­ "JTAG" ¸ðµå·Î ¼³Á¤Çصµ µÇÁö¸¸ Dragon °³¹ßº¸µå¿¡¼­´Â JTAG ÇÉÀÇ ÀϺθ¦
LCD Á¦¾î½Ã »ç¿ëÇÏ°í Àֱ⠶§¹®¿¡ ¹Ýµå½Ã "SWD" ¸ðµå·Î ¼³Á¤À» ÇØ¾ß ÇÕ´Ï´Ù. ±×¸®°í Connect Target À» ½ÇÇà ÇÕ´Ï´Ù.

Cortex-M3

´Ù¿î·Îµå ÇÒ bin ÆÄÀÏÀ» ¼±Åà ÇÕ´Ï´Ù.

Cortex-M3

- Âü°í·Î IAR ÄÄÆÄÀÏ·¯ ȯ°æ¿¡¼­´Â bin ÆÄÀÏÀ» »ý¼ºÇϱâ À§Çؼ­´Â Ouput Converter ¿¡¼­ ¾Æ·¡ ±×¸²°ú °°ÀÌ Binary ÆÄÀÏ »ý¼º ¿É¼ÇÀ» ¼³Á¤ÇØ ÁÖ¾î¾ß bin ÆÄÀÏÀÌ »ý¼ºÀÌ µË´Ï´Ù.

Cortex-M3

- Dowload & Veriry ¸¦ ½ÇÇà ÇÕ´Ï´Ù.
- IAR, KEIL µîÀÇ °³¹ßȯ°æ°ú Á÷Á¢ ¿¬µ¿À» ÇÏÁö ¾ÊÀ» °æ¿ì¿¡´Â ST-Link Utility ¸¦ ÀÌ¿ëÇؼ­ ½ÇÇà binary¸¦ ´Ù¿î·Îµå ¹ÞÀ» ¼ö ÀÖ½À´Ï´Ù.

Cortex-M3

(6) EWARM Debug Environment - ST-Link/V2

- Debugger ¿¡¼­ Driver¸¦ ST-Link ¸¦ ¼±Åà ÇÕ´Ï´Ù.

Cortex-M3

- ST-Link ¼³Á¤¿¡¼­ "SWD" ¸ðµå·Î ¼³Á¤À» ÇÕ´Ï´Ù.
- ST-Link/V2 Á¦Ç°Àº IAR ¿¡¼­ »ç¿ëÇÒ °æ¿ì 6.20 ÀÌ»óºÎÅÍ ¿¬µ¿À» ÇÒ¼ö ÀÖ½À´Ï´Ù.

Cortex-M3


3.1.2 ARM-JTAG
(1) ARM-JTAG Utility ¼³Ä¡

Cortex-M3

Cortex-M3

Cortex-M3

Cortex-M3

Cortex-M3

Cortex-M3

(2) JICE Server ÇÁ·Î±×·¥ ½ÇÇà
- ARM-JTAGÀÇ 20ÇÉ JTAG CableÀ» Dragon °³¹ßº¸µåÀÇ CPU ¸ðµâ¿¡ ÀÖ´Â 20ÇÉ JTAG ¹Ú½º Çì´õ¿¡ ¿¬°á ÇÏ°í JICE Server ÇÁ·Î±×·¥À» ½ÇÇà ÇÕ´Ï´Ù.
- Windows 7ÀÇ °æ¿ì ¹Ýµå½Ã °ü¸®ÀÚ ±ÇÇÑÀ¸·Î ½ÇÇàÇØ¾ß ÇÕ´Ï´Ù.

Cortex-M3

- ¿¬°áÀÌ Á¤»óÀûÀ̶ó¸é Core ID ¸¦ ÀÐ¾î ¿É´Ï´Ù.

Cortex-M3

- Core ID°¡ ÀоîÁöÁö ¾Ê´Â ´Ù¸é ¾Æ·¡¿Í °°ÀÌ JICE Server ¸¦ ¼³Á¤ÇØ º¸½Ã±â ¹Ù¶ø´Ï´Ù.

Cortex-M3

(3) JICE Configuration

- Debug Port Configuration

Cortex-M3

- Tap Configuration

Cortex-M3

(4) JICE Commander

Cortex-M3

(5) Easy Flashloader ¼³Á¤

STM32F103VC(STM32F10xxC) or STM32F103ZE(STM32F10xxE) Áß¿¡¼­ ¼±Åà ÇÕ´Ï´Ù.

Cortex-M3

- ´Ù¿î·ÎµåÇÒ Binary ¼³Á¤

Cortex-M3

- Start Download ¸¦ ½ÇÇàÇÏ¸é ¸ÕÀú Flash¸¦ EraseÇÏ°í ³ª¼­ ¼±ÅÃÇÑ ¹ÙÀ̳ʸ® ÆÄÀÏÀ» ´Ù¿î·Îµå ÇÕ´Ï´Ù.

Cortex-M3

Cortex-M3

(6) EWARM Debug Environment - ARM-JTAG

- Debugger ¿¡¼­ Driver¸¦ RDI À» ¼±Åà ÇÕ´Ï´Ù.

Cortex-M3

- RDI µå¶óÀ̹ö¸¦ ¼³Á¤ ÇÕ´Ï´Ù.

Cortex-M3

- Easy Flashloader ¿¡¼­ "Flash Download Before Debugging" À» üũ ÇÕ´Ï´Ù.

Cortex-M3

- IAR °³¹ßȯ°æ¿¡¼­ "Download and Debugging" À» ½ÃÀÛÇϸé "Check Flash Download State!" ½ÇÇàâÀÌ ³ª¿À°Ô µÇ°í JICE Commander¿¡¼­ ´Ù¿î·Îµå°¡ Á¤»óÀûÀ¸·Î ÀÌ·ç¾î Á³´Ù¸é "PASS" ¹öÆ°À» Ŭ¸¯ ÇÕ´Ï´Ù.

Cortex-M3

- IAR °³¹ßȯ°æ¿¡¼­ Debugging È­¸é

Cortex-M3

ARM-JTAG ÀÇ »ç¿ëÀÇ °æ¿ì Windows7 ȯ°æ¿¡¼­ÀÇ º¸´Ù ÀÚ¼¼ÇÑ È¯°æ ¼³Á¤Àº ¾Æ·¡ URLÀ» ÂüÁ¶ÇϽñ⠹ٶø´Ï´Ù.
http://www.jkelec.co.kr/http://www.jkelec.co.kr/img/lecture/cortex_app/img/jtag/arm/armjtag/arm_jtag_manual.html

3.2 STM32F ½Ã¸®ÁîÀÇ internal ISP(UART0) ¸¦ ÀÌ¿ëÇÑ ¹æ¹ý

STM32F ½Ã¸®ÁîÀÇ CPUµéÀº º°µµÀÇ JTAG Àåºñ¾øÀÌ ³»Àå ISP ±â´ÉÀ» ÀÌ¿ëÇؼ­ bin ÆÄÀÏÀ» ´Ù¿î·Îµå ÇÒ¼ö ÀÖ½À´Ï´Ù.

(1) ISP ¸ðµå·Î ÁøÀÔ
´Ù¿î·Îµå ¸ðµå·Î ÁøÀÔÇϱâ À§Çؼ­´Â ¾Æ·¡ ±×¸²°ú °°ÀÌ Boot0 Á¡ÆÛ¸¦ ISP ¶ó°í µÇ¾î ÀÖ´Â À§Ä¡ ¼¼ÆÃÇÏ°í PC¿Í ¿¬°á ÇÕ´Ï´Ù.

Cortex-M3

Dragon Bottom º¸µå°¡ ÀÖÀ»°æ¿ì¿¡´Â Bottom º¸µåÀÇ UART Æ÷Æ®¿¡ ¿¬°áÀ» ÇÏ¸é µË´Ï´Ù. Drgon Bottom º¸µå¿¡´Â PL2303 USB to Serial Æ÷Æ®°¡ ³»Àå µÇ¾î ÀÖ½À´Ï´Ù.

(2) PL2303 USB to Serial µå¶óÀ̹ö ¼³Ä¡
- PL2303_Prolific_DriverInstaller_v1210.exe

Cortex-M3

Cortex-M3

Cortex-M3

Cortex-M3

Cortex-M3

Cortex-M3

(3) "STMicroelectronics flash loader.exe" ÇÁ·Î±×·¥À» ¼³Ä¡ÇÏ°í ½ÇÇà ÇÕ´Ï´Ù.

- Parity : "Even" , Baud Rate : "115200" À¸·Î ¼³Á¤

Cortex-M3

Cortex-M3

Cortex-M3

- Binary or Hex ÆÄÀÏÀ» ¼±Åà ÇÏ°í º¸ÅëÀº "Erase necessary pages" ¸¦ ¼±Åà ÇÏ¸é µË´Ï´Ù.

Cortex-M3




Cortex-M3

Cortex-M3