Uploading troubles to 1284p

Bit of history about the problem before I start of... (Plz have a little patience its going to be a long one... :) )

http://arduino.cc/forum/index.php/topic,80483.msg747154.html#msg747154

Is it just me or is someone else facing problems while uploading sketches into ATmega1284p using maniacbugs optiboot bootloader?

For the last few days I have been experiencing the problem. The smaller sketches say Blinky codes and all get uploaded fine(with a probability of around 90% ie) it uploads properly 9 out of 10times ) But when the sketch size is larger(Sketch of a project I am working on. Mine around 16-17KB) my rate of uploading correctly drops drastically to around 10-20% smiley-sad Most of the time it uploades wrongly with the following error... smiley-sad

Code:

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64 avrdude: stk500_cmd(): programmer is out of sync

or this...

avrdude: stk500_getsync(): not in sync: resp=0x00

Tried burning bootloader again and still no improvement... (The board and schematics I use http://arduino.cc/forum/index.php/topic,80483.msg732693.html#msg732693) Has anyone else experienced it??

Had enough with this uploading problem now... :( Now it hardly ever uploads properly (more like once or twice in around 30-40times...) I really need some help here... :( Reading the maniacbug optiloader (ATmega1284P: End to End using 1.0 IDE) post towards the end I seem there are others are facing the same issue or are they?? ( Ex: http://arduino.cc/forum/index.php/topic,80483.msg768523.html#msg768523 different clone boards but similar issues? )

Can anyone plz help me this?? I will try to be ask specific and detailed as possible regarding it...

Stuff I use... 1) Atmega1284p clone board http://www.ebay.in/itm/ATMEL-ATMEGA1284P-PCB-ATMEGA644P-ATMEGA32-ATMEGA16-components-/140621576563?pt=LH_DefaultDomain_203&hash=item20bdb2f973 Schematic and PCB of the board http://arduino.cc/forum/index.php/topic,80483.msg732693.html#msg732693

2) Serial Cable DB9 connector on 1 end and 5pin female terminal on the other side Connections:

PC ATMEGA1284

DB9 Board

3 Rx 2 Tx 7 RT 5 GND

3) Power supply 9V DC adaptor (No issues there still... ;) )

4) Software I am using Win XP with Arduino 1.0

Stuff I tried for trying to solve this...

  1. Replaced the boards, with a replacement from the Ebay dealer still no change in result.

  2. Replaced the Atmega1284P with an another piece still no change.

  3. Burnt the maniacbug's bootloader 3-4 times -- > Bootloader burns just fine using ArduinoISP tutorial

  4. Tested the serial cable for continuity --> Works fine

  5. Tested the serial port of my PC --> works fine(Programming my other duemilanove clone boards. They are uploading fine and working properly )

  6. Tried to program my ATmega1284p (With IC in clone board) with duemilanove board (with that ATMega1284p board selected in IDE) by shorting RST, Rx, Tx, 5V, GND of duemilanove board (with Amega328p IC removed of course..) and Atmega1284p. ----> This I thought should have worked but strangely wasnt...

  7. Tried the step 6 again with Atmega1284p now on breadboard(rather than on clone board) with same connections + connected the crystals from duemilanove boards in addition to power supply to breadboard ICs ---> This also wasnt working. :(

  8. Last try changed the serial cable connections from PC ATMEGA1284

    DB9 Board

    3 Rx 2 Tx 7 RT 5 GND

to

PC ATMEGA1284

DB9 Board

3 Rx 2 Tx 4 RT 5 GND

changed to DTR pin connection (Still not sure which to use for reset though DTR or RTS) --> this was more of a hunch not sure why I did it. got the idea from this http://arduino.cc/forum/index.php/topic,104435.msg783355.html#msg783355

After all this I am totally stumped still cant figure out whats wrong... Tried everything possible with my limited knowledge to get the uploadings done properly but still facing issues... :(

This by far my longest post in this forum. :) First of all thanx for reading upto this... ;) (U have one helluva patience :D )

Anybody with any suggestions on how to make uploads smoother is welcome... :)

Thanx again. Hoping U guys will help me out.

(Sorry if Mods feel this a run off of the Maniacbug thread, thought this required a new thread. Hope you understand :) )

I admit I haven't read every last word there, but have you considered using SPI (ICSP) programming instead? Get a suitable programmer (I can't say for sure about them as I don't have a ATmega1284p) but if you upload using that you don't need a bootloader at all.

With a bootloader you are inserting another point of failure into the uploading process. The bootloader, which may or may not work for every sketch size, and avrdude which is reading in the .hex file and uploading it.

One thing that ought to work .... ought to, I say .... would be to get the AVRISP MkII from Atmel (eg. Digi-Key) and the AVR Studio, and then upload the .hex file produced by the Arduino IDE. Once you have things set up, it's just a case of plugging in the 6-pin IDC cable and hitting the "program" button in the AVR Studio.

