atmega1284

I had a similar problem, but I suspect it was related to using the USBtinyISP from adafruit (which is acknowledged to not be able to program an 1284, see this: USBtinyISP Bug reading flash >64kb - adafruit industries).

Burning the bootloader (with USBtinyISP, that's the only one I got) was half-successful: writing ok, reading back for verification failed, as expected and as detailed in the above-mentioned adafruit post. But then, when uploading sketches always failed.

I the end I found a combination that worked:

  • bootloader from calunium (atmega1284p_16MHz.hex)
  • these settings in boards.txt:
atmega1284.name=Sanguino W/ ATmega1284p 16mhz
atmega1284.upload.protocol=stk500v1
atmega1284.upload.maximum_size=129024
atmega1284.upload.speed=57600
atmega1284.bootloader.low_fuses=0xFF
atmega1284.bootloader.high_fuses=0x98
atmega1284.bootloader.extended_fuses=0xFD
atmega1284.bootloader.path=atmega
atmega1284.bootloader.file=atmega1284p_16MHz.hex
atmega1284.bootloader.unlock_bits=0x3F
atmega1284.bootloader.lock_bits=0x0F
atmega1284.build.mcu=atmega1284p
atmega1284.build.f_cpu=16000000L
atmega1284.build.core=sanguino

Note that I already have the sanguino libraries installed. I also modified the code specific to 644 (some files in core/sanguino folder) to include the 1284 as well.

Ok so this is where Im at.
I have installed the bootloader from calunium - the same one you stated, using avr studio and an isp mkii programmer. All went well.
I have installed the sanguino files to the hardware folder, and inside the sanguino boards folder I have added the board you uploaded. i.e:

##############################################################
atmega1284.name=m1284 16mhz
atmega1284.upload.protocol=stk500v1
atmega1284.upload.maximum_size=129024
atmega1284.upload.speed=57600
atmega1284.bootloader.low_fuses=0xFF
atmega1284.bootloader.high_fuses=0x98
atmega1284.bootloader.extended_fuses=0xFD
atmega1284.bootloader.path=atmega
atmega1284.bootloader.file=atmega1284p_16MHz.hex
atmega1284.bootloader.unlock_bits=0x3F
atmega1284.bootloader.lock_bits=0x0F
atmega1284.build.mcu=atmega1284p
atmega1284.build.f_cpu=16000000L
atmega1284.build.core=arduino

The arduino is programmed as the isp programmer and I am trying to burn the blink example to the m1284. However I get the error
'OUTPUT' was not declared in this scope.
This is only a problem when I choose the board above.

I have the m1284 on a breadboard w/ 16MHz crystal, power from arduino, arduino pins 10,11,12,13 going to mosi miso sck and reset lines.
One thing Im not sure of is whether i need to connect the rx's together and the tx's together?

am trying to burn

Did you mean "upload the sketch"? Are you using the FTDI cable/breakout?

I get the error 'OUTPUT' was not declared in this scope.

Is this a compilation error?

"OUTPUT is not declared in this sketch" !

This relates to the processor not being recognised by the IDE and so it is not declaring the definitions etc for it. Have you modified the relevant files? Did you look at the thread I started about the 1284p that is linked to from maniacbugs's page?

The work he has done with v1.0 should give you a pointer.

I have the 1284p uploading and working under v1.0 now. My only issue is that I would like an option of uploading more slowly as my test board kicks off quite a bit on longer sketches and I am too busy working on other projects to build a better one :slight_smile:

Check this thread re variant part : http://arduino.cc/forum/index.php/topic,99134.0.html

buycris:
Ok so this is where Im at.
I have installed the bootloader from calunium - the same one you stated, using avr studio and an isp mkii programmer. All went well.

I've not tried burning bootladers using an Arduino. When I started with the stripboard version of Calunium I built my own parallel port programmer to get started. It worked but was slow. I invested in an AVR dragon and I've not had any hassles since. Either way, the first thing I do with a new MCU is to program the fuses using avrdude from the command line. Once it is programmed for an external crystal all later actions can be done at full speed.

If are mixing and matching bootloaders and pin mappings you might get problems later with digitalRead, digitalWrite and analogueRead. If your board is a Calunium you should be able to use all of the code from github repository. Inside your sketches create a directory called "hardware", then copy everything in Calunium/software at master · stevemarple/Calunium · GitHub and put it in your hardware directory.

Maniacbug has done lots of good work getting everything to work. I'm in the process of rewriting the Calunium pins_arduino.h for mighty-1284p.

OK guys i got there, but now failing again.
I used maniacs bootloader and uploaded it using AVR studio 4. That was a success, then using his board file in arduino IDE, i could upload the blink sketch.
i am not using the arduino board any more, I have the mega1284 on a breadboard, with a max232 chip and a usb-serial cable wired up. I program it using this. After watching a youtube video I found out about the DTR on the serial line that needed to be connected to the negative of a capactior while the positive was connected to the reset pin. i managed to upload the blink sketch and everything was good.
I then tried uploading a longer program, and I got errors. I tried the blink sketch again and now that doesnt work either...:

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

Is there something to do with autoreset i need to deal with? aparently if its not quite reset at the right moment it can cause problems?

Try this: Hold the reset button down, and start the IDE transfer.
When it shows "Binary sketch size: 2146 bytes (of a 32256 byte maximum)" or similar, release the reset button.

the DTR on the serial line that needed to be connected to the negative of a capactior while the positive was connected to the reset pin.

That capacitor is supposed to be a non-polarized 100nF (like the decoupling capacitors).

buycris:
I then tried uploading a longer program, and I got errors. I tried the blink sketch again and now that doesnt work either...:

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

Is there something to do with autoreset i need to deal with? aparently if its not quite reset at the right moment it can cause problems?

Welcome to the 1284p !

I've had the same issues to be honest. I asked maniacbug to produce a bootloader that uploaded at 28K but there isn't one yet. I don't get much time to play with the 1284p etc with my other stuff but keep coming back to it. I suspect the PCB I made for the 1284p has the crystal and caps on the limit of distance and I'm having a little timing glitch. I had already designed a replacement but not had chance to make it yet. How close are these devices to the legs of the 1284p on your breadboard? It you stick the crystal at an angel or bend the legs you can get it virtually touching.

I ended up using the AVR ISP Mk2 for uploading sketches too but will sort this eventually.