STM32_Primer2

Page 1

STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 1

STM32 Primer2 :

Fun, easy introduction kit for STM32 microcontroller STM32 Primer2 à» ¹à¤Ã×èͧÁ×Í㹡ÒÃàÃÕ¹ÃÙ áÅоѲ¹ÒäÁâ¤Ã¤Í¹â·ÃÅàÅÍà 32 ºÔµã¹ µÃСÙÅ STM32 ¢Í§ ST Microelectronics ·Õ¾è ² Ñ ¹ÒÀÒÂ㵠ʶһ µÂ¡ÃÃÁ ARM Cortex-M3 â´Â àºÍà ·ãÕè ª à» ¹ËÅѡ㹡ÒþѲ¹Ò¢Í§ STM32 Primer2 ¤×Í STM32F103VET6 «Ö§è ÁÕ˹ ǤÇÒÁ¨íÒ á¿ÅªÁÒ¡¶Ö§ 512 ¡ÔâÅ亵 ˹ ǤÇÒÁ¨íÒáÃÁ 64 ¡ÔâÅ亵 áÅÐÁÕâÁ´ÙÅà¾ÍÃÔà¿ÍÃÑÅÁÒ¡ÁÒÂáÅÐ à˹×Í¡Ç ÒàÁ×Íè à·Õº¡ÑºäÁâ¤Ã¤Í¹â·ÃÅàÅÍà 32 ºÔµÍ×¹è æ ·Õ¼è ÅÔµÍÍ¡ÊÙµ ÅҴ㹪 ǧàÇÅÒà´ÕÂǡѹ STM32 Primer2 ä´ ÃºÑ ¡ÒÃÍ͡ẺãË ÁÃÕ »Ù Åѡɳ ÃÇ ÁÊÁÑ àÅ×Í¡ãª Í»Ø ¡Ã³ àª×Íè Áµ Í·ÕÍè Â٠㹡ÃÐáʤÇÒÁʹ㨢ͧ¹Ñ¡¾Ñ²¹ÒÃкºÊÁͧ¡Å½ §µÑÇÍ ҧ¤Ãº¶ ǹ äÁ ÇÒ ¨Ðà» ¹¡ÒôÒǹ âËÅ´ áÅдպ¡Ñ ¼ Ò¹¾Íà µ USB, ¨ÍáÊ´§¼Å LCD Êվà ÍÁÃкºÊÑÁ¼ÑÊ, ÊÇÔµª ¨ÍÂʵԡê 4 ·ÔÈ·Ò§, ÁÕµÇÑ µÃǨ¨Ñº¤ÇÒÁàà § 3 ᡹·Õ¾è ² Ñ ¹ÒÀÒÂãµ à·¤â¹âÅÂÕ·àÕè ÃÕÂ¡Ç Ò MEMS (Micro-Electro-Mechanical Systems) «Ö§è ä´ ÃºÑ ¤ÇÒÁ¹ÔÂÁÍ ҧÊÙ§, ÁÕ«Íç ¡à¡çµ MicroSD ¡Òà ´à¾×Íè 㪠§Ò¹¡Ñº¡Òà ´Ë¹ ǤÇÒÁ ¨íÒ MicroSD ·Õ¡è Òí ÅÑ§ä´ ÃºÑ ¤ÇÒÁ¹ÔÂÁ㪠§Ò¹Í ҧá¾Ã ËÅÒÂ, ÁÕǧ¨Ã¨Ñ´¡ÒÃà¡ÕÂè ǡѺ¡Òúѹ·Ö¡áÅÐ àÅ ¹¡ÅѺàÊÕ§¼ Ò¹ÃкººÑÊ·Õàè ÃÕÂ¡Ç Ò I2S (Inter-IC Sound) «Ö§è à» ¹·ÕÂè ÍÁÃѺ¡Ñ¹ã¹Ç§¡Ç Ò§Ç Ò à» ¹ ÃкººÑÊÊíÒËÃѺÍØ»¡Ã³ ¨´Ñ ¡ÒÃà¡ÕÂè ǡѺÊÑ­­Ò³àÊÕ§´Ô¨µÔ ÍÅ·Õ´è Õ áÅÐÁÕ»ÃÐÊÔ·¸ÔÀÒ¾ÁÒ¡ à· Ò¹Ñé¹ÂѧäÁ ¾Í STM32 Primer2 ÂѧÁҾà ÍÁ¡ÑºÃкº»¯ÔºÑµÔ¡ÒÃ੾ÒеÑÇ·ÕèàÃÕÂ¡Ç Ò CircleOS «Ö§è ª ÇÂãË ¹¡Ñ ¾Ñ²¹ÒÊÒÁÒö¾Ñ²¹Òâ»Ãá¡ÃÁ»ÃÐÂØ¡µ ËÃ×ÍáÍ»¾ÅÔपѹè ä´ ÊдǡáÅÐà» ¹ ÃкºÍ ҧÁÒ¡ à¹×Íè §¨Ò¡ CircleOS ä´ ¨´Ñ àµÃÕÂÁ¿ §¡ ª¹Ñè ¾Ã ÍÁ㪠§Ò¹à» ¹¨íҹǹÁÒ¡à¾×Íè ʹѺʹع ãË ¹¡Ñ ¾Ñ²¹ÒÊÒÁÒöÊà ҧáÍ»¾ÅÔà¤ªÑ¹è ·ÕÃè ¹Ñ º¹ÎÒà ´áÇà ¢Í§ STM32 Primer2 ä´ à» ¹Í ҧ´Õ ¹Í¡ ¨Ò¡¹Ñé¹ÂѧÊÒÁÒöáÅ¡à»ÅÕè¹¢ ÍÁÙÅ ¢ ÒÇÊÒà «Íà Êâ»Ãá¡ÃÁ ¡Ñº¹Ñ¡¾Ñ²¹Ò¨Ò¡·ÑèÇâÅ¡·Õèà ÇÁà» ¹ »ÃЪҤÁ¢Í§ CircleOS ẺäÁ Á¤Õ Ò ãª ¨Ò ¼ Ò¹·Ò§àǺ䫵 www.stm32circle.com ´ Ò¹¡ÒþѲ¹Òâ»Ãá¡ÃÁ¹Ñ¹é Raisonance ¼Ù¾ ² Ñ ¹Ò¤ÍÁä¾àÅÍà ª¹Ñé ¹íÒ¨Ò¡»ÃÐà·È½Ãѧè àÈÊ áÅÐÂѧ໠¹¼Ù¼ ÅÔµ STM32 Primer2 ä´ ¾² Ñ ¹ÒªØ´«Í¿µ áÇà ¢¹Öé 㹪×Íè Rkit-ARM áÅÐ RIDE7 ·Õºè ÃÃ¨Ø C ¤ÍÁä¾àÅÍà (·Õäè Á ¨Òí ¡Ñ´¢¹Ò´¢Í§â»Ãá¡ÃÁ) áÅÐ IDE ·ÕÊè ÁºÙó ÍÍ¡ÁÒãË ´Òǹ âËÅ´ä»ãª §Ò¹ ä´ â´ÂäÁ ¤´Ô ¤ Ò㪠¨Ò  áÅÐá¹ ¹Í¹ Rikit-ARM áÅÐ RIDE7  ÍÁµ ͧ໠¹à¤Ã×Íè §Á×ÍËÅѡ㹡ÒþѲ¹Ò áÍ»¾ÅÔà¤ªÑ¹è ·ÕÃè ¹Ñ º¹ CircleOS ¢Í§ STM32 Primer2 ´Ñ§¹Ñ¹é ¡ÒÃàÃÕ¹ÃÙá ÅоѲ¹ÒáÍ»¾ÅÔपѹè ÊíÒËÃѺäÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 º¹ STM32 Primer2 ¨Ö§à» ¹¡ÒÃŧ·Ø¹·Õ¤è ÁØ ¤èÒ à¹×Íè §¨Ò¡ÎÒà ´áÇà Á¤Õ ÇÒÁ·Ñ¹ÊÁÑ ÊǧÒÁ ¢Õ´¤ÇÒÁÊÒÁÒöÊÙ§ Ê Ç¹ «Í¿µ áÇà ¡Êç ÒÁÒöÃͧÃÑºä´ Í ҧàµçÁ·Õâè ´ÂäÁ µÍ §¨Ñ´ËÒ C ¤ÍÁä¾àÅÍà ÃÒ¤ÒᾧÁÒ㪠§Ò¹à¾ÔÁè àµÔÁ STM32 Primer2 à» ¹à¤Ã×Íè §Á×Í¡ÒÃàÃÕ¹ÃÙá ÅÐ㪠§Ò¹·Õªè Ç ÂãË ¤³ Ø à¢ Ò¶Ö§¹ÔÂÒÁ¢Í§ STM32 Releasing your creativity ä´ Í ҧᷠ¨ÃÔ§


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

2 l

ÊÒúѭ : ͧ¤ »ÃСͺ¢Í§ STM32 Primer2....................................................................................3 : ¡ÒÃàµÃÕÂÁ¡ÒÃáÅз´Êͺ STM32 Primer2 àº×Íé §µ ¹.........................................................6 ! : ¡ÒèѴ¡ÒÃáÍ»¾ÅÔà¤ªÑ¹è ¢Í§Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS......................................................11 " : à¤Ã×Íè §Á×Í㹡ÒþѲ¹ÒáÍ»¾ÅÔà¤ªÑ¹è º¹ STM32 Primer2...................................................14 # : ·´Êͺ¡ÒÃÊà ҧáÍ»¾ÅÔà¤ªÑ¹è º¹ STM32 Primer2..............................................................16 $ : ¡ÒèѴ¡ÒÃáÍ»¾ÅÔà¤ªÑ¹è º¹ STM32 Primer2....................................................................23 % : ¡ÒÃÃÕ૵ STM32 Primer2..................................................................................................27 & : » ­ËÒáÅÐá¹Ç·Ò§á¡ 䢢ͧ STM32 Primer2..................................................................28 ' : ǧ¨Ã¢Í§ STM32 Primer2...............................................................................................29 : Ê Ç¹µ Í¢ÂÒ¾Íà µ¢Í§ STM32 Primer2........................................................................38


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 3

1 : ͧ¤ »ÃСͺ¢Í§ STM32 Primer2 STM32 Primer2 ËÃ×ÍàÃÕ¡ÊÑé¹æ Ç Ò Primer2 à» ¹ÍØ»¡Ã³ ÊíÒËÃѺ¡ÒÃàÃÕ¹ÃÙ áÅоѲ¹Ò äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 ÀÒÂ㵠ʶһ µÂ¡ÃÃÁ ARM Cortex-M3 ÍÕ¡ÃÙ»áººË¹Ö§è «Ö§è ä´ ¨´Ñ àµÃÕÂÁ ÍØ»¡Ã³ ÍÔ¹¾Øµ/àÍÒµ ¾ØµáÅÐÃÇÁ件֧Ãкº»¯ÔºÑµÔ¡Ò÷Õèª×èÍÇ Ò CircleOS ÃͧÃѺÊíÒËÃѺ¡ÒþѲ¹Ò â´ÂÁÕ¡ÒÃÍ͡Ẻ¾×é¹°Ò¹¡ÒäǺ¤ØÁàÁ¹Ùµ Ò§æ ´ ÇÂËÅÑ¡¡ÒõÃǨ¨Ñº¤ÇÒÁàÍÕ§¨Ò¡µÑǵÃǨ¨Ñº ¤ÇÒÁàà § 3 ᡹ (3 axis accellerometer sensor) «Ö§è ¾Ñ²¹ÒÀÒÂãµ à·¤â¹âÅÂÕ MEMS (Micro-ElectroMechanical Systems) à ÇÁ¡Ñº¨ÍÂʵԡê áÅÐ˹ Ò¨ÍÊÑÁ¼ÑÊ ¹Í¡¨Ò¡¹ÕÂé §Ñ ÁÕͧ¤ »ÃСͺ¢Í§ÎÒà ´áÇà ·Õäè ´ ÃºÑ ¡ÒÃÍ͡ẺãË ÃͧÃѺ¡Ò÷íÒ§Ò¹Í×¹è æ ·Õ¹è Ò Ê¹ã¨ÍÕ¡ÁÒ¡ÁÒ ã¹ÃÙ»·Õè 1 áÊ´§Ê ǹ»ÃСͺËÅÑ¡æ ¢Í§ STM32 Primer2

¨Ø´µ Í USB ÊíÒËÃѺ ´ÕºÑ¡/â»Ãá¡ÃÁ

«çÍ¡à¡çµ MicroSD ¡Òà ´ (µÔ´µÑé§ÍÂÙ ÀÒÂã¹) ¨ÍÂʵÔê¡ µÑǵÃǨ¨Ñº¤ÇÒÁàà § 3 ᡹ (µÔ´µÑé§ÍÂÙ ÀÒÂã¹) »Ø Á¡´àÁ¹Ù 4 ª ͧ

¨Ø´µ ÍËÙ¿ § ÊàµÍÃÔâÍ

ÅíÒ⾧

¨Ø´µ Í USB ÊíÒËÃѺ áÍ»¾ÅÔपÑè¹

äÁâ¤Ã⿹ STM32F103VET6 (512 ¡ÔâÅ亵 )

¨Í LCD ẺÊÑÁ¼ÑÊ áºµàµÍÃÕèÅÔà¸ÕÂÁ 3.7V 400mAH (µÔ´µÑé§ÍÂÙ ÀÒÂã¹)

ÃÙ»·Õè 1 áÊ´§Í§¤ »ÃСͺ·Ò§ÎÒà ´áÇà ¢Í§ STM32 Primer2

âÁ´ÙÅ IrDA (µÔ´µÑé§ÍÂÙ ÀÒÂã¹)


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

4 l

