0

Does anyone know how to configure the Atmega32u4 to run using an external 8MHz oscillator ?

I needs to still be responsive to the Arduino IDE

Thanks

  • The ATmega32U4 is configured by default to work with an external 8MHz crystal. – Ignacio Vazquez-Abrams Nov 13 '16 at 17:21
  • @IgnacioVazquez-Abrams, per Table 28-5 in Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Datasheet.pdf, the -RC models of 32U4 are configured for RC operation :) See note 1, “1. The default setting of CKSEL3..0 results in Low Power Crystal Oscillator for ATmega16U4 and ATmega32U4, and Internal RC oscillator for ATmega16U4RC and ATmega32U4RC.” – James Waldby - jwpat7 Nov 13 '16 at 17:44
1

See §28.2 in Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Datasheet.pdf, which explains usage of various fuse bits.

Also see engbedded.com/fusecalc, which lets you easily figure out fuse settings. Fusecalc also tells you the strings to use as part of avrdude command strings.

Once you know the fuse settings, send them to your device via a command like

avrdude -p m32u4 -c usbasp -u -U lfuse:w:0xEF:m -U hfuse:w:0xD5:m -U efuse:w:0x07:m

or like

avrdude -p m32u4 -P $port -c arduino -u -U lfuse:w:0xEF:m -U hfuse:w:0xD5:m -U efuse:w:0x07:m

where $port represents a port name like /dev/ttyUSB0.

Note, it makes sense to read the fuses first, and put the readings into Fusecalc to see what they correspond to. You can read the fuses via a command like

avrdude -p m32u4 -P $port -c arduino -U hfuse:r:-:i
  • Hi Thanks I see your point and i thought I had to change the fuse settings too, for external 8MHz clock operation with the at328p..... but you don't. The fuse settings are the same. – hoboBob Nov 13 '16 at 18:16
  • Why do I know this... well I read the data sheet and the settings for the atmega328 are the same for both Uno (atmega328p, 5v, 16MHz) and pro(atmega328, 3.3v 8MHz). see the boards.txt file inside arduino application. The only difference is the High fuse which is nothing todo with clock speed – hoboBob Nov 13 '16 at 18:19
  • Sorry I was answering something else :/ hahaha I think you have both given me the answer I needed........ I just need to change to CKDIV8 – hoboBob Nov 13 '16 at 18:24
  • I've been head banging all day on this. I only have at328p's to test on still waiting on my 32u4's to be delivered. – hoboBob Nov 13 '16 at 18:28
  • @DannyJ, re your second comment, “settings for the atmega328 are the same for both Uno (atmega328p, 5v, 16MHz) and pro(atmega328, 3.3v 8MHz)”, right. The same sort of thing will apply on the 32U4, with the same settings at 8 to 16 MHz Low Power Crystal, and other settings for lower frequencies, as shown in Table 6-3 of Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Datasheet.pdf. Note, if by “responsive to the Arduino IDE” you mean that millis() reports correctly, that is controlled by correctly setting the .build.f_cpu parameter in the appropriate boards.txt section. – James Waldby - jwpat7 Nov 13 '16 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.