NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Upgrade from the ATmega168?

September 27, 2010
by oldictguy
oldictguy's Avatar

Hi, I am out of I/O pins! I could also really do with another USART input...

What is the best device to upgrade too - I really only need an extra 6 input pins (looking at putting in a touchscreen LCD), a total of 6 ADC inputs, and a second USART.

How would I get the bootloader on there?

September 27, 2010
by oldictguy
oldictguy's Avatar

It looks like the ATmega324 is the next 'size' up - with a 40pin PDIP package.

How would I get the bootloader on here, so I can continue to program the same way I have done with my 168/328 I have got from Nerdkits?

Thanks!

September 28, 2010
by Rick_S
Rick_S's Avatar

To do this, you have to make several changes to the boot loader files to use the new chip. 1st thing I'd do is make a copy of one of the boot loader folders so the originals remain unchanged. Then you can modify at will. You will need an ISP programmer to set the fuses properly and get the boot loader on the chip initially.

Here is a link of one of the other members here who put the boot loader on a atmega325. This may give you some insight as to what will have to be done.

Rick

September 28, 2010
by oldictguy
oldictguy's Avatar

The other thread had some good information on setting up the files, thanks.

What ICSP programs support using the USB cable supplied with the nerdkits?

September 28, 2010
by Rick_S
Rick_S's Avatar

Depending on what you have computer wise, there are several options available. If you have a true parallel port in your computer, you can make a simple parallel port programmer (called DAPA) If you don't have a true parallel port, you can either build or buy a USB based programmer. They are available from several vendors on ebay as well as several elecronics stores online. I use a kit based USBASP programmer these days - I got it on ebay.

Rick

September 29, 2010
by oldictguy
oldictguy's Avatar

Can you use the USB cable supplied with the nerdkits kit?

What pins does the ICSP connect to on the ATmega?

September 30, 2010
by Rick_S
Rick_S's Avatar

The ISP (In System Programming) devices connect to Pins 17 (MOSI), 18 (MISO), 19(SCK), and 1(RESET), as well as VCC and GND. They cannot be directly programmed with a TTL serial connection the USB Nerdkit cable provides. There are home brew serial programmers but I believe they require a true full serial port on the pc (it uses the DTR and CTS signals as part of the communication). If you have a trues Parallel or Serial port on your pc, search the web for "DAPA AVR" (for homemade parallel programmer), or "DASA AVR" (for a homemade Serial programmer). Both require a real port on the pc to work not a USB to Parallel/seral adapter.

Avrdude will program through these. If you are unsure at all about building something like this, spend the $20 and buy a programmer on ebay or your favorite electronics shop, because a bad build could mess up your chip or worse yet, your PC.

Rick

September 30, 2010
by oldictguy
oldictguy's Avatar

I'll probably get a USBTinyISP from adafruit, which provides power and uses the SPI interface.

Once hooked up, can I flash with the bootloader that is provided by Nerdkits? The pin that is used for determining programming mode (pin 14?) - that will then be the same on the new ATmega1284?

Thanks

October 01, 2010
by Rick_S
Rick_S's Avatar

The programming pin is determined by the bootloader code. The way it is setup for the Nerdkit, it uses PB0 or Pin 14. As is, PB0 is located at pin position 1 on a ATmega324 or ATmega1284. Remember, when using a different chip, it isn't the pin number you would go by but the pin function that is equivalent. For instance in all the Nerdkit projects with a 168 or 328, pin 1 is reset. On a 324 or 1284, pin 9 is reset.

Not only will you have to modify the bootloader code to be configured for the 324 or 1284 (whichever you are getting), you will have to determine what fuse bits need to be set so that once installed, the bootloader code will not get overwritten. These fuse bits most likely won't be the same as for the 168's. They even changed between the 168's and 328's. To find what they need to be set at, you'd have to compare datasheets and program accordingly.

One last thing, programming these chips with an ISP programmer can easily render a chip useless if done wrong (especially when programming the fuse/lock bits). Improper configuration can lock the chip down to a place where only a special high voltage programmer can resurrect it. So please be 100% sure before you do it. :)

Rick

October 03, 2010
by oldictguy
oldictguy's Avatar

Eeeep!

Is anyone able to give me a hand in setting the 1284's fuse bits? I'll be able to get the hardware sorted out, and probably have a good understanding of the bootloader code - but would love more information surrounding these fuse bits!

Thanks for your help so far Rick!

October 03, 2010
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi oldictguy,

There's a file "fuses_mike.txt" in the bootloader directory where I describe which fuses I have set with a short reason why. Hopefully that will help get you started in mapping those to a different MCU.

Mike

Post a Reply

Please log in to post a reply.

Did you know that you can adjust most wire strippers to make it easier to strip insulation faster? Learn more...