1.1 ͧ¤ »ÃСͺ·Ò§ÎÒà ´áÇà ¢Í§ STM32 Primer2 µÑÇ»ÃÐÁÇżÅà» ¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà 32 ºÔµµÃСÙÅ STM32 ʶһ µÂ¡ÃÃÁ ARM Cortex-M3 ÃËÑÊàºÍà STM32F103VET6 ·ÕÁè ËÕ ¹ ǤÇÒÁ¨íÒẺá¿Åª¢¹Ò´ 512 ¡ÔâÅ亵 áÅÐ˹ Ç ¤ÇÒÁ¨íÒ¢ ÍÁÙÅáÃÁ 64 ¡ÔâÅ亵 l ˹ Ò¨ÍáÊ´§¼Å¡ÃÒ¿ ¡ LCD ẺÊÑÁ¼ÑÊ ÁÕ¤ÇÒÁÅÐàÍÕ´ 128 N 160 ¾Ô¡à«Å ¤ÇÒÁÅÐàÍÕ´ÊÕ ¢¹Ò´ 24 ºÔµ (´ÙÃÒÂÅÐàÍÕ´à¾ÔÁè àµÔÁä´ ¨Ò¡´Òµ ÒªÕµ LCM-TGG00177YP02-01_SPEC.pdf áÅеÑǤǺ¤ØÁ ¡ÒÃáÊ´§¼ÅàºÍà ST7732 ¨Ò¡ www.sitronix.com.tw/.) l ÁÕªÍ §µ ;Íà µ USB 2 ª ͧ â´Â·Õè ª ͧ·Õè 1 à» ¹¨Ø´µ Í USB Debug 㪠àª×Íè Áµ ͡Ѻ¤ÍÁ¾ÔÇàµÍà áÅл¯ÔÊÁÑ ¾Ñ¹¸ ¡ºÑ â»Ãá¡ÃÁ RIDE7 à¾×Íè Ãѹã¹âËÁ´´Õº¡Ñ áÅÐ㪠㹡ÒÃâ»Ãá¡ÃÁ¢ ÍÁÙÅŧã¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32F103 VET6 ÀÒÂã¹ STM32 Primer2 ª ͧ·Õè 2 à» ¹¨Ø´µ Í USB STM32 㪠㹡ÒÃàª×Íè Áµ Í¢ ÍÁÙÅÃÐËÇ Ò§à¿ ÃÁ áÇà ·¾Õè ² Ñ ¹Ò¢Ö¹é ¡ÑºâÎʵ ÀÒ¹͡ l ¨ÍÂʵԡ ê 4 ·ÔÈ·Ò§ 5 àÍÒµ ¾µØ 1 µÑÇ l »ØÁ ¡´à¾×Íè àÅ×Í¡àÁ¹Ù 4 µÑÇ l ¤Í¹à´¹à«Íà äÁâ¤Ã⿹ÊíÒËÃѺµÃǨ¨ÑºáÅкѹ·Ö¡àÊÕ§ l ÅíÒ⾧ÊíÒËÃѺàÅ ¹¡ÅѺàÊÕ§ l ¨Ø´µ ÍËÙ¿§ ẺÊàµÍÃÔâÍ l µÑǵÃǨ¨ÑºáÅÐÇÑ´¤ÇÒÁàà §áºº 3 ᡹ àºÍà LIS3LV02DL ¨Ò¡ ST ÊíÒËÃѺµÃǨ¨Ñº ¤ÇÒÁàÍÕ§ 1 µÑÇ (¶Ù¡ãª §Ò¹à¾×Íè àÅ×Íè ¹àÁ¹ÙáÅо͹ àµÍà µÒ §æ ÀÒÂã¹Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS ã¹ ¢³ÐÃѹáÍ»¾ÅÔà¤ªÑ¹è º¹ STM32 Primer2) l âÁ´ÙÅ IrDA ÃͧÃѺ¡ÒÃÊ×Í è ÊÒâ ÍÁÙÅ͹ءÃÁäà ÊÒ¼ Ò¹áʧÍÔ¹¿ÃÒàô l «çÍ¡à¡çµ MicroSD ÊíÒËÃѺÃͧÃѺ¡ÒÃàª×Í è Áµ ͡Ѻ¡Òà ´Ë¹ ǤÇÒÁ¨íÒẺ MicroSD ËÃ×Í MicroSD ¡Òà ´ l ¨Ø´µ ÍÊíÒËÃѺÃͧÃѺ¡ÒâÂÒ¾Íà µÍÔ¹¾ØµàÍÒµ ¾µ Ø l ẵàµÍà ÃÅ Õè àÔ ¸ÕÂÁÍÔÍ͹ 3.7V 400mAH ¾Ã ÍÁǧ¨Ã»ÃШØẵàµÍÃÕãè ¹µÑÇ ÊÒÁÒö»ÃÐ¨Ø áç´Ñ¹¼ Ò¹¾Íà µ USB ä´ l


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 5

1.2 ͧ¤ »ÃСͺ´ Ò¹«Í¿µ áÇà ¢Í§ STM32 Primer2 STM32 Primer2 ä´ ÃºÑ ¡ÒõԴµÑ§é Ãкº»¯ÔºµÑ ¡Ô Ò÷ժè Í×è Ç Ò CircleOS ÁÒ¨Ò¡¼Ù¼ ÅÔµ â´Â·Õµè ÇÑ Primer2 àͧ¡ç¨ÐÁҾà ÍÁ¡ÑºáÍ»¾ÅÔà¤ªÑ¹è ¾×¹é °Ò¹µ Ò§æ ·Õ¨è Òí à» ¹ ઠ¹ ¡ÒÃµÑ§é ¤ ÒàÇÅÒ ËÃ×Í¡ÒÃµÑ§é ¤ Òµ Ò§æ ¢Í§Ãкº ¨¹ä»¶Ö§à¡ÁµÑÇÍ ҧ «Ö觹͡¨Ò¡¹ÕéÃкº»¯ÔºÑµÔ¡Òà CircleOS ÂѧÊÒÁÒöÃͧÃѺ¡Òà µÔ´µÑ§é áÍ»¾ÅÔपѹè à¾ÔÁè àµÔÁ¨Ò¡¼Ùã ª §Ò¹´ Ç µÑÇÍ ҧ¡ÅØÁ ¿ §¡ ª¹Ñè ·Õãè ª 㹡ÒþѲ¹ÒáÍ»¾ÅÔà¤ªÑ¹è º¹ STM32 Primer2 ·ÕÃè кº»¯ÔºµÑ ¡Ô Òà CircleOS ÃͧÃѺ »ÃСͺ´ Ç 1. ¡ÅØÁ ¿ §¡ ª¹Ñè áÊ´§¼Å¡ÃÒ¿ ¡ÊíÒËÃѺ LCD ·ÑªÊ¡ÃÕ¹ 2. ¡ÅØÁ ¿ §¡ ª¹Ñè ¡ÒõԴµ ͡ѺµÑǵÃǨ¨ÑºáÅÐÇÑ´¤ÇÒÁàà § 3 ᡹ 3. ¡ÅØÁ ¿ §¡ ª¹Ñè ¡ÒõԴµ ͡Ѻ»ØÁ µ Ò§æ, ¨ÍÂʵԡê , LED áÅÐÅíÒ⾧¢ÑºàÊÕ§ 4. ¡ÅØÁ ¿ §¡ ª¹Ñè ¡ÒèѴ¡ÒÃàÁ¹Ù 5. ¡ÅØÁ ¿ §¡ ª¹Ñè ¡ÒèѴ¡Ò÷ÒÊ¡ Í ҧäáçµÒÁ ¨íҹǹ¢Í§¡ÅØ Á¿ §¡ ªÑè¹·Õè CircleOS ÊÒÁÒöÃͧÃÑºä´ ¨ÐÁÕ¡ÒÃà¾ÔèÁàµÔÁÁÒ¡ ¢Ö¹é µÒÁ¡ÒûÃѺ»Ãا·Ñ§é ¨Ò¡¼Ù¼ ÅÔµ¤×Í Raisonance àͧáÅШҡ»ÃЪҤÁ Primer2 ·ÑÇè âÅ¡ ÊíÒËÃѺµÑÇÍ ҧ¢Í§¡ÒþѲ¹Òâ»Ãá¡ÃÁÀÒÉÒ C à¾×Íè Êà ҧáÍ»¾ÅÔà¤ªÑ¹è µ Ò§æ ¼ÙÊ ¹ã¨ÊÒÁÒö ´Òǹ âËÅ´ä´ ·Õè www.stm32circle.com ä´ ¿ÃÕËÅѧ¨Ò¡¡ÒÃŧ·ÐàºÕ¹ ÃÇÁ¶Ö§¡ÒÃ㪠§Ò¹¡Ãдҹ¶ÒÁ µÍº » ­ËÒµ Ò§æ 㹡ÒþѲ¹ÒáÍ»¾ÅÔपѹè (ËÑÇ¢ Í Forum)

ÃÙ»·Õè 2 áÊ´§àǻྨ¢Í§«Íà Êä¿Å áÍ»¾ÅÔपѹè ÃÙ»·Õè 3áÊ´§àǻྨ¢Í§¡Ãдҹ¶ÒÁµÍº» ­ËÒ µÑÇÍ ҧ·Õ¼è ¾Ù ² Ñ ¹ÒÊÒÁÒö´Òǹ âËÅ´ä»ÈÖ¡ÉÒä´ ¿ÃÕ ã¹¡ÒÃ㪠§Ò¹ STM32 Primer2 áÅСÒþѲ¹Ò áÍ»¾ÅÔà¤ªÑ¹è º¹Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

6 l

2 : àµÃÕÂÁ¡ÒÃáÅз´Êͺ STM32 Primer2 àº×Íé §µ ¹ 2.1 ¡ÒÃàª×Íè Áµ ÍáÅлÃШØẵàµÍà ÃÕè àÁ×Íè ¼Ùã ª §Ò¹¹íÒ STM32 Primer2 ÁÒ㪠§Ò¹¤Ãѧé ááÊØ´ áËÅ §¨ ÒÂä¿«Ö§è à» ¹áºµàµÍà ÃÕè 3.7V ÀÒÂã¹µÑÇ STM32 Primer2 ¨ÐÂѧäÁ ä´ ¶¡Ù àª×Íè Áµ ͡Ѻǧ¨Ã¢Í§ STM32 Primer2 ´Ñ§¹Ñ¹é ¼Ùã ª §Ò¹¨Ð µ ͧàª×Íè Áµ ÍẵàµÍà ÃàÕè ¢ ҡѺªØ´Ç§¨Ã¢Í§ STM32 Primer2 àÊÕ¡ ͹ â´ÂÁÕ¢¹Ñé µÍ¹´Ñ§¹Õé (1) à» ´½Ò´ Ò¹ËÅѧ¢Í§ STM32 Primer2 Í ҧÃÐÁÑ´ÃÐÇѧµÒÁÃÙ» ¡ÒûÃСºÂÖ´¢Í§½Ò ˹ ÒáÅÐÅ Ò§¢Í§ STM32 Primer2 äÁ ÁÊÕ ¡ÃÙ ¨Ð㪠ÊÅѡ㹡ÒûÃСͺÂÖ´ ´Ñ§¹Ñ¹é ¡ÒÃà» ´½Ò¨Ö§ÊÒÁÒö 㪠ÁÍ× ¤ ÍÂæ §Ñ´½ÒËÅѧÍÍ¡ ÃÐÇѧÍ ÒãË ÊÅÑ¡ËÑ¡ (2) ¹íÒ¨ÑêÁà»Íà àª×èÍÁµ ÍÃÐËÇ Ò§¢Ò¢Í§¤Í¹à¹ç¡àµÍà µÒÁ·ÔÈ·Ò§¢Í§ÅÙ¡ÈõÒÁÃÙ»·Õè 4 à¾×Íè àª×Íè Áµ ÍẵàµÍà ÃàÕè ¢ ҡѺªØ´Ç§¨Ã¢Í§ STM32 Primer2 (3) » ´½ÒËÅѧ¡ÅѺࢠÒä»àËÁ×͹à´ÔÁ ÃÐÇѧÊÅÑ¡ËÑ¡ ËÅѧ¨Ò¡¹Õé STM32 Primer2 ÊÒÁÒö ¶Ù¡à» ´ãª §Ò¹ä´ µÒÁ»¡µÔ (4) ¶ ÒËÒ¡¼Ùã ª §Ò¹µ ͧ¡ÒûÃШØẵàµÍà ÃÕè ÊÒÁÒö·íÒä´ §Ò Âæ ´ Ç¡Òõ ÍÊÒ USB (ÁÕ ÁÒ㹪ش) ÃÐËÇ Ò§ STM32 Primer2 (ÊÒÁÒöµ ͡Ѻ¨Ø´µ Í USB ª ͧ㴡çä´ ) ¡Ñº¤ÍÁ¾ÔÇàµÍà LED ÊÕ á´§¨ÐµÔ´ÊÇ Ò§à¾×Íè ᨠ§Ê¶Ò¹Ð¡ÒûÃÐ¨Ø àÁ×Íè ¡ÒûÃШØʹÔé Êشŧ (ẵàµÍÃÕàè µçÁ) LED ÊÕà¢ÕÂǨеԴÊÇ Ò§ á·¹ ¹Í¡¨Ò¡¹Ñ¹é ËÒ¡·íÒ¡ÒûÃШØã¹ÃÐÇË Ò§·Õàè » ´à¤Ã×Íè §ãª §Ò¹ ·ÕËè ¹ Ò¨ÍáÊ´§¼Å¨ÐÁÕäͤ͹áÊ´§ ʶҹТͧÃдѺẵàµÍà ÃáÕè Ê´§ÍÂÙ· ÁÕè ÁØ Å Ò§´ Ò¹¢ÇҢͧ˹ Ò¨ÍáÊ´§¼Å (µ ͧÃѹáÍ»¾ÅÔपѹè ÀÒÂãµ Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS) ½ÒËÅѧ ¨ÑêÁà»ÍÃ

ÊÅÑ¡ÊíÒËÃѺÂÖ´½Ò

ẵàµÍÃÕè

¤Í¹à¹ç¡àµÍà ÊíÒËÃѺµ Í¢ÂÒÂÃкº

¨Ø´µ ;Íà µ USB

«çÍ¡à¡çµ MicroSD ¡Òà ´ ¨Ø´µ ;Íà µ USB

ÃÙ»·Õè 4 áÊ´§Ê ǹ»ÃСͺ·ÕÍè ÂÙÀ ÒÂã¹ STM32 Primer2 áÅСÒõ ͨÑÁê à»Íà à¾×Íè ¨ ÒÂä¿àÅÕÂé §¨Ò¡ ẵàµÍÃÕàè ¢ ÒÊÙÇ §¨Ã


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 7

2.2 ¡ÒÃ㪠§Ò¹àº×Íé §µ ¹ ¡ÒÃà» ´ãª §Ò¹ STM32 Primer2 ·íÒä´ â´Â¡´»ØÁ ·ÔÈ·Ò§µÃ§¢Í§¨ÍÂÊµÔ¡ê ¨Ò¡¹Ñ¹é ¡Ò÷íÒ§Ò¹ ¢Í§ STM32 Primer2 ¨ÐàÃÔÁè µ ¹¢Ö¹é ·ÕËè ¹ Ò¨ÍáÊ´§¼ÅáÊ´§Ë¹ Ò¨ÍËÅÑ¡àÃÔÁè µ ¹¢Ö¹é µÒÁÃÙ» ¾Ã ÍÁ´ Ç àÊÕ§·Ñ¡·ÒÂà» ¹¤íÒ¾Ù´ÍÍ¡¨Ò¡ÅíÒ⾧ Welcome to STM32 Primer2

