I am having a bootloader issue ( I think ) with the mega328p. I'll load the bootloader and set fuses using a STK500 and avrstudio ( 4.16sp1 with bootloader upload fix ) and also tried the latest avrdude. Put the 328p on my board, bootloader comes up as expected. Upload a sketch and I never see the bootloader again. The reported upload size looks correct ( 30xxx something, not in front of that computer right now ).
This isn't an "arduino" board. This is a module called the midi2sds, which is opensource. It happened to have a mega8 but the available code was written in codevisionavr and would be difficult to backport to avrgcc so I figured making this more arduino-like would be fun and useful. I added a breakout board with a TTL serial port and reset button.
If I just put a bootloader on a mega8 and install it, I can upload a sketch repeatedly just fine however I'm afraid I'll be a little tight on space with the Mididuino libraries and everything so why not put in the 328p...
I actually got the 328's preprogrammed with the bootloader and of course immediately wiped it upon test sketch upload.
My immediate first thought was that bootloader protection was off, but I've double checked that many times using info from the web as well as the fuse calculator, avrstudio, and finally from the datasheet.
Anyone else had this issue?
i've read that symptom posted here before but don't recall what the fix(s) was if any. I assumed it was a fuse thing but can't recall for sure. Maybe trying a search of past posts would bring something back.
I'll try some more searches. I've tried various permutations of atmega328p/328 etc and not found anything.
Yeah, I do expect it will be as simple as a fuse, but I'm at a loss as to what it will be...
I never found the topic hiding in the forum but I did manage to solve my problem.
I was unable to get the Arduino bootloader in 0016 to work on the 328p, however the latest Adaboot works perfectly. Note : Same fuse settings for both.
In case anyone is curious, here are my avrdude lines used to burn the bootloader :
avrdude -p m328p -c stk500v2 -P /dev/tty.usbserial -V -e -U lock:w:0x3F:m -U hfuse:w:0xD8:m -U lfuse:w:0xFF:m -U efuse:w:0x03:m
avrdude -p m328p -c stk500v2 -P /dev/tty.usbserial -V -D -U flash:w:ATmegaBOOT_168_atmega328.hex:i
avrdude -p m328p -c stk500v2 -P /dev/tty.usbserial -V -U lock:w:0x0F:m
Used that for both the stock bootloader ( shown above ) and Adaboot. I forget what webpage it came from, but I verified the fuses in avrstudio just to make certain.
Anyhow, don't know why I was having trouble, but I'm up and working now and thats all I care about at the moment.
I'm guessing you weren't setting the lock fuses after burning the bootloader before.
Thats what I assumed my problem was, so I paid particular attention to the lock fuses. I can use the above avrdude lines and the stock 328 bootloader, and the bootloader dies after one sketch upload, or I can use adaboot with the same avrdude lines and it works repeatedly.
I tried to use a USBtiny to load a bootloader into my atmega328p's. My method was based on an older post on this forum by brunolatortue. I had a similar problem in that after I burned the bootloader, I could load a sketch into the device only once. Subsequent attempts to reprogram failed.
I modified your instructions for the USBtiny:
avrdude -c usbtiny -p m328p -B 5 -V -e -U lock:w:0x3F:m -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m -U efuse:w:0xF8:m
avrdude -c usbtiny -p m328p -B 1 -V -D -U flash:w:"C:\ATmegaBOOT_168_atmega328.hex":i
avrdude -c usbtiny -p m328p -B 5 -V -U lock:w:0xCF:m
and I've been able to burn botloaders into all three of my new 328s.
Argghhh, I posted the old version rather than the new one. My real avrdude instructions are:
avrdude -c usbtiny -p m328p -V -e -U lock:w:0x3F:m -U hfuse:w:0xD8:m -U lfuse:w:0xFF:m -U efuse:w:0x03:m
avrdude -c usbtiny -p m328p -V -D -U flash:w:"C:\ATmegaBOOT_168_atmega328.hex":i
avrdude -c usbtiny -p m328p -V -U lock:w:0x0F:m
First post and it's wrong.