Welcome! Log In Create A New Profile

Advanced

Downclocking?!

Posted by sungod3k 
Downclocking?!
June 11, 2014 12:17AM
In my youthful ignorance I ordered a 20mhz atmega 1284p replacement for my sanguinololu which ran with a 16mhz chip before. Apart from the fact that I didnt find any 16mhz chips sold and with that start to wonder why my board supplier used it, I need to remedy that situation somehow.

So my potenitally stupid question is: if its possible to have a 20mhz chip run on 16mhz and if I can "downclock" it somehow. From what I gather about "setting fuses" lots of people are playing around with clockspeeds but I havent found an example for the 1284p. Is there a source on how to navitgate through "http://www.engbedded.com/fusecalc"?
Re: Downclocking?!
June 11, 2014 03:39AM
The key part is less the fuses, and more the clock source. The ceramic oscillators that sanguinololu uses aren't brilliant (compared to a crystal) and the only thing that differs (besides frequency) is the clock drive. Ceramic oscillators are a bit unstable and therefore start faster, but have lower drive values. Crystals are more stable, take a little longer to get going but have very good drive values.

Read back the fuses that you used originally, then set matching fuses (not values, tick the appropriate boxes int he engbedded calculator) and you should be fine. The 1284P is not a specific speed chip, it'll work on a variety of speeds, so long as you match the clock inputs correctly (usually).
Re: Downclocking?!
June 11, 2014 08:39AM
Quote
sungod3k
I ordered a 20mhz atmega 1284p replacement for my sanguinololu

These 20 MHz aren't a fixed frequency, but a maximum frequency. ATmegas run at lower frequencies just fine, down to the kHz level.

@majic79 is right with clock source selection, but fuses for 16 MHz and 20 MHz are the same. On what to set, see [reprap.org]


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Downclocking?!
June 11, 2014 09:39AM
Aha, thanks for the fast answers, in the Gen/ article I read: "A bootloader compiled for 16 MHz won't work on an ATmega running at 20 MHz and vice versa. Again, make sure to choose the right variant."

So I guess I over-interpreted the above sentence and the chip should normally accept the 16mhz bootloader on my 16mhz board.

Edited 2 time(s). Last edit at 06/11/2014 10:41PM by sungod3k.
Re: Downclocking?!
June 12, 2014 04:52AM
Just for more confusion :-)

An ATmega running at 16 MHz will accept a bootloader compiled for 20 MHz as well. It'll even run. But the baud rate will be very odd (115200 / 20 * 16 = 92160 baud). This baud rate thing is the entire reason why we need a different bootloader for each clock frequency.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Sorry, only registered users may post in this forum.

Click here to login