ËÅѧ¨Ò¡¹Ñ¹é ¼Ùã ª §Ò¹ÊÒÁÒö·´Êͺ¡Ò÷íÒ§Ò¹ã¹áµ ÅÐàÁ¹Ù¢Í§ STM32 Primer2 ä´ µÒÁ µ ͧ¡Òà ´ Ç¡Òá´»ØÁ ·ÔÈ·Ò§µÃ§¢Í§¨ÍÂʵԡê ÍÕ¡ 1 ¤ÃÑ§é ¨Ð»ÃÒ¡¯àÁ¹Ùà¾×Íè ࢠҶ֧¡ÒÃ㪠§Ò¹ã¹Ê ǹ µ Ò§æ ¢Í§ÃкºµÒÁÃÙ»

¡ÒÃàÅ×è͹µíÒá˹ §¢Í§á¶ºàÅ×Í¡ÃÒ¡ÒùÑé¹·íÒä´ â´Â¡Òá´»Ø Á·ÔÈ·Ò§·Õè¨ÍÂʵÔê¡ËÃ×Í·íÒ ¡ÒÃàÍÕ§ STM32 Primer2 ¨Ò¡á¹ÇÃйҺä»ÁÒã¹·ÔÈ·Ò§¡ÒÃàÅ×Íè ¹àÁ¹Ù (ã¹Ê ǹ¹Õ¼é ãÙ ª §Ò¹ÊÒÁÒö ¡íÒ˹´»ÃѺà»ÅÕÂè ¹µÒÁ¤ÇÒÁµ ͧ¡ÒÃä´ ã¹ÀÒÂËÅѧ·Õàè Á¹Ù Config)

2.2.1 àÁ¹ÙËÅÑ¡¢Í§Ãкº àÁ¹ÙËÅÑ¡æ ¢Í§Ãкº·Õ¼è ãÙ ª §Ò¹ÊÒÁÒöࢠÒ仡íÒ˹´¤ ÒËÃ×Í㪠§Ò¹ä´ ÁÕ´§Ñ ¹Õé

2.2.1.1. àÁ¹Ù Config

à» ¹àÁ¹Ùàª×Íè Áâ§ä»ÂѧàÁ¹ÙÂÍ Âµ Ò§æ ÊíÒËÃѺãË ¼ãÙ ª §Ò¹à¢ Ò仡íÒ˹´ËÃ×Íᡠ䢡Ò÷íÒ§Ò¹ ËÅÒÂæ Ê Ç¹¢Í§Ãкº ÍÑ¹ä´ á¡ àÁ¹ÙÂÍ Â Power, Interface, Time áÅÐ Test µÑÇÍ ҧ¼Ñ§ã¹¡ÒÃàª×Íè Á â§ã¹Ê ǹ¹Õàé » ¹ä»µÒÁÃÙ»·Õè 5


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

8 l

Config

Power

Interface

CPU Freq.

User Input

Backlight

Speaker

Time

Test

TS Calibrate

ÃÙ»·Õè 5 áÊ´§¼Ñ§¡Ò÷íÒ§Ò¹¢Í§àÁ¹Ù config º¹Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS ¢Í§ STM32 Primer2 àÁ¹Ù Power ÁÕàÁ¹ÙÂÍ Â 2 ÃÒ¡Òä×Í 1. CPU Freq ÊíÒËÃѺ»ÃѺ¤ÇÒÁ¶ÕÊè ­ Ñ ­Ò³¹ÒÌ ¡Ò¢Í§«Õ¾ÂÕ ËÙ ÅÑ¡ ÊÒÁÒö¡íÒ˹´ä´ 5 ÃдѺ (level)â´Âã¹áµ ÅÐÃдѺ¨ÐÊ §¼Åµ ͤÇÒÁ¶ÕÊè ­ Ñ ­Ò³¹ÒÌ ¡Ò¢Í§«Õ¾ÂÕ áÙ ÅФÇÒÁ¶Õ¢è ͧä·àÁÍà Ãкº Systick ´Ñ§áÊ´§¤ÇÒÁÊÑÁ¾Ñ¹¸ ã¹µÒÃÒ§·Õè 1 2. Backlight ÊíÒËÃѺ¡íÒ˹´ÃдѺ¤ÇÒÁÊÇ Ò§¢Í§ä¿Ê ͧËÅѧ·ÕËè ¹ Ò¨Í LCD ã¹¢³Ð ·íÒ§Ò¹ «Ö§è ¡íÒ˹´ä´ 5 ÃдѺ l àÁ¹Ù Interface ÁÕàÁ¹ÙÂÍ Â 3 ÃÒ¡Òä×Í 1. User Input ÊíÒËÃѺ¡íÒ˹´ÅѡɳСÒÃàª×Íè Áµ ͡Ѻ¼Ùã ª §Ò¹à¾×Íè ·íÒÃÒ¡ÒÃËÃ×Íà¢ Ò ¶Ö§àÁ¹ÙµÒ §æ´ ÇÂà§×Íè ¹ä¢ÍÔ¹¾Øµáººµ Ò§ ÁÕãË àÅ×Í¡ 3 ·Ò§¤×Í 1.1 㪠µÇÑ µÃǨ¨Ñº¤ÇÒÁàà § 3 ᡹à¾Õ§Í ҧà´ÕÂÇ 1.2 㪠¨ÍÂʵԡê à¾Õ§Í ҧà´ÕÂÇ 1.3 Ẻ㪠§Ò¹·Ñ§é ¤ÙÃ Ç Á¡Ñ¹ (¤ Ò default) l

ÃдѺ (Level) ¤ÇÒÁ¶ÕèÊÑ­­Ò³¹ÒÌÔ¡Ò«Õ¾ÕÂÙ ¤ÇÒÁ¶Õè¢Í§ä·àÁÍà Systick 1 2 3 4 5

18MHz 24MHz 36MHz 48MHz 72MHz

0.75kHz 1kHz 1.5kHz 2kHz 3kHz

µÒÃÒ§·Õè 1 áÊ´§¤ÇÒÁÊÑÁ¾Ñ¹¸ ¢Í§¡ÒáíÒ˹´ÃдѺ¤ÇÒÁ¶ÕÊè ­ Ñ ­Ò³¹ÒÌ ¡Ò¢Í§«Õ¾ÂÕ áÙ ÅФÇÒÁ¶Õè ¢Í§ä·àÁÍà Systick


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 9

2. LoudSpeaker ÊíÒËÃѺ໠´/» ´àÊÕ§ʶҹе Ò§æ ¢Í§Ãкº 3. TS Calibreat ÊíÒËÃѺ»ÃѺᵠ§Ë¹ Ò¨ÍÊÑÁ¼ÑÊ l àÁ¹Ù Time 㪠㹡ÒÃµÑ§é ¤ ÒàÇÅҢͧÃкº l àÁ¹Ù Test 㪠·´ÊͺÎÒà ´áÇà ¢Í§Ãкº â´ÂÁÕ¢Í ¤ÇÒÁᨠ§¢Ñ¹é µÍ¹¡Ò÷´ÊͺãË ¼ãÙ ª §Ò¹ ä´ ´Òí à¹Ô¹¡ÒõÒÁ

2.2.1.2 àÁ¹Ù Applic

à» ¹àÁ¹ÙÊÒí ËÃѺࢠҶ֧áÍ»¾ÅÔà¤ªÑ¹è µ Ò§æ ·Õ¶è ¡Ù µÔ´µÑ§é ࢠÒÁÒã¹ STM32 Primer2 â´Â·Õè STM32 Primer2 ÁÕáÍ»¾ÅÔà¤ªÑ¹è µÑÇÍ ҧ·Õµè ´Ô µÑ§é ÁÒ¨Ò¡âç§Ò¹´Ñ§¹Õé l Maze à» ¹à¡ÁÍÔàÅç¡·ÃÍ¹Ô¡Ê ·ÕèÁÕ¡ÒÃàÅ ¹¤Å Ò¡Ѻà¡Áá¾ç¡áÁ¹·ÕèÁÕ¡ÒÃÇÔè§à¡çº¤Ðá¹¹ä» µÒÁà¢Òǧ¡µ

l

Breakout ¤×Í à¡ÁµÕÅ¡Ù ºÍÅ仡Ãзºà» ÒËÁÒÂà¾×Íè ÊÐÊÁáµ Á

COMMTEST à» ¹â»Ãá¡ÃÁ·´Êͺ¡ÒÃàª×Íè Áµ ͡Ѻ MicroSD ¡Òà ´ l EchoIrDA à» ¹â»Ãá¡ÃÁ·´Êͺ¡ÒÃÊ×Í è ÊÒâ ÍÁÙÅ´ ÇÂáʧÍÔ¹¿ÃÒàô¡ÑºâÁ´ÙÅ IrDA ã¹ ÅѡɳÐà͡⤠ËÃ×ÍÊз ͹¢ ÍÁÙÅ¡ÅѺ l


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

10 l

2.2.1.3 àÁ¹Ù About

à» ¹àÁ¹ÙÊÒí ËÃѺàÃÕ¡´ÙÃÒÂÅÐàÍÕ´à¡ÕÂè ǡѺÃкº»¯ÔºµÑ ¡Ô Òà CircleOS ·Õ¡è Òí Åѧ㪠§Ò¹ÍÂÙ ÃÇÁ ¶Ö§¨íҹǹáÍ»¾ÅÔà¤ªÑ¹è ·Õ¶è ¡Ù µÔ´µÑ§é , ¢¹Ò´¢Í§¾×¹é ·ÕËè ¹ ǤÇÒÁ¨íÒ·Õ¶è ¡Ù ãª §Ò¹ áÅÐ¾×¹é ·ÕËè ¹ ǤÇÒÁ ¨íÒ·Õàè ËÅ×ͺ¹ STM32 Primer2

2.2.1.4 àÁ¹Ù Shutdown

à» ¹àÁ¹ÙÊÒí ËÃѺ» ´¡ÒÃ㪠§Ò¹ STM32 Primer2

2.2.1.5 àÁ¹Ù Quit

à» ¹àÁ¹ÙÊÒí ËÃѺ¡ÅѺä»Âѧ˹ Ò¨ÍËÅÑ¡ áÅÐãª ã¹·Ø¡æ ¡ÒÃàÃÕ¡㪠ÀÒÂã¹àÁ¹ÙÂÍ Â´ ÇÂ


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 11

3 : ¡ÒèѴ¡ÒÃáÍ»¾ÅÔà¤ªÑ¹è ¢Í§Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS ÁÕ¿§ ¡ ª¹Ñè ʹѺʹع¡Ò÷íÒ§Ò¹áÅСÒþѲ¹ÒáÍ»¾ÅÔà¤ªÑ¹è º¹ STM32 Primer2 ÁÒ¡¾ÍÊÁ¤Çà áÅÐÍÒ¨ÁÕà¾ÔÁè àµÔÁã¹Í¹Ò¤µ ¡µÑÇÍ ҧ 1. ¡ÅØÁ ¿ §¡ ª¹Ñè áÊ´§¼Å¡ÃÒ¿ ¡ÊíÒËÃѺ¨Í LCD ẺÊÑÁ¼ÑÊ 2. ¡ÅØÁ ¿ §¡ ª¹Ñè µÔ´µ ͡ѺµÑǵÃǨ¨ÑºáÅÐÇÑ´¤ÇÒÁàà § 3 ᡹ 3. ¡ÅØÁ ¿ §¡ ª¹Ñè µÔ´µ ͡Ѻ»ØÁ µ Ò§æ, ¨ÍÂʵԡê , LED áÅÐÅíÒ⾧ 4. ¡ÅØÁ ¿ §¡ ª¹Ñè ¨Ñ´¡ÒÃàÁ¹Ù 5. ¡ÅØÁ ¿ §¡ ª¹Ñè ¨Ñ´¡Ò÷ÒÊ¡

3.1 ª ǧ¨Ñ§ËÇÐǧÃͺ¢Í§Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS 㹡ÒÃÃѹáÍ»¾ÅÔà¤ªÑ¹è µ Ò§æ·Õ¶è ¡Ù àÃÕ¡㪠§Ò¹º¹ STM32 Primer2 Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS ÁÕ¡ÒÃẠ§§Ò¹ã¹¡ÒûÃÐÁÇżšÒ÷íÒ§Ò¹¢Í§áÍ»¾ÅÔपÑè¹à» ¹Ç§Ãͺ¢Í§àÇÅÒ¨Ò¡¤ÒºàÇÅÒã¹ ¡ÒÃÍÔ¹àµÍÃ Ã»Ñ µ ¢Í§ä·àÁÍà Systick

3.2 ª ǧÊÀÒÇÐàÃÔÁè µ ¹ (Initialization state) ¢Í§Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS 㹪 ǧàÃÔÁè µ ¹¡Ò÷íÒ§Ò¹¤ ҤسÊÁºÑµµÔ Ò §æ ¢Í§ÃкºÃÇÁ件֧¨Ñ§ËÇÐǧÃͺ¢Í§àÇÅÒ¨Ò¡¤Òº àÇÅÒ㹡ÒÃÍÔ¹àµÍÃ Ã»Ñ µ ¢Í§ä·àÁÍà Systick ¨Ð¶Ù¡¡íÒ˹´¤ Ò¡Ò÷íÒ§Ò¹ «Ö§è ÊÀÒÇйըé Ðà¡Ô´¢Ö¹é ËÅѧ¨Ò¡ ¡ÒÃÃÕ૵Ãкº â´Â·Õ¤è ÒºàÇÅÒ㹡ÒÃÍÔ¹àµÍÃ Ã»Ñ µ ¢Í§ä·àÁÍà Systick ¨Ð¢Ö¹é ÍÂÙ¡ ºÑ ¡ÒáíÒ˹´¤ Ò ÊÑ­­Ò³¹ÒÌ ¡Ò¢Í§«Õ¾ÂÕ Ù (´ÙÃÒÂÅÐàÍÕÂ´ä´ ¨Ò¡µÒÃÒ§·Õè 1) ¨Ò¡¿ §¡ ª¹Ñè RCC_Configuration àÁ×Íè à·Õº ¡Ñºâ¤Ã§Êà ҧ¡Ò÷íҧҹ㹪 ǧàÃÔÁè µ ¹ËÃ×ÍInitialization ·Õáè Ê´§ã¹ÃÙ»·Õè 6 â´Â¼Ùã ª §Ò¹ÊÒÁÒö»ÃѺ¤ Ò ¤ÇÒÁ¶ÕÊè ­ Ñ ­Ò³¹ÒÌ ¡Òä´ ¨Ò¡àÁ¹Ù Config à Power à CPU Freq.

