ATmega1284P: End to End using 1.0 IDE

I removed the Maniacbug's core.
BTW, the files come from Arduino core.

I tried to use interrupts and/or timers and everything seems to work.

I am using the Arduino 1.0.1 core with a 1284p and it works quite successfully. I did define my own variant for the pins_arduino.h header, and I'm using a variation of the Sanguino bootloader (recompiled for 1284p, 8MHz clock, 57600 baud) but the bootloader is the only compiled non-core thing I'm using.

Both UARTs work fine for me, as does SPI and I2C. I haven't checked all the built-in libraries but I believe the ethernet library might have an issue as it has some pin selections 'hardcoded' based on AVR / board (eg. uno / mega or 328 / 2560) but of course there's no entry for the 1284p.

The only other caveat is how the analog pins are assigned if you use the "A0, A1, ... A7" syntax. There's some lines in wiring_analog that translate things differently so it was easier to not use the A0 A1 etc. names.

Cheers!

@Steph:
thanks for your reply.
The Ax enumeration isn't a problem, in the past I've already encountered this issue.
Can I ask you more about:

  1. pin_arduino.h file: which variant did you use? I used the one from Maniaccbug's core;
  2. when you recompiled the bootloader, did you only modify the make file to create the new entry for 1284p or did you modify the bootloader code too?

westfw:

1284_16.build.variant=1284p

I don't think the default install has a 1284p variant;

Sorry, I didn't put all the steps I did.
I forgot to say that I created a folder named /1284p under /hardware/arduino/variants and that I put inside it the file pin_arduino.h coming from Maniacbug's core.

leo72:
@Steph:
thanks for your reply.
The Ax enumeration isn't a problem, in the past I've already encountered this issue.
Can I ask you more about:

  1. pin_arduino.h file: which variant did you use? I used the one from Maniaccbug's core;
  2. when you recompiled the bootloader, did you only modify the make file to create the new entry for 1284p or did you modify the bootloader code too?

I created my own pins definition. Initially I was working with the Sanguino one but I could never remember which port/pin was which arduino pin so I re-did it with a pin mapping that I could remember.

For the bootloader, I initially managed with just a change to the make file - my project is running at 8MHz with a resonator - but I found the 19200 baud upload to be too slow. To get it working reliably at 57600 baud I had to modify the source file to enable the UART speed doubling function. (My next revision is going back to a crystal and hopefully that will be stable enough for 115200 baud so I will modify the bootloader again to test it.)

Finally, I put everything including my own 'boards.txt' file into my arduino data folder under /hardware. So it's using the custom pins file and bootloader but pointing back to the core files for the actual sketches.

I can zip it all up and post it if you like? When my project is finally completed I'll be posting everything to GitHub but I'm waiting on the next PCB revision and don't want to put it all out there till I know the hardware and software are all working correctly.

Cheers!

I'm having some problems with the bootloader that comes with Mighty-1284 core.
I flashed it "out of the box" and it didn't work. The LED on PB1 won't flash. So I recompiled and flashed it again and then the led flashed correctly. But when I try to upload a sketch via serial I see that the LED flashes 3 times and then, after a couple of seconds, the IDE reports that the programmer is not responding.

