ATmega1284P: End to End using 1.0 IDE

I have sorted my problem. It turned out that I hadn't burned the bootloader properly.

I have an AVRISP MkII but I obviously did something wrong when I used AVR Studio 5.1 to manually burn the bootloaders.

Unfortunately the Arduino IDE can't use the AVRISP MkII using the standard USB drivers so I had find some other way of burning the bootloader.

I decided to try to using ArduinoISP and cobble together a patch cable for my ZIF programming board.

Anyway after re-burning the bootloader with the IDE I can now use my TTL-232R-3V3 to upload sketches.

Such are the mishaps of being new to this :slight_smile:

Martyn.

Unfortunately the Arduino IDE can't use the AVRISP MkII using the standard USB drivers so I had find some other way of burning the bootloader.

I don't understand that. Isn't the AVRISP Mkll driver already installed when you set it up to function with AVR studio? Once the driver is installed it's the PC that senses when you plug in the programmer and uses the preinstalled driver. The IDE does have a AVRISP Mkll choice in the bootloader programmer selection menu, so as long as the programmer is already plugged into the PC, then choosing that programmer should work. That's how it works for my USBtiny programmer, the driver didn't come with the IDE disturbution nor did it install it, that was done prior when the PC first saw the USBtiny was plugged into the PC and asked for a driver source.

Anyway your statement has me confused, could you explain further?

Lefty

Hi Lefty,

I'm just going on what I read in this thread:

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

Martyn.

ringz:
Hi Lefty,

I'm just going on what I read in this thread:

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

Martyn.

Ok, understood. It would seem that you need is to first unistall the driver that avr studio installed for the AVRISP and have someone here identify where you can find the proper driver for it to work under AVRDUDE/arduino IDE.

Anyone have such a lead to the 'correct' driver?

Lefty

It was easier to use my bog standard Arduino, make the lead, and use those to do the work of ISP programmer than go to all the trouble of uninstalling drivers.

Martyn.

It could be this issue:

http://code.google.com/p/arduino/issues/detail?id=650&q=avr%20dragon

It is a combination of things that trigger what I believe is a deficiency (technically a bug) in avrdude.
Basically the problem is that the avrdude low level USB code that talks to libusb (it is not libusb)
resets the USB when it closes the USB device but does not wait for devices to show up when opening the
USB and scanning for USB devices.
So anything that does back to back avrdude commands can potentially
see the second avrdude command fail on some USB devices because the USB enumeration
caused by the first avrdude command is not yet complete when the 2nd avrdude command attempts
to locate the USB device.
The 2nd avrdude command will simply not see the device.

Whether it fails to locate the USB device on the 2nd avrdude command or not depends
on a number factors but this unable to locate the device on the 2nd avrdude command
failure will not happen on USBtiny as it uses different code inside avrdude which does not reset the USB when
the device is closed.
But on an avr dragon and some of the other Atmel USB based ISP products,
it will happen pretty much every time on Windows, and Linux.

There are some simple work arounds that could be done in the IDE java code
or in the bootloader makefiles if you are using makefiles to install bootloaders rather than IDE.
The IDE even already has a 1 second sleep in the java code but 1 second is simply not long
enough for the Atmel USB ISP devices.
A better solution than a blind delay is to do everything in a single avrdude command vs
more than 1 avrdude command.
Currently both the IDE and bootloader makefiles are using 2 avrdude commands
instead of a single avrdude command to burn a bootloader.

There is also a small patch that could be done to avrdude to solve it.
I've entered a bug report on avrdude and in the Arduino buglist
but so far I've not been able to get anybody to make any changes to work around this
as there are concerns about the fix and its impact.

So for now, I run my own privately patched avrdude
Before that, I patched the bootloader makefiles to use a single avrdude
command rather than 2 avrdude commands, which works around the avrdude issue.

--- bill

Very infomative Bill, thanks.

Whether it fails or not depends on a number factors but this failure will not happen
on USBtiny as it uses different code inside avrdude which does not reset the USB when
the device is closed.

And while I've been very satisfied with my USBtiny, I've been told it won't work for an upcoming task I have to burn a bootloader into a mega1284 chip, as the USBtiny can't handle FLASH byte addresses higher then 64k, so I need to look for a solution. I don't know if the standard arduinoISP sketch will perform that task, but if so I'll probably use that. But I was considering purchasing a AVRISP Mkll as I've been told it's a very good programmer, but that may only apply if one is using it with AVR studio?

Lefty

I just borrowed one from skyjumper to burn optiloader into some 1284's.
For reasons I do not understand, when I burned the bootloader with the MDFLY programmer via the IDE, it was leaving one of the lockbits in a state that prevented the IDE from downloading sketches via FTDI Basic after that. Was also sloooow.
Using AVR Studio 5.1, I can download optliloader much quicker, and clear the lockbits if needed. I am doing 50 cards pretty soon (waiting for assembly to complete in CA) so I needed a reliable way to make sure I could load those.
I purchased my own to have now.