3.3 ǧÃͺàÇÅÒ㹡ÒÃÍÔ¹àµÍÃ Ã»Ñ µ ¢Í§ä·àÁÍà Systick ·Ø¡æ ¤ÃÑ§é ·Õäè ·àÁÍà Systick à¡Ô´¡ÒÃÍÔ¹àµÍÃ Ã»Ñ µ à¹×Íè §¨Ò¡¤ÃºÃͺàÇÅÒµÒÁ·ÕÃè кº¡íÒ˹´ äÇ Ãкº»¯ÔºÑµÔ¡ÒèÐࢠÒÁÒÃѺÁ×͡ѺÎÒà ´áÇà µ Ò§æ ઠ¹ LED, »Ø ÁàÁ¹Ù, ¨ÍÂʵÔê¡ áÅÐ LCD áµ ÊíÒËÃѺµÑǵÃǨ¨Ñº¤ÇÒÁàà § 3 ᡹ ¹Ñ¹é Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS ¨Ð㪠¡ÒÃÍÔ¹àµÍÃ Ã»Ñ µ ¨Ò¡ä·àÁÍà 2 ÃѺÁ×Íá¡ÍÍ¡ÁÒµ Ò§ËÒ¡ áÅÐãË ¹ÂÑ ÊíҤѭ (priority) ÊÙ§¡Ç Òä·àÁÍà Systick Ê Ç¹¡ÒÃÃѺÁ×͡Ѻ ¡ÒÃࢠÒÃËÑÊ¢ ÍÁÙÅàÊÕ§ (Codec) ¨Ðà» ¹Ë¹ Ò·Õ¢è ͧÍÔ¹àµÍÃ Ã»Ñ µ ¢Í§âÁ´ÙÅàª×Íè Áµ ÍÃкººÑÊ I2S


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

12 l

à¡Ô´¡ÒÃÃÕ૵ã¹Ãкº

ÀÒÇÐàÃÔèÁµ ¹¡Ò÷íÒ§Ò¹ (Initialization)

RCC_Configuration(); LED_Init(); MEMS_Init(); etc.....

do_nothing

ÍÔ¹àµÍà ÃÑ»µ ä·àÁÍà Systick

ª ǧàÇÅÒ»®ÔºÑµÔ¡ÒÃ

BUTTON_Handler (); BUZZER_Handler (); MENU_Handler (); LCD_Handler (); etc.....

ÃÙ»·Õè 6 â¤Ã§Êà ҧ¡Ò÷íÒ§Ò¹ã¹ÀÒÇÐàÃÔÁè µ ¹¢Í§ STM32 Primer2 àÁ×Íè ÃѹÃкº»¯ÔºµÑ ¡Ô Òà CircleOS

3.4 ¡Ò÷íÒ§Ò¹¢Í§áÍ»¾ÅÔà¤ªÑ¹è ¡Ò÷íÒ§Ò¹¢Í§áÍ»¾ÅÔà¤ªÑ¹è º¹ STM32 Primer2 ÀÒÂãµ Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS ¹Ñ¹é ¨Ð ÍÒÈÑ¡ÒÃàÃÕ¡㪠§Ò¹¼ Ò¹àÁ¹Ù «Ö觡 ͹˹ Ò·ÕèáÍ»¾ÅÔपÑ蹨ж١Ãѹ Ãкº»¯ÔºÑµÔ¡Òà CircleOS ¨ÐÊà ҧÊÀÒÇÐàÃÔÁè µ ¹¢Í§¡Ò÷íÒ§Ò¹ËÃ×Í Initialization ¡ ͹àÊÁÍà¾×Íè ¡íÒ˹´Ç§Ãͺ¡Ò÷íÒ§Ò¹¢Í§ ä·àÁÍà Systick Å ÒÊØ´ ¨¹¡Ãзѧè ä´ ÃºÑ ¡Òä׹¤ Ò¨Ò¡áÍ»¾ÅÔपѹè à» ¹ MENU_LEAVE ËÃ×Í¡Òà ÍÍ¡¨Ò¡áÍ»¾ÅÔपÑè¹¹Ñé¹æ


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 13

3.5 ¡ÒèѴÊÃÃ˹ ǤÇÒÁ¨íҢͧÃкº»¯ÔºµÑ ¡Ô Òà CircleOS Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS à» ¹à¿ ÃÁ áÇà ·µÕè Í §¡ÒÃ¾×¹é ·ÕËè ¹ ǤÇÒÁ¨íÒá¿Åª 64 ¡ÔâÅ亵 áÅÐ˹ ǤÇÒÁ¨íÒáÃÁ 4 ¡ÔâÅ亵 (ÃÇÁ¶Ö§Ë¹ ǤÇÒÁ¨íÒà¾×èÍ㪠§Ò¹à» ¹Êáµç¡ÊíÒËÃѺ¡Ò÷íÒ§Ò¹ µ Ò§æ ¢Í§áÍ»¾ÅÔपѹè ) ´Ñ§áÊ´§ã¹ÃÙ»·Õè 7 ´Ñ§¹Ñ¹é ¾×¹é ·ÕËè ¹ ǤÇÒÁ¨íÒá¿Åª¨ÐàËÅ×Í㪠§Ò¹¨ÃÔ§ 448 ¡ÔâÅ亵 (¨Ò¡ 512-64 = 448 ¡ÔâÅ亵 ) áÅÐÍÒ¨ÁÕ¡ÒÃà»ÅÕÂè ¹á»Å§ä´ ËÒ¡ÁÕ¡ÒûÃѺ»Ãا࿠ÃÁ áÇà Í ҧäáçµÒÁ ¼Ùã ª §Ò¹ÊÒÁÒö·Õ¨è еԴµÑ§é áÍ»¾ÅÔपѹè à¾ÔÁè àµÔÁËÃ×ÍźáÍ»¾ÅÔà¤ªÑ¹è ·ÕÁè ÍÕ ÂÙà ´ÔÁä´ ã¹ ÀÒÂËÅѧ ã¹Í¹Ò¤µàÁ×èͼ٠㪠§Ò¹ÁÕ¡ÒÃÍÑ»à¡Ã´à¿ à ÁáÇà ¢Í§Ãкº»¯ÔºÑµÔ¡Òà CircleOS à» ¹àÇÍà ªÑ¹ ·ÕèÊÙ§¢Öé¹ ÍҨ㪠¾×é¹·Õè˹ ǤÇÒÁ¨íÒ·Õèᵡµ Ò§¡Ñ¹ÍÍ¡ä» «Ö觼٠㪠§Ò¹ÊÒÁÒöµÃǨÊÍºä´ ¨Ò¡àÁ¹Ù About ˹ ǤÇÒÁ¨íÒá¿Åª 512 ¡ÔâÅ亵 N& &

áÍ»¾ÅÔपѹè 3 : 24 ¡ÔâÅ亵 ........... áÍ»¾ÅÔपѹè 2 : 8 ¡ÔâÅ亵

N& "

........... áÍ»¾ÅÔपѹè 1 : 4 ¡ÔâÅ亵

N& "

˹ ǤÇÒÁ¨íÒáÃÁ 64 ¡ÔâÅ亵 ÊíÒËÃѺ CircleOS 4 ¡ÔâÅ亵

...........

N N .

N& & N& %...

´ÕºÑ¡ä´ 32 ¡ÔâÅ亵 ¿ÃÕ ¶ Òµ ͧ¡ÒÃãË ´ÕºÑ¡ä´ àµçÁ¾×é¹·Õè¢Í§Ë¹ ǤÇÒÁ¨íÒ µ ͧ·íÒ¡ÒÃÍÑ»à¡Ã´ (ÁÕ¤ Ò㪠¨ ÒÂ)

áÍ»¾ÅÔà¤ªÑ¹è ·ÕÊè ÒÁÒö´Õº¡Ñ ä´ : 8 ¡ÔâÅ亵 N& $ N& #...

¾×¹é ·Õàè ¡çº¢ ÍÁÙŢͧ áÍ»¾ÅÔपѹè 60 ¡ÔâÅ亵

CircleOS 24 ¡ÔâÅ亵

N&

ÃÙ»·Õè 7 ¡ÒèѴÊÃÃ˹ ǤÇÒÁ¨íҢͧ STM32 Primer2

N


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

14 l

4 : à¤Ã×Íè §Á×Í㹡ÒþѲ¹ÒáÍ»¾ÅÔà¤ªÑ¹è º¹ STM32 Primer2 㹡ÒþѲ¹ÒáÍ»¾ÅÔपѹè ÊíÒËÃѺµÔ´µÑ§é º¹ STM32 Primer2 ËÃ×ÍÃѹº¹Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS ¹Ñ¹é ¡ÃзíÒä´ â´Â㪠ª´Ø ¾Ñ²¹Ò RIDE7 ¨Ò¡ Raisonance RIDE7 ÃͧÃѺ¡ÒÃÊà ҧâ»Ãà¨ç¡µ ÀÒÉÒ C ·Õãè ª Ã¹Ñ º¹Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS ÁÕàÍ´ÔàµÍà 㹡ÒÃà¢Õ¹â»Ãá¡ÃÁ,¼¹Ç¡ C ¤ÍÁä¾àÅÍà áÅÐà¤Ã×Íè §Á×Í ÍÂ㹡ÒþѲ¹Òâ»Ãá¡ÃÁÍ×¹è æ â´Â·Õè RIDE7 à» ¹«Í¿µ áÇà ·¼Õè ¾Ù ² Ñ ¹ÒÊÒÁÒö¹íÒÁÒ㪠§Ò¹ä´ â´ÂäÁ Á¤Õ Ò ãª ¨Ò  â´Â´Òǹ âËÅ´àÇÍà ª¹Ñ Å ÒÊØ´·ÕÍè Ò¨ÁÕä´ ¨Ò¡ www.raisonance.com Í ҧäáçµÒÁ㹪ش¾Ñ²¹Ò STM32 Primer2 ä´ àµÃÕÂÁä¿Å µÔ´µÑ§é RIDE7 ÁҾà ÍÁ㪠§Ò¹ÀÒÂã¹á¼ ¹«Õ´ÃÕ ÍÁàÃÕºà ÍÂáÅ Ç ã¹¡Ã³Õ··Õè Òí ¡ÒôÒǹ âËÅ´ªØ´¾Ñ²¹Ò¨Ò¡ Raisonance µ ͧ´Òǹ âËÅ´«Í¿µ áÇà 2 µÑǤ×Í l Ride7 IDE ¤×ÍÊ Ç¹àÍ´ÔàµÍà áÅÐàÁ¹Ùà¤Ã×Í è §Á×͵ Ò§æ·ÕÊè ¹ÑºÊ¹Ø¹¡ÒÃà¢Õ¹â»Ãá¡ÃÁ à¾×Íè ·íÒ¡ÒÃàª×Íè Áâ§ä»Âѧ¤ÍÁä¾àÅÍà ·¹Õè Òí ÁÒµÔ´µÑ§é à¾ÔÁè àµÔÁµÒÁ·Õè Ride7 ʹѺʹع l Rkit-ARM ¤×ͪش C ¤ÍÁä¾àÅÍà ·Ê Õè ¹ÑºÊ¹Ø¹¡ÒþѲ¹ÒäÁâ¤Ã¤Í¹â·ÃÅàÅÍà µÃСÙÅ µ Ò§æ ÍÒ·Ô STM32 áÅÐ LPC2xxx ÃÇÁ¶Ö§¿ §¡ ª¹Ñè µ Ò§æ ·ÕÃè кº»¯ÔºµÑ ¡Ô Òà CircleOS ʹѺʹع

4.1 ¡ÒõԴµÑ§é à¤Ã×Íè §Á×Í㹡ÒþѲ¹ÒáÍ»¾ÅÔà¤ªÑ¹è º¹ STM32 Primer2 4.1.1 µÔ´µÑ§é â»Ãá¡ÃÁ RIDE7 IDE

(4.1.1.1) ´ÑºàºÔÅé ¤ÅÔ¡·Õäè ¿Å µ´Ô µÑ§é Ride7 ¨Ò¡¹Ñ¹é ¨Ð»ÃÒ¡¯Ë¹ Òµ Ò§µÒÁÃÙ» ãË ¤ÅÔ¡·ÕÃè Ò¡Òà Install Ride7 or its components 㹺ÃÔàdz˹ Òµ Ò§·Õ»è ÃÒ¡¯¢Ö¹é ÁÒ


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 15

(4.1.1.2) ËÅѧ¨Ò¡¹Ñ¹é ¨Ð»ÃÒ¡¯Ë¹ Òµ Ò§µÒÁÃÙ» ÊíÒËÃѺãË ¼ãÙ ª §Ò¹àÅ×Í¡¡íÒ˹´¾Ò¸ã¹¡Òà µÔ´µÑé§â»Ãá¡ÃÁ â´Âá¹Ð¹íÒÇ ÒãË µÔ´µÑ駵ÒÁ¾Ò¸»¡µÔ·Õèà» ¹¤ Ò default «Ö觡ç¤×Í C:\Program Files\ Raisonance\ ¨Ò¡¹Ñ¹é ¤ÅÔ¡·Õ»è ÁØ Start install à¾×Íè àÃÔÁè µ ¹¡ÒõԴµÑ§é

(4.1.1.3) ËÅѧ¨Ò¡¡Ãкǹ¡ÒõԴµÑ§é àÊÃç¨ÊÁºÙó ¨Ð»ÃÒ¡¯Ë¹ Òµ ҧᨠ§¡ÒõԴµÑ§é àÊÃç¨ÊÁºÙó

4.1.2 µÔ´µÑ§é Rkit-ARM

(4.1.2.1) ´ÑºàºÔÅé ¤ÅÔ¡·Õäè ¿Å µ´Ô µÑ§é Rkit-ARM ¨Ò¡¹Ñ¹é ¨Ð»ÃÒ¡¯Ë¹ Òµ Ò§µÒÁÃÙ» ãË ¤ÅÔ¡»ØÁ Next à¾×Íè ¼ Ò¹¢Ñ¹é µÍ¹¹Õäé »

