{"id":252,"date":"2013-01-25T16:35:33","date_gmt":"2013-01-26T00:35:33","guid":{"rendered":"http:\/\/micromouseusa.com\/?p=252"},"modified":"2013-02-04T19:16:32","modified_gmt":"2013-02-05T03:16:32","slug":"how-to-make-a-simple-auto-download-circuit-for-stm32","status":"publish","type":"post","link":"http:\/\/micromouseusa.com\/?p=252","title":{"rendered":"how to make a simple auto download circuit for STM32"},"content":{"rendered":"<p>For those who know successfully downloaded code to STM32 through built in ISP must remember that you have to hold boot0 button(assume boot1 is already pulled down) then press reset button then release reset button in order to switch to ISP mode for stm32 to download code into flash. To be honest, I quit enjoy the moment to hold and release the boot0 button when downloading code(I am not a big fan of STMlin btw :D), but this is not quite true for all cases.<\/p>\n<p>Those who don&#8217;t have sufficient space on their micromouse PCB always tend to choose smaller buttons to save space. However, these buttons are definitely not as easy to press as those normal size buttons, it becomes pretty painful when you need to press more than one button at same time such as operating boot0 and reset buttons at same time to download code.<\/p>\n<p>Of course, there some develop board who use STM32 as their MCU have some auto download circuit, but since you usually make your own minimum system on mouse PCB, you won&#8217;t be able to utilize these features on other people&#8217;s products for sure.\u00a0Auto download circuit can be achieved by having a additional micro-controller, but this is not what we are going to do today.<\/p>\n<p>In fact, I found a software has such as function to utilize RTS and DTR on FTDI programmer IC to control the behavior of BOOT0 and RESET with some simply modification on your STM32 circuit.<\/p>\n<p>Firstly, here is the screenshot of this magical software, named &#8220;FlyMcu&#8221;<\/p>\n<p><a href=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/flymcu.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-255\" alt=\"flymcu\" src=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/flymcu.png\" width=\"756\" height=\"543\" srcset=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/flymcu.png 756w, http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/flymcu-300x215.png 300w, http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/flymcu-417x300.png 417w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/a><\/p>\n<p>it supports both LPC and STM32 ISP mode<\/p>\n<p><a href=\"http:\/\/cache.ourdev.cn\/bbs_upload782111\/files_39\/ourdev_634621AD436Q.rar\">download click here<\/a><\/p>\n<p>I use RS232 USB to serial programmer IC to make a FTDI board to download code from PC to STM32, I reserve a 6 pins port on my micromouse. They are TX TX GND\u00a0 3.3V\u00a0\u00a0 DTR and RTS. I think you guys know TX and RX already, since TX RX and GND is the minimum requirement for download code through serial port. DTR are RTS are some other functional pins on traditional serial port on your PC(a 15 pin port. even though most of the new PC no long have it). What we are doing here is let the software flymcu to control these 2 pins through USB to serial IC to automatically send high or low with a certain order you define.<\/p>\n<p>I decided to use DTR to control reset and use RTS to control boot0.<\/p>\n<p>Let&#8217;s look at the modified circuit<\/p>\n<p>BOOT0<a href=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/boot0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-258\" alt=\"boot0\" src=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/boot0.png\" width=\"617\" height=\"431\" srcset=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/boot0.png 617w, http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/boot0-300x209.png 300w, http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/boot0-429x300.png 429w\" sizes=\"(max-width: 617px) 100vw, 617px\" \/><\/a> Circuit<\/p>\n<p>Reset circuit<\/p>\n<p><a href=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/rst-bottun.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-254\" alt=\"rst bottun\" src=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/rst-bottun.png\" width=\"553\" height=\"433\" srcset=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/rst-bottun.png 553w, http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/rst-bottun-300x234.png 300w, http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/rst-bottun-383x300.png 383w\" sizes=\"(max-width: 553px) 100vw, 553px\" \/><\/a><\/p>\n<p>pin order on my 6 pin port on micromouse<\/p>\n<p><a href=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/usart.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-256\" alt=\"usart\" src=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/usart.png\" width=\"283\" height=\"189\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>schematic for 6 pin port on micromouse<\/p>\n<p><a href=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/usart-sch.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-259\" alt=\"usart sch\" src=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/usart-sch.png\" width=\"517\" height=\"428\" srcset=\"http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/usart-sch.png 517w, http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/usart-sch-300x248.png 300w, http:\/\/micromouseusa.com\/wp-content\/uploads\/2013\/01\/usart-sch-362x300.png 362w\" sizes=\"(max-width: 517px) 100vw, 517px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Basically this circuit set will make it available to do both manual and automatic code download. The way that flymcu does with my circuit setting is to send\u00a0 low signal to DTR(connected to reset) to make the voltage on RESET to be low then send a high through RTS(connected to BOOT0 though a current limit 47K resistor) to set the voltage at BOOT0 as high, then stop sending low signal to DTR, since I have a pull up resistor on reset, the voltage on reset back to high(which is no longer low). thus, your STM32 is in ISP mode now, flyMCU will then automatically download the hex file you selected to your STM32 right after finishing control of DTR and RTS.<\/p>\n<p>In this case, you are no longer need boot0 and reset button on you micromouse now. I still keep them both since I sometime do need to press them for fun : )\u00a0\u00a0 . This method can also make you download code automatic and wirelessly if you have a bluetooth adapter who has DTR and RTS.<\/p>\n<p>If you use some of the NXP LPC series cortex arm M3\/M4 processer, you can also use this software do make a auto download system since LPCxxxx also has such a similar mechanism to trigger ISP mode like STM32.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For those who know successfully downloaded code to STM32 through built in ISP must remember that you have to hold boot0 button(assume boot1 is already pulled down) then press reset button then release reset button in order to switch to &hellip; <a href=\"http:\/\/micromouseusa.com\/?p=252\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[8,10,7],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/micromouseusa.com\/index.php?rest_route=\/wp\/v2\/posts\/252"}],"collection":[{"href":"http:\/\/micromouseusa.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/micromouseusa.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/micromouseusa.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/micromouseusa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=252"}],"version-history":[{"count":14,"href":"http:\/\/micromouseusa.com\/index.php?rest_route=\/wp\/v2\/posts\/252\/revisions"}],"predecessor-version":[{"id":320,"href":"http:\/\/micromouseusa.com\/index.php?rest_route=\/wp\/v2\/posts\/252\/revisions\/320"}],"wp:attachment":[{"href":"http:\/\/micromouseusa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/micromouseusa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=252"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/micromouseusa.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}