Go Down

Topic: 32mHz ARDUINO PROJECTS.. ATMega328P etc... (Read 13 times) previous topic - next topic

mcnobby

I have been using 32mHz crystal oscillators on my projects for some time now without any crashes or ANY noticable heat from the processor.

Instead of the 16mhz crystal the parts I use are like these
http://www.ebay.co.uk/itm/201074903412

You cant just use a 32mHz CRYSTAL because the micro isnt able to drive it properly, so therefore it must be a TTL CRYSTAL OSCILLATOR (as above)

I created a new entry in boards.txt to cover the new chip frequency (for example)

Code: [Select]

uno32.name=Arduino Uno 32mhz
uno32.upload.protocol=arduino
uno32.upload.maximum_size=32256
uno32.upload.speed=115200
uno32.bootloader.low_fuses=0xff
uno32.bootloader.high_fuses=0xde
uno32.bootloader.extended_fuses=0x05
uno32.bootloader.path=optiboot
uno32.bootloader.file=optiboot_atmega328.hex
uno32.bootloader.unlock_bits=0x3F
uno32.bootloader.lock_bits=0x0F
uno32.build.mcu=atmega328p
uno32.build.f_cpu=32000000L
uno32.build.core=arduino
uno.build.variant=standard


This WILL affect your BOOTLOADER as it will be running a 2x speed, you can solve this problem by one of two ways:
(1) Dont use the bootloader, only upload via USBISP etc etc
(2) Put some clever switch to switch between 16mhz (serial upload) and 32mhz (operational) clocks

There could be a few issues regarding your peripheral devices, for example using LCDs, perhaps SPI problems, and obviously serial is cracking away twice as fast so your debugging speed will need adjustment.

LIBRARIES:

so far, in the LiquidCrystal library, I found that the following mod fixed writing problems

Code: [Select]
void LiquidCrystal::pulseEnable(void) {
  digitalWrite(_enable_pin, LOW);
  delayMicroseconds(1);   
  digitalWrite(_enable_pin, HIGH);
  delayMicroseconds(1);    // enable pulse must be >450ns
  digitalWrite(_enable_pin, LOW);
  [b]delayMicroseconds(200);[/b]   // commands need 200us if using 32mHz xtal (was 100us)
}


As yet I havent found any issues when using internal EEPROM and the EEPROM library

I have been using 32mHz on ATMega328P_PU (DIL) and ATMega328P_AU (QFP32) chips so far without problems, and I shall be trying many more as I get them

This may be well outside the 20mhz specification of the atmel device, but sometimes its worth a little extra nitro to squeeze a bit more out, just for fun.

NOTE: Please do this at your own risk, even though I havent had a problem there is no guarantee that your device wont kick the bucket, blow up in your face, or set off world war III !

Regards Bob
while (z--) { snoreEvenLouder(); }
www.smartshow.lighting - www.dmx512.lighting

ChilliTronix

Well done. If I want to over clock I now know how....

Go Up