(4.1.2.2) ËÅѧ¨Ò¡¹Ñ鹨лÃÒ¡¯Ë¹ Òµ Ò§µÒÁÃÙ» ÊíÒËÃѺáÊ´§ÃÒÂÅÐàÍÕ´à¡ÕèÂǡѺ license Agreement â´ÂãË ¤ÅÔ¡àÅ×Í¡ÃÒ¡Òà I accept the terms in the license agreement ¨Ò¡¹Ñ¹é ¤ÅÔ¡·Õè »ØÁ Next à¾×Íè ¼ Ò¹¢Ñ¹é µÍ¹¹Õäé »à¢ ÒÊÙ¢ ¹Ñé µÍ¹¡ÒõԴµÑ§é ãË ·Òí ¡ÒäÅÔ¡µÍºÃѺã¹áµ ÅÐ¢Ñ¹é µÍ¹¢Í§¡Òà µÔ´µÑ§é ¨¹¡ÃÐ·Ñ§è ¡Ãкǹ¡ÒõԴµÑ§é àÊÃç¨ÊÁºÙó


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

16 l

5 : ·´Êͺ¡ÒÃÊà ҧáÍ»¾ÅÔà¤ªÑ¹è º¹ STM32 Primer2 ËÅѧ¨Ò¡·Õ¼è ¾Ù ² Ñ ¹Òä´ µ´Ô µÑ§é ªØ´â»Ãá¡ÃÁ Ride7 áÅÐ Rkit-ARM à» ¹·Õàè ÃÕºà ÍÂáÅ Ç ã¹ÅíҴѺ µ Íä»à» ¹¡ÒÃá¹Ð¹íÒ¡ÒÃÊà ҧâ»Ãà¨ç¡µ ÀÒÉÒ C à¾×Íè ¾Ñ²¹ÒáÍ»¾ÅÔपѹè ÊíÒËÃѺ STM32 Primer2 (5.1) à» ´â»Ãá¡ÃÁ Ride7 àÅ×Í¡ä»ÂѧàÁ¹Ù¤Òí Êѧè Project à New Project à¾×Íè Êà ҧä¿Å §Ò¹ â»Ãà¨ç¡µ ¢Öé¹ÁÒãËÁ µÒÁÃÙ»

(5.2) ˹ Òµ Ò§ÊíÒËÃѺ¡íÒ˹´¤Ø³ÊÁºÑµ¢Ô ͧâ»Ãà¨ç¡µ »ÃÒ¡¯¢Ö¹é ãË ¡Òí ˹´¤Ø³ÊÁºÑµ´Ô §Ñ ¹Õé


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 17

(5.2.1) Type: àÅ×Í¡ÃÒ¡Òà New application to be built (à» ¹¤ Ò default) (5.2.2) Processsor: 㪠àÅ×Í¡àºÍà äÁâ¤Ã¤Í¹â·ÃÅàÅÍà ËÃ×Íá¾Å絿Íà Á·Õè㪠㹡Òà ¾Ñ²¹Ò ã¹·Õ¹è ãÕé Ë àÅ×Í¡ÃÒ¡Òà STM32_Primer2_CircleOS (5.2.3) Name: 㪠¡Òí ˹´ª×Íè ¢Í§â»Ãà¨ç¡µ ·¡Õè Òí ÅѧÊà ҧ ã¹·Õ¹è ¡Õé Òí ˹´à» ¹ HelloPrimer2 (5.2.4) Lacation: à» ¹Ê ǹ¡íÒ˹´µíÒá˹ §·Õ¨è ´Ñ à¡çºâ»Ãà¨ç¡µ ÀÒÂ㹤ÍÁ¾ÔÇàµÍà ãË ¡íÒ˹´ª×Íè à» ¹ C:\HelloPrimer2 ¤ÇÃÊà ҧâ¿Å à´Íà ãËÁ ªÍ×è HelloPrimer2 (ÍҨ໠¹ª×Íè ã´æ µÒÁ·Õè ¼Ù ¾Ñ²¹Òµ ͧ¡ÒÃ) à¾×èÍà¡çº¼Ñ§â»Ãà¨ç¡µ ã¹¢Ñ鹵͹¡ÒáíÒ˹´¾Ò¸ «Ö觷íÒãË Ãкºä¿Å ¼Ñ§§Ò¹à» ¹ ÃÐàºÕºáÅÐáÂ¡Ê Ç¹·Õªè ´Ñ ਹ ´Ñ§ÃÙ»

(5.2.5) ¤ÅÔ¡»ØÁ Finish à¾×Íè ¼ Ò¹¢Ñ¹é µÍ¹¡ÒÃÊà ҧ¼Ñ§â»Ãà¨ç¡µ


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

18 l

(5.3) ËÅѧ¨Ò¡¹Ñ¹é ¨ÐࢠÒÊÙÊ ÀÒÇÐáÇ´Å ÍÁ㹡ÒþѲ¹ÒáÍ»¾ÅÔà¤ªÑ¹è ¢Í§â»Ãá¡ÃÁ Ride7 â´Â ¨Ð»ÃÒ¡¯¼Ñ§â»Ãà¨ç¡µ HelloPrimer2 ¢Ö¹é ÁÒµÒÁÃÙ» ËÅѧ¨Ò¡¹Õ¼é ¾Ù ² Ñ ¹ÒÊÒÁÒöࢠÒä»á¡ ä¢/à¾ÔÁè àµÔÁ ¤íÒÊÑ§è ¡Ò÷íÒ§Ò¹¢Í§â»Ãà¨ç¡µ ä´ ¨Ò¡ä¿Å Application.c «Ö§è à» ¹ä¿Å ¡Ò÷íÒ§Ò¹ËÅÑ¡¢Í§áÍ»¾ÅÔपѹè

(5.4) ËÅѧ¨Ò¡¹Ñ鹴ѺàºÔéŤÅÔ¡·ÕèÃÒª×èÍä¿Å Application.c à¾×èÍࢠÒ仾Ѳ¹ÒáÍ»¾ÅÔपÑè¹ ¨Ò¡¹Ñé¹à¢ Òä»à¾ÔèÁ¤íÒÊÑè§ â´Â¨Ø´ááãË á¡ ä¢ª×èͧ͢áÍ»¾ÅÔपÑè¹ãË à» ¹ä»µÒÁ·Õè¼Ù ¾Ñ²¹Òµ ͧ¡Òà ¡µÑÇÍ ҧ const char Application_Name[8+1] = {“Hello”}; // Max 8 characters


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 19

(5.5) ËÅѧ¨Ò¡¹Ñé¹à¢ Òä»à¾ÔèÁ¤íÒÊÑè§ÀÒÂ㹿 §¡ ªÑè¹ Application_Handler à¾×èÍãË áÊ´§¢ Í ¤ÇÒÁ·ÕËè ¹ Ò¨Í LCD áÊ´§¢ ͤÇÒÁà» ¹ Hello Primer2 â´Â¾ÔÁ¾ ¤Òí Êѧè à¾ÔÁè àµÔÁ 2 ºÃ÷Ѵµ Í仹Õé (´ÙÃÙ»»ÃСͺ) const char msg[]=”Hello Primer2"; DRAW_DisplayString(5,20,msg,sizeof(msg));

(5.6) ËÅѧ¨Ò¡¹Ñ¹é ·íÒ¡ÒäÍÁä¾Å â»Ãà¨ç¡µ â´Â¡´»ØÁ Ctrl+F9 ËÃ×ÍàÅ×Í¡àÁ¹Ù¤Òí Êѧè Project à Build Project


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

20 l

(5.7) ¶ Ò¡ÒäÍÁä¾Å äÁ ¾º¢ ͼԴ¾ÅÒ´ã´æ ¨Ðᨠ§¢ ͤÇÒÁ· ÒÂÊØ´à» ¹ Build successful ã¹Ë¹ Òµ Ò§ Build Log (´ ҹŠҧÊØ´¢Í§Ë¹ Òµ Ò§ËÅÑ¡¢Í§«Í¿µ áÇà Ride7)

(5.8) àª×èÍÁµ ÍÊÒ USB ÃÐËÇ Ò§ª ͧ USB Debug ¢Í§ STM32 Primer2 ¡Ñº¾Íà µ USB ¢Í§¤ÍÁ¾ÔÇàµÍà áÅ Çà» ´¡Ò÷íÒ§Ò¹ STM32 Primer2 ࢠÒÊÙË ¹ ÒËÅÑ¡ ¨Ò¡¹Ñ¹é ࢠÒÊÙâ ËÁ´´Õº¡Ñ ÎÒà ´áÇà áÅеԴµÑ§é áÍ»¾ÅÔपѹè ä»ã¹µÑÇâ´ÂàÅ×Í¡àÁ¹Ù¤Òí Êѧè Debug à Start


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 21

(5.9) ËÅѧ¨Ò¡¹Ñ¹é STM32 Primer2 ¨Ð»¯ÔÊÁÑ ¾Ñ¹¸ ¡ºÑ â»Ãá¡ÃÁ Ride7 ã¹âËÁ´´Õº¡Ñ ÎÒà ´áÇà «Ö§è ã¹ÃÐËÇ Ò§¹Õé Ride7 ¨ÐµÃǨÊͺàÇÍà ª¹Ñ ¢Í§Ãкº»¯ÔºµÑ Ô CircleOS áÅзíÒ¡ÒÃÍÑ»à¡Ã´à¿ ÃÁ áÇà ãË à» ¹àÇÍà ª¹Ñ Å ÒÊØ´·ÕÁè Ҿà ÍÁ¡ÑºªØ´ Rkit-ARM («Ö§è ÍÒ¨·íÒãË Ê¡ÃÕ¹ËÃ×Íäͤ͹à»ÅÕÂè ¹ä»µÒÁàÇÍà ª¹Ñ Å ÒÊØ´ áµ â´ÂÃÇÁÂѧÁÕÃкºàÁ¹Ù¤Òí ÊÑ§è ¤Å ÒÂæ à´ÔÁ)àÁ×Íè ࢠÒÊÙâ ËÁ´´Õº¡Ñ ÎÒà ´áÇà áÅ Ç »ØÁ ¤íÒÊÑ§è µ Ò§æ ã¹ ¡Òôպ¡Ñ ¨ÐáÍ¡µÕ¿¢Ö¹é ÁÒÃͧÃѺ¡ÒÃ㪠§Ò¹ ¨Ò¡¹Ñ¹é ãË ¤ÅÔ¡·Õ»è ÁØ ¤íÒÊѧè Run à¾×Íè àÃÔÁè µ ¹¡Ò÷íÒ§Ò¹ «Ö§è ËÅѧ ¨Ò¡¹Õé STM32 Primer2 ¡ç¨ÐࢠÒÊÙË ¹ ÒËÅÑ¡à¾×Íè àÃÔÁè µ ¹¡Ò÷íÒ§Ò¹

(7.10) ¡ÅѺÁÒ·Õè STM32 Primer2 ¡´»Ø Á·ÔÈ·Ò§µÃ§¢Í§¨ÍÂʵÔê¡à¾×èÍàÃÕ¡àÁ¹ÙËÅÑ¡¢Öé¹ÁÒ ¼Ù¾ ² Ñ ¹Ò¨Ð¾ºÃÒª×Íè áÍ»¾ÅÔपѹè Hello »ÃÒ¡®ÍÂÙ´ Ç ÂµÒÁÃÙ»

¨Ò¡¹Ñ¹é ãË ¼¾Ù ² Ñ ¹Ò¡´àÅ×Í¡áÍ»¾ÅÔपѹè Hello à¾×Íè ·´Êͺ¡Ò÷íÒ§Ò¹ ¨ÐÊѧࡵàËç¹Ç Ò ÅѡɳТͧʡÃÕ¹áÅÐäͤ͹µÒÁµÑÇÍ ҧà»ÅÕè¹ä»àÅ硹 Í à¹×èͧ¨Ò¡Ãкº·íÒ¡ÒÃÍÑ»à¡Ã´ à¿ ÃÁ áÇà ¢Í§Ãкº»¯ÔºµÑ ¡Ô Òà CircleOS ¨Ò¡à´ÔÁàÇÍà ª¹Ñè 3.1 ÁÒà» ¹àÇÍà ª¹Ñè 3.7 ãË ÍµÑ â¹ÁÑµÔ ËÁÒÂàËµØ ã¹¡Ã³Õ·ÁÕè ¡Õ ÒÃÍÑ»à¡Ã´à¿ ÃÁ áÇà áÍ»¾ÅÔपѹè à´ÔÁ·Õàè ¤ÂÁÕÍÂÙ¨ ÐËÒÂ仨ҡ STM32 Primer2


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

22 l

(5.11) ËÅѧ¨Ò¡¹Ñ¹é ·Õè STM32 Primer2 ¨Ð»ÃÒ¡¯¢ ͤÇÒÁ Hello Primer2 ¡´»ØÁ ·ÔÈ·Ò§µÃ§ ¢Í§¨ÍÂʵԡê à¾×Íè àÃÕ¡àÁ¹ÙËÅÑ¡¢Ö¹é ÁÒ ¼Ù¾ ² Ñ ¹Ò¨Ð¾ºÃÒª×Íè áÍ»¾ÅÔपѹè Hello ËÒ¡¼Ù¾ ² Ñ ¹Òµ ͧ¡Òà ÍÍ¡¨Ò¡áÍ»¾ÅÔपѹè Hello ¡ÃзíÒä´ â´Â¡Òá´»ØÁ ·ÔÈ·Ò§µÃ§¢Í§¨ÍÂʵԡê 1 ¤Ãѧé


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 23

6 : ¡ÒèѴ¡ÒÃáÍ»¾ÅÔà¤ªÑ¹è º¹ STM32 Primer2 ¼Ù 㪠§Ò¹ÊÒÁÒö㪠ÂÙ·ÔÅÔµÕéÊíÒËÃѺ¨Ñ´¡ÒÃáÍ»¾ÅÔपÑ蹢ͧ STM32 Primer2 ¨Ò¡ä¿Å circle_mgr.exe «Ö§è ¨ÐÁҾà ÍÁ¡ÑºªØ´µÔ´µÑ§é Ride7 â´Â¨Ñ´à¡çºÍÂÙÀ ÒÂã¹â¿Åà´Íà Bin ¢Í§â¿Åà´Íà ËÅÑ¡·Õµè ´Ô µÑ§é â»Ãá¡ÃÁ Ride7 «Ö§è ¶ Ò¼Ùã ª §Ò¹µÔ´µÑ§é µÒÁ»¡µÔ ä¿Å circle_mgr.exe ¨Ð¶Ù¡¨Ñ´à¡çºÍÂÙ· Õè ¾Ò¸ C:\Program Files\Raisonance\Ride\Bin ÊíÒËÃѺ¡ÒÃàÃÕ¡㪠§Ò¹¨ÐÊÒÁÒö¡ÃзíÒ¼ ҹ˹ Òµ Ò§ Command Prompt ¨Ò¡àÁ¹Ù Start à Programs à Accessories à Command Prompt ËÅѧ¨Ò¡¹Ñ¹ é ¨Ð»ÃÒ¡¯Ë¹ Òµ Ò§ Command Prompt ¢Ö¹é ÁÒãË ãª §Ò¹µÒÁÃÙ»

