atmega1284p recv error

Hello,

I've been working with the atmega1284p in projects requiring a little more than the 328p, and have been prototyping on one board for a little while. I have been successfully uploading to the board and using it for various (yet basic) functions. Today I tried to upload a new sketch to the board and after I had done so (as it said it was done uploading, once again with no errors), I could no longer upload to the board.

I'm not quite sure what's happening, but every time I attempt to upload my sketch (with the same wiring that was working over and over) it now does not work, giving me this error:

avrdude: stk500_recv(): programmer is not responding
Problem uploading to board.

I also had a "getsync" error in the beginning.

I have now taken all components off of my board so it is just the 1284p, its associated caps, resonators, and power wires, and the wires coming off from rx0, tx0, and the reset pin (with its 10k pullup and .1uf cap to the ftdi reset line). These are the same as on maniacbug's documentation( here : ATmega1284P on a Breadboard.sch | maniacbug.wordpress.com/20… | Flickr ). I was still getting these errors here as well.

I went ahead and re-uploaded the bootloader after this using the "Atmega_Board_Programmer" sketch to make sure everything was in order, and got that on with success.

When I try to upload now I either get the same recv error as above, or now one of a few new errors, including:

avrdude: arduino_read_sig_bytes(): (a) protocol error, expect=0x10, resp=0x00
avrdude: error reading signature data for part "ATmega1284P", rc=-3
avrdude: error reading signature data, rc=-1
avrdude: stk500_recv(): programmer is not responding
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

and

avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x60

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0xe0
avrdude: stk500_cmd(): programmer is out of sync
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

I've spent a number of hours reading through different forums and posts now regarding these errors with no real conclusion as to what they mean.

I've checked numerous times for little wiring errors such as a cap or pin being loose or unplugged, I've pulled my chip out about 10 times now and made sure everything is placed correctly, but I can't manage to successfully upload to the chip anymore and don't know what's causing it. Normally with a diagnostic procedure of removing everything like this I am able to find the root of the problem, but not this time.

Any ideas what is going on?

Thanks

Try the loop-back test http://forum.arduino.cc/index.php?topic=73748.0 if any data pass to MCU at all.
Interconnect Tx and Rx and any terminal emulator.

Thanks for the reply Budvar10,

I have completed the loop-back test and shows what I type in the serial monitor (just once). I am not sure if this is working properly but it sure seems to be. If i type a phrase and hit enter it shows up once on the serial monitor after hitting the enter key.

This works fine, but I'm still at a loss for what's happening during upload - compile goes smoothly and when I try to upload a simple sketch (such as blinky with a new pin-out for the 1284p) I get more errors like this:

avrdude: error reading signature data for part "ATmega1284P", rc=-1
avrdude: error reading signature data, rc=-1
avrdude: stk500_recv(): programmer is not responding
Problem uploading to board.

Thoughts? Suggestions?

What did your last sketch do - was it outputting anything on the Rx0/Tx0 pins that could be interfering?
If so, press & hold Reset, release it when the IDE shows "compiled xxx of 128xxx bytes".
Can be easier to get the release timing if you select File:Preferences and turn on verbose outputs.

My last sketch did a variety of things, but I realized after uploading it that some of the pins were wrong and changed them. That's when I first noticed the errors. It could be that it was using those pins.

...press & hold Reset, release it when the IDE shows "compiled xxx of 128xxx bytes".
Can be easier to get the release timing if you select File:Preferences and turn on verbose outputs.

I tried this many times, and it kept giving me some of the earlier errors or this error :

avrdude: stk500_recv(): programmer is not responding

I got a printout like this in one error after verbose was on as well:

         Using Port                    : COM4
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega1284P
         Chip Erase delay              : 55000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10   128    0 no       4096    8      0  9000  9000 0xff 0xff
           flash         65    10   256    0 yes    131072  256    512  4500  4500 0xff 0xff
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 129.5
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

and ends with this:

avrdude: reading on-chip flash data:

Reading | avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x60

avrdude: stk500_paged_load(): (a) protocol error, expect=0x14, resp=0xe0
##########avrdude: stk500_cmd(): programmer is out of sync
Problem uploading to board.

I can't seem to get it to Reset with this method, am I just missing the timing?

Thanks for your help.

Still havent gotten this working. Is there a way to use this chip still?? Any Thoughts?

Try re-bootloading it. That will wipeout the sketch that's in there, and get you back to square 1, as it were.
I use 1284Ps all the time with an FTDI module in IDE 1.0.6, I don't get those errors.

Thanks again CrossRoads - my apologies for the delay.

I have tried re-bootloading multiple times on that original chip, and it keeps giving the same sets of errors. I received a few new chips in the mail (atmega1284 (not P by accident)) so after figuring out they were the higher power version and how to bootload them, I tried uploading a simple blink sketch to them.

I started getting the same errors, and tried yet again to take everything apart and put it back together, this time on a brand new breadboard. I rebuilt the entire circuit and now am receiving all of the original errors on the old chip, and then mainly this error (during writing if using verbose output) Writing | ####avrdude: stk500_recv(): programmer is not responding

