UNO bootloading breaks with no crystal on Programming

Hi guys,

So I made this bootloader device a few months back, which I use with Nick Gammons great and excellent sketches. Its basically an FTDI thats fits on a board-socket, directly connected to an Arduino Nano Pro 328, with Nicks bootloader sketch on. The Nano then has connections on pin 10-13, to the appropriate pins on a 28pin socket. On this mini-board, there is also room for connecting the FTDI in serial mode, for programming – and a small breakout for programming the 40 pin 324 chip.

Okay, so, there are no crystals on this board. I originally inteded this board for just programming 8mhz ”lilypad” style chips, however, now I need to program a 328 with arduino ”uno” boot loader - that means crystals.

So, the board works like a charm on the fiften 328’s ive programmed so far with lillypad. I then took one of these (working) chips, plugged it in, and bootloaded it with the ”uno” bootloader. It crashed just after ”setting fuses” as far as I recalled, and then died. From now on all I get is the error that it cannot enter ICSP programming mode. My assumptions are, that the loader first sets the fuses for accepting a crystal, and then tries flash the chip – but while doing so, the board must have crystals on it, as this is now the new fuse-requirements.

The thing is, when I plug it into my homemade board with crystals, it works perfectly – if I take out the crystals, it stops working. So it seems the fuses has been set correctly, however I think the internals of the chip, is still Nick Gammons 8mhz HEX loader.

I am thinking the correct way to solve this, would be to add crystal support for my flash-board.

What do you guys think ?

You (probably*) don't need to use a crystal.

If you want to use the internal 8mhz oscillator with a bootloader, set the fuses to use the internal oscillator (low fuses = E2 for the 328p, IIRC), and the bootloader to use an 8mhz bootloader (actually, you can just use the Uno optiboot bootloader, which is 115200 baud at 16mhz - at 8mhz it'll be 57600 and 115200 doesn't work reliably at 8mhz anyway - so just set baud rate in boards.txt entry for your board correctly).

If you have the low fuse set to use a crystal (which is done if you select the uno board and do burn bootloader), you need to have a crystal connected; if you don't want to use a crystal, create a boards.txt entry that sets the low fuse correctly.

*(reason you might being that the internal RC oscillator in the 328p is pretty crap, and sometimes is far enough away from 8mhz that serial doesn't work right)

Hi DrAzzy,

An external crystal fixed it. It seems you cannot use the bootloader tool to fuse an 328 to use crystals, on a board, with no crystal on it. As soon as I remove the crystal and try to fuse it again, it breaks, same place every time.

I have not had a problem using the 8mhz internal oscillator - but thanks.

you cannot use the bootloader tool to fuse an 328 to use crystals, on a board, with no crystal on it

Yes, that's correct. Programming the arduino requires it to have a working clock. Once you program the chip to use a crystal, if there is no crystal present, the clock goes away...

(many more modern chips "solve" this issue by always booting to an internal clock, and requiring that user software switch to the external crystal.)

I believe the reason you are observing this behavior is the bootloader program or ISP programmer makes 2 passes. It first unlocks and erases the chip and sets the fuses, then second pass it resets the chip and uploads the bootloader and sets the lock fuse. When it resets the chip and does its second pass, since the target chip has no clock (internal or external) it does not behave correctly. So you must usually have the target chip outfitted with the supporting circuitry such as crystal which is just like it will have when the chip is finally installed and in-use.

I say usually because Nick Gammon's website does cover how to use pin 9 as a clock wire, which you could use instead of a crystal. So perhaps you just missed one additional wire to hook up to cover what you're trying to do...