{"id":208,"date":"2021-08-07T22:48:51","date_gmt":"2021-08-07T21:48:51","guid":{"rendered":"https:\/\/www.bolukan.nl\/?p=208"},"modified":"2021-08-11T14:17:08","modified_gmt":"2021-08-11T13:17:08","slug":"programming-stm32f-boards","status":"publish","type":"post","link":"https:\/\/www.bolukan.nl\/?p=208","title":{"rendered":"Programming STM32F boards"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I got three versions of STM32F boards, one Cortex-M3 and two Cortex-M4&#8217;s:<br><code>STM32F103C8T6 Arm Cortex-M3 MCU, 80 DMIPS, 64KB Flash \/ 20KB RAM, 72 MHz<br>STM32F401CCU6 Arm Cortex-M4 MCU+FPU, 105 DMIPS, 256KB Flash \/ 64KB RAM, 84 MHz<br>STM32F411CEU6 Arm Cortex-M4 MCU+FPU, 125 DMIPS, 512KB Flash \/ 128KB RAM, 100 MHz<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Uploading with UART and PlatformIO<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To upload a blink sketch I connected a CP2102 Serial-USB converter to the following STM32F-pins: 3V3, GND, PA9 USART1_TX and PA10 USART1_RX. The blink sketch uses the on-board led PC13 (LOW=active). <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The default STM32F103C8 protocol for PlatformIO is stlink, so first add <code>upload_protocol\u00a0=\u00a0serial<\/code> to <code>platformio.ini<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Other issue with PlatformIO: the installed version 0.4 of stm32flash.exe does not suffice for the STM32F411CEU6 and it needs to be updated to v0.5 or higher (I used v0.6) using <a rel=\"noreferrer noopener\" href=\"https:\/\/sourceforge.net\/projects\/stm32flash\/\" target=\"_blank\">https:\/\/sourceforge.net\/projects\/stm32flash\/<\/a> and saved to <code>.platformio\/packages\/tool-stm32duino\/stm32flash\/stm32flash.exe<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Uploading with USB<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To use the USB-port of the STM32F103C8, follow the <a rel=\"noreferrer noopener\" href=\"https:\/\/www.electronicshub.org\/how-to-upload-stm32f103c8t6-usb-bootloader\/\" data-type=\"URL\" data-id=\"https:\/\/www.electronicshub.org\/how-to-upload-stm32f103c8t6-usb-bootloader\/\" target=\"_blank\">instructions<\/a> to upload a software-bootloader with <a rel=\"noreferrer noopener\" href=\"https:\/\/www.st.com\/en\/development-tools\/stm32cubeprog.html\" data-type=\"URL\" data-id=\"https:\/\/www.st.com\/en\/development-tools\/stm32cubeprog.html\" target=\"_blank\">STM32CubeProgrammer<\/a> and the right bootloader binary <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/rogerclarkmelbourne\/STM32duino-bootloader\/tree\/master\/binaries\" data-type=\"URL\" data-id=\"https:\/\/github.com\/rogerclarkmelbourne\/STM32duino-bootloader\/tree\/master\/binaries\" target=\"_blank\">generic_boot20_pc13.bin<\/a>. My board has a 10K resistor at R10, which first needs to be replaced with an 1,5K. <em>To be continued&#8230;<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Both STM32F4&#8217;s contain a ROM-bootloader and they need no preparations. The USB can be used with <code>upload_protocol = dfu<\/code> in <code>platformio.ini<\/code>. With the BOOT and RESET keys the usb-port becomes available.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"681\" height=\"1007\" src=\"https:\/\/www.bolukan.nl\/wp-content\/uploads\/2021\/08\/STM32F103C8T6.jpg\" alt=\"\" class=\"wp-image-206\" srcset=\"https:\/\/www.bolukan.nl\/wp-content\/uploads\/2021\/08\/STM32F103C8T6.jpg 681w, https:\/\/www.bolukan.nl\/wp-content\/uploads\/2021\/08\/STM32F103C8T6-203x300.jpg 203w\" sizes=\"(max-width: 681px) 100vw, 681px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"657\" height=\"1007\" src=\"https:\/\/www.bolukan.nl\/wp-content\/uploads\/2021\/08\/STM32F401CCU6.jpg\" alt=\"\" class=\"wp-image-204\" srcset=\"https:\/\/www.bolukan.nl\/wp-content\/uploads\/2021\/08\/STM32F401CCU6.jpg 657w, https:\/\/www.bolukan.nl\/wp-content\/uploads\/2021\/08\/STM32F401CCU6-196x300.jpg 196w\" sizes=\"(max-width: 657px) 100vw, 657px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"629\" height=\"1005\" src=\"https:\/\/www.bolukan.nl\/wp-content\/uploads\/2021\/08\/STM32F411CEU6.jpg\" alt=\"\" class=\"wp-image-205\" srcset=\"https:\/\/www.bolukan.nl\/wp-content\/uploads\/2021\/08\/STM32F411CEU6.jpg 629w, https:\/\/www.bolukan.nl\/wp-content\/uploads\/2021\/08\/STM32F411CEU6-188x300.jpg 188w\" sizes=\"(max-width: 629px) 100vw, 629px\" \/><\/figure>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I got three versions of STM32F boards, one Cortex-M3 and two Cortex-M4&#8217;s:STM32F103C8T6 Arm Cortex-M3 MCU, 80 DMIPS, 64KB Flash \/ 20KB RAM, 72 MHzSTM32F401CCU6 Arm Cortex-M4 MCU+FPU, 105 DMIPS, 256KB Flash \/ 64KB RAM, 84 MHzSTM32F411CEU6 Arm Cortex-M4 MCU+FPU, 125 DMIPS, 512KB Flash \/ 128KB RAM, 100 MHz Uploading with UART and PlatformIO To upload [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[12],"class_list":["post-208","post","type-post","status-publish","format-standard","hentry","category-esp8266","tag-platformio"],"_links":{"self":[{"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=\/wp\/v2\/posts\/208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=208"}],"version-history":[{"count":6,"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=\/wp\/v2\/posts\/208\/revisions"}],"predecessor-version":[{"id":225,"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=\/wp\/v2\/posts\/208\/revisions\/225"}],"wp:attachment":[{"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}