ËÅѧ¨Ò¡¹Ñ¹é à¾×Íè àµÃÕÂÁ㪠§Ò¹ÂÙ·ÅÔ µÔ ¢Õé ͧ circle_mgr.exe ãË ¾ÁÔ ¾ ¤Òí Êѧè cd C:\Program Files\Raisonance\Ride\Bin

à¾×Íè ãË ÃкºÁͧàËç¹ä¿Å circle_mgr.exe ÊíÒËÃѺ¡ÒÃàÃÕ¡㪠§Ò¹ â´ÂáÊ´§µÒÁÃÙ»


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

24 l

㹡ÒÃ㪠§Ò¹ÂÙ·ÅÔ µÔ ¢Õé ͧ circle_mgr.exe ¨Ðµ ͧࢠҶ֧¾Ò¸·Õàè ¡çºä¿Å circle_mgr.exe áÅÐ ¡ÒÃàÃÕ¡㪠§Ò¹¨íÒà» ¹µ ͧÃкØÃËÑʤíÒÊÑ§è ·Õäè ¿Å circle_mgr.exe ÃͧÃѺ¡Ò÷íÒ§Ò¹ ÃÇÁ件֧㹢³Ð 㪠§Ò¹¨íÒà» ¹¨Ðµ ͧàª×èÍÁµ ÍÊÒ USB ÃÐËÇ Ò§ª ͧ USB Debug ¢Í§ STM32 Primer2 ¡Ñº¾Íà µ USB ¢Í§¤ÍÁ¾ÔÇàµÍà áÅ Ç·íÒ¡ÒÃà» ´¡Ò÷íÒ§Ò¹ STM32 Primer2 ࢠÒÊÙË ¹ ÒËÅÑ¡à¾×Íè ãË à¡Ô´¡Òû¯Ô ÊÑÁ¾Ñ¹¸ ÃÐËÇ Ò§¡Ñ¹

6.1 ¤íÒÊÑ§è µÃǨÊͺÃÒÂÅÐàÍÕ´áÍ»¾ÅÔपѹè ËÃ×ͤíÒÊѧè List ÃٻẺ¤íÒÊѧè

circle_mgr.exe S

¼ÅÅѾ¸

ÊÑ§è ¡ÒÃãË STM32 Primer2 àÃÔÁè µ ¹»ÃÐÁÇżÅ

6.2 ¤íÒÊÑ§è µÃǨÊͺÃÒÂÅÐàÍÕ´áÍ»¾ÅÔपѹè ËÃ×ͤíÒÊѧè List ÃٻẺ¤íÒÊѧè

circle_mgr.exe L

¼ÅÅѾ¸

¨ÐáÊ´§¶Ö§ÃÒª×èÍáÍ»¾ÅÔपÑè¹, µíÒá˹ §áÍ´à´ÃÊ, ¢¹Ò´¾×é¹·Õè˹ ǤÇÒÁ¨íÒ·Õè㪠ÃÇÁ¶Ö§¾×¹é ·ÕÇè Ò §¢Í§Ãкº·Õàè ËÅ×ÍÍÂÙ


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 25

6.3 ¤íÒÊѧè źáÍ»¾ÅÔपѹè ÍÍ¡¨Ò¡ STM32 Primer2 ËÃ×ͤíÒÊѧè Erase ÃٻẺ¤íÒÊÑ§è ·Õè 1

circle_mgr.exe Eappname

¼ÅÅѾ¸

·íÒ¡ÒÃźáÍ»¾ÅÔà¤ªÑ¹è ·Õªè Í×è appname µÒÁ·ÕÃè кØÍÍ¡¨Ò¡ STM32 Primer2

ËÅѧ¨Ò¡¹Ñ¹é à¾×Íè ãË STM32 Primer2 àÃÔÁè µ ¹¡Ò÷íÒ§Ò¹¤ÇþÔÁ¾ ¤Òí Êѧè à¾ÔÁè ´Ñ§¹Õé circle_mgr.exe S

ÃٻẺ¤íÒÊÑ§è ·Õè 2 circle_mgr.exe E*

¼ÅÅѾ¸

·íÒ¡ÒÃźáÍ»¾ÅÔà¤ªÑ¹è ·Ñ§é ËÁ´ÍÍ¡¨Ò¡ STM32 Primer2 ËÁÒÂàËµØ ã¹¡Ã³Õ·Õè STM32 Primer2 äÁ µÍºÊ¹Í§¡Ò÷íÒ§Ò¹ËÃ×ÍÍÒ¨ËÂØ´¹Ô§è ¡Ò÷íÒ§Ò¹ ä»ÇÔ¸Õ¡ÒÃ˹Öè§ã¹¡ÒÃᡠ䢤×ÍãË ·íÒ¡ÒÃàª×èÍÁµ Í STM32 Primer2 ¡Ñº¤ÍÁ¾ÔÇàµÍà ã¹âËÁ´´ÕºÑ¡ ÎÒà ´áÇà ¨Ò¡â»Ãà¨ç¡µ ã´æ ÍÕ¡¤Ãѧé


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

26 l

6.4 ¤íÒÊÑ§è µÔ´µÑ§é áÍ»¾ÅÔपѹè (¨Ò¡ä¿Å Object ) ÃٻẺ¤íÒÊѧè

circle_mgr.exe A<path>

¼ÅÅѾ¸

µÔ´µÑé§áÍ»¾ÅÔपÑè¹·ÕèÃкصÒÁ¾Ò¸ <path> ÊíÒËÃѺªÕéä»Âѧä¿Å Object (ä¿Å *.o ¢Í§â»Ãà¨ç¡µ ·¼Õè ¾Ù ² Ñ ¹ÒÊà ҧáÍ»¾ÅÔपѹè ) ¡µÑÇÍ ҧ µ ͧ¡ÒõԴµÑ§é áÍ»¾ÅÔपѹè HelloPrimer2 ¹Ñ¹è ¤×Í µ ͧµÔ´µÑ§é ä¿Å Application.o ¨Ò¡â»Ãà¨ç¡µ HelloPrimer2 (ä¿Å ¹¨Õé Ðà¡Ô´¢Ö¹é ÀÒÂËÅѧ¨Ò¡¡ÒäÍÁä¾Å â´ÂäÁ Á¢Õ Í ¼Ô´¾ÅÒ´«Ö§è à¡çº ÍÂÙÀ ÒÂã¹â¿Åà´Íà objdebug ¢Í§â»Ãà¨ç¡µ ) â´Â¾ÔÁ¾ ¤Òí ÊÑ§è ´Ñ§¹Õé circle_mgr.exe AC:\HelloPrimer\objdebug\Application.o

ËÅѧ¨Ò¡¹Ñ¹é à¾×Íè ãË STM32 Primer2 àÃÔÁè µ ¹¡Ò÷íÒ§Ò¹¤ÇþÔÁ¾ ¤Òí Êѧè à¾ÔÁè ´Ñ§¹Õé circle_mgr.exe S

6.5 ¤íÒÊÑ§è µÔ´ËÂØ´ÃÍËÃ×ͤíÒÊѧè Wait ÃٻẺ¤íÒÊѧè

circle_mgr.exe W

¼ÅÅѾ¸

ÊÑ§è ¡ÒÃËÂØ´ÃÍã¹¢³Ð·Õ¤è Òí Êѧè Í×¹è æ¡íÒÅѧ·íÒ§Ò¹ÍÂÙË Ã×Í¢³Ðä¿Å bat ¡íÒÅѧ·íÒ§Ò¹ÍÂÙà ¾×Íè µÃǨÊͺ¡Ò÷íÒ§Ò¹ºÒ§Í ҧ


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 27

7 : ¡ÒÃÃÕ૵ STM32 Primer2 ¡ÒÃÃÕ૵ STM32 Primer2 ·íÒä´ 2 ÇÔ¸¤Õ Í× ÃÕ૵·Ò§ÎÒà ´áÇà áÅÐÃÕ૵·Ò§«Í¿µ áÇÃ

7.1 ¡ÒÃÃÕ૵·Ò§ÎÒà ´áÇà (Hardware reset) ÁÕ¢Ñ鹵͹´Ñ§¹Õé (7.1.1) à» ´½Ò´ Ò¹ËÅѧ¢Í§ STM32 Primer2 Í ҧÃÐÁÑ´ÃÐÇѧ (7.1.2) »Å´¨ÑÁê à»Íà ·àÕè ª×Íè Áµ ÍẵàµÍÃÕàè ¢ ҡѺǧ¨ÃÀÒÂ㹢ͧ STM32 Primer2 ÍÍ¡ áÅ Ç ÃÍ 10 ÇÔ¹Ò·Õ (7.1.3) µ ͨÑÁê à»Íà à¾×Íè àª×Íè Áµ ÍẵàµÍÃÕàè ¢ ҡѺǧ¨ÃÀÒÂ㹢ͧ STM32 Primer2 ઠ¹à´ÔÁ

7.2 ¡ÒÃÃÕ૵·Ò§«Í¿µ áÇà (Software reset) ÁÕ¢Ñ鹵͹´Ñ§¹Õé (7.2.1) àª×Íè Áµ ÍÊÒ USB ÃÐËÇ Ò§ STM32 Primer2 ·Õ¨è ´Ø µ Í USB debug ¡Ñº¾Íà µ USB ¢Í§¤ÍÁ¾ÔÇàµÍà (7.2.2) à» ´¡Ò÷íÒ§Ò¹¢Í§ STM32 Primer2 ¨Ò¡¡Òá´»ØÁ ·ÔÈ·Ò§µÃ§¢Í§¨ÍÂʵԡê (7.2.3) à» ´ Command Prompt ࢠÒÊÙ ¾Ò¸ bin ¢Í§ Ride7 ¨Ò¡¤íÒÊÑè§ cd C:\Program Files\Raisonance\Ride\Bin à¾×Íè 㪠§Ò¹ÂÙ·ÅÔ µÔ Õé cortex_pgm.exe ¨Ò¡¹Ñ¹é ¾ÔÁ¾ ¤Òí Êѧè : cortex_pgm S

STM32 Primer2 ¨Ðä´ ÃºÑ ¡ÒÃÃÕ૵


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

28 l

8 : » ­ËÒáÅÐá¹Ç·Ò§á¡ 䢢ͧ STM32 Primer2 » ­ËÒ·Õè 1 ËÒ¡ÁÕ¡ÒõԴµÑé§à¿ à ÁáÇà ¢Í§àÇÍà ªÑ¹·ÕèµèíÒ¡Ç Ò Ë¹ Ò¨ÍáÊ´§¼Å¢Í§ STM32 Primer2 ÍÒ¨ äÁ áÊ´§¼Å áÅÐÁÕ˹ Òµ ҧᨠ§àµ×͹·Õè Command Prompts ã¹ÃÐËÇ Ò§»¯ÔÊÁÑ ¾Ñ¹¸ ´Ç ¤íÒÊÑ§è µ Ò§æ Ç Ò áç´Ñ¹µèÒí ¼Ô´»¡µÔ 1.0 ËÃ×Í 1.1 º Ò§·íÒãË ·Òí ÍÐäõ ÍäÁ ä´ à¹×Íè §¨Ò¡à¿ ÃÁ áÇà ʧÑè ãË STM32 Primer2 ࢠÒÊÙ âËÁ´»ÃÐËÂÑ´¾Åѧ§Ò¹

ÇÔ¸Õ¡ÒÃá¡ ä¢

¡´»Ø Á·ÔÈ·Ò§µÃ§¢Í§¨ÍÂʵÔꡤ Ò§äÇ ã¹ÃÐËÇ Ò§ Restore Firmware ·Õè˹ Òµ Ò§ Command Prompts ¨¹¡ÃÐ·Ñ§è ¡Òà Restore Firmware ¨ÐàÊÃç¨ÊÁºÙó

» ­ËÒ·Õè 2 àÁ×Íè µÔ´µÑ§é à¿ ÃÁ áÇà àÇÍà ª¹Ñè 3.7 ¾ºÇ Ò ¡Ò÷íÒ§Ò¹¢Í§àÁ¹Ù¡ÃÒ¿ ¡ (ÁØÁº¹´ Ò¹« ÒÂ) ·Õµè Òí á˹ § Config à¾×Íè ࢠÒä»àÃÕ¡áÍ»¾ÅÔà¤ªÑ¹è µÑÇÅ ÒÊØ´·Õàè ¤Â㪠§Ò¹¢Ö¹é ÁÒÃѹ »ÃÒ¡¯Ç Ò ÁÕ¡ÒÃàËÅÕÍè Á¢Í§µíÒá˹ § àÁ¹Ù ·Ñ§é ·Õ¡è Í ¹Ë¹ Ò¹Õ·é Òí ¡ÒûÃѺᵠ§Ë¹ Ò¨ÍàÃÕºà ÍÂáÅ Ç

ÇÔ¸Õ¡ÒÃá¡ ä¢

µ ͧÃÍ¡ÒÃá¡ ä¢à¿ ÃÁ áÇà ¨Ò¡ Raisonance ã¹àÇÍà ª¹Ñ ¶Ñ´æ ä»

» ­ËÒ·Õè 3 ËÅѧ¨Ò¡·íÒ¡ÒÃÊѧè źáÍ»¾ÅÔपѹè (Remove) ¨Ò¡ Command Prompts ´ ǤíÒÊѧè Circle_mgr.exe Eappname // ź 1 µÑÇ ËÃ×Í Circle_mgr.exe E* // ź·Ñ§é ËÁ´ ¨Ò¡¹Ñé¹ÊÑè§àÃÔèÁµ ¹¡Ò÷íÒ§Ò¹ãËÁ ´ Ç Circle_mgr.exe S