Or, set your bootloader to AVRISP in the IDE, and upload directly. I can't prove one way or another that it will work (because I don't have the chip), but I'm confident there is a solution.

@Nick Gammon Thanx for the help... :)

I admit I haven't read every last word there

I really didnt suppose anyone would. But then again I had to try becoz this was driving insane for weeks now... :(

have you considered using SPI (ICSP) programming instead

No. I havent issue is when I started out into field of electroics around 3-4yrs back, I got introduced to Arduino first. I liked it so much that I didnt feel it necessary to go for any other device like PIC or so and not even any other programmer. I really dont want to invest in any other programmers. :( I would do it only if its the last option available... :( If anyone else can suggest any other solutions I would be really grateful BTW I dont have much idea on how to do it with other programmers. Is it easy??

The issue with this problem is I cant find out where the problem is. Is it the problem with board, chip, bootloader . serial cable or even with the interface circuit. Always when I have a failed upload Rx pin blinks like 3 times or so and stops. could be a sync problem. But I cant really figure it out... :( Hoping someone will be able to crack this... :|

I really dont want to invest in any other programmers.

...

Tried to program my ATmega1284p (With IC in clone board) with duemilanove board (with that ATMega1284p board selected in IDE) by shorting RST, Rx, Tx, 5V, GND of duemilanove board (with Amega328p IC removed of course..) and Atmega1284p. ----> This I thought should have worked but strangely wasnt...

Well you have at least two boards, right? A programmer costs around $20. It might solve your problems.

[quote author=Nick Gammon link=topic=104780.msg785825#msg785825 date=1336385920]

I really dont want to invest in any other programmers.

...

Tried to program my ATmega1284p (With IC in clone board) with duemilanove board (with that ATMega1284p board selected in IDE) by shorting RST, Rx, Tx, 5V, GND of duemilanove board (with Amega328p IC removed of course..) and Atmega1284p. ----> This I thought should have worked but strangely wasnt...

Well you have at least two boards, right? A programmer costs around $20. It might solve your problems. [/quote]

Yes. I know it really sounds strange or so... Shelling out some 25$ + around 25-30$ for shipping it here... isnt a option right now :( As I said I am not close minded about that idea but Plz understand its the last option I would want to do.. (Plus there is a chance that it might not work also.) So plz do understand my situation... :( @Nick gammon I have some 4-5 dumilanove boards though... :) Can I make a AVRISP MkII from that?

So you've bought 4-5 duemilanoves but you can't bring yourself to buy a programmer? If you can bring yourself to get another duemilanove board, get a programmer instead.

So you've bought 4-5 duemilanoves but you can't bring yourself to buy a programmer? If you can bring yourself to get another duemilanove board, get a programmer instead.

that bought over last 4yrs or so... + these clone boards are available here in my area pretty cheap so no shipping costs... :)

you can't bring yourself to buy a programmer?

See the problem is I never felt i needed till now. My Arduino projects were doing just fine till now apparently. So I never needed a programmer till now.

Is there no other solution other than burning via ICSP? :(

mmkay well since you have so many boards, you may not have to.

Search around on the arduino.cc pages for something about using an arduino to burn a bootloader or program another microcontroller. I would get you the link but i'm in class right now :)

It seems ICSP is working fine -- he says the bootloader is written successfully:

Burnt the maniacbug's bootloader 3-4 times -- > Bootloader burns just fine using ArduinoISP tutorial

... so another programmer isn't likely to help anything.

From what I understand, the problem is with uploading sketches via serial. From my own research, I see that's rather common. Crossroads and others suggested it's probably the fuse settings that need to be fixed, and westfw found some bugs in the bootloader on the 1284p that have also been fixed.

So, it sounds like the fix is: Get the new OptiBoot from the repo and replace Maniacbug's version. Then, fix the boards.txt entry to use the fuses from the last page or two of the long 1284p IDE thread. I haven't gotten back around to test this on my 1284p breadboard yet, so I have nothing to add from my own experience, but it sounds promising! :-)

@funkyguy4000 Nice of you to read such a long post in class.. Boring lectures are on??? ;) Thanx But as I said its last option. Are u referring to burning bootloader via another arduino (or something similar) becoz I have burnt bootloaders via ArduinoISP only... :)

SirNickity: It seems ICSP is working fine -- he says the bootloader is written successfully:

Burnt the maniacbug's bootloader 3-4 times -- > Bootloader burns just fine using ArduinoISP tutorial

... so another programmer isn't likely to help anything.

If this is true, that takes out the programmer out of the equation.

From what I understand, the problem is with uploading sketches via serial. From my own research, I see that's rather common. Crossroads and others suggested it's probably the fuse settings that need to be fixed, and westfw found some bugs in the bootloader on the 1284p that have also been fixed.

So, it sounds like the fix is: Get the new OptiBoot from the repo and replace Maniacbug's version. Then, fix the boards.txt entry to use the fuses from the last page or two of the long 1284p IDE thread

I will give it a go.. :) but plz do help me out here becoz where can I get the edited bootloader? (I have no idea what you meant by " Get the new OptiBoot from the repo") I will try burning the bootloader the first thing tmrw... bit late here... :) Thanx for your help... :)

