0

I have a custom PCB with a 32u4 running fine with an 8MHz external oscillator. I burned the bootloader and loaded my sketch with an UNO using Arduino as ISP.

I have no USB on my PCB nor do I need precise timing, so I wanted to see if I could simplify things by removing the external oscillator and caps.

Reading the 32u4 datasheet it states "The device is shipped with Low Power Crystal Oscillator (8.0 - 16MHz) enabled and with the fuse CKDIV8 programmed".

With that, can I simply hook my PCB (assuming a factory fresh 32u4) via ISP to the UNO as before and in IDE just use Sketch > Upload Using Programmer? Basically not burning any bootloader at all.

Also, in IDE I have been choosing the Sparkfun ProMicro 3.3v, 8MHz board. Can I still use that selection?

2 Answers 2

1

Yes you can reprogram your 32U4 chips via the ISP, they do not have to be fresh chip. If you set your Fuses to -U lfuse:w:0xE2:m -U hfuse:w:0xD8:m -U efuse:w:0xCB:m using AVRDUDE you will have an 8mhz internal RC oscillator set and you do not have to have the external crystal.

You can play with these settings at http://www.engbedded.com/fusecalc/.

I recommend learning the command line AVRDUDE commands this way you have more control over what you are doing to your chip.

I use this all the time, and if you need to do more than one quickly I typically make a batch file that does the Fuse Burn and hex at the same time.

this is for a attiny167 but you get the idea: .\avrdude\avrdude -C".\avrdude\avrdude.conf" -v -pattiny167 -cstk500v2 -PCOM3 -Ulfuse:w:0xE2:m -Uhfuse:w:0xDF:m -Uefuse:w:0xFF:m -Uflash:w:1060X01-001.hex:i

6
  • I understand that I can set the fuses using AVRDUDE. My question is: since the datasheet says the 32u4 comes from the factory with the internal oscillator fuse already set, do I need to do anything additional (i.e. set other fuses) before being able to upload my code with SPI?
    – user19216
    Dec 5, 2018 at 2:29
  • I have always programmed my fuses then loaded the bootloader hex. then you can use the USB like any pro micro.
    – robogeek78
    Dec 5, 2018 at 3:08
  • @da40flyer also, the single fuse setting of the High, Low, and Extended fuses are all the fuses you have to set, It configures the entire chip with things that need to be done at power on. After that the only thing you need is your program code or your bootloader on the chip.
    – robogeek78
    Dec 5, 2018 at 14:34
  • 1
    I believe I discovered why.... I purchased the 32u4 chips. While you can set the fuses for the internal clock to be used, it does require an external clock in order to program the first time. I need to use the 32u4rc which is set from the factory to use the internal clock and can be programmed directly.
    – user19216
    Dec 17, 2018 at 2:21
  • 1
    actually it doesn't require an external clock you have to tell AVRdude to use a very slow clock like 1024 because without any setting the chip defaults to the 32khz RC clock.
    – robogeek78
    Dec 22, 2018 at 2:32
0

I just received some 32u4RC chips and confirmed: If you are building a custom PC and want to use the 32u4 chip and use the chip's internal clock for your project, simply purchase the 32u4RC version of the chip. Your sketch can be loaded onto the chip via SPI without the need to set any fuses with avrdude.