ËÅѧ¨Ò¡¹Ñé¹¾ºÇ Ò ã¹àÇÍà ª¹Ñè 3.1 Âѧ·íÒ§Ò¹µÍºÊ¹Í§ä´ »¡µÔ·ÇÑè æä» áµ àÁ×Íè ¨ÐࢠҶ֧àÁ¹Ù Applic. ¨Ðà¡Ô´ ÍÒ¡ÒÃáΧ¡ ã¹àÇÍà ª¹Ñè 3.7 à¡Ô´ÍÒ¡ÒÃáΧ¡ ·Òí §Ò¹µ ÍäÁ ä´

ÇÔ¸Õ¡ÒÃá¡ ä¢

·íÒä´ àº×Íé §µ ¹¤×Í Å§à¿ ÃÁ áÇà ãËÁ ËÃ×͵ԴµÑ§é áÍ»¾ÅÔपѹè à¾ÔÁè àµÔÁࢠÒä» («Ö§è ÍÒ¨ÁÕ¡Òà ŧ࿠ÃÁ áÇà «éÒí ࢠÒä» àÁ×Íè Ride7 ¾ºà˵ءÒó ¹)Õé áÅе ͧÃÍ¡ÒÃá¡ ä¢à¿ ÃÁ áÇà ¨Ò¡ Raisonance ã¹àÇÍà ª¹Ñ ¶Ñ´æ ä»


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32 l 29

9 : ǧ¨Ã¢Í§ STM32 Primer2 STM32 Primer2 ÁÕÊÇ ¹»ÃСͺ¤ ͹¢ Ò§ÁÒ¡ áÁ ÇÒ ¨ÐÁÕ¢¹Ò´¢Í§µÑǺÍà ´äÁ ãË­ ¹¡Ñ (à· Ò ¡Ñºâ·ÃÈѾ· à¤Å×Íè ¹·ÕÊè ÁÑÂãËÁ ) ´Ñ§¹Ñ¹é ¨Ö§ä´ á¡ǧ¨ÃÍÍ¡à» ¹Ê ǹæ à¾×Íè ãË ÊÒÁÒö·íÒ¤ÇÒÁࢠÒã¨ ä´ §Ò  ÃÇÁ¶Ö§Âѧª ÇÂãË ¼·Ù ÊÕè ¹ã¨µ ͧ¡ÒõѴàÍÒºÒ§Ê Ç¹¢Í§ STM32 Primer 2 ä»Êà ҧâ¤Ã§§Ò¹·Õè ÁÕÅѡɳе Ò§ÍÍ¡ä»ÊÒÁÒö·íÒä´ § Ò¢Öé¹ Ç§¨Ã¢Í§ STM32 Primer2 Ạ§ÍÍ¡à» ¹ 8 Ê Ç¹´Ñ§¹Õé 1. Ê Ç¹¢Í§Ç§¨Ã´Õº¡Ñ /â»Ãá¡ÃÁ·Õãè ª ǧ¨Ãà´ÕÂǡѺªØ´ R-Link ¢Í§ Raisonance 2. ǧ¨ÃäÁâ¤Ã¤Í¹â·ÃÅàÅÍà ËÅÑ¡ STM32F103VET6 3. ǧ¨ÃÀÒ¤¨ ÒÂä¿áÅлÃШØẵàµÍÃÕè 4. ǧ¨Ã¨Ñ´¡ÒÃÊÑ­­Ò³àÊÕ§¼ Ò¹ÃкººÑÊ I2S 5. ǧ¨Ã¡íÒà¹Ô´ÊÑ­­Ò³¹ÒÌ ¡Ò 6. ǧ¨Ãàª×Íè Áµ ÍÍØ»¡Ã³ Í¹Ô ¾ØµàÍÒµ ¾µØ ªØ´·Õè 1 »ÃСͺ´ Ç ÊÇÔµª ¨ÍÂʵԡê , µÑǵÃǨ ¨Ñº¤ÇÒÁàà § 3 ᡹, MicroSD ¡Òà ´ áÅÐ LED 7. ǧ¨Ãàª×Íè Áµ ÍÍØ»¡Ã³ Í¹Ô ¾ØµàÍÒµ ¾µØ ªØ´·Õè 2 »ÃСͺ´ Ç USB, âÁ´ÙÅ IrDA áÅÐÊ Ç¹ µ Í¢ÂÒ¾Íà µ 8. ǧ¨Ãàª×Íè Áµ ÍâÁ´ÙÅ¡ÃÒ¿ ¡ LCD áÅÐÃкº¨ÍÊÑÁ¼ÑÊ


VCC2V8 VCC5_RLink

100nF

2

VCC5_USB_RLink USBDUSBD+ 12MHZ_5V

1 4 5 2 3 63 64

DNG_RST DNG_VPP

51 50

USBVSS USBVCC USBVDD USBDM USBDP

VDDf VDDA

GND 1 USBVCC

C1

31 59

VDD1 VDD2

6 60

VCC2V8

OSCIN OSCOUT RESET VPP / ICCSEL

TQFP64 10x10mm

SWDIO TSTV2 VCC2V8

1

R5 1M 2

DNG_DATA DNG_CLK

58 57 56 55 54 53 52

VCC_EMS

1

26 25 24 23 22 21 20 19

PB7 / DTC PB6 / DTC PB5 / DTC PB4 / DTC PB3 / DTC PB2 / DTC PB1 / DTC PB0 / DTC

18 17 16 15 14 13 12 11

PC7 PC6 PC5 PC4

PE7 (HS) / DTC PE6 (HS) / DTC PE5 (HS) / DTC PE4 / PWM1 PE3 / PWM0 / AIN7 / DTC PE2 (HS) / AIN6 / DTC PE1 (HS) / AIN5 / DTC PE0 (HS) / AIN4 / DTC

PC3 (HS) / DTC / SCK PC0 (HS) / DTC / MOSI PC0 (HS) / DTC / MISO PC0 (HS) / MCO / SS PD7 / AIN3 PD6 / AIN2 PD5 / OCMP2 PD4 / OCMP1 PD3 PD2 PD1 PD0

PF6 (HS) / ICCDATA PF5 (HS) / ICCCLK PF4 (HS) / USBEN PF3 / AIN1 PF2 / AIN0 PF1 (HS) / SDA PF0 (HS) / SCL VSSf VSSA

R6 1M 2

36 35 34 33 30 29 28 27

1

RESET

R1 10K

2

SWDIO

RESET SWDCLK

VCC5_RLink SWDCLK 1

R3 1M

44 43 42 41 40 39 38 37

1

2

R4 330R

2 1

D1

2

VCC5_USB_RLink

VCCIN

USBVCC

D2 BAT54CFILM

32 62

ST72651AR6T1 7 61

U1

VCC5_RLink 3

VSS1 VSS2

10 9 8 49 48 47 46 45

PA7 / DTC PA6 / DTC PA5 / DTC PA4 / DTC PA3 / DTC PA2 / DTC PA1 / DTC PA0 / DTC

1

2

J1 6 7

Header 1x6 J2

GND GND

VCC5_USB_RLink 8 9 1

1 2

DNG_VPP

3

DNG_DATA

4

DNG_CLK

5

DNG_RST

6

GND GND

GND R8 100K

2

VCC2V8 1

2

2

1

C3 100nF

USB INTERFACE

10µF

2

C5 100nF

CONTRACT NO.

COMPANY NAME

RAISONANCE SAS APPROVALS

VCC5_USB_RLink

DRAWN

FL

CHECKED YR

ST72651 programmation connector

2

USBDUSBD+

1

C4 2

1 2 3 4 5

VBUS DD+ ID GND

1

USB-mini-B

VCC5_RLink 1

C2 10µF

R7 1K5

DECOUPLING

ISSUED

DATE

Jun.2008 Sept.2008

DWG

SIZE

EMBEDDED RLINK FSCM NO.

SCALE

DWG NO.

REV.

V1.1

A

1:1

SHEET 1 of 8


RESET

14

12MHZ

1

C8 100nF

R58 1M

VCC5_USB

1

R55

1

CX_ADC_TIM

35 36 91 92 93 95 96 47 48 51 52 53 54

R56 2 1

330R D12

2

AUDIO_SCL AUDIO_SDA AUDIO_I2S2_WS AUDIO_I2S2_SCK AUDIO_SPI_MISO AUDIO_I2S2_SD

2 1

2

100K

R13

2

R14 STATUS2

SDIO_D0 SDIO_D1 SDIO_D2 SDIO_D3 SDIO_CK

15 16 17 18 33 34 63 64 65 66 78 79 80

22 21

VBAT_STM32

BOOT0 PB2/BOOT1

PA13/JTMS/SWDIO PA14/JTCK/SWCLK PA15/JTDI PB3/JTDO PB4/JTRST

PC14/OSC32_IN PC15/OSC32_OUT PC13/TAMPER/RTC

PD0/FSMC_D2 PD1/FSMC_D3 PD2 PD3/FSMC_CLK PD4/FSMC_NOE PD5/FSMC_NWE PD6/FSMC_NWAIT PD7/FSMC_NE1/FSMC_NCE2 PD8/FSMC_D13 PD9/FSMC_D14 PD10/FSMC_D15 PD11/FSMC_A16 PD12/FSMC_A17 PD13/FSMC_A18 PD14/FSMC_D0 PD15/FSMC_D1

PA0/WKUP/ADC_IN0 PA1/ADC_IN1 PA2/ADC_IN2 PA3/ADC_IN3 PA4/ADC_IN4 PA5/ADC_IN5 PA6/ADC_IN6 PA7/ADC_IN7 PA8/USART_CK/MCO PA9USART1_TX PA10/USART1_RX PA11/USART1_CTS PA12/USART1_RTS PB0/ADC_IN8 PB1/ADC_IN9 PB5 PB6/I2C1_SCL PB7/I2C1_SDA PB8 PB9 PB10/I2C2_SCL PB11/I2C_SDA PB12/SPI2_NSS PB13/SPI2_SCK PB14/SPI2_MISO PB15/SPI2_MOSI

2

2

R11

94 37

PC0/ADC_IN10 PC1/ADC_IN11 PC2/ADC_IN12 PC3/ADC_IN13 PC4/ADC_IN14 PC5/ADC_IN15 PC6/TIM3_CH1 PC7/TIM3_CH2 PC8/TIM3_CH3 PC9/TIM3_CH4 PC10/UART4_TX PC11/UART4_RX PC12

100K

100K

1 R12

72 76 77 89 90

SWDIO SWDCLK

81 82 83 84 85 86 87 88 55 56 57 58 59 60 61 62

CAN_RX CAN_TX SDIO_CMD USB_DISCONN LCD_/RD LCD_/WR LCD_/RST LCD_/CS IRDA_CS

97 98 1 2 3 4 5 38 39 40 41 42 43 44 45 46

LED0 LED1 CS_MEMS JOYSTICK_L JOYSTICK_R JOYSTICK_U JOYSTICK_D LCD_D0 LCD_D1 LCD_D2 LCD_D3 LCD_D4 LCD_D5 LCD_D6 LCD_D7

0R

AUDIO_I2S3_WS AUDIO_I2S3_CK

Decoupling for VDD_X

VCC2V8

1

2

LCD_RS

1

C10 100nF

2

1

C11 100nF

2

C12 100nF

1

1

C13 100nF

2

2

C14 100nF

VBAT

LQFP100 14X14

PE0 PE1 PE2/TRACECLK/ FSMC_A23 PE3/TRACED0/FSMC_A19 PE4/TRACED1/FSMC_A20 PE5/TRACED2/FSMC_A21 PE6/TRACED2/FSMC_A22 PE7/FSMC_D4 PE8/FSMC_D5 PE9/FSMC_D6 PE10/FSMC_D7 PE11/FSMC_D8 PE12/FSMC_D9 PE13/FSMC_D10 PE14/FSMC_D11 PE15/FSMC_D12

1

Decoupling for VREF+ & VBAT

R52

VCC2V8

2

220K

VBAT_STM32 1

1

C17 2

10µF

2

1

C18

1

R44

10nF

2

470K

2

C19 10nF

Decoupling for VBAT

49 74 99 27 10

STATUS1

2

TOUCH_L TOUCH_R TOUCH_U TOUCH_D CX_ADC1 CX_ADC2 1

D11

23 24 25 26 29 30 31 32 67 68 69 70 71

AUDIO_I2S3_SD CX_I2CSCL CX_I2CSDA BACKLIGHT_/EN

1

330R

CX_USART_CTS CX_USART_RTS CX_USART_TX CX_USART_RX CX_USART_CK SPI_SCK SPI_MISO SPI_MOSI PBUTTON IRDA TX IRDA RX USB-DM USB-DP

100K

2

VSSA VREF-

1

8 9 7

1

NC

73

CONTRACT NO.

COMPANY NAME

RAISONANCE SAS

19 20

1M

OSC32_IN OSC32_OUT SHUTDOWN

1

R10

OSC_IN OSC_OUT

VSS_1 VSS_2 VSS_3 VSS_4 VSS_5

R57

2

NRST

2

1

2

12 13

VDDA VREF+

VBAT

U2

VDD_1 VDD_2 VDD_3 VDD_4 VDD_5

2

R9 100K

50 75 100 28 11

1

VCC2V8

6

VCC2V8

VBAT

VCC2V8 VCC2V8

APPROVALS

DATE

DWG

STM32F103VET6 DRAWN

FL

SIZE CHECKED YR ISSUED

STM32F103VET6

Jun.2008 FSCM NO.

DWG NO.

REV.

Sept.2008

V1.1

A

SCALE

SHEET

2 of 8


VCC5_USB

VCCS

VBAT

VCCS

VCCS VCC2V8

VCCIN

L2

1

74V1G02STR

3

2

1

C21 10µF

R43 470K

2

1

R19 470K

2

1

1

2

R17

470K

2

1

560K

2

C20 10µF

R20

4

1

220pF

100K 2

LX PGOOD VFB

5 8 3

74V1G02STR C22

1

L6928D GND

2

SYNC VCC RUN

1B

1B 3

7 6 1

4

1Y 2

2

1 R16

1A

4

1Y VCCS

1

1A

2

U9

COMP

1

1

1

1 5

470K

VE

PBUTTON

BAT60 D7

2

2

5

BAT60 D6

U15

R15

U12

4.7µH

1

2

R61

1

2

R21 10K

2

150K

2

VCCS

VCCIN U10

SHUTDOWN

4

1 2 5 6

EXACT OUTPUT VOLTAGE VALUE : 2V84

1

2

3

C23 10µF

VE STT5PF20V

