NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Project Help and Ideas » My Nerdkit is an ISP Programmer
June 27, 2011 by Noter |
I've been working on this for a while and I think it is in good enough shape to post. It's a program that will turn your nerdkit into an ISP (In System Programming) programmer. You can use the Nerdkit ISP programmer to load the bootloader onto new chips and set fuses for different clock rates as well as all of the other fuse values. Just be careful with thoses fuses because if you disable the SPI programming interface or the reset pin you won't be able to program the chip again without a high voltage programmer. A good starting place on how to use an ISP programmer is Rick's tutorial on installing the bootloader. The code is fairly well commented too so go through it for the finer details. The program along with my makefile will be posted below. BAUD and F_CPU must be defined in the makefile and passed to the program during compile so if prefer to use the basic nerdkit makefile be sure to add the definitions. Just compile it and download it to your chip then run and it's ready to use. I also use a custom definition file for avrdude which I have also posted. In it I've defined the ISP programmer and given the same names to mcu's that gcc uses so I don't have to have more than one device defined in the make file. The last makefile is one that I use to compile sources in the nerdkit library and build the .a library file. You can see in my makefile how to use a library instead of individule .o object files. Hope it works for you. I'll answer questions as best I can. |
---|---|
June 27, 2011 by Noter |
|
June 27, 2011 by Noter |
|
June 27, 2011 by Noter |
|
June 27, 2011 by Noter |
|
June 27, 2011 by Noter |
By the way, the Z command to select a port for the multi-port programmer is not functional. I may put the code back in at some point and if so I'll post it. |
June 27, 2011 by hevans (NerdKits Staff) |
I think this project would work really well in the Library somewhere, that way folks can reference it without having to find this thread. Humberto |
June 29, 2011 by Noter |
Hi Humberto, Ok, I guess I need to byte the bullet and get going with the new library ... for now I've just put a couple of links to this thread in there but in time I'll move the whole project in and tune up the directions. |
July 07, 2011 by Noter |
Here's a pic of the nerdkit programmer. It's hooked up for programming a tiny85. The program I am working on for the tiny85 is small and downloads in about 2 seconds. It's just a basic nerdkit with a few changes. The power regulator is moved to another small breadboard, a reset switch has been added, replaced the slider with a push button for programming mode, isolated the usb yellow wire voltage with a couple of mosfets, and upgraded to a 18.432 Mhz crystal. However, none of these changes are necessary to use the nerdkit as an ISP programmer. |
July 07, 2011 by Rick_S |
Noter, what are you doing playing around with 120VAC on a breadboard... Don't you know they're not rate for that
(at least mine aren't) Mine are only rated at 36V 2A. PS... Just giving you a hard time, even though mine aren't rated for it, I built a 4 channel lamp dimmer to drive Christmas lights last year... Though I never really used it, it was fun to see it work. Rick |
July 07, 2011 by Noter |
Heck, it didn't even occur to me that my breadboard might go up in flames! I must be lucky cause it's working ... I have several little projects that rely on switching 120VAC and I didn't want to use relays so I've been figuring out triac's. I started this one with 24VAC and once it was working moved over to 120VAC for the final test. It is dangerous though, stuff doesn't just smoke with 120VAC, it flashes - poof! |
July 07, 2011 by Rick_S |
Now just create a zero cross circuit, feed it into INT0 and setup an interrupt on it. Then create a time delay for a dimmer. Fun stuff :D Rick |
July 08, 2011 by Noter |
Yep, that will be fun! I'm going to do it! I am thinking of using the analog comparator on the atMega for the zero cross detector. Just a simple voltage divider (150K - 2K)to get the AC down to a couple of volts and then right into the comparator. Will that work? |
July 08, 2011 by Rick_S |
I used a zero cross optocoupler off low voltage AC into PCINT0 so it generated a pulse. Actually if you look at my avatar, that was me checking my circuit (see the spike at each zero cross). That was done back in my atmega8 days using the BASCOM compiler. I could control 4 triacs each at a different brightness level by sending serial data from hyperterminal. I forget exactly how many different levels I got, but it was plenty to be smooth looking from full on to off. I believe what I did was setup a timer that was tripped on each pulse. Then I would turn off all channels and then based on how bright the light was to be, I would turn them on at different times in that cycle. At least that is the best I remember. I lost the hard-drive I had most of my BASCOM stuff on and after getting into C, I haven't really moved back. Rick |
July 08, 2011 by Noter |
Ok, it works perfectly! I set the comparator to interrupt on output toggle and then toggle PB0 so I can view it on my scope which by the way must be the about oldest scope in the world. I used a 150K and 150 ohm for the voltage divider and fed less than a 1VAC into AIN1. AIN0 is GND'ed. My little test program compiles to a 180 byte .hex file.
|
July 08, 2011 by Rick_S |
How did you hook AC up to the ADC... what did you reference it to for ground. Did you run it through a bridge first to keep both the upper and lower phase positive in relationship to ground? Just curious. Looks like you are well on your way to making a dimmer |
July 08, 2011 by Noter |
I connected 120VAC neutral to DC GND. I have DC coming from a wall transformer so my DC supply is completely isolated from the AC until I connected the neutral line. Same would apply to a battery supply. I did not run the AC thru a bridge or anything. The 1st try I had a few volts ac going to AIN1 and I saw clipping on the negative side and I assumed it was clipped by the protection diode on the pin so I reduced the AC voltage until it was less than the clipping voltage and it was no longer clipped. Would have worked anyway but didn't look so nice on the scope. It's about .37V peak to peak now so only goes about .18v negative. The scope is set on .2v/cm for the AC and 5v/cm for the square wave. |
July 08, 2011 by Rick_S |
I know that's ok, I just do my best to keep negative voltage out. I know the Absolute max negative on any pin is -.5V with respect to ground. I also know that the Atmel note AVR182: Zero Cross Detector takes advantage of the built in clamping diodes. They wire theirs differently than you did but similarly too. I just prefer the optocoupler. But obviously either way works and your way is probably less expensive component wise. I do like having the clean pulse totally isolated from the AC side of things though. I might have tried the app note from Atmel except I happened to have harvested a couple zero cross optocouplers from old 300bps modems --- (Yes I know technically they were antiques ) It will be interesting to see how it works out for you. Do you have a project in mind or are you just playing?? Rick |
July 08, 2011 by Noter |
The Atmel version is interesting but triggers at ~VCC/2 volts so it's late on the rising edge and early on the falling edge. Using the comparator triggers spot on at the zero crossing in both directions. I have a few projects that involve heating elements. I want to be able to heat just a little when the temp is close to the target vs the way thermostates work these days with a few degrees under then a few over. One is for outside water troughs to keep them from freezing in the winter. Another is for a counter top proof box which hopefully will allow improvment in my bread making efforts, especially in the winter when the kitchen is cooler. And the last is accurate temp control for an incubator. |
July 08, 2011 by Rick_S |
Sounds like fun projects. Bread can be fun to get to rise in the winter - I've run into that as well. |
July 09, 2011 by jabelch |
Hey Noter, I am trying to get your programmer code to work properly. I successfully programmed my Nerdkit with the ISP code, but I'm having difficulty getting it to program another chip. Is there anything glaringly obvious that I'm doing wrong? Here is the output I'm getting.
|
July 09, 2011 by jabelch |
Alright, so I figured out my first error - I switched my MISO MOSI wires and it started recognizing it. MISO goes to MISO and MOSI goes to MOSI. Now, I am getting a different error when trying to program the Nerdkits bootloader. I added the -e command to the bootloader Makefile and that works just fine, but when it tries the lock command, it fails to correctly write to the chip.
|
July 09, 2011 by Noter |
Way to go! I'm glad you have it working! Looking at the datasheet, bits 6 and 7 cannot be written and will always be read as a 1 meaning they are unprogrammed. 0x2F is 0xEF with bits 6 and 7 set. So I think what you really want to do is set the lock byte to 0xEF and then avrdude will be happy. |
July 09, 2011 by killercow |
Noter, Thanks for posting your project here. I have to laugh at myself cause I spent a few hours copying and pasting the code from the webpage....and know I found that there is a 'View Original' link that allows one to copy the code and paste it without needing to edit it. LMAO!!! Oh my, I just want to try this out. I'll post my reults. Killercow - a.k.a. Kevin |
July 09, 2011 by Noter |
Ok Killercow, glad you are going to take the plunge. I know my makefile and use of the avrdude config file is not standard practice so maybe jabelch will post his makefile and save you some time. |
July 09, 2011 by killercow |
That would be nice Noter as I'm lost. Could you post screen shots of your directories as to where and the names of the code files are at. That might get me further. Thanks for the help. Kevin |
July 10, 2011 by jabelch |
Here is my Makefile, I liked how Noter uses variables for the MCU and everything else. It makes it so you can easily change parameters.
|
July 10, 2011 by jabelch |
The previous makefile is to initially program your Nerdkit with the AVR ISP code. Once that works you'll take the 'avrdude.conf.in' code from above and save it somewhere. I named mine avrconfig and put it in the same folder as the AVR910 project (ISP Programmer) but you can put it anywhere. Find the bootloader328p (or 168) project folder and open the Makefile. Here is what I have. -c tells it the type of programmer, -C tells it where to look for the config file. the .. just tells it to go up one directory from the bootloader folder so it can find my 'ISP Programmer' folder. I also added line 6 - it erases the chip before doing anything else (got that from Rick's Tutorial).
|
July 10, 2011 by jabelch |
Noter, thanks for such an awesome project. I always wondered why I couldn't just program my existing chip to be a programmer... obviously there was a lot of work involved. I'll try out your suggestion when I get a chance and post my results. |
July 10, 2011 by jabelch |
killercow, I'm sorry I wasn't more specific right off. I won't post a screenshot, but I'll explain my structure - hopefully it will help. I created a new project directory in my code folder named 'ISP Programmer'. I saved Noter's first set of code there as 'AVR910_Noter.c', I modified his second code block to come up with the Makefile (see my post above). His third code block is the config file. I named mine 'avrconfig' and put it in my 'ISP Programer' folder. I ignored his fourth code block for now(hence why I had to modify the Makefile) If you haven't downloaded the 'booloader168' and 'bootloader328p' folders from this site, do so. I saved them in my code folder as well. Each of them have a Makefile that needs to be edited to point to the 'avrconfig' file and to tell it what programmer you are using. Hope this helps clarify the structure, I'm more than happy to respond to any questions. Now hopefully I can get my chips programmed correctly! |
July 10, 2011 by Noter |
Glad you like it. After I got it going the 1st thing I did was put the bootloader on several chips so I would have a backup in case my nerdkit mpu died (or was killed by mistake). Turned out to be a good plan because I did accidently fry it one day with 12v on the power rail. Thanks for sharing your makefiles and advice as I'm sure that will help Kevin and others get going with the programmer. |
July 10, 2011 by jabelch |
Noter, I changed the lock to 0xef but then the efuse was doing the same thing. I changed it to 0xfd... everything seems to work, I was able to program a few chips and each of them was able to program the next in line. Success! I'm just starting to wrap my head around fuse setting. Do you have any references (forum posts, datasheet pages, etc...) that can get me on the right track? I'm not sure where to start. |
July 10, 2011 by jabelch |
Also, any insight on changing the clock frequency for the bootloader? I have an extra 20 mHz crystal that I though I would use for a dedicated ISP Programmer. Would I be better off directly programming the chip as an ISP programmer? |
July 10, 2011 by Rick_S |
I don't know if I'd go with the 20MHz crystal. I prefer the 18.432MHz. The reason being, like the 14.7456MHz, it is evenly divided by standard baud rates giving error free serial communications. If you want to do this, check out my Installing the bootloader on an ATMEGA324 thread. I show in that thread what changes to make to the standard files to not only change the crystal frequency, but to also change the micro-controller. You can use the frequency portions for any 328p or 168. Rick |
July 10, 2011 by jabelch |
Thanks Rick. I always wondered why we used the 14.7456MHz crystal speed. I like the idea of expanding to other chips, especially something with more ports. Where did you purchase the 324p? |
July 10, 2011 by killercow |
Hey jabelch and Noter, I got Noter's code into my 328p now. I did find out that make needs TABs and not spaces in the makefile lines of 24 trhu 32. I have to stay away from Notepad and stick with Programmers Notepad 2. Line 23 I needed to add _Noter. On to more programming. Thanks for the all the help! Kevin / killercow |
July 10, 2011 by Rick_S |
Mouser electronics. It's pretty much like the atmega328p the upgraded NK has but with a lot more I/O. It comes in handy if you want to add a bunch of switches or need a bunch of outputs for some reason.. Rick |
July 10, 2011 by Noter |
I posted my bootloader if you would like to give it a try. Needs a couple of mods for the 324p but might be easier than changing the nerdkits version. AVR109_Noter I used a 20MHz crystal on my nerdkit for awhile but then I did drop back to 18.432MHz for the better baud rate match. Now days most of my projects use the 8MHz internal clock which is even worse on baud error rate but then I don't need a crystal and have two more I/O pins to use. With 8MHz and my PC I either have to drop back to 38400 or bump up to 250000 for it to work. Another thing I do is go to a .05uf bypass capacitor once I go over 16MHz. The .1uf is good 8MHz to 16Mhz. The .05uf is good 16MHz to 32MHz. For reference on fuses and everything else I rely heavily on the Atmega48/88/168/328 datasheet. There are also several fuse calculators on the web that come in handy too. I like http://www.engbedded.com/fusecalc/. |
July 17, 2011 by killercow |
Hey Noter, I'm getting the same error jabelch was getting:
I moved the setup to a breadboard just in case the printed circuit board I'm using was missing anything. Well, I get the same results. I did notice in your picture above, that the pin 1 (/reset) of the ATTiny chip was going to what looks to be pin 16 on the 328p, is that correct? Or maybe a one to one pin to pin wiring guide for you-know-who...lol. It's just the ISP header that has me lost right now. Thansk for any info, Kevin / killercow |
July 17, 2011 by Noter |
Yes, pin 16 (PB2) goes to the reset pin on the target chip. If you're going between two atmega168/328 chips then the spi wires connect straight thru from the programmer to the target. Pin 19 to 19, 18 to 18, 17 to 17, and then reset will be 16 to 1. Going to a different target chip will be for the same signals but on different pins like you see on the atiny. |
July 18, 2011 by killercow |
Thanks for clearing that up Noter. I thought i was going crazy. Okay, at this point I don't think it's a wiring issue (I'm going to move back to the proto-typing board and use pin 16(PB2) to pin 1 on the target. I'll try to post a picture of my hook up just for thrills and giggles. Off to the bat cave! |
July 18, 2011 by Noter |
Glad to help. I'd like to see a photo of your setup. I think your error from avrdude is because you are not using the custom config file and by default avrdude does not have atmega328p. Add "-C ../libNoter/avrdude.rs " to your avrdude command line but instead of libNoter, use the directory name where you have put the .rs file. However, it's not required to use the .rs file, jabelch posted his makefile above and he doesn't use the .rs file and instead uses the "m328p" mpu name. It may be easiest to use his makefile. |
July 18, 2011 by killercow |
I'll have to charge up my camera. I've been looking over the instrcutions for posting here, I think I can handle it... Anywho, I did follow jabelch's lead on the name and position of the avrconfig file. Avrdude reads it, displays your title HW/SW versions and then it seems to take a minute or so to display the error message, still getting it. Here's an interesting note though, I mis-typed the chip # in the makefile, and make did display the 3 chips that were supported and I guess that's pulled in from the avrconfig file. I'm using the PCB that Starwarslegokid designed. It was posted under here. I'm able to pull all 4 lines plus Vcc and Gnd over to my breadboard with the 328p chip in it. Now, shouldn't one be able to upload the bootlaoder again to a 328p that already has the NK bootloader in it? Also, I saw on Rick_S's tutorial, that he has the crystal/capacitor and 10K resistor still in-circuit, do you think that might be my stopping point? I'll try to get a few photos up tomorrow after I get home from work. Kevin |
July 19, 2011 by killercow |
Noter, look! The monster, it lives!!!!!!! Muahahahahahaha! It must have been a few things.. Like, a lose wire on the target breadboard (zif socket will be ordered) and posssibly the way I was understanding the 5x2 header. I'll investigate more. but, it does work! Yippeeee! Sorry for the size of the photo. I wanted to capture the wires clearly. I'll change my settings the next time. And a big thanks to Humberto and Mike for putting all this (Nerdkits) out there for us! Great job! |
August 07, 2011 by jabelch |
Noter, So now I am wanting to use this to program an Atmega8 with usbasp firmware. How would I go about adding that to your configuration file? The reason why is I had ordered one of the programmers from fun4diy.com (about a month prior to you posting your code) but did not specify that firmware. Since I have Win7 it doesn't work for me with the avrisp mkii firmware. |
August 07, 2011 by kayrock |
Hey noter, nice work. I am trying to get this to work. I compiled your code and have it running on a chip, and set up a new blank chip for it to talk to. avrdude -c "AVR ISP" -C avrdude.conf -p ATMEGA328 -b 115200 -P /dev/cu.usbserial -e I get the command series "SVvpab", and fail on 'b', trying to enter programming mode, so I think that something isn't working with the SPI communication. I have a 14.74 crystal on the master chip and assume that the slave chip is running 1Mhz internal? The contents of SPI_Reply are "0xAC, 0x53, 0x00, 0x00" |
August 07, 2011 by kayrock |
Ok, so if I take out the 10K resistor on row 17 ( from +5v to pin 1 of the slave chip ) it is able enter programming mode. ( That shouldn't be the case, right? ) Now the signature I get back from my chip is 0x1E 0x95 0x14, and using google I realized that I just bought a bunch of ATMEGA328 chips, not ATMEGA328P. After changing the device signature in the programmer and avrdude conf, it is getting closer to working, I can erase the chip! Unfortunately, I can't write the lock fuse... avrdude -c "AVR ISP" -C ../noter/avrdude.conf -p ATMEGA328 -b 115200 -P /dev/cu.usbserial -U lock:w:0x2f:m Found programmer: Id = "AVR ISP"; type = S Software Version = 3.0; Hardware Version = 0.1 Programmer supports auto addr increment. Programmer supports buffered memory access with buffersize = 128 bytes. Programmer supports the following devices: Device code: 0x03 = ATMEGA328 avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e9514 avrdude: reading input file "0x2f" avrdude: writing lock (1 bytes): Writing | | 0% 0.00s ***failed; avrdude: 1 bytes of lock written avrdude: verifying lock memory against 0x2f: avrdude: load data lock data from input file 0x2f: avrdude: input file 0x2f contains 1 bytes avrdude: reading on-chip lock data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: verification error, first mismatch at byte 0x0000 0x2f != 0xef avrdude: verification error; content mismatch avrdude: safemode: Fuses OK avrdude done. Thank you. make: *** [fuses] Error 1 |
August 08, 2011 by jabelch |
So I found the Atmega 8 information in the avrdude config file so I'm good to go there, still working on getting it talking though. kayrock, it looks like you had a similar problem as me (look at post on July 9). Just change your fuse settings to match what it expects (0xEF). The top bits are 1 by default. |
August 08, 2011 by kayrock |
Thanks jabelch. I think that should work. Unfortunately, I am using osx and the driver for the usb serial adapter has always been very flaky ( I have to unplug it every time I run avrdude ) I haven't been able to get noter's bootloader to work, yet. My friend tristan just gave me a tuxgraphics stk500v2 programmer today, and it works great with the virtual comport driver from http://www.ftdichip.com/ I was able to put the nerdkits bootloader onto 3 atmega328 chips. I had to use the -F flag with avrdude, because the signature 0x1e9514 is different from the m328p 0x1e950f, but otherwise the chip seems to work exactly the same. |
August 16, 2011 by missle3944 |
Can I use the atmega168 to program the 328p? |
August 17, 2011 by missle3944 |
Hi guys, I'm new to all this stuff and I'm kinda confused. I cant get the code to make on my atmega168 because it says "makefile:24 ***missing separator. stop. " I checked line 24 but i dont know what to put there...
|
August 17, 2011 by missle3944 |
Ok guys, I fixed that one by just tabbing instead of spaces. But now it says "make:***no rule to make target 'AVR910_NOTER.HEX',needed by 'AVR910_NOTER-upload'. Stop. -Dan |
August 17, 2011 by missle3944 |
ahhh im making progress. I fixed that because I just had to add .c to the end of one of the avr910_noter . Should I use the makefile that noter gave or can I use jabelch's one. Noter's looks significantly diffrent than jabelch's one though??? -dan |
August 17, 2011 by missle3944 |
Ok guys, ignore all my other post before this. I got the isp code to make on my atmega 168, it loaded fine, but am i supposed to see something on the lcd? becuase its just the classic 2 black bars. Also I got the avrdude to work kinda except it says "programmer ID: FDL v02" I think that sounds wrong. Sorry for all of the posts guys, I have no idea what im doing but its working i guess... heres a pic of what I'm up to so far... |
August 20, 2011 by killercow |
Hey Dan, I used jabelch makefile and the avrdude.conf file too. Read his posts and place the files where he did. The entries have to match up with where the files are stored at. As far as using the 168 vs the 328, I'll get back to you on that one. It looks like you might need to change to lines in the makefile and you would also use the 186 bootloader folder. I'm going to try this and I'll report back. Kevin |
August 20, 2011 by killercow |
Dan, I do see the "lock:w:0x2f" entry...change the 0x2f to 0xef. And post back if you need to. Kevin |
August 23, 2011 by missle3944 |
Killercow, I still get the same results on typing make for the 328 bootloader and putting 0xef instead of 0x2f. Heres a pic of my setup I also dont get the lcd text that others got on their pictures such as the avr isp v3.0 so I have no idea what I am doing. But I just ordered a 328p from the nerdkits guys that already has the bootloader on it so I'll try that. Thanks for your help, -Dan |
August 25, 2011 by missle3944 |
Killercow did you ever get it to work? |
August 25, 2011 by missle3944 |
I GOT IT!!! HAHAHA, AWESOME. Noter this was very easy easy to do. Once I got my 328p from the nerdkits it was all smooth sailing from there. If someone wants to do this I personally don't recommend using a 168 to program a 328 because it is so much more complicated! I suppose it would work but you just have to mess around with the fuses a lot more. Heres my 328p makefile. This one worked great for me the last time.
And here is the makefile I used for the isp programmer, compliments of Jabelch and others! If you copy and past this make sure to add your own indentations because for some reason the compiler doesn't like the spaces.
Great Job again Noter and to all the others who posted fixings on this. Much Appreciated!!! -Dan |
August 28, 2011 by killercow |
Dan, I did get mine working. I'm trying to get the specs for the aTTiny2313 into the makefile for testing. Your connections look good. I do think that if you try to use the 168, you will need to make changes in all the files the reference the 328p chip. I'll try this out this coming week and report back. Happy trail, Kevin |
October 27, 2011 by scottmc94 |
Thank you Noter, jabelch, kayrock, missle3944, et all! I am now a cool kid! :) I have burnt the fuses and loaded my first bootloader using Noters Nerdkit ISP code, jabelch's makefile and kayrock's & missle3944's pictures of their setups. Thanks a lot guys. That was a fun project. My setup for the ISP programmer (button in the middle is leftover from a different project) The newly burnt chip on it's own breadboard after putting the initialload on it.
|
February 19, 2012 by nordlys |
It is possible and pretty easy to use a 168 to program a 328p. If you want to do it you will have to make changes to the makefile posted here earlier as I've done below: Makefile for the programmer:
And then just use this makefile for the 328 bootloader:
And that should be it. Just make sure to doublecheck the wiring. |
September 18, 2012 by scootergarrett |
I’m trying to bootload a fresh 328P with the Nerdkit 168. And I’m having some problems, I can load the bootload program with a normal make file but not this special one. I get errors like “makefile:24 ***missing separator. stop.”. I’m doing this all in a code file just like the temperature sensor file. So after loading the program I need to navigate the command window to the 328P bootload file and use that make file. I’m confused on what all the files are and where they should be saved Also dose the new chip need a Crystal 14.7456MHz on it? I made a nice Wire diagram |
September 18, 2012 by Ralphxyz |
scootergarrett, one thing at a time:
That is one of the most common errors!! It means your indents are not correct!! Usually this comes from copy/paste. Put TABS in your indents or possible 5 spaces.
Ralph |
September 19, 2012 by Noter |
Hi scootergarrett - That's a nice wire diagram you made. I'm working on detailed instructions in the Library and might be done this evening or tomorrow. If you don't mind I'll include your wiring diagram in the directions. |
September 19, 2012 by Noter |
Hi scootergarrett - I think the library reference is mostly complete now so please use it when you are ready to work on your ISP programmer again. Here it is -> Nerdkit ISP Programmer. Also download and use the files from the library because they are the latest code versions and the makefiles are tailored for the ATmega168 Nerdkit to put a bootloader on a new ATmega328P. When I put your wiring diagram on the page I noticed you had a 10k ohm resistor on PC6 of the target mcu. I don't know if that will cause a problem programming but it will not let the target go back into run mode between loads. So probably don't want it there. Also will appreciate anyone else reviewing/trying the directions and files from the new library reference so I can get any problems fixed asap (before I forget everything again:-). Thanks! |
September 19, 2012 by scootergarrett |
OK so now I have the 168 loading with the program and the make file. The two chips are wired together. Then navigate the command window to the “bootloader328p” downloaded folder. where there is another make file. I enter ‘make’ or 'make fuses’, no matter what I have for a header in the make file I get the error
So what the bootloader328p make file be? and dose the second chip need a crystal? -Garrett |
September 19, 2012 by Noter |
It appears you have a mix of files from various projects. Wipe it all out and start over following step by step the directions in the library article. I think that is your best bet at this point. |
September 19, 2012 by scootergarrett |
OK I think I'm getting it programming always gets easier as it gets later. |
September 19, 2012 by Noter |
The directions I have do require a crystal on the target chip. After you get it working and then want to run without an external crystal it's just a matter of setting the fuses differently. But it's best to get the simpler config working first. I'm turning in - will check tomorrow to see if you made any progress. |
September 19, 2012 by scootergarrett |
The 10K resistor is based on Nerdkit bootloader installation “The main difference is that you MUST replace the jumper wire at pin1 with a resistor (I use 10k).”. I will restart and fallow your library reference because I’m getting that 'Writing | | 0% 0.00s ***failed' error like everyone else now. I can change that wire diagram but it looks like you already took care of it. circuit lab link. bed time |
September 20, 2012 by Noter |
Actually the 10k resistor is ok, it doesn't prevent it from working like I first thought. I just looked at it wrong and thought it was going to GND. Seems I never remember to put an external pull-up resistor on the reset pin and never have a problem because of it. Perhaps Rick will remind me again why it should be there? |
September 20, 2012 by Noter |
About the only thing I can find is that without bias the reset pin floats and in some circuits that could cause unpredictable mcu resets. The reason I've been getting away with out it in this ISP programmer is that PB2 always maintains either +5v or gnd on the reset pin of the target so it never gets to float. If you're going to connect to load and then disconnect the programmer to run, the 10k should be installed. If you run it like I have so far and never disconnect the target to run standalone then either way is fine. |
September 26, 2012 by pcbolt |
Noter - Great contribution to the Nerdkit Library! Thank you. Just wish it was posted 8 months or so ago before I went out and bought one {:-)> |
September 27, 2012 by Rick_S |
The floating issue is excactly the problem I had. I originally used a parallel port ISP programmer for my programming and the reset was pulled low or left floating and I would get wierd programming results. I also usually setup a reset button on my reset pin when running on a breadboard so the resistor just became second nature. In my bootloader install text, I was letting people know to build their target chip as the NK standard setup except for the wire going between reset and VCC had to be changed to a resistor (in hind sight as with your programmer, it may be able to be eliminated alltogether). This guaranteed no matter what programmer the person had, the target should get a proper reset without the programmer being shorted directly to vcc when it tried to reset the target mcu. Rick |
September 27, 2012 by Noter |
Thanks PCBolt. Sorry I didn't get it posted earlier. I put up another lib entry this afternoon on a bluetooth/smartphone interface. Please let me know of errors/omissions if you have time to look it over. |
September 27, 2012 by Noter |
Thanks for the clarification Rick! |
October 20, 2012 by Noter |
After many iterations of the Nerdkit ISP Programmer, this is my favorite! The Arduino NANO can be found on eBay for as little as $11.00 and makes a great little programmer. First thing I did was put on the 1K boot loader from the Library and then modify the ISP programmer to replace the LCD display with a couple of LEDs and then reassign pins to work with the NANO configuration. The NANO already has LEDs on board for Power, SCK, RX, and TX which is real handy to see if it's working or not so I only added a yellow LED that blinks with a heartbeat to let me know the ISP program software is running and a red LED that comes on when there is a target communication failure (typically a wiring problem). The NANO also has it's own reset switch on board and I added the small one on the bread board to reset the target mcu when pressed. The only other thing was to reroute the NANO reset pin from the connector to another pin that could be used for the target reset. Makes a very nice ISP programmer! |
October 28, 2012 by Rick_S |
I like that version, it incorperates the USB/Serial adapter and mcu all in one. Still more pricy than the USBASP ISP programmer I use (When I program ISP), but has much more potential. Rick |
November 21, 2012 by cadiz1 |
Hi , Everyone, The wiring diagram for the nerdkit isp programmer does not show a crystal on the Atmega 329P which is the target mcu . Is a crystal needed ? I am going to target a ATmega 168 what changes do I need to make? to the source or to the make file? Thanks |
November 21, 2012 by cadiz1 |
Hi , I followed the instructions STEP 1 - compile and load AVR_ISP made the Folders and the avr_isp.c and makefile opend cmd window, typed make. Following message makefile:51 *** missing separator. Stop. Why? Thanks |
November 21, 2012 by Noter |
Need of a crystal depends on the fuse settings. If you set fuses to use the internal oscillator then you don't need an external crystal. Apparently the leading tab characters in the makefile have been converted to spaces. Each line that does not begin on the left margin needs to have a leading tab character. |
November 22, 2012 by cadiz1 |
Thanks for the help Noter.
I was using a computer in Spain. I was in the cmd window. I changed the prompt to avr or avrdude. I was able to read the eeprom using the dump command and to exit I used quite command. Can anyone shine some light? |
November 22, 2012 by Noter |
Sounds like you were using terminal mode in avrdude. As long as avrdude is properly installed you should be able to do it again. Take a look at chapter 3 in the documentation. http://www.nongnu.org/avrdude/user-manual/avrdude.html |
November 22, 2012 by cadiz1 |
Hi Noter, Your Right. I managed it just as you posted your answer . Thanks again I had forgotten the -t |
November 22, 2012 by cadiz1 |
I replaced the nerdkit 168 with another 168 but with a Arduino bootloader. With the nerdkit I used avrdude -c avr109 -p m168 -b 115200 -P com3 -t Any thoughts? Many Thanks to Noter |
November 22, 2012 by Noter |
The avrdude AVR109 programmer is actually a particular type of bootloader. The Nerdkit has an AVR109 type bootloader but not so for the Arduino. By using an ISP programmer (AVR910 type) instead of the bootloader, avrdude works directly with the serial programming interface on the chip bypassing any bootloader. With the ISP programmer you can change/load the bootloader if you wish or even skip it and not use a bootloader. Plus with an ISP programmer you change fuse values to reconfigure the chip for different options. |
November 23, 2012 by Ralphxyz |
Wow Paul, thank you I think that this is the first time I have seen a explanation for avrxxx notation. Or at least the first time I actually understood it. Of course I am just once again getting around to using ISP. Isn't "ISP programmer" redundant? Ralph |
November 23, 2012 by Noter |
Sort of but not exactly. ISP stands for In System Programming which is a method, procedure, or technique. A Programmer is a physical thing, something you can put your hands on. |
November 23, 2012 by Ralphxyz |
Ha, I was thinking "In System Programmer" being the device with "In System Programming" being the action of using it. Ralph |
January 05, 2013 by sask55 |
I am attempting to use Noters ISP programmer. I have been using the code and information provided on Noters library post. I cannot complete STEP 1 – compile and load AVR_ISP. In step 7 the make commnd fails . I get an error message “makefile:51: ***missing separator. Stop.” I can not see what I am doing wrong, I believe I have the correct code in the locations as instructed. |
January 05, 2013 by Noter |
I think the problem is in the makefile format. The indented lines in the makefile must be indented with tab characters, not spaces. For whatever reason the nerdkits site changes tabs to spaces so when you copy and paste the makefile to your PC you also have to change leading spaces to a tab character on the indented lines. |
January 05, 2013 by sask55 |
Noter That is a great project, very impressive. I have learned a number of interesting things just by going through your library project and Ricks tutorial. I now have an ISP programmer that includes very little extra hardware and a considerable amount of code that I don’t have to have an in-depth understand of. The information regarding spaces versus tab character could be helpful down the road. Another thing I was unaware of was that the USB TDX (yellow wire) is 3.3 volt logic I always just assumed it was 5 Volts. I was so sceptical I decided to verify the voltage with my oscilloscope. I have now successfully loaded my first boat loader on a chip using your project/tutorial. Everything went smoothly after I corrected the make files as you suggested. I think this is perhaps the most widely useful project I have seen, as you have demonstrated at the bottom of the library post there are a number of ways this can be put to use. I do have a couple of small suggestions to help clarify thing for those of us that are not as comfortable with this kind of thing. I am under the impression the software you provided can be used to program a tiny85, a mega168 or a mega328 without any requirement to change any code or identify the chip in the code. In the library post you are programming a mega 328 , I am programming mega 168 s at this time. If I do have that correct you could mention this in the library post. One more very small thing, I would consider showing a crystal on both chips in the wiring diagram. It is clear from the photo and your parts list that there is one on both chips but seams to me that one on the diagram would not hurt. Thank you for making this project available to everyone on the Nerdkit site. Darryl |
January 06, 2013 by Noter |
Glad you got it working. Thanks for the suggestions too, they are good ideas and I will work on the project page to address them. Have fun with your new ISP programmer! |
May 08, 2013 by pcbolt |
Noter - I finally have some time to work on building the programmer an lo and behold the library is STILL down. I fortunately downloaded the source code and makefiles before the crash but I wanted some advice. (BTW, is the bootloader source code a re-write of the one pre-installed on the NK chips or are there important changes that I need to be aware of?). I seem to recall you mentioned wiring up LED's to the 168 programmer, but I don't remember what they were for. I went through the source code and it made some references but nothing specific. The other parts of the source code were great. It still amazes me you took the time to translate the assembly code to C. You also mentioned some enhancements you made to the reset pin (I think?) so it was easier to test programs. Just wondering if there were more things you came up with to make things smoother. I hate to ask you to rehash something you spelled out before so if you're reluctant I'd certainly understand. |
May 09, 2013 by Ralphxyz |
Of course the Library is still down. I do not have much faith that it will ever be restored. The only reason Huberto and Mike made up the Library was because they didn't want me me to host one. They have never done anything on it beyond the initial setup, they never even made mention of it anywhere for new users. Luckily there is a Web Archive. The web archive engine is a bit screwy so if you get this: just correct the URL with this: Of course it is an Archive/image so it can not be updated. Ralph |
May 09, 2013 by Noter |
RALPH - The wayback machine doesn't show the nerdkit ISP programmer for me. It doesn't show most of the library for that matter. Maybe it's time to go ahead and set up your own library. And maybe forum too as I don't think the nerdkits guys really care about this one. You could use my 1K bootloader to preload chips and sell them on eBay too. PCBOLT - I referenced several bootloaders to make the final ISP programmer. Basically it is a bootloader that has been modified to read/write commands over the SPI interface instead of directly to flash. Since it emulates the a bootloader avrdude uses the same protocol as for any avr109 type programmer. By the way, the only difference between the avr109 and butterfly is avrdude will not send set fuse commands to the butterfly. I also rewrote the nerdkits bootloader so it would fit in 1K instead of 2K which just frees up more flash for your project. I don't remember for sure the state of the led usage in the library article but I've used them as an error indicator, blinkers so I can see that data is moving over the SPI interface, and another with a fast/slow blink to indicate if the programmer is ready for commands or currently in programming mode. I haven't worked on the ISP program since moving it to the Arduino Nano so I guess that means it's finished. I don't think I have a copy of the source from the library article either because I posted what I had at the time. My most recent programmer follows along the same lines as far as using the avr109 interface to avrdude and is on an at90usb162 chip which needs only a standard usb cable. However it is programed and built as a high voltage programmer for the ATtiny10's and since the Nano is working so well I will probably not make it into an ISP/SPI programmer. But if you want to go this route I will be glad to share the source. It's worthwhile to get to know the avrdude configuration file because you will need custom entries for programmers you build. The library article included a custom config file with definitions for the ISP/SPI programmer. Those definitions are still in my config file if you need them. I also downloaded the avrdude source and built it on my system so I could change it to output debug data when trying to figure out what it was doing or wanting and that's how I got past a few problem areas. I'll be glad to help if needed and keep us up to date on your progress. |
May 09, 2013 by Rick_S |
I had a forum setup on my website when I initially set it up, but it got no use so I took it down. I could set it back up in case anyone would want that. I'm thinking of copying all the threads I had my projects in and moving them into blog posts on my website. I have done that with my LED Array project. I'd be happy to host anything people would want there. Rick |
May 09, 2013 by pcbolt |
Thanks Noter. I did look into the config files both for this project and for loading a bootloader onto a 644p awhile back. I should have all the files from before so it's on to the hardware part now. I think I'm just going to build it on a little perf board after breadboarding it first. |
May 09, 2013 by dvdsnyd |
//RANT
What blows me away is the total disregard for this community by Humberto and Mike. And it isn't like people are keeping them in the dark to it either. I have seen a few different posts by people expressing discontent. I mean, HOW hard is it to update the people on the forums as to the status? I have had my NK for over a year now, and this forum is amazing! pcbolt, noter, Rick, Ralph, esolderberg, you all have helped me out IMMENSELY! From my pressure sensor, to Rick's library post on how to put a bootloader on a blank chip...and many more silly questions. I thank each of you, and appreciate all you have done on these forums! It is a shame if the library is gone. Maybe they are working on it...maybe they aren't...sure would be nice to at least know. In other news, I designed, etched and built my own development board. I just got it working this evening. I will put up a pic and short description when I get an SD card reader...wife lost the cord to her hold camera... Didn't mean to hijack this thread, but wanted to chime in. Dave |
May 11, 2013 by Rick_S |
I've posted the Bootloader installation instructions on my blog to make sure it remains available. Here is the link in case anyone needs it. Rick |
May 12, 2013 by sask55 |
I am not certain why this forum thread seams to have been high jacked to a couple of different topics. But since it appears to be that way now I would like to add. Ralph; your link to the Wayback machine is working for me. It could be useful. Do you know Is this archive is permanent or will it expire and be removed at some point? It is very strange that there appears to be an intact copy of the Nerdkit Library available on the Wayback achieve but the Nerdkits site has not re-establish the library in any way. Ralph, Thanks for the link to a copy of the library contents,even if it cannot be edited it is still available. Also Rick; thanks for the link to your blog. The blog is interesting and well done. If this Nerdkits Furum site every goes down again it is very reassuring to know I have access by a different means to contact at least one of the others that follow this forum. For myself and I am sure others his forum is the only link I have to any of the regular contributors. I was very concerned when this Nerdkits site was down that I was on me own and had lost a very valuable link to a great deal of knowledge, interesting threads and useful advice. I am very glad this site is up and running again and also happy to have at least one outside connection to a regular and highly valued contributor to this forum. Darryl |
May 20, 2013 by pcbolt |
Finished up the ISP programmer project..and all went great. I only had to make a few mods to the code and Makefiles but the comments helped out immensely. After breadboarding it, I went with a perfboard for the finished product. Here are the photo's along with a shout out to Noter... |
May 20, 2013 by Noter |
That's neat! I bet you're having fun now :-) |
May 20, 2013 by pcbolt |
Yep! I even have room for a few LED's. I noticed if I use the power output headers for the LCD, I have to power the target 328p separately. I could go with LED's to show progress and use the power out for the target. Either way it works great. The LCD 2-wire shift register board (tucked in behind the LCD) saved me a large amount of real estate on the little perfboard shown above. Learned a lot on this one. |
May 12, 2014 by scootergarrett |
SO in my move to Linux I'm trying to get the programer working again, and I can't load the AVR_ISP, this is the message I get: avrdude: writing flash (16360 bytes): Writing | ############################################ | 88% 1.92savrdude: error: programmer did not respond to command: write block make: *** [AVR_ISP.pgm] Error 1 It seems like the fix is with in the make file but this make file has much more going on, and I'm not a make file guy. any ideas? |
May 12, 2014 by Noter |
Make is not so hard, you could be a make file guy by looking through the GNU make manual. But if you don't want to take the time to do that then bypass the make file and run avrdude manually from the command line in terminal mode and see if you can dump flash to verify it is at least communicating with the bootloader. |
May 12, 2014 by Noter |
By the way, one of my favorite tools in linux is the "open terminal here" in the Nautilus file manager context menu. |
May 12, 2014 by Noter |
Messed up that link somehow, here it is open terminal here |
May 13, 2014 by scootergarrett |
I just got Linux mint 16 and it allready had a feature 'Open in Terminal' wich is a great feature. ok so I got the ISP on a 328p, I don't know what was causing that timeout project. Anyways now when I load the 'AVRBOOT' I get the error: AVRBOOT.c:64:25: error: unknown type name ‘prog_uint8_t’ in the code:
So if I change 'prog_uint8_t' just to 'uint8_t' it works programing wise but then I get try to load a program on the fresh chip I get the ' Yikes! Invalid device signature.' error. Which I can ignore with the -F. This is all code and setup that worked on XP and is now giving me trouble. So should I just add the -F into all my programs make files? Or is there a way to get linux to understand 'prog_uint8_t'? thanks for any advide |
May 13, 2014 by scootergarrett |
Well here is my temporary solution although its not ideal. In the AVRBOOT code where the device code was written onto the chip I changed to:
This just manually enters in the numbers bypassing the need for a 'prog_uint8_t'. its unsettling for me not to be able to bootload a fresh chip because I have a seemingly endless list of projects so as long as I have a supply of 328p's I can move forward |
May 13, 2014 by Noter |
It's not a linux issue but one for the newer version of avr-gcc ... see prog_uint8_t. You can define the macro name as referenced in the above link or just change the line to
|
Please log in to post a reply.
Did you know that our USB NerdKit works on Windows, Linux, and Mac OS X? Learn more...
|