NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Can’t load Noter’s AVR ISP programmer.
October 20, 2013 by sask55 |
I had a working version of Noter’s ISP programmer loaded on a Atmega 168. I would like to add the capability of selecting the target chip that I intend to program on a SPI bus. This should be easily achieved by controlling the reset pins on all of the chips on that buss. I made a few changes to the AVR ISP programmer code that Noter had posted. My version of Noter’s ISP programmer will compile but I have not had any luck getting it to load onto a chip. Without the resource of the Nerdkits library and Noter’s step by step detailed instructions I have no doubt neglected to do something important in this process. When I was unable to load the AVR_ISP code I decided to try the Initialload code to test the hardware setup. I was able to load the initialload code with no problem. In doing that I lost my original ISP programmer. I then decide to try and reload Noter’s original AVR_ISP programmer code from the same location that I had done it before , I was not successful in doing that. At this point I cannot seam to load ether Noter’s original code or my modified code. I get a very similar error message. I suspect the problem is resulting from something I am doing incorrectly with regards to the make files. I realy have no idea why I was able to load the AVR_ISP code before but cannot now. |
---|---|
October 20, 2013 by Noter |
That's a strange error. The only reference I can find on the web is related to an old version of winavr running on vista - http://www.madwizard.org/electronics/articles/winavrvista. Are you running windows vista? Probably the best bet is to upgrade to the latest tool-chain/winavr from ATMEL and go from there. Otherwise maybe delete the object files to force a fresh compile and try again. Or get rid of the objdump command from you make file if you never look at the disassembled listing anyway. I always try to stay current with the compiler and other tools posted on the ATMEL web site although sometimes I forget to check regularly and may fall a little behind. But all the tools linked from the nerdkits site are several years out of date thus missing important patches and enhancements. |
October 20, 2013 by sask55 |
Noter Yes the computer I was using for that upload is running vista. It was a few months ago that I originally uploaded your AVR_ISP code to a chip, I think it may have been from a different machine on my home LAN. I am going to attempt the upload from that computer and also take your advice about the upgrade to the vista machine and others. I will let you know how I make out. thanks |
October 21, 2013 by sask55 |
Noter I seam to be way out of my league here. I don’t think I ever made any changes to your code as it was posted in the Nerdkits library. I did make a copy of the code and made some changes to the copy, yet I cannot seam to reproduce the same results I was getting a few months ago. I downloaded and installed the latest version of the Tool-chain for windows from the ATMEL web site as you suggested. I also tried using a deferent computer to accomplish the download to the chip. Nether of these approaches resulted in success. I am now getting a completely different set of error mssages on the visa machine and the other machine. When I attempted to remove the objdump command I get a different error set. I suppose it may be possible that I inadvertently caused some changes in ether the make file or the ISP programmer code but I don’t think so. Since the original code that you posted in the library is not available and your code posted on the forum has a few changes it is difficult for me to verify what may have changed. In any event here is the latest error message I get when running the make file for your original ISP programer. I don’t understand much about the make file or the errors that appear to be now in the ISP code. Any help is greatly appreciated. |
October 21, 2013 by Noter |
I don't remember exactly when that changed but one of the new versions of avr-gcc required that PROGMEM variables be declared as CONST. I've had to make those changes to most of my older programs when I compile them again. The fix is to put the keyword const in front of the avr_info declaration. And again in the function prototype and declaration of uart_write_PSTR().
|
October 21, 2013 by sask55 |
Noter Thanks! it is looking like I am getting closer to me, Still not working after making the changes you posted. Running the make file produces the .o and .hex files in the correct directory. But the make does not write to the chip. As far as I can see it does not report any error codes either it just stops running and return control to the Command Prompt window. |
October 21, 2013 by Noter |
I don't know for sure what make file you are using but if it's one of mine then probably 'make' will just compile and 'make program' will compile and download or just download if the compile is current. Look at the make file to see what other targets are defined. Section 2.1 in GNU `make' gives a quick explanation of rules, targets, prerequisites, and recipes. Make can do a ton of stuff but if you learn about those 4 things you'll have the basics covered. |
October 22, 2013 by sask55 |
Thanks again Noter. “make program” did the trick. I am able to program the chip with my slightly modified version of the code that you posted for the ISP programmer. The outcome from my changes to noter's original ASV_ISP programmer, are not doing what I expected. Perhaps someone could explain where I am going wrong. I could repost the entire code as Noter has it on Noters code if that would be useful. For now I will try to explain my issue by only posting a couple of short additions I have made to that code. I am displaying on the LCD which of the four chips on my SPI buss the ISP programmer will be communicating with. I have set up the hardware so that I can select the chip by setting the position of two switches. These two switches are connected to PC0 and PC1. I made this function to display the current selection on the LCD. There is no doubt a better way to do this but I can’t understand why this is not working as expected.
I call this function from inside the main loop, after the while(true){ statement.
The chip selection display is working in the sense that it will show the correct display to indicate the positions of the selection switches when the program is rebooted or power up. What I don’t understand is why it will never change if the switches are altered after the chip is running the program. PC0 and PC1 are setup as input pins and changing the switch position will change the state of these pins. Each time the show_target function is executed the display should change to reflect the current sate of input pins. Since show_target is called each time the main loops why does the LCD never update as the switches are changed? |
October 22, 2013 by Noter |
Your code looks ok but it doesn't run until a char is received over the serial line. At the top of the while loop is
which doesn't return until a character is read from the queue. Probably you can insert your show_target call in the read queue function like so:
Run it once on entry and then continuously in the wait loop. I think that will work but I haven't tested it. |
October 22, 2013 by sask55 |
I was thinking that was probably the case, the main lop is not cycling waiting for a uart read character. Some how when I took a look at the uart_read_q function, I concluded that it would return with “null” data if there was no new characters in the uart read queue. I think I imagined a { after the while (qout==qin) statement, never really thought it through. Your approach makes perfect sense now |
October 23, 2013 by Noter |
I like your idea of using a couple of switches to select the target. Simpler than what I have done in the past probably easier to use too because no changes to makefiles or anything else is needed for it. |
October 25, 2013 by sask55 |
Noter I am still having some problems getting ISP programming to work. Again I suspect something in the make file tat I am not getting correct.
I have my Nerdkit ISP programmer connected to the SPI bus. I have attempted to reprogram the master micro on the SPI bus with the initialload code but failed to get it to work. Avrdude: error: programmer did not respond to command: select device make: ***[initialload-upload] Error 1 The ISP programmer is dropping the level on the master reset pin which would indicate that the programmer code has gone at least as far as my code in the enter_programing_mode function .
I also tried to use the makefile used to load the boatloder from your library tutorial on ISP programmer. I changed
To
I put it in a directory with a copy of intialload.c. That makefie produce a series of undefined reference to the lcd commands in the initialload..c code. It will not compile. Again any help or suggestions would be greatly appreciated. |
October 26, 2013 by Noter |
That is an unusual place for avrdude to get stuck because there is nothing going on in the select device logic other than to send back a <CR> no matter what device code avrdude sends. Zip up you directory and email it to me and I'll see if I can spot the problem. - NerdkitNoter@gmail.com |
Please log in to post a reply.
Did you know that any circuit of voltage sources and resistors can be simplified to a "Thevenin" equivalent circuit? Learn more...
|