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.

Support Forum » ATmega168

January 13, 2010
by Arik
Arik's Avatar

How do I get a ATmega168 (for sake of argument, and ATmega328P) that I found else where, work with the same code; or work just like the ATmega168 I bought with my NerdKit?... I really just want them to play nice together, the NerdKit way...

I read through some posts about flashing a new bootloader, but none of the posts I saw asked/mentioned my exact question...

I am a n00b on this stuff, so hopefully when I mentioned "flashing a new bootloader" doesn't sound completely off base with what I am trying to acomplish...
If I am completely out in left field and all I need to do is push my code to the new MCU with out any changes, that would be really nice and easy, but I am really not that confident thats the case. So let me know either way....

Thanks in advanced!

January 13, 2010
by Rick_S
Rick_S's Avatar

It really depends on where you got the chip and what if anything is on it already. Either way you are correct that you will have to flash the NK bootloader onto the chip to have it act like the NK chips. To do this, you will have to have what is called an ISP programmer. This programmer connects to the chip and is capable of setting up the chip properly (adjust the fuse settings) and will also allow flashing with the bootloader.

The programmer provided with the nerd kit will not do that. There are many sources for ISP programmers and if your pc has a real parallel port (Not a USB to Parallel adapter), you can build one pretty easily. E-mail the NK-guys and they will send you the info on how to do that.

Once you have the programmer, you will only need to power the chip and attach the programmer to the appropriate legs to set the fuses and flash the NK bootloader. BTW, the NK bootloader is included as part of your download. They have a version for the 328p as well.

If however, you purchased a chip that already had a bootloader (such as arduino) on it, you will need to place your crystal as shown in the nk guide as well as the power connections. Then do a chip erase, then set fuses and flash.


January 13, 2010
by Arik
Arik's Avatar

I am not sure where the MCU came from or if there is anything already on it... What do you mean by "set fuses"? Hopefully after I hear back from the NerdKit staff, I will better understand the process and what "set fuses" means...

Thanks for the info and will send the NK guys and email right now.

January 13, 2010
by Rick_S
Rick_S's Avatar

The fuse bits in the chip are what configures the chip. They can be configured many ways to set the chip up for a bootloader, internal / external oscillator, etc...

If the chip is new and never been programmed, the fuses simply need to be set to what is needed for the NK bootloader and the bootloader needs loaded.

If the chip has been programmed before, or has an arduino bootloader installed, you may need to do a chip erase, then set the fuses and program with the bootloader.

If you look in the bootloader folder in your code folder, you will see a file called MAKEFILE.

This file contains:

AVRDUDEFLAGS=-c dapa -pm168

all: fuses install

    avrdude ${AVRDUDEFLAGS} -U lock:w:0x2f:m
    avrdude ${AVRDUDEFLAGS} -U efuse:w:0x00:m
    avrdude ${AVRDUDEFLAGS} -U hfuse:w:0xd5:m
    avrdude ${AVRDUDEFLAGS} -U lfuse:w:0xf7:m

    avrdude ${AVRDUDEFLAGS} -U flash:w:foodloader.hex:a

There are two sections fuses: and install:

If you just run make, it will first set the fuses then install the bootloader. This will work on a new chip. If you use a homebrew parallel ISP programming cable, you won't even need to change the makefile settings. Otherwise, you will need to replace the -c dapa with -c (your programmer).

Hope this helps somewhat... Any other questions just ask.


January 13, 2010
by Farmerjoecoledge
Farmerjoecoledge's Avatar

Could you tell us more about "your" code and what you know of the chips? maker, family etc.

Just to add my two bits. The fuses are changed by the bootloader from default. This is done for the bootloader to reside in program space, and run serial communications.

If you go the isp way the software handles everything. Just install the driver hook it to the board and use PN and 'make all' to flash it. That's it the fuses remain default or are set back to default by the software. Just like Rick is saying except, Rick you know that the bootloader changes the fuses, I learned this from you.

January 14, 2010
by Arik
Arik's Avatar

To be honest I don't have any code yet... just have been playing with other code and putting it on my NerdKit playing around with it. Like I said I am a n00b and am not familiar with this stuff at all. Well, not a 'complete' n00b... I have been known to play around with a soldering iron now and then putting my own hacks together... Mostly modding to make things smaller In college, I took a few languages... Java, PHP, C#, Perl, SQL,... But its been 8 years since I had to look at any of them...

I do not know anything when it comes down to the actual chips, volts, resisters ect. Right now I am just trying to get my feet wet, and relearn C so I can use the NerdKit properly. With this post, I am trying to figure out how to get other MCUs to work like the NerdKit does so I can get them to work together. The MultiLED display with 5 MCUs was a big help to see that it is possible... still not sure how exactly it works, but at lest now know its possible. My biggest problem is I am not sure what is all capable with this kit...

Thanks for any help/advice you guys can give me. I know after I get a few little things put together I will be asking you guys lots of questions/advice in the future.

January 15, 2010
by Arik
Arik's Avatar

I found an old adapter for the device side of a console cable for old CISCO switch, that just so happens to plug perfectly into a parallel port... As long as the pin outs are all numbered the same, I shouldn't soldering this thing up...

Thanks for your help!

Post a Reply

Please log in to post a reply.

Did you know that you can make a capacitive proximity sensor with some aluminum foil and paperclips? Learn more...