spcomputing:
It appears that the DIP version of the 1284p has a communications issue on UART0 (Atmel issue). I assume that you are using CrossRoads SMD 1284p board, so it will not affect your setup. We did get it to work properly using the 16MHz external resonator but not the crystal (don't ask...). So, while not perfect, everything is somewhat workable.

Can I ask more info about this issue?
I'm trying to upload a sketch to a DIP 1284p using the Optiboot from Mighty-1284 core with no luck. I get "programmer is not responding". I can only flash the chip using ISP programming.

EDIT:
I found a cer. res. at 12 MHz, so I recompiled the bootloader for 12 MHz and changed the speed in the entry in the file boards.txt and now it works! I flashed a sketch without problems.
Can someone tell me more about this issue? :sweat_smile:

I have both the CrossRoads SMD 1284p and the Bobuino using Maniacbugs files and setting the board to Bobuino. I have not had any problems.

Can someone tell me more about this issue?

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=107115

What really is ridiculous my date codes are 1021 and it is still an issue.

@leo72: You can use the 16MHz crystals with westfw's UART1 variant of Optiboot for the 1284p. It just means you have to upload your sketches through UART1 and change the Serial to Serial1 in the sketches.

spcomputing:
@leo72: You can use the 16MHz crystals with westfw's UART1 variant of Optiboot for the 1284p. It just means you have to upload your sketches through UART1 and change the Serial to Serial1 in the sketches.

Where can I find this variant?

westfw:

Can someone tell me more about this issue?

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=107115

Uhm.. I read that thread but it seemed to me that those guys had problems using the 1284p at 20 MHz. But I'm using it at 16 MHz, and they said that at this speed the issue shouldn't appear.

Another strange thing is.... why was I able to upload a sketch using a 12 MHz external resonator and I wasn't using a 16 MHz crystal?
who was the problem: the speed or the kind of the clock?

optiboot_atmega1284p-u1.hex

http://code.google.com/p/optiboot/downloads/list

spcomputing:
optiboot_atmega1284p-u1.hex

http://code.google.com/p/optiboot/downloads/list

Thanks, I'll try that but I'll try to find a solution for UART0 issue too..

Thanks, I'll try that but I'll try to find a solution for UART0 issue too..

Good luck my friend. It will be greatly appreciated. I heard, but could not verify (Failed bootload for me) that the Bobuino worked with UART0 and external crystal and Cadunium as well (failure for me as well). The Original Mighty 1284 will bootload with a crystal, but the communications have lantency.

Optiboot-1284p with a resonator operates perfectly on a breadboard.

Bobuino works fine with UART0. I bootloaded 50 boards and downloaded a simple sketch into them before sending the boards to Singapore.
I'm really not understanding where the issue is coming from.
Do you suppose its a fuse setting thing?

Here's what's in my boards.txt file

bobuino.name=Bobuino
bobuino.upload.protocol=arduino
bobuino.upload.maximum_size=130048
bobuino.upload.speed=115200
bobuino.bootloader.low_fuses=0xff
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=arduino:arduino
bobuino.build.core=standard
bobuino.build.variant=bobuino

Here's the bootloader hex file & bobuino pins_arduino.h file used with the mighty1284 core files.
I loaded the mini1284 with these - bootloader went in first try, and then 30 sketch downloads as I tested each pin for LED blinkability one at a time.

optiboot_atmega1284p.hex (1.47 KB)

pins_arduino.h (6.08 KB)

Hi Bob, it seems that this issue only affects DIP chips and your board has SMD MCUs.
Moreover, it seems that this bug doesn't have any clear criteria..
On AvrFreaks forum it's said that it affects DIP chips with 20 MHz crystals, someone here said that it only affects crystals and not resonators, someone else said to use an RC filter but it didn't worked for me.

I know for sure that FOR ME:

  1. at 16 MHz with an external crystal, it DID NOT work, nor at 115200 bps nor at 57600 bps, nor with or without the RC filter
  2. at 12 MHz with a ceramic resonator it DID work at 115600 bps.

So I will buy a 16 MHz cer.res. and I'll try that.

EDIT:
fuses are OK, and I don't get any error after the flash of the bootloader. And it works well too, it flashes the led when I try to upload a sketch but then it fails.

It seems I've solved. :stuck_out_tongue:

Steps I did:

  1. I changed the crystal: same clock (16MHz) but different maker;
  2. put the RC filter as said in the thread of AvrFreaks (R: 10K; C: 100pF);
  3. cut the pins of the C to have them as short as possible and put on the breadboard as close as possible at the RXD0 pin

After several uploads I finnaly can say that now it works correctly. XD

I changed the crystal

Any idea whether there are different specifications for the two crystals that might be relevant?

Same files/settings work on DIP based boards too:
Original Bobuino, Duemilanove style Bobuino, even wirewrap test board.
Maybe the problem is the Programmer? I use Atmel AVR ISP MKii. Nick Gammon's Uno as programmer also appears to work.