I guess I should have been a little bit clearer about the failure type.
When I said:

Whether it fails or not ...

I really meant,
Whether it fails to locate the USB device or not...

(updated the original post above for clarity).

--- bill

1284 thruhole, Duemilanove style boards are in!
Prices shipped to US locations:
1-lot $4.50
2-lot $6.75
3-lot $9.25
5-lot $17.00
10-lot $28.25

I've got 50 of them. 28 are spoken for.

So,
JoeO, wade, kfzqd, 000, skyjumper, maniacbug, lefty, westfw, sync - please paypal your payments to
cardinalflyer @ comcast . net
and we'll get them mailed in letter size envelopes for qtys 1, 2, 3, and small boxes in qty 4 & above due to size & stacked thickness.

I'll see if I can get one asssembled & a picture posted.

Thanks!
Robert

(Rats - I don't have regulators. Knew I forgot to order something when I last ordered stuff from anyone.)

Hi.

I too am trying to get an ATMEGA1284P working with Arduino 1.0 per this site: Arduino on ATmega1284P | maniacbug.

I am able to burn the "Mighty 1284p 16MHz using Optiboot" bootloader to my ATMEGA1284P chip, however, I am unable to upload sketches/programs to the bootloaded chip. Below are the messages I am shown from the console/error log in the Arduino 1.0 IDE when trying to upload the included Blink example sketch:

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

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

Like I said, I have everything wired up per manicbug's wordpress post.

If I have the circuit setup exactly as the schematic shows, have the same Arduino IDE version, and I'm using the same bootloader files, how can there be variance in the outcome?

Given all these constants in our setups, why does everything work for some people and not others?

Is there anyway I can help you guys figure out what is going wrong with this? I am somewhat familiar with Makefiles, how can I try a different baud rate as noted by a few posts earlier in this thread?

Thank you!

I hope I didn't come across as being condescending or anything in my previous post (and subsequently gave you guys reason to ignore my questions). I am genuinely curious as to why there is variance in the outcome of trying to get the ATMEGA1284p working in the Arduino IDE. I read through this entire thread; did I maybe miss a post that was the golden ticket to getting this working?

I would really appreciate any further discussion on this.

Thanks,
Blaker

Sorry, tax return time, been busy.
You may need to check your fuses. For reasons I do not understand, I was seeing one of the Lock Bit fuses being set. Ended up using an AVR ISP MKii to read them and clear the fuses. I don't know if AVRDUDE can do the same for you via the serial port, or if you need to be connected with a programmer to the ICSP header to do that.

Hi all,

I am trying to use the Arduino 1.0 IDE's SoftwareSerial library with an ATMEGA1284P; on physical pins 24 and 25 (pins 18 and 19 in pins_arduino.h for the standard variant) and I see that I cannot receive on pin 24(18). However, I can transmit successfully on pin 25(19).

After research, I now understand that I need to use pins that support 'change interrupts' - which pins on the 1284P support that?

By the way, pins 24 and 25 are part of the JTAG port (TCK and TMS respectively).

Thank you all in advance for your help,
Madhu.

EDIT -

After further testing, the SoftSerial receive is not working on any port. I am at a loss to understand what may be causing this.

CrossRoads:
Sorry, tax return time, been busy.
You may need to check your fuses. For reasons I do not understand, I was seeing one of the Lock Bit fuses being set. Ended up using an AVR ISP MKii to read them and clear the fuses. I don't know if AVRDUDE can do the same for you via the serial port, or if you need to be connected with a programmer to the ICSP header to do that.

Awesome. Thanks for the heads-up on the fuses. I will look into this. I will probably need to buy an AVR IPS MKii; I am currently trying to get the bootloader to work using a spare Arduino.

It makes me wonder if these fuses were (incorrectly) set when we tried to burn the old ATMEGA1284p bootloaders that were made for your Bobuino (I had followed your forum post on getting the ATMEGA1284p working a while back with Arduino 0022).

For anyone having similar issues, I found this Ladyada page that talks about using AVRDUDE and setting/resetting fuses/etc: AVR Tutorial - AVRDUDE.

Un-populated ProMighty boards just waiting on a few parts.


Shot at 2012-03-14

Madhu:
Hi all,

I am trying to use the Arduino 1.0 IDE's SoftwareSerial library with an ATMEGA1284P; on physical pins 24 and 25 (pins 18 and 19 in pins_arduino.h for the standard variant) and I see that I cannot receive on pin 24(18). However, I can transmit successfully on pin 25(19).

Hi all,

Can anyone help me with this?

Thanks,
Madhu.

I don't know Madhu.

To burn the maniacs bootloader with AVR studio and MKii do I just use the .hex?

Don't mean for the newb questions im just learning all of this... :slight_smile: