NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Programming via ICSP with SPI set as master
November 24, 2010 by esoderberg ![]() |
All, I have been successfully programming my 168/328p chips via a 6 pin programmer,
AVR studio, and the ICSP pins. The bootloader was been erased from these chips
as it was not needed. I recently loaded code setting one of these chips as SPI Master. Eric |
---|---|
November 24, 2010 by hevans (NerdKits Staff) ![]() |
Hi Eric, When programming your chip via an ISP the reset line should be kept active (low). If your ISP programmer is doing its job correctly the reset line will be low when you turn it on so the program code should never even start running long enough to even configure the SPI module on. I'd check the reset line with a multimeter, when attempting to program, if it is indeed being dragged low by the ISP then I think the problem is not related to that chip being the master. Is there something in your circuit that might be keeping the reset line high for just your master chip? Humberto |
November 24, 2010 by hevans (NerdKits Staff) ![]() |
Another thought. Is there is another chip in the circuit that is turning on and possibly driving the MISO line? Humberto |
November 24, 2010 by esoderberg ![]() |
Humberto, There was another 328p set up as slave - I can still program that one - but I have disconnected
that and everything else from the master chip at this point. I also tried connecting the reset line to ground, even though the programmer should be doing this. Eric |
November 25, 2010 by Rick_S ![]() |
I don't know if you are using a crystal with the chip or not, but if you are, you do need to leave that in place when programming. Also, depending on your programmer, you may try adding a pullup resistor from vcc to pin 1 as well as the reset line of your programmer. This will allow the programmer full control of when to pull the reset low to keep the startup timings for programming. This snippet is from the datasheet.
Other than that, you aren't by any chance using the reset as an I/O pin and set the fuses that way did you? I know doing that will prevent an ISP programmer from working. Rick |
November 25, 2010 by mrobbins (NerdKits Staff) ![]() |
Hi Eric, I'm guessing that you also changed the target chip's fuse bits when you switched to using the ISP programmer. Do you have a record (i.e. in a Makefile) of what you set them to? There are definitely some fuse bit settings that will render a microcontroller no longer usable for ISP programming. Also, you said that you get "a variety of error messages" -- care to post? Curious to know if avrdude is able to read the chip signature, etc. Mike |
November 25, 2010 by esoderberg ![]() |
Mike, Rick, I was not accurate when I said nothing was connected to the chip in question. More precisely I have a 328p on a Nano v3.0, and one of your NK Atmega 168 chips in a duemilanove pcb, both of which I was able to program successfully for months via ICSP, but subsequent to loading the SPI code cannot. However, nothing else external to the pcb is connected to either at this point. As for the specific errors, they're all related to the fact that when the AVR STK500 and programmer try to enter programming mode it fails. I don't have a multi meter to use as Humberto suggested, but used an LED to see if reset was low, it appeared to be. I also tried a pull up per Rick, but no joy. Also, the AVR STK500 is unable to read the chips signature - returns a "signature does not match selected device" warning, which appears to be, again, because it can't enter programming mode. As for the fuses, I certainly didn't do anything intentionally to change them beyond the programmer's default settings. However, you're probably right that this is the issue because on the AVR studio's programming Fuse menu,the SPIEN fuse is not checked as it is when the programmer is hooked up to my other 328p/168 chips that are working with the programmer. But I don't know if this is a cause or symptom of the fact that I can't get it to go into ISP mode and don't know how to change it (when I even open the AVR studio's Fuses page for programming AVR STK500 with 328p, it gives me an error because it fails to go into programming mode and I can't change the setting.) Below is the Makefile I used to create the hex file for upload via AVR studio.
|
November 25, 2010 by Ralphxyz ![]() |
Try using HVPP (High Voltage Parallel Programing) for seeing/setting your fuse settings. You can also use HVPP for programing. Ralph |
Please log in to post a reply.
Did you know that you can make a spooky Halloween Jack-O-Lantern with a microcontroller? Learn more...
|