<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Why I like a well-designed bootloader</title><link>/members-area/personalblogs/b/blog/posts/why-i-like-a-well-designed-bootloader</link><description>Or, also known as: How I pretty much bricked, and then fixed a product I was roadtesting. The following story is something I encountered during my Roadtest of the MKR WAN 1300. (See roadtests.) I&amp;#39;ve mentioned the programming error I encountered ...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Why I like a well-designed bootloader</title><link>https://community.element14.com/members-area/personalblogs/b/blog/posts/why-i-like-a-well-designed-bootloader</link><pubDate>Sun, 27 Sep 2020 13:49:06 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:891f2955-af46-4a34-ac61-400bad7fb965</guid><dc:creator>kiri-ll</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;that was a funny story &lt;span&gt;[View:/resized-image/__size/16x16/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-891f2955-af46-4a34-ac61-400bad7fb965/contentimage_5F00_1.png:16:16]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;i got an interesting impression, that the double-button-press is like a cheat-code. one usually can find it on forums and not in official sources.&lt;/p&gt;&lt;p&gt;pretty neat&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=9932&amp;AppID=293&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Why I like a well-designed bootloader</title><link>https://community.element14.com/members-area/personalblogs/b/blog/posts/why-i-like-a-well-designed-bootloader</link><pubDate>Sat, 26 Sep 2020 20:08:16 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:891f2955-af46-4a34-ac61-400bad7fb965</guid><dc:creator>genebren</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;A bootloader is a very useful tool.&amp;nbsp; I have spent a lot of time building and perfecting bootloaders for many of the products that I build.&amp;nbsp; I tend to try and reuse hardware and software as I move from project to project, which leads me to having common building blocks.&amp;nbsp; The bootloader is typically my starting point for any project.&amp;nbsp; What I may need to do when porting the bootloader is to adjust the communication layer of the bootloader.&amp;nbsp; Most of my projects have some form of serial communications (serial, USB/serial, DMX, etc) and it is important to adjust the bootloader to work with current communications protocol.&amp;nbsp; I also like to have some method to indicate when the bootloader is active, like LEDs.&amp;nbsp; Again, in the porting process, I need to make sure the bootloader can connect to any LED present (onboard or connector coupled) and through the appropriate interface (direct connect and/or serial connected).&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I tend to have my bootloaders capture the microprocessor&amp;#39;s reset vector and have it check to see if the application layer is present/functional.&amp;nbsp; I usually do this through a series of EEPROM variables (status - installed/missing/bad and checksum of CRC values that can be used to verify the application program in FLASH prior to starting.&amp;nbsp; I also tend to use a watchdog timer (which returns to the bootloader) to invalidate an application program the has hung expectantly (changes status to bad).&amp;nbsp; Resets on the board with &amp;#39;badb status&amp;#39; leaves the bootloader active, awaiting a new application level.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This approach has worked fairly well, and I continue to tune and tweak my bootloaders as I find new issues or problems or need to add new features.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=9932&amp;AppID=293&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Why I like a well-designed bootloader</title><link>https://community.element14.com/members-area/personalblogs/b/blog/posts/why-i-like-a-well-designed-bootloader</link><pubDate>Sat, 26 Sep 2020 19:32:52 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:891f2955-af46-4a34-ac61-400bad7fb965</guid><dc:creator>dougw</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I had the same experience with an arduino Pro Micro and its built-in USB. Eventually googling found the answer, but it wasn&amp;#39;t easy to get a search to find the solution, since everyone seems to have a different way to describe the problem. Now I always add a reset button to my projects. I wonder how many others fall into this trap. Hopefully your blog helps some avoid it.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=9932&amp;AppID=293&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Why I like a well-designed bootloader</title><link>https://community.element14.com/members-area/personalblogs/b/blog/posts/why-i-like-a-well-designed-bootloader</link><pubDate>Sat, 26 Sep 2020 14:28:30 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:891f2955-af46-4a34-ac61-400bad7fb965</guid><dc:creator>BigG</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;If all else fails, I sometimes cross the fingers hold the reset button down and power up the board. Sometimes that produces a twist but most of the time you get nothing...&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;So I can empathise with your interesting, if not somewhat painful, experience. These are often the best way to learn in my experience (discovered that with similar painful experience with Nordic Semi SDK and their nRF52 dev boards). &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;So, hopefully the hair pulled out grows back but sorry to say, the grey generally sticks &lt;span&gt;[View:/resized-image/__size/16x16/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-891f2955-af46-4a34-ac61-400bad7fb965/contentimage_5F00_938.png:16:16]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Anyway, I&amp;#39;ve discovered a couple of Arduino function friends for Serial along the way.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;em&gt;Serial.available&lt;/em&gt;() - this always returns the number of bytes available in the buffer so you can always place a limit to trigger an action if number of bytes reaches max RX buffer size.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;em&gt;Serial.peek&lt;/em&gt;() - this tells you the latest character in the buffer without removing the character from the buffer so you can always poll to see what&amp;#39;s there.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;em&gt;Serial.readBytesUntil&lt;/em&gt;() - this one can be useful if you use a special terminating character in your transmit stream when transmitting. This then triggers a buffer transfer. If character not found then waits until a read timeout (which you can also set using the &lt;em&gt;Serial.setTimeout&lt;/em&gt;() function).&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=9932&amp;AppID=293&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>