While first try programming a 3pi unit ( first project in avrstudio) I’ve encountered a problem with flashing the chip - nothing can recognize a microcontroller neither AVR studio nor avrdude.
System - win7 x64, Programmator - Usbtiny (atmega8 on board) by Adafruit. Batteries level ( between Vcc and Gnd - 4,95 V)
Avrdude returns this:
avrdude.exe -p m328p -c usbtiny -P usb -U calibration:r:calibration.hex:r
avrdude.exe: initialization failed, rc=-1
Double check connections and try again, or use -F to override
avrdude.exe done. Thank you.
I’ve found in google that ISP freq chainging to 200kHz or lower might help, but it doesn’t help. Avrstudio reports that voltage possesed is 0 V.
Howewer preloaded programm with menu is working ( that I hope means crystall is ok).
Could you please advise me what else I can check to figure out how to flash mcu sucessfully?
I moved your post to a new thread and gave it a more appropriate name, since you seem to be having a different issue than the original poster in the thread you posted in.
It seems like the 3pi is working and you are having an issue connecting to it through the programmer that you got from Adafruit. The error message you got makes it sound like the 3pi is not getting power. The 3pi must be on while trying to program it. From briefly looking at the documentation for the programmer, it seems there is a jumper that can be used to power your target device through the programmer. When programing the 3pi, it would probably be best to leave the jumper disconnected and power the 3pi from its own batteries instead.
Thanks for correcting me with topic title. Well, about the jumper - it’s been already removed ( this was the first thing before flashing). Because thought that i could burn the 3pi device. 3pi is powered by betteries, Vcc - 4,95 V.
What a really strange that if i flash a robot ( I mean a standart sentence to avrdude to flash, neither checking hex signature) It looks like being programmed at the first time - diodes ain’t work, menu is not available and one of the wheels rotates endlessly. But after RESET and POWER (off, then on) returns to demo program.
This thing makes me a little bit confused, cuz I can’t catch with of the devices is on malfunction mode.
I have tried several time and several forums with my problem. And detailed avrdude backlog:
So there is a string with:
Device signature = 0x0000000,
In my case that shows unability to programmer to connect mcu because of different ISP and mcu clocking ( atmega switched to internal oscillator and it’s too slow for connect). Probably fuse bits were touched and the controller was blocked permanently. I will check it one more time in my college’s laboratory, but I guess result will still remain the same.
Though i got a good silicone key loker, I think that I can change microcontroller unit manually ( by ordering new one and soldering it).
Could you please advise me if you have any recomendation in such case or maybe thread at this forum, touching the manual microcontroller replacement procedure?
At this point I cannot say whether the fuses on the 3pi’s microcontroller are messed up. I also have no advice to help you replace the ATmega328P. In general surface mount rework is difficult, and if you do not have experience with it, I would recommend asking someone with experience to do it instead.
If you would like to continue troubleshooting, please post the exact AVRDUDE command you use when trying to load code and the full output that you get from it. Are you able to program other AVRs with the same programmer?
Fortunately, I’ve dealed with USBtiny programmer. THe problem was with usbtiny flex plug. Multiple exams with the robot and other programmers helped to solve the problem. Now I’m able to flash it sucessfully via avrdude. but there is one quiz I would like to ask you.
I checked current pololu’s fuse bit condition and avrdude showed me: 3F D9 F6 04. However defauld atmega328p’s fuse bits should be 62 D9 FF engbedded.com/fusecalc - here e.g. I didn’t touch anything with these bits for sure. Could you please advise me if the current fb condition is normal for pololu itself? because I understand that default settings may not be appropriate for the robot.
It’s hard to interpret your fuse settings because you just gave the values of the bytes without giving the names of each byte. The fuse settings that we program onto the 3pi are lfuse=0xF6, hfuse=0xD9, and efuse=0x04. I think the extra 0x3F you read is the lock byte, which should correspond to everything unlocked. Given that you read all of those bytes (though not in the same order) and you don’t think that you have changed your fuse settings, I think your 3pi probably still has the ones we programmed on it.
YEP those are lockbits in hex( I just checked in avrdude) the rest are the same as us described. Well, it is so good that you helped me to clarify that. Thank you so much.
For those who have problems with Usbitny:
- Try to first flash oficial AVR programmer ( STK500 or else).
- Check power supply settings ( should be ~5V on 3pi board).
- Check all pins to be contacted correctly.( don’t throw away GND pin because SPI gets 0 level from GND pin)
- DO NOT TOUCH FUSE AND LOCK BITS if you are not sure how to use them.It is a simple algorythm:
READ->VERIFY->WRITE ( and not vice versa or other way)
- After flashing, turn off the robot and THEN detouch it from programmer!
5.Read FAQ and forums.