STM32 POWER SUPPLY

VCC5_USB_RLink

VCC5_MiniUSB

1

VCC_EXT

1

R22 2

C24 2

1K

100nF

1

1

1

1

BAT60 D5

R23

BAT60 D8

BAT60 D9

2

470R

VBAT

2

2

2

HE14 1x2 RA 8

12

JP3

2

2

STATUS1 STATUS2

4 3 7

TH

5

6.8nF

L6924D

IPRG

TPRG ST1 ST2 SD

VPRE GND

C26

GND

1

VOUT VOSNS IEND

Vin VINSNS

VOPRG

1

C25 10µF

1 2

VREF

U8 VCC5_USB

IPRE

1 2

11 10 13

1

15 1

R24

14 16

1

2

68K

R25 2

T1

1

3K9

2

C27 10µF

CONTRACT NO.

RAISONANCE SAS APPROVALS

6

9

DATE

DWG

2

Battery

DRAWN

FL

CHECKED YR

BATTERY UNIT : SUPPLY & CHARGE

COMPANY NAME

ISSUED

Jun.2008 Sept.2008

SIZE

GENERAL POWER SUPPLY FSCM NO.

DWG NO.

REV.

V1.1

A

SCALE

SHEET

3 of 8


VCC2V8

VCC3V1

1 R26 1K8

2

VCC2V8

1 R27

HP_RIGHT REF. HP_LEFT

1

SP_P SP_N

R29 1K8

12

2

1

R37

33

14

22

VCCIO/D4

VCCP/F3 E3/GNDP

R28 750R 2

1

REMOUT/A3 AUXCLK/C5 BZ/E6

3 17 30

MCLK/A4 FS/B5 DX/A6 DR/A5

4 11 6 5

SDA/F5 SCL/F6 AMCK/E5

35 36 29

LRCK/C6 SDI/D5 SCK/D6

18 23 24

2

R50

10K

2

10K

AUDIO_I2S2_SCK AUDIO_I2S2_WS AUDIO_I2S2_SD AUDIO_SDA AUDIO_SCL 12MHZ AUDIO_I2S3_WS AUDIO_I2S3_SD AUDIO_I2S3_CK

27

1

D3/GNDCM

WM-61B

21

2

B3/MBIAS B1/MIC1P B2/MIC1N A2/MIC2P A1/MIC2N C4/REMIN C1/MIC3 C3/CAP2 F4/HPR E4/VCMHP E2/HPL D2/FMR E1/FML F2/LSP F1/LSN

VCCA/C2

-

C30 100nF

9 7 8 2 1 16 13 15 34 28 26 20 25 32 31

D1/GND

10µF

1

19

+

2

2

C29

1

1

VCC/B4

K1

B6/GND

2

1

U3

10

STW5094A C28 100nF

750R

2

K2

+

1

SP_P VCC3V1

2

-

VCC2V8

VCC2V8

SP_N 1

KDMG10008C

SPEAKER 2

1

C31 22µF

2

1

C33 10µF

2

1

C34 100nF

2

C36 100nF

J3 SLEEVE RING (R)

1

REF.

2

HP_RIGHT

Decoupling on VCCP

Decoupling on VCCA

3

DECOUPLING

4

TIP (L)

5

HP_LEFT

PJ-3007

CONTRACT NO.

COMPANY NAME

RAISONANCE SAS APPROVALS

DATE

DWG

DRAWN SIZE

HP INTERFACE CHECKED ISSUED

FSCM NO.

DWG NO.

REV.

V1.1

A

SCALE

SHEET

4 of 8


R30 1M

VCC2V8 2

1

1

VCC5_RLink

C37

2

100nF 5

U4

74V1G04CTR

2

12MHZ_5V

4

VCC2V8 1

3 5

U16

74V1G04CTR 12MHZ

2

4

1

R31 1

47R

3

2 Y1

12Mhz

1

2

Y2

OSC32_IN

1

1

4

2

OSC32_OUT

1

C38

1

6pF

2

6pF

1

C40

C39 2

33pF

C41 2

33pF

32Khz

Default capacity value for 32Khz crystal : 6pF Final value will depend on available crystal for manufacturing

CONTRACT NO.

COMPANY NAME

RAISONANCE SAS APPROVALS

DATE

DWG

CLOCK SOURCE

DRAWN SIZE CHECKED ISSUED

A

SCALE

FSCM NO.

DWG NO.

REV.

V1.1 SHEET 5 of 8


VCC3V1

VMEMS VMEMS

VMEMS

LED1 U11 LED0

5 3 1 1

C43 10µF

2

4 11 13

1

2

2

LIS3LV02

1

C44 100nF

2

R33

330R

2

1 8

C45 10µF

1

R32 2

2

U5 1

1

C42 100nF

LK112SM28TR

D4

2

2

MEMS POWER SUPPLY

SPI_MISO SPI_MOSI SPI_SCK

2 3 5

CS_MEMS

6

VDD_IO VDD VDD

D3

VIN VOUT BYPASS SHDN GND

RDY/INT CK

7 15 12 10

NC RES RES RES

SDO SDA/SDI/SDO SCL/SPC

330R

VMEMS

CS

GND GND GND

1

1 4

LIS3LV02 9 14 16

MEMS VCC2V8

VCCS 1

10K

R34 47K

2

1

R35 47K 2

1

R47 47K 2

1

R48 47K 2

1

R49 47K 2

2

VCC2V8

R36 1

SW1 J4 JOYSTICK_U

3

JOYSTICK_L

7

JOYSTICK_D

4

UP (A) LEFT (B)

CENTER RIGHT (D)

5

6

PBUTTON 9 10 11 12

JOYSTICK_R

2 1

DOWN (C)

NC/DATA2 /CS/DATA3 MOSI/CMD VDD CLK VSS MISO/DATA0 RSV/DATA1

GND GND GND GND

COMMON

1 2 3 4 5 6 7 8

SDIO_D2 SDIO_D3 SDIO_CMD SDIO_CK SDIO_D0 SDIO_D1

MicroSD (CT10108A0 - China)

TPA-511G-LFS

SD CARD CONNECTOR CONTRACT NO.

COMPANY NAME

RAISONANCE SAS APPROVALS DRAWN

JOYSTICK

DWG

PERIPHERALS PAGE1: MEMS,JOYSTICK,µSDCARD, LEDS FL

CHECKED YR ISSUED

DATE

Jun.2008 Sept.2008

SIZE

FSCM NO.

DWG NO.

REV.

V1.1

A

SCALE

SHEET

6 of 8


VCC5_MiniUSB

VCC5_MiniUSB VCC3V1

J5 6 7

8 9

1

GND GND

GND GND

VBUS DD+ ID GND

U6

1 2 3 4 5

1 2 3

USBLC6-2SC6

I/O1 GND I/O2

USB-DM

6 5 4

I/O1 VBus I/O2

2

C48 100nF

USB-DP VCC3V1 R38

USB-mini-B

VCC2V8

Q1 BC847 CAN_TX CAN_RX

1

VCC5_MiniUSB

1 4 8

VCC2V8

2

1

2

R40 36K 1

TxD RxD RS

1

R39

R2

10K

22K

2

1

VCC CANH CANL SHDN GND 2

1

R41

7 6 5

2

120R

CX_CANL

U14 MAX3051ESA

R42

2

3

CX_CANH

3

2

1

2

3

1K5

2

47K

1

Q2 BC847

USB_DISCONN

USB + DISCONNECT FEATURE

Transceiver CAN

VCC2V8

JP2

VCC2V8

VCC_EXT U7

1

6 1 2 4 3 5 7 8

2

VCC ANODE CATHODE RxD TxD SD VLOG GND

R51 47R

1 3 5 7 9 11 13 15 17 19

CX_I2CSCL AUDIO_SPI_MISO AUDIO_I2S2_SCK CX_CANH CX_ADC1 CX_ADC_TIM CX_USART_RTS CX_USART_CK

IRDA RX IRDA TX IRDA_CS

2 4 6 8 10 12 14 16 18 20

CX_I2CSDA AUDIO_I2S2_SD AUDIO_I2S2_WS CX_CANL CX_ADC2 CX_USART_CTS CX_USART_TX CX_USART_RX

SR2-020-H135/02-55 EXTENSION CONNECTOR

1 TFDU4300 2

CONTRACT NO.

C51 100nF

COMPANY NAME

RAISONANCE SAS APPROVALS

DATE

DWG

PERIPHERALS PAGE 2 : USB, IrDA, Extension DRAWN

IrDA

FL

CHECKED YR ISSUED

Jun.2008 Sept.2008

SIZE A

SCALE

FSCM NO.

DWG NO.

REV.

V1.1 SHEET 7 of 8


VCC2V8 VCC2V8 1

R67 U13 13 14 15 16 17 18 19 20 21 22

XL(X+) YU(Y+) XR(X-) YD(Y-) /CS /RST RS

GND GND

/WR /RD DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7

2

VDD

LCD_/WR LCD_/RD LCD_D0 LCD_D1 LCD_D2 LCD_D3 LCD_D4 LCD_D5 LCD_D6 LCD_D7

24

LCD DISPLAY

LEDA LEDK NC NC

1K

TOUCH_L

1 2 3 4 10 11 12

TOUCH_U TOUCH_R TOUCH_D LCD_/CS LCD_/RST LCD_RS

1

VCC3V1

R65

VCC2V8 2

0R

1

5 6 8 9

R46 3

Q4

2

1

C6

7 23

2

22µF

1 2

10K BACKLIGHT_/EN

BSS123 Backlight active low

VCCIN

L3 1

VCC3V1

4.7µH 2

U17

1

1

2

2 1

R18 L6928D GND

SYNC VCC RUN

COMP

7 6 1

LX PGOOD VFB

5 8 3

470K

2 2

C56 1

R62 47K

2

2

2

C54 10µF

1

R54

1

R53 10K

VCC3V1 exact value : 3.18V

1

4

1

C55 220pF

10µF

R45 470K

2

CONTRACT NO.

COMPANY NAME

RAISONANCE SAS

120K APPROVALS DRAWN

2

FL

CHECKED YR

DATE

Jun.2008 Sept.2008

DWG

SIZE A

LCD FSCM NO.

DWG NO.

REV.

V1.1

Back Light Power Supply ISSUED

SCALE

SHEET 8 of 8


STM32 Primer2 ªØ´àÃÕÂÑ ¹ÃÙá ÅÐ㪠§Ò¹äÁâ¤Ã¤Í¹â·ÃÅàÅÍà STM32

38 l

10 : Ê Ç¹µ Í¢ÂÒ¾Íà µ¢Í§ STM32 Primer2 STM32 Primer2 ä´ ¨´Ñ àµÃÕÂÁ¢Ò¾Íà µÍÔ¹¾ØµàÍÒµ ¾µØ ÊíÒËÃѺµ Í¢ÂÒÂÃкºà¾ÔÁè àµÔÁ â´Â¨Ñ´ ÊÃÃäÇ ·¤Õè ͹à¹ç¡àµÍà µÍ ¢ÂÒÂÃкº ¡ÒÃ㪠§Ò¹¨Ðµ ͧ໠´½Ò¢Í§ STM32 Primer2 ÍÍ¡ÁÒ áÅ Çàª×Íè Á µ ÍÊÒÂÊÑ­­Ò³ÍÍ¡ÁÒ «Ö§è ÊÒÁÒö·íÒä´ 3 ÇÔ¸ËÕ ÅÑ¡æ ¤×Í 1. ºÑ´¡ÃÕµÍ ÊÒÂâ´ÂµÃ§ 2. ·íÒÊÒÂá¾·ÕÁè ¤Õ Í¹à¹ç¡àµÍà µÇÑ àÁÕÂÊíÒËÃѺµ ͡Ѻ¤Í¹à¹ç¡àµÍà µÍ ¢ÂÒÂÃкº 3. ·íÒºÍà ´·ÕÊè ÒÁÒöàÊÕºࢠҡѺ¤Í¹à¹ç¡àµÍà µÍ ¢ÂÒÂÃкºä´ â´ÂµÃ§ ã¹ÃÙ»·Õè 10-1 áÊ´§µÑÇÍ ҧ¢Í§ºÍà ´µ Í¢ÂÒÂÃкº·Õ¼è ÅÔµ¢Ö¹é â´Â Raisonance ¼Ù¼ ÅÔµ STM32 Primer2 ¹Í¡¨Ò¡¹Ñ¹é 㹺·¹Õäé ´ ¹Òí Ẻà ҧµÑÇÍ ҧÊíÒËÃѺ¡ÒúÍà ´µ Í¢ÂÒÂÃкºÊíÒËÃѺ STM32 Primer2 «Ö§è áÊ´§¶Ö§¢¹Ò´ Ãٻà ҧ·Õáè ¹Ð¹íÒ ª×Íè áÅеíÒá˹ §¢Í§¢Ò¾Íà µ·Õ¨è ´Ñ ÊÃÃäÇ à¾×Íè »ÃÐ⪹ 㹡ÒÃãª Í Ò§ÍÔ§ÊíÒËÃѺ¡ÒÃÍ͡ẺºÍà ´µ Í¢ÂÒÂÃкºâ´Â¼Ù ¾Ñ²¹Òàͧ ËÑ¡ÍÍ¡ä´

45 ÁÁ.

ÃÙ»·Õè 10-1 µÑÇÍ ҧºÍà ´àª×Íè Áµ Íà¾×Íè ¢ÂÒÂÃкº¢Í§ STM32 Primer2


1

3

2

4

B

Max components height on top face : 2.0mm

Max components height on bottom face : 7.5mm

A

42

1,6

21

A

C

5

1

R2

,3

31,8

D

46,8

60

R 1

,8

,7

2

,7

9 R8

,7

7 R8

0,5

A 1

E

Top face

SECTION

A-A

Bottom face

Note : Components are placed on the bottom face of the daughter board. Bottom face is the side of the board away from the motherboard/main board. Note : red hatched zones : no component areas

1

SSW 110 01 X D_SAMTEC HE14 FEM 20PTS (as ref)

PC NO PART NAME

1 QTY

Tolerances generales

Status

Etat de surface

Ce plan est la propriete de RAISONANCE et ne peut etre reproduit ou communique sans son autorisation

www.raisonance.com

17 av J Kuntzmann

Traitement

1/1 Folio F

KeyOx PL Date

Des

Dessine / verifie par

Format

ECH

A4

1/1

Raisonance FL Approuve par

K07145_1_113Z00 Primer BigSTM32 daughter board PCB

Matiere

Poids



Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.