
{"id":58,"date":"2012-05-04T15:25:21","date_gmt":"2012-05-04T14:25:21","guid":{"rendered":"http:\/\/www.kanda.com\/blog\/?p=58"},"modified":"2012-05-04T15:25:21","modified_gmt":"2012-05-04T14:25:21","slug":"avr-microcontroller-default-clock","status":"publish","type":"post","link":"https:\/\/www.kanda.com\/blog\/microcontrollers\/avr-microcontrollers\/avr-microcontroller-default-clock\/","title":{"rendered":"AVR Microcontroller Default Clock"},"content":{"rendered":"<p>One feature of AVR devices that can baffle new users is the default clock setting on new AVR microcontrollers. They are set to run from their internal RC oscillator, usually 1 MHz, which throws out the timing on code samples, such as UART.<\/p>\n<p>If the code is configured for an 8MHz clock and there is a 8MHz clock on the target board, you expect it to work but instead you get nothing or garbled characters. This is due to the default Internal RC. How do you change it?<\/p>\n<p><!--more--><\/p>\n<p>All AVR programmers have a Fuse screen somewhere, that lists the configuration fuses for the AVR. These set how the device runs, including things like brown-out, reset vector, debug enables and clock.<\/p>\n<p>The settings we are interested in are CLKSEL and CLKDIV8. The 4 CLKSEL bits (Clock Select) define the type of clock. If you read the fuses on a new AVR, they appear as an Internal RC Oscillator. The default speed depends on the particular AVR. Change this to an External Crystal\/Ceramic Oscillitor for most circuits. If the CLKSEL fuses are displayed in binary, this is 1110 or 1111 for most target circuits. Do NOT choose External Clock (0000) unless you have a specialised clock circuit (not just crystal) on your board or you will lock yourself out of the AVR microcontroller.<\/p>\n<p>Most devices default to 1MHz Internal RC but some, like ATtiny2313, default to 8MHz, but don&#8217;t be fooled as they also have a CLKDIV8 fuse that divides the clock by 8. This also needs to be unchecked if it is present on the device.  <\/p>\n<p>Program the new fuse settings and your AVR will now run at the speed you expect.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One feature of AVR devices that can baffle new users is the default clock setting on new AVR microcontrollers. They are set to run from their internal RC oscillator, usually 1 MHz, which throws out the timing on code samples, such as UART. If the code is configured for an 8MHz clock and there is &hellip; <a href=\"https:\/\/www.kanda.com\/blog\/microcontrollers\/avr-microcontrollers\/avr-microcontroller-default-clock\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">AVR Microcontroller Default Clock<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[21],"class_list":["post-58","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-avr-microcontrollers","tag-avrprogrammer"],"_links":{"self":[{"href":"https:\/\/www.kanda.com\/blog\/wp-json\/wp\/v2\/posts\/58","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kanda.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kanda.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kanda.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kanda.com\/blog\/wp-json\/wp\/v2\/comments?post=58"}],"version-history":[{"count":2,"href":"https:\/\/www.kanda.com\/blog\/wp-json\/wp\/v2\/posts\/58\/revisions"}],"predecessor-version":[{"id":60,"href":"https:\/\/www.kanda.com\/blog\/wp-json\/wp\/v2\/posts\/58\/revisions\/60"}],"wp:attachment":[{"href":"https:\/\/www.kanda.com\/blog\/wp-json\/wp\/v2\/media?parent=58"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kanda.com\/blog\/wp-json\/wp\/v2\/categories?post=58"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kanda.com\/blog\/wp-json\/wp\/v2\/tags?post=58"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}