000: @Nick gammon I have some 4-5 dumilanove boards though... :) Can I make a AVRISP MkII from that?

You should be able to make an ArduinoISP out of one of them. I've been playing with bootloaders recently (here) but in my case I made a programmer that worked stand-alone. And I haven't put the bootloader for the 1284 in it.

You have a number of problems you need to solve and I'm not sure where in the list you are:

  • Finding the correct bootloader (hex file) for your chip
  • Flashing the bootloader (ie. via the ICSP interface)
  • Getting the fuses right
  • Connecting the bootloader to the computer via serial/USB
  • Selecting the correct board in the IDE
  • Uploading a sketch using the new bootloader without errors
  • Seeing the sketch work. :)

@funkyguy4000 Nice of you to read such a long post in class.. Boring lectures are on??? Thanx But as I said its last option. Are u referring to burning bootloader via another arduino (or something similar) becoz I have burnt bootloaders via ArduinoISP only...

yea, well I like to help as best I can and learn at the same time. I think I was in Circuit Analysis and Design and my professor was talking about three-phase systems. blech yes I do mean that. As the other person said, we don't need a programmer for this issue.

000: but plz do help me out here becoz where can I get the edited bootloader? (I have no idea what you meant by " Get the new OptiBoot from the repo")

http://arduino.cc/forum/index.php/topic,80483.375.html

Check the end of that thread... Crossroads published some fuse settings, and further down, there were some posts on recently-discovered issues with the 1284p.

There's a sticky thread right in this forum: http://arduino.cc/forum/index.php/topic,64105.0.html

That should get you to the download site.

@SirNickity http://code.google.com/p/optiboot/downloads/list Is this the one? In that this is it?? http://code.google.com/p/optiboot/downloads/detail?name=optiboot_atmega1284p-u1.hex&can=2&q=

and is this the msg u were mentioning about Crossroads? http://arduino.cc/forum/index.php/topic,80483.msg768482.html#msg768482 (I really dont know where to edit these though)

@Nick gammon

You have a number of problems you need to solve and I'm not sure where in the list you are:

Finding the correct bootloader (hex file) for your chip Flashing the bootloader (ie. via the ICSP interface) Getting the fuses right Connecting the bootloader to the computer via serial/USB Selecting the correct board in the IDE Uploading a sketch using the new bootloader without errors Seeing the sketch work. smiley

I think i got all these steps right for maniacbugs tutorial. and was successful in uploading the maniacbugs bootloader. I dont know where the new edited bootloader is... :~

If you have a bootloader burnt in, the next important thing is to tell the IDE the right board type. Or more correctly, the one that matches the bootloader you used.

Bootloaders take serial commands from the comms port, if the bootloader is expecting 9600 baud, and the computer is sending 115200 then it ain't gonna work.

Insert Quote If you have a bootloader burnt in, the next important thing is to tell the IDE the right board type. Or more correctly, the one that matches the bootloader you used.

Bootloaders take serial commands from the comms port, if the bootloader is expecting 9600 baud, and the computer is sending 115200 then it ain't gonna work.

I guess i have done that also correctly because I was able to burn quite a few times before troubles started and frequency of getting uploaded correctly started reducing...

Board selected is Mighty 1284p 16MHz using Optiboot with maniacbugs bootloader

It's been a few weeks since I read the post -- I think I mis-remembered. There's an update to the Makefile to build optiboot (regarding oscillator settings), but looks like no changes to the hex itself. So the one (4.5) from January looks to be the latest. I don't know if that's the same as Maniacbug's or not.

You might need to check out the various fuse combos posted in the last page. Run those through a fuse calculator and see what the differences are. Pick the one that looks most appropriate for your setup and see if that improves things. I'm pretty sure that was my problem, I just haven't gotten back around to testing it yet. (Other priorities...)

How and wer do I change these fuse settings? :~

Can you "talk" to this board using avrdude? Just remind me what programmer you are using?

With my Uno, and with the board plugged into a USBtinyISP, I can do this:

$ avrdude -c usbtiny -p m328p -v

...

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as 5

There are the fuses. With your chip you would want:

avrdude -c usbtiny -p m1284p -v

As I said I dont have any other programmer. I use the Serial interface in the duemilanove board or the transistor interface i have the Atmega1284p clone board for "talking " with the IC. I have only used the Arduino IDE to talk with the board till now. I have never used AVRdude software.(Till now Inever had the need to... :( ) So would I need a programmer to do what you mentioned? I mean for reading and writing fuses...