Go Down

Topic: Using empty UNO board to program external ATmega328 (Read 2 times) previous topic - next topic

Loudhvx

I wasn't sure if this could be done, but apparently it can.

I pulled the atmega328 out of the UNO board. Put it into a circuit on a breadboard (with crystal and two caps) to drive a stepper motor circuit. Then I jumpered the reset pin on the ATmega328 to the reset pin on the UNO. I also jumpered the RX pin and TX pin similarly. Finally I also jumpered a ground to ground in the same way.

I did not use D0 or D1, so there was no conflict with external circuitry on those pins. The ATmega328 is powered externally at 5v and the UNO board is powered through the USB cable.

I was able to upload sketches just as if the ATmega328 was still in the UNO and it ran great. It never failed to upload new sketches or run them.

My question is, can I rely on this method, or is there a potential conflict between the UNO's crystal clock and the ATmega chip's external crystal clock?  In other words, if the two clocks were to be too far off in frequency, would longer sketches possibly fail to upload correctly?

retrolefty

I would think you should be able on counting on it to work long term. There is always going to be slight speed variation between crystal to crystal and even more so between resonators. And the new Uno bootloader program works at yet a high baudrate then prior boards. However USART characters 'resync' their bit sample timing with each new start bit, so there is still tolerance for slight speed mismatch.

Loudhvx

Thanks for the reply.
Well, that is good news.

Also, I should mention in case anyone tries it...

If the UNO is unplugged from the computer, it has no power on it and tends to drag down the reset line, even with a 10k pull up on the Atmega328's reset pin, so I had to disconnect the reset line from the UNO to get the breadboard circuit working when the UNO is powered off.

It may even require powering off the ATmega328's circuit to get the reset to work again... not sure why, just something I noticed.

tim7

Can this technique be used to program an ATmega328 with a non-Uno bootloader?
For example, can I use an Uno board (minus microcontroller chip) as a USB-to-Serial programming interface for something like the Arduino Pro-Mini?  (The Pro-Mini board uses the ATmegaBOOT, whilst the Uno uses Optiboot, AFAIK)

MarkT

Quote
If the UNO is unplugged from the computer, it has no power on it and tends to drag down the reset line, even with a 10k pull up on the Atmega328's reset pin


That's possibly solvable by adding a 100nF in series, so that only fast downwards edges pull it down.
[ I won't respond to messages, use the forum please ]

Go Up