It starts the writing process, then the #'s stop and it waits about a minute and finally prints that error.

I believe I've only gotten the paged write error once so far with the new chip, whereas the older (p) chip is doing that a good portion of the time if I try to upload to it. I really have no idea what could be causing these errors... This morning I reinstalled the arduino IDE and upgraded to the new version, but am still having the same errors. I'm about to start continuity testing all of my jumpers and ftdi cables for the rare and unlikely event of a defective wire.

CrossRoads, Do you have a specific protocol, circuit, and code that you use for bootloading, and also setting up the board? I notice your Bobuino has different pin settings, so I figured maybe you're doing something different (and in this case, better) than I am.

I have been using Nick Gammon's Atmega_Board_Programmer sketch to boot load these, and it gives a "success" after bootloading on all of these chips. I really don't know if there's a different protocol for uploading/selecting the Atmega1284 as opposed to its P model counterpart, but I've been attempting going about this the same way after uploading the same bootloader as to the 1284 upon changing the acceptable signatures to allow bootloading of the same bootloader to the 1284 (which may not be correct).

Any ideas or tips are appreciated as I have some more (P) chips coming soon and am really hoping to be able to use them!

Thanks!

I use Atmel AVR ISP MKii for all my bootloading. I don't have time to be uploading sketches into Arduino's and finding cables.
The pins are defined in pins_arduino.h and do not come into play for bootloading, only in uploading a sketch.

That blink upload error - do you have the DTR reset cap, and Rx/Tx are not reversed?

Yeah, I've considered moving into that AVR ISP MKiibut haven't needed it until this design gets more refined (and working, at this point).

As far as the blink error, I'm using the same 0.1uF ceramic as maniac bug suggests, I've also tried it previously with 100uF electrolytic as I used on the atmega328p before with no luck. I am pretty darn positive my rx goes to tx and vice versa, I even tried switching them before, and wasn't getting any communication at all. The present layout has it starting the "writing" almost ever time.

Is there any way to test what's going on (or not going on)? Is there a debug procedure you'd recommend?

Thanks again.

If its any help, these are the fuses it states it has verified as correct after bootloading:

Erasing chip ...
Writing bootloader ...
Committing page starting at 0x1FC00
Committing page starting at 0x1FD00
Written.
Verifying ...
No errors found.
Writing fuses ...
LFuse = 0xFF 
HFuse = 0xDE 
EFuse = 0xFD 
Lock byte = 0xEF 
Clock calibration = 0x90 
Done.

Does this match with what you're doing?

Fuses come from pins_arduino.h boards.txt [edit - corrected my statement]
Pin definitions come from pins_arduino.h.

Here are the 1284P settings I use:

bobuino.name=Bobuino with 1284P
bobuino.upload.protocol=arduino
bobuino.upload.maximum_size=130048
bobuino.upload.speed=115200
bobuino.bootloader.low_fuses=0xf7
bobuino.bootloader.high_fuses=0xde
bobuino.bootloader.extended_fuses=0xfd
bobuino.bootloader.path=optiboot
bobuino.bootloader.file=optiboot_atmega1284p.hex
bobuino.bootloader.unlock_bits=0x3F
bobuino.bootloader.lock_bits=0x0F
bobuino.build.mcu=atmega1284p
bobuino.build.f_cpu=16000000L
bobuino.build.core=mighty
bobuino.build.variant=bobuino

The low fuse is the one that sets the crystal type.

This seems to have done it! So far I'm back in business blinking! Maybe Nick has been using another clock (maybe a 20 MHz?) and I did not notice that? The question to me is why did it work beforehand with the same 16MHz resonator? For reference again, the FF low fuses was changed to F7. Thanks so much for all the help, I am very grateful and happy to be able to upload once more.

I have been meaning to ask if you have any description on why the pinouts on the Bobuino are so different from say, the maniacbug pinouts? Is there a reason you selected them in this seemingly unorthodox, but useful manner? Any info would be great as I'm trying to select which one to use.

This may be appropriate for another post, but I feel you're the person to ask. I haven't worked much with these microprocessors and RF communication transceivers such as the nRF24L01+ modules, as much as I have with the atmega328P's - is there a proper connection pinout for this module or specific set of pins that are best to use for CE, and CSN pins (as I know MOSI, MISO, and SCK belong in 6,7, & 8 respectively)? I believe my library allows me to define CE and CSN, but just wanted to ask what thoughts or conventional methods were.

Thanks again

The Bobuino pinouts are different because I was going for compatibility with Duemilanove/Uno - Serial on D0/D1, SPI on 10-11-12-13, I2C on 18/19. Then A0 redefined to be at the middle of the board with A7 at the corner to match what the 328 boards had.
Others just marched around the ports & numbered the pins.

CE/CS for the nRF24L01+ - probably best to select what the library you use calls out. uC SS needs to be an output for the uC to be an SPI master, I'd go with that, unless you already have SS in use as CS for another device, like SD card. In which case pick another non-conflicting pin.