7
\$\begingroup\$

If I upgrade my arduino from the ATMega168 to ATMega328 will I be able to use the ATMega168 like a stock chip from the factory or will the bootloader prohibit this? In other words, will I be able to overwrite the bootloader, with my usbtiny ISP programmer, on the 168 to use as a Atmel stock chip with Avrdude?

Is there any special steps I would need to take like reseting fuses?

\$\endgroup\$

3 Answers 3

4
\$\begingroup\$

Yes, you can reprogram the chip. I did the same when I upgraded my Arduino from a 168 to a 328 two weeks ago. The chip works great in another application.

Take note, of course, that you may need to change fuses depending on what kind of board you had and what kind of board you are moving it to. The most common, I would imagine (and the ones I had to reset) dealt with changing to the internal oscillator and setting dividers instead of using an external crystal. There is no comprehensive list of fuse changes, though, because it depends on what kind of circuit you're moving the chip to. YMMV.

--Edit-- As JohnC said, yes, reprogramming of fuses should be done BEFORE you remove it from the Arduino. Since the Arduino is fused to use an external oscillator, the chip will not do a darn thing if placed on a board without an oscillator.

\$\endgroup\$
3
\$\begingroup\$

I would reset the fuses to factory default whilst the 168 is still in the Arduino board. If the fuses are configured for an external oscillator (as they are in the Arduino) and there isn't one then you will not be able to re-program without using a high voltage programmer. Setting to factory default sets the chip up to use an internal oscillator.

\$\endgroup\$
1
\$\begingroup\$

I've done this - pulled the 168 from an arduino, programmed it with the USBtinyISP. You'll need some form of target board for the USBtiny ISP. I used one of these from Evil Mad Scientist Labs, along with a ZIF socket from Sparkfun. The actual circuit needed to program them is simple enough that you can build it on a protoboard without much trouble. EMSL also has a handy article on just what that circuit needs to be so you can DIY.

In order for a target board to work, it needs to be set up with at least an approximation of how the chip is already fused. That means having the right amount of power (if the brownout detection circuit is enabled) and having an oscillator if the chip is set to use an external one (AFAIK the chip will ignore an external oscillator if not fused to use it). You either need to first set the fuses to use the internal oscillator before removing from the Arduino or put an oscillator on your target board. I don't think the Arduino comes with brownout detect enabled, so you're probably safe on that score. I'd suggest just using the jumper on the USBtiny to supply power to the target board, rather than bothering with an external power supply.

I can't recommend using the Arduino board as the programmer target because it has a normal socket instead of a ZIF socket. I find that I'm much less likely to mangle the pins on my MCU when I use a ZIF socket. Going in and out of a breadboard is bad enough. Sparkfun seems to have the cheapest prices on ZIF sockets, if you decide to go that route.

Since you already have an ISP programmer, you can save a little money on your 328 chip and buy one without the Arduino bootloader. Just use the Arduino software to burn the appropriate bootloader to it once you've got it installed.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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