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.

Basic Electronics » replace MCU?

December 27, 2009
by noobcake
noobcake's Avatar

Hi, can I just buy any ATmega168 and replace it? Or does it need some special bootloader or formatting? Or do I have to buy them from nerdkits?

I want to buy them from jameco/mouser in bulk or something and then program them via winavr and then pop them onto some pcb to solder them for good and I want to know if I can just swap the ICs (ATmega168) without any special nerdkits formatting/bootloader or not?

Also, second question: could I use ATmega328 / ATmega644 in replace of them too?

Thanks! ^_^

December 27, 2009
by mongo
mongo's Avatar

From what I understand... You could buy them direct but then you would need to have the bootloader installed before you can use them with this particular set of circumstances.

I just bought a couple of the upgraded 368 chips from NK which I believe already have that part done.

I would like to see a schematic and hookup diagram to interface to the parallel port of a PC and how to dump the required firmware to it but I haven't seen much in that as of yet.

Current plans for the next couple of days is to work the 368 into the setup. I'll know then, if the bootloader is installed.

December 27, 2009
by hevans
(NerdKits Staff)

hevans's Avatar

Hi noobcake and mongo,

Mongo is right, we preload the chips we sell with a bootloader. This allows you to reprogram your chips through the USB-Serial interface we describe. If you wish to buy blank chips form a different supplier, you will need to have either an ISP programmer, or figure out a way to get the bootloader on there which can get complicated (although it is possible).

It is very easy to upgrade to the ATmega328, especially ones you pick up from our store. Check out the ATmega328 upgrade nano guide from your downloads section of the members area. The will be a bit more tricky to upgrade because of the different number of pins; it will not be completely code compatible. However once you learn the concepts on the 168, using the 644 will be easy.

Hope that answers all your questions!

Humberto

December 28, 2009
by carlhako
carlhako's Avatar

Good timing on this post i was about to go get a 2nd breadboard, chip etc thinking i could just plug it in and off i go. Will the following be ok to load the bootloader? EBAY LINK

December 28, 2009
by Rick_S
Rick_S's Avatar

That should do the trick. You will have to change the settings in the make file to reflect the type of programmer you are using when you transfer the bootlooader to the chip. I don't know where you are getting your chip from, however, if you get it off e-bay, make sure it doesn't have the arduino bootloader already installed. If it does, you will need to remove that by erasing the chip and update the fuse settings for the Nerdkit bootloader prior to loading it.

If you get stumped, post what happened here on the forum and someone will happily jump in and try to help.

Rick

March 19, 2010
by ese
ese's Avatar

Hi,

When jumping to the EBAY LINK(by carlhako) above I noticed that the (Device Supported List:) does not include the ATmega168. Also it seems, if I remember right , that the Atmel stk500 did not list the ATmega168 as supported either(at some other website). What's the deal?

Also, what is the name of the 10pin connector on the Avrisp programmer, so that I can purchace its female?

mike

March 19, 2010
by ese
ese's Avatar

10-PIN IDC Cable?

mj

March 20, 2010
by Rick_S
Rick_S's Avatar

USBASP is an opensource project for programming Atmel micro controllers. It supports more devices than the list in the ebay link you saw. This link Here for example lists the 168 and 328. There are several different people/companies producing and selling their own version of hardware with the USBASP firmware on the device.

I've built one of these devices myself and it works great with avrdude. Here are a couple of photos's in case anyone is interested.

USBASP on breadboard

USBASP on breadboard

I used an ATMega8 for the mcu since I have a few of those laying around.

And yes the cable is a 10 pin IDC for most of those devices. Some use a 6 pin which is a newer standard. The pin-outs are as shown here.

ISP pinout

Hope that helps...

Rick

March 20, 2010
by Rick_S
Rick_S's Avatar

I forgot to post the link to the Project page. :D

Here is the link where you can find all the source and schematic from the creator. As well as some links to other peoples creative twists on the original.

Rick

March 20, 2010
by treymd
treymd's Avatar

Interesting link Rick. I was under the assumption that Atmega 168s were too slow to do USB themselves, now I am seeing that perhaps I was incorrect. Can you, using usbasp in your firmware, communicate on the usb bus without special hardware?

March 20, 2010
by Rick_S
Rick_S's Avatar

It's not my firmware, I was just providing a link to the project page. However, to answer your question, yes. Most of the Atmel chips can do USB without any special hardware. In the case of the USBASP, the chip is simply clocked with a 12mhz crystal and does a software emulation of USB protocol. It uses very few external components to work as you can see from the photo's.

The USBASP programmer firmware is based on the virtual USB library. Here's a link to that projects page. You'll also find on that page a link to several projects based on the library.

I built a "Prank" circuit I plan to use for an april fools day joke on a co-worker called a Capslocker.

Here's a couple of images of the one I built.

CAPSLOCKER

CAPSLOCKER

Sorry to get this topic so off track....

Rick

March 20, 2010
by ese
ese's Avatar

Rick,

Thanks for the feedback.

Going to the (device support) bookmark in the stk500 user manual PDF:

stk500

It too does not list atmega168. Yet I assume it will work with the -168 as others in the NK forums have purchased the stk500.

I don't think I've run across any kits for the (parallel port ISP). Schematics but no kits.

mike

March 20, 2010
by Rick_S
Rick_S's Avatar

There are a couple listed on e-bay. Was there a specific reason why you wanted a parallel programmer?

March 20, 2010
by Rick_S
Rick_S's Avatar

Also, the manual for the stk500 is dated 3/03. That's probably why the 168 isn't listed. Plus that list was for the microcontrollers supported by their software at that time. Avrdude supports the stk500 and will definitely program the 168.

March 20, 2010
by ese
ese's Avatar

Just confronted with a number of possibilites:

... AVRDUDE supports the following basic programmer types: Atmel’s STK500, Atmel’s AVRISP and AVRISP mkII devices, Atmel’s STK600, Atmel’s JTAG ICE (both mkI and mkII, the latter also in ISP mode), appnote avr910, appnote avr109 (including the AVR Butterfly), serial bit-bang adapters, and the PPI (parallel port interface). PPI represents a class of simple programmers where the programming lines are directly connected to the PC parallel port. ... AVRDUDE

A few thoughts:

-Having an ISP that worked would gain me a bit of independence.

-Money is always an issue.

-Might change the fuse settings where an stk500 would come in handy.

-Could mess up my laptop with a mistake using a,too simple, PPI.

Reading thru the NK Basic Electronics thread concerning ISP's has been very informative. Alot of good energy put out helping FJC. A good read.

March 20, 2010
by ese
ese's Avatar

I do need to reinforce the habit of checking the date on items I read from the Internet.

Thanks.

March 20, 2010
by ese
ese's Avatar

I am kind of interested in the secret NK parallel "hack".

mj

March 20, 2010
by Rick_S
Rick_S's Avatar

It's no big mystery. You've probably seen schematics over the internet. This is a common pair -- one with a buffer one without.

stk200

I just found this real quick... Some people use the 6 pin header others use a 10. The connections by name go to the same pins as shown on the parallel plug. Be very careful if you attempt to build one of these because a bad connection could equate to a blown parallel port on your computer. Also, know that usb to parallel adapters will not work with these.

Rick

March 20, 2010
by Rick_S
Rick_S's Avatar

Whoops, here is the link

March 20, 2010
by Rick_S
Rick_S's Avatar

For some reason a direct link to that redirects, so copy and paste the link...

http://elm-chan.org/works/avrx/stk.png

And that should work :D

March 20, 2010
by ese
ese's Avatar

I don't know that I am wise to make that myself.

Chimp with a stick

March 21, 2010
by Rick_S
Rick_S's Avatar

What is that ?? :D

March 21, 2010
by ese
ese's Avatar

On pg.820 of "Practical Electronics for Inventors" (as inventors go I'm about at the level of a chimp with a stick) is a circuit to run a stepper motor. The picture is the 555 timer section. It does put out a clock but I have been using a clock from the NerdKit lately trying to get the circuit to work. Two more pins of the NerdKit switch a relay at the 74194 DPDT to control direction. The circuit kind of works, but when I turn off the clock and the motor stops it doesn't restart upon restart of the clock- until I manually disconnect and connect pin 9/10 (depending on the direction) of the 74194.

March 21, 2010
by Rick_S
Rick_S's Avatar

It's just kind of hard to see what you had going on there. Is that the 555 timer attached via wires to screws on a board?? I'll give you an A+ for ingenuity!! BTW, many small stepper motors can be controlled with the micro-controller thru a driver such as mosfets or a darlington array. The wiring will vary depending on the stepper. As far as the programming goes, all you need to do is generate a cascading bit pattern on the outputs to make them go forward or reverse.

I've played a bit with a couple of old 4 wire steppers removed from old 5-1/4" floppy drives. It's interesting to see them run.

If we want to talk about that more however, we should probably start another thread to try to keep this one on topic.

Rick

March 21, 2010
by ese
ese's Avatar

Rick,

I just started a thread. "Stepper motor - Stepping Stone". Please join me.

mj

July 24, 2010
by kle8309
kle8309's Avatar

I was wondering if is it possible to accidentally corrupt the bootloader by bad wiring or bad coding. I bought the NK recently and succeeded with the first temp sensor project but now it won't make any thing. Im using programming notepad. I even tried to simplified things by just doing the led mini-project (with source code given, I only modified the COM). Still it won't make.

Connecting to programmer: .

Found programmer: Id = "Ö ""; type = k Software Version = . ; Hardware Version = . avrdude: error: buffered memory access not supported.

Any idea?

July 25, 2010
by Ralphxyz
Ralphxyz's Avatar

kle8309, unplug your USB cable and replug and of course my favorite reboot!

Ralph

July 29, 2010
by kle8309
kle8309's Avatar

Ralph, I don't think unplug and replug will do much (already tried it before). You said "and of course my favorite reboot!". Did you mean I should try to reload the bootloader again? I still waiting for a shipment of the avrisp stk500 programmer.

July 30, 2010
by Ralphxyz
Ralphxyz's Avatar

kle8309, I have seen "similar" errors after everything was working. My solution has always been either unplug and replug the usb

and/or a reboot. Sometimes it takes a couple of tries.

Sorry I cannot be of more help.

You should search the NerdKit forums for "buffered memory" you will see a lot of related threads.

Ralph

January 26, 2011
by Jalex
Jalex's Avatar

Hi I would like to know why the bootloader procedure has to be different than programming. Are the levels dirrerent or do something different to protect the bootloader from removal or what? I have seen programmers with just a few diodes and resisors. What is really needed? I am a bit confuesed about this whole procedure. I think the bootloader is there to let the chip execute a program loaded in flash. Is this correct? I am use to programming for an operating system like windows and know very little about what the computer does with the programs I write them.

Post a Reply

Please log in to post a reply.

Did you know that a NerdKit can take control of a remote-controlled car? Learn more...