{"id":2426,"date":"2018-04-14T10:16:28","date_gmt":"2018-04-14T08:16:28","guid":{"rendered":"http:\/\/www.itluxembourg.lu\/site\/?page_id=2426"},"modified":"2023-10-13T10:16:44","modified_gmt":"2023-10-13T08:16:44","slug":"fuse-settings","status":"publish","type":"page","link":"https:\/\/www.itluxembourg.lu\/site\/hobbyking-orangerx-433mhz-modules-faq\/fuse-settings\/","title":{"rendered":"Fuse settings"},"content":{"rendered":"<h1>Introduction<\/h1>\n<p>Fuses are a few special configuration bytes that are stored on the atmega328 microcontroller. Their role is to configure low level settings of the microcontroller such as the type of crystal oscillator connected to it, the brown-out detector level, the bootloader size etc.<\/p>\n<p>When you buy an OrangeRX or Wolfbox module, the fuses are preconfigured to certain values.<\/p>\n<p>It&#8217;s however possible to change their values under certain circumstances.\u00a0Just an FTDI cable isn&#8217;t sufficient to modify the fuses values, this can only be done with a programmer such as the USBasp programmer.<\/p>\n<h1>Why modify the fuses values ?<\/h1>\n<p>There can be several reasons, but for ULRS project the most obvious one is to activate the brown-out detector on OrangeRX modules.<\/p>\n<h2>The brown-out detector<\/h2>\n<p>The brown-out detector (BOD) is a simple feature of the microcontroller that will inactivate it whenever its supply voltage is below a configurable limit.<\/p>\n<p>This is advisable for any project, because if the microcontroller operates in undervoltage it can lead to unexpected behaviours : it can for example randomly jump to any memory location and execute the code.<\/p>\n<p>One consequence of this is that it can jump into the bootloader code and execute randomly sequences of code that will modify the flash memory. In this case the firmware itself can be corrupted and even after resetting the microcontroller and powering correctly it won&#8217;t work. Until the firmware is flashed again.<\/p>\n<p>Similar examples can be found in other projects (for example here).<\/p>\n<p>For this to happen the module supply voltage has to be very low, under 3.39V (remember that because of the switching regulator the supply voltage of the microcontroller is lower). This shouldn&#8217;t happen in normal use with the module connected directly to the battery, but it happened already to a user with an almost empty battery and full throttle.<\/p>\n<p>It&#8217;s not clear why Hobbyking doesn&#8217;t activate the BOD by default, but anyways for maximum safety it&#8217;s recommended to do it.<\/p>\n<h2>Only required for OrangeRX modules ?<\/h2>\n<p>Yes, because the Arduino Mini (ULRS Mini modules) have a factory setting of 4.3V BOD, which is fine as these boards run at 5V. So all the ULRS Mini modules based on arduino mini have already a good BOD.<\/p>\n<p>And for the Wolfbox modules this should still be checked.<\/p>\n<h1>Modifying the fuses<\/h1>\n<h2>About the fuse values<\/h2>\n<p>The fuses are represented by 3 bytes : the high fuse, the low fuse and the extended fuse. Every bit of every byte has a specific meaning, please refer to the atmega328 datasheet for a description of all the bits (or to <a href=\"https:\/\/www.allaboutcircuits.com\/projects\/atmega328p-fuse-bits-and-an-external-crystal-oscillator\/\" target=\"_blank\" rel=\"noopener noreferrer\">this article<\/a>).<\/p>\n<p>Be careful that the high, low and extended fuses are sometimes presented in a different order.<\/p>\n<h3>Factory fuse values for OrangeRX<\/h3>\n<p><span style=\"color: #ff0000;\">Factory settings on the OrangeRX modules :<\/span><\/p>\n<p><span style=\"color: #ff0000;\">Extended fuse : <strong>0xFF<\/strong> (the 0x means that it&#8217;s an hexadecimal value)<\/span><br \/>\n<span style=\"color: #ff0000;\">High fuse : <strong>0xD8<\/strong><\/span><br \/>\n<span style=\"color: #ff0000;\">Low fuse : <strong>0xF7<\/strong><\/span><\/p>\n<h3>Factory fuse values for Arduino pro mini 5V 16MHz used in ULRS Minis<\/h3>\n<p>This is just for information, as explained above the Arduino pro mini has a factory setting of 4.3V BOD, which is fine as it runs at 5V. So no real need to change it.<\/p>\n<p>Factory settings on the Arduino pro mini 5V 16MHz :<\/p>\n<p>Extended fuse : 0xF8<br \/>\nHigh fuse : 0xDA<br \/>\nLow fuse : 0xFF<\/p>\n<h3>Recommended fuse values<\/h3>\n<p><span style=\"color: #339966;\">The fuse values have a difference for the brown-out detector, which is then configured for 2.7V.<\/span><\/p>\n<p><span style=\"color: #339966;\">Notice that the atmega328 only allows 3 different BOD values, and 2.7V is the only value that will work for this project. (Don&#8217;t try to set it at 4.3V, because the microcontroller is powered at 3.3V, and don&#8217;t set it at 1.8V because it won&#8217;t provide any improvement.)<\/span><\/p>\n<p><span style=\"color: #339966;\">Extended fuse : <strong>0xFD<\/strong><\/span><br \/>\n<span style=\"color: #339966;\">High fuse : <strong>0xD8<\/strong><\/span><br \/>\n<span style=\"color: #339966;\">Low fuse :<strong> 0xF7<\/strong><\/span><\/p>\n<h2>A word of caution<\/h2>\n<p>It should be noted that modifying the fuses in a wrong way can make the board unusable. For example if Debugwire and SPI are deactivated at the same time it won&#8217;t be possible to program the part again, including impossible to modify the fuses again. Basically you&#8217;ll have to buy a new part in this case.<\/p>\n<h2>Modifying the fuses<\/h2>\n<p>Without going into the detail of avrdude installation, the command to run to set the fuses with USBasp is the following :<\/p>\n<p><strong>avrdude -Cavrdude.conf -patmega328p -c usbasp -V -D -U efuse:w:0xFD:m -u -U hfuse:w:0xD8:m -U lfuse:w:0xF7:m<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Fuses are a few special configuration bytes that are stored on the atmega328 microcontroller. Their role is to configure low level settings of the microcontroller such as the type<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":635,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"template-sitemap.php","meta":{"footnotes":""},"class_list":["post-2426","page","type-page","status-publish","hentry"],"amp_enabled":false,"_links":{"self":[{"href":"https:\/\/www.itluxembourg.lu\/site\/wp-json\/wp\/v2\/pages\/2426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itluxembourg.lu\/site\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.itluxembourg.lu\/site\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.itluxembourg.lu\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itluxembourg.lu\/site\/wp-json\/wp\/v2\/comments?post=2426"}],"version-history":[{"count":21,"href":"https:\/\/www.itluxembourg.lu\/site\/wp-json\/wp\/v2\/pages\/2426\/revisions"}],"predecessor-version":[{"id":3152,"href":"https:\/\/www.itluxembourg.lu\/site\/wp-json\/wp\/v2\/pages\/2426\/revisions\/3152"}],"up":[{"embeddable":true,"href":"https:\/\/www.itluxembourg.lu\/site\/wp-json\/wp\/v2\/pages\/635"}],"wp:attachment":[{"href":"https:\/\/www.itluxembourg.lu\/site\/wp-json\/wp\/v2\/media?parent=2426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}