{"id":194,"date":"2015-07-12T17:46:13","date_gmt":"2015-07-12T14:46:13","guid":{"rendered":"http:\/\/gronlier.fr\/blog\/?p=194"},"modified":"2020-03-30T12:43:44","modified_gmt":"2020-03-30T09:43:44","slug":"blink-led-on-the-stm32f103c8t6","status":"publish","type":"post","link":"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/","title":{"rendered":"Blink LED on the STM32F103C8T6"},"content":{"rendered":"<p>I just ordered one of those cheap 4USD STM32F103 board from <a href=\"http:\/\/www.ebay.com\/itm\/161651410726\" target=\"_blank\" rel=\"noopener noreferrer\">ebay<\/a> and a <a href=\"http:\/\/gronlier.fr\/blog\/2015\/07\/unbrick-and-update-an-j-link-v8-clone\/\" target=\"_blank\" rel=\"noopener noreferrer\">JTAG<\/a> probe.<\/p>\n<p>It's labeled STM32FxCxT6 Board V5.02 150118<\/p>\n<p><a href=\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-195\" src=\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316-300x169.jpg\" alt=\"20150712_170316\" width=\"300\" height=\"169\" srcset=\"https:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316-300x169.jpg 300w, https:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316-1024x576.jpg 1024w, https:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316.jpg 1576w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0 <\/a><a href=\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150708_082029.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-199\" src=\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150708_082029-227x300.jpg\" alt=\"20150708_082029\" width=\"227\" height=\"300\" srcset=\"https:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150708_082029-227x300.jpg 227w, https:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150708_082029.jpg 671w\" sizes=\"(max-width: 227px) 100vw, 227px\" \/><\/a><\/p>\n<p><!--more--><\/p>\n<p>As always, the price is as light as the documentation, but eventually digging the WWW you find interesting things.<\/p>\n<p>Most electronic products available on Ebay, Aliexpress, DX, Banggood, ... are also available from Taobao and after 15mins search I found an ad selling the same looking <a href=\"http:\/\/item.taobao.com\/item.htm?spm=a230r.1.14.115.FOLxZw&amp;id=39524177238&amp;ns=1&amp;abbucket=4#detail\" target=\"_blank\" rel=\"noopener noreferrer\">board<\/a> with a link to <a href=\"http:\/\/pan.baidu.com\/s\/1eQcRViE\" target=\"_blank\" rel=\"noopener noreferrer\">sample codes<\/a>.<\/p>\n<p>To me, the most interesting file in the archive is\u00a0 <a href=\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/stm32f103c8t6.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">circuit diagram<\/a> of the board.<\/p>\n<p>The onboard LED is connected to the pin PC13.<\/p>\n<p><a href=\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/led13.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-198\" src=\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/led13-268x300.png\" alt=\"led13\" width=\"268\" height=\"300\" srcset=\"https:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/led13-268x300.png 268w, https:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/led13.png 269w\" sizes=\"(max-width: 268px) 100vw, 268px\" \/><\/a><\/p>\n<p>Since I just want to blink an LED, I'll go for the fastest way and use the <a href=\"https:\/\/developer.mbed.org\/compiler\/\" target=\"_blank\" rel=\"noopener noreferrer\">mbed online IDE<\/a>.<\/p>\n<ol>\n<li>Add the platform <a href=\"https:\/\/developer.mbed.org\/platforms\/ST-Nucleo-F103RB\/\" target=\"_blank\" rel=\"noopener noreferrer\">NUCLEO-F103RB<\/a> to your IDE.<br \/>\nthe C8 and RB differ as follow:<br \/>\nR = 64 pins| C = 48 pins<br \/>\nB = 128KB Flash| 8 = 64 KB Flash<br \/>\nThe memory addresses are the same.<\/li>\n<li>Create a new project and use the following code\n<pre class=\"lang:c++ decode:true\">#include \"mbed.h\"\r\n\r\nDigitalOut led(PC_13);\r\n\r\nint main() {\r\n    while(1) {\r\n        led = 1;\r\n        wait(0.5); \/\/ 500 ms\r\n        led = 0;\r\n        wait(0.5);\r\n    }\r\n}<\/pre>\n<\/li>\n<li>Press compile and download the .bin file.<\/li>\n<li>Assuming you know how to install openocd on your box, I like to use the following script to flash the target with the J-LINK JTAG probe.<br \/>\n<a href=\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170336.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-200\" src=\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170336-300x169.jpg\" alt=\"20150712_170336\" width=\"300\" height=\"169\" srcset=\"https:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170336-300x169.jpg 300w, https:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170336-1024x576.jpg 1024w, https:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170336.jpg 1576w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<pre class=\"lang:sh decode:true\" title=\"flash.sh\">#!\/bin\/sh\r\n\r\nbinpath=\"$1\"\r\ncfgfile=\"\/tmp\/flash_cmds.cfg\"\r\n\r\ncat &gt; \"$cfgfile\" &lt;&lt;EOF\r\ninit\r\nreset init\r\nhalt\r\nflash write_image erase $binpath 0x08000000\r\nreset run\r\nshutdown\r\nEOF\r\n\r\nopenocd -f \/usr\/share\/openocd\/scripts\/interface\/jlink.cfg -f \/usr\/share\/openocd\/scripts\/target\/stm32f1x.cfg -f \"$cfgfile\"<\/pre>\n<p><span class=\"lang:default highlight:0 decode:true  crayon-inline \">.\/flash.sh &lt;the file from step3&gt;<\/span><\/li>\n<\/ol>\n<ol>\n<li>Congrats, your on board LED should now be flashing \ud83d\ude42<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<div class='skype-share' data-href='https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/' data-lang='auto' data-style='large' data-source='WordPress' ><\/div><div style='clear:both;padding-bottom:10px;'><\/div>\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=ticapix\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I just ordered one of those cheap 4USD STM32F103 board from ebay and a JTAG probe. It's labeled STM32FxCxT6 Board V5.02 150118 \u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[14],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Blink LED on the STM32F103C8T6 - Bits and Bytes<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Blink LED on the STM32F103C8T6 - Bits and Bytes\" \/>\n<meta property=\"og:description\" content=\"I just ordered one of those cheap 4USD STM32F103 board from ebay and a JTAG probe. It&#039;s labeled STM32FxCxT6 Board V5.02 150118 \u00a0\u00a0\u00a0\u00a0\u00a0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/\" \/>\n<meta property=\"og:site_name\" content=\"Bits and Bytes\" \/>\n<meta property=\"article:published_time\" content=\"2015-07-12T14:46:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-30T09:43:44+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316-300x169.jpg\" \/>\n<meta name=\"author\" content=\"ticapix\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ticapix\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/\",\"url\":\"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/\",\"name\":\"Blink LED on the STM32F103C8T6 - Bits and Bytes\",\"isPartOf\":{\"@id\":\"https:\/\/gronlier.fr\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316-300x169.jpg\",\"datePublished\":\"2015-07-12T14:46:13+00:00\",\"dateModified\":\"2020-03-30T09:43:44+00:00\",\"author\":{\"@id\":\"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/9abd8d0260a4d942d7069de75446e2bc\"},\"breadcrumb\":{\"@id\":\"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/#primaryimage\",\"url\":\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316-300x169.jpg\",\"contentUrl\":\"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316-300x169.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/gronlier.fr\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Blink LED on the STM32F103C8T6\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/gronlier.fr\/blog\/#website\",\"url\":\"https:\/\/gronlier.fr\/blog\/\",\"name\":\"Bits and Bytes\",\"description\":\"As the default template said: &quot;Just another WordPress site&quot;\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/gronlier.fr\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/9abd8d0260a4d942d7069de75446e2bc\",\"name\":\"ticapix\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/94bba7228ec3665afea02078abebfa94?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/94bba7228ec3665afea02078abebfa94?s=96&d=monsterid&r=g\",\"caption\":\"ticapix\"},\"url\":\"https:\/\/gronlier.fr\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Blink LED on the STM32F103C8T6 - Bits and Bytes","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/","og_locale":"en_US","og_type":"article","og_title":"Blink LED on the STM32F103C8T6 - Bits and Bytes","og_description":"I just ordered one of those cheap 4USD STM32F103 board from ebay and a JTAG probe. It's labeled STM32FxCxT6 Board V5.02 150118 \u00a0\u00a0\u00a0\u00a0\u00a0","og_url":"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/","og_site_name":"Bits and Bytes","article_published_time":"2015-07-12T14:46:13+00:00","article_modified_time":"2020-03-30T09:43:44+00:00","og_image":[{"url":"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316-300x169.jpg"}],"author":"ticapix","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ticapix","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/","url":"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/","name":"Blink LED on the STM32F103C8T6 - Bits and Bytes","isPartOf":{"@id":"https:\/\/gronlier.fr\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/#primaryimage"},"image":{"@id":"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/#primaryimage"},"thumbnailUrl":"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316-300x169.jpg","datePublished":"2015-07-12T14:46:13+00:00","dateModified":"2020-03-30T09:43:44+00:00","author":{"@id":"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/9abd8d0260a4d942d7069de75446e2bc"},"breadcrumb":{"@id":"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/#primaryimage","url":"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316-300x169.jpg","contentUrl":"http:\/\/gronlier.fr\/blog\/wp-content\/uploads\/2015\/07\/20150712_170316-300x169.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/gronlier.fr\/blog\/2015\/07\/blink-led-on-the-stm32f103c8t6\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gronlier.fr\/blog\/"},{"@type":"ListItem","position":2,"name":"Blink LED on the STM32F103C8T6"}]},{"@type":"WebSite","@id":"https:\/\/gronlier.fr\/blog\/#website","url":"https:\/\/gronlier.fr\/blog\/","name":"Bits and Bytes","description":"As the default template said: &quot;Just another WordPress site&quot;","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gronlier.fr\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/9abd8d0260a4d942d7069de75446e2bc","name":"ticapix","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/94bba7228ec3665afea02078abebfa94?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/94bba7228ec3665afea02078abebfa94?s=96&d=monsterid&r=g","caption":"ticapix"},"url":"https:\/\/gronlier.fr\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/posts\/194"}],"collection":[{"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/comments?post=194"}],"version-history":[{"count":6,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/posts\/194\/revisions"}],"predecessor-version":[{"id":322,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/posts\/194\/revisions\/322"}],"wp:attachment":[{"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/media?parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/categories?post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/tags?post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}