Wanted more info on running atmega1284P?

Hi guys,

I have recently been reading up on the 1284P chip which Looks like an impressive improvement to the Uno/328P. Alot of comments out there about people having problems With bootloaders Etc.

I am curious to find out some solid info on exactly what boot loader To use for the 1284P that's fully working at 16mhz Xtal, and if its Possible to burn a bootloader to it using the UNO as ISP, although I Do have a genius g540 programmer as well.

Is there any loses using the 1284P with functionality e.g. Using the eeprom? I have been reading up a lot on it and everything's still abit in the open. Just looking for Solid info so I can crack on with projects.

I have 2 on the way in the post and I don't want to mess them up/brick them When they cost £5 each. Which is still better than the arduino mega at £13 for the SMD chip.

Cheers.

CrossRoads and I were just commenting on the RAM aspect of the 1284P yesterday: http://forum.arduino.cc/index.php?topic=177842.msg1318937#msg1318937

He may be able to answer your question regarding any maturity issues. Of course, after you have a play with your board, you can post your experience, too.

  • Ray

Thanks. Yeah I did see this post at somepoint.

Is this upgraded UNO to 1284P is a recent build/project Going on?

I take it there are still problems to iron out then?

I hope to use this chip on breadboard rather than having an UNO looking Pcb for the 1284P.

Cheers.

I’ve been making Arduino-like 1284P based boards since late 2010.

http://www.crossroadsfencing.com/BobuinoRev17/

This board does a lot - SPI to SD cards, I2C to RTC, dual serial to USB & RS232. Tested all the features on all boards shipped, and did additional testing later when it was discovered that the analog pins were sort of wrapped around by 1 position, which led to a pins_arduino.h tweak.


I use this one to check out simple stuff. Wirewrap assembly, ICSP header to program bootloader, FTDI header for sketches, access to all IO for playing around.

I use the mighty1284 core files that maniacbug put together, replacing pins_arduino.h in the Bobuino variant folder with this file, which has 2 small corrections in it.

pins_arduino.h (6.26 KB)

Thanks for the reply. I did see your builds a few nights ago.
Pretty interesting stuff compared to the specs of the 328p.

What did you mean about the analogue pins and wrapping?

Am I right in saying the mighty 1284 is the latest optiboot bootloader
To burn?

Once the boot loader is on, do you have to have an ftdi to upload
Sketches or can you upload through the UNO or other device?

Analog pin wrapping: There was a problem with this line
// #define analogPinToChannel(p) ( (p) < NUM_ANALOG_INPUTS ? NUM_ANALOG_INPUTS - (p) : -1 )

that fixed with this line
#define analogPinToChannel(p) ( (p) < NUM_ANALOG_INPUTS ? (NUM_ANALOG_INPUTS-1) - (p) : -1 ) // test to see if A0-A7 are off by 1

A0-A7 were responding as if A1-A8 were being accessed.
-1 was added in the middle to fix that. This may have been from flipping the analog pin assignments end for end so that the analog pin located near the middle of a DIP part could be routed direct to the A0 header, continuing out to A6 & A7 (added from Uno) at the corner of the board.
(vs the pins all crisscrossing as they got routed)

Mighty1284 might be the only bootloader available to burn. The copy I use may have been tweaked to have the SCK pin toggle like a Duemilanove/Uno does. I’m not sure what pin might toggle otherwise with the bootloader.

Once the bootloader is loaded, then loading sketches via serial interface is done just like any other Arduino board - external USB/Serial adapter, or on-board USB/Serial adapter.
FTDI based modules are readily available, I just received 2 in the mail yesterday, each came with a short USB A to USB- Mini B cable as well. tinyos electronics, www.tinyosshop.com? Haven’t even opened them up yet.
CP2102 based modules work as well. Usually need a USB-A to USB-A male-female extension cable.
Or you can use your Uno. USB/Serial modules are so inexpensive I wouldn’t bother.

argh right i think i understand a bit about what you mean, and yes i noticed not to long ago about the extra ADC pins in the top corner. why are they not labelled down on the silk screen?

is the wrapping of pins the only problem you have had with this expanded arduino setup?

i am only going to use the 1284p for general I/O, serial in/out and the fact it has a larger sram and eeprom which gives me a lot of head room and less worry about running out.

whats the reason for needing a bootloader on this mega chip? could you not have a bootloader but still use arduino IDE to program the uC?

Not sure where you are looking, I can assure you everything is labelled.

There was something about SPI that the pins_arduino.h takes care of too, like it was being called out twice & causing compile errors when Arduino went from -0023 to 1.0. Just needed a line commented out, you can see it under the diagram of the pinout in the file.

whats the reason for needing a bootloader on this mega chip? could you not have a bootloader but still use arduino IDE to program the uC?

Huh? The bootloader is what lets Arduino program the chip via the serial interface, just like all the other Arduino boards.
Yes, you can not have a bootloader and program the chip with an AVR ISP programmer using File:Upload Using Programmer, just like all the other Arduino boards. I use Atmel AVR ISP MKii myself.

http://it.mouser.com/ProductDetail/Atmel/ATAVRISP2/?qs=sGAEpiMZZMurtJ7VwBTl0Yn98AREnSh5M%2FUVM9qhaqI%3D
wow- price has gone up again - was only $33 when I bought mine originally.

I used to use this one
http://www.mdfly.com/index.php?main_page=product_info&cPath=5&products_id=415
I was having problems after bootloading at some point and switched to the MKii. Later discovered a mismatch with bootload expected speed and PC speed during serial downloads was the culprit (I may have forgotten to set the fuses too) but I never went back to using the MDFLY programmer and can’t find it at the moment.

This is the 1284 bootloader I use.
There might be a slight change from the 2/11/12 version to make the SCK pin blink vs some other pin.
I don’t know what the standard one does.
You can see in boards.txt that the optiboot version is called out.

optiboot_atmega1284p.hex (1.47 KB)

optiboot_atmega1284p.hex (1.46 KB)

ATmegaBOOT_1284P.hex (5.01 KB)

boards.txt (3.3 KB)

My bootloader-uploader supports the 1284:

http://www.gammon.com.au/forum/?id=11635

Also see here: http://www.gammon.com.au/forum/?id=11637

Example of it being hooked up:

Yeah the AVR ISP 2 is expensive over here too.

And now you mention it, I do have one of those USB AVR ISP Dongles, yet I have never had it working. I never got any software Or instructions on how to use it. I can't remember if it works on Win 7 Or XP.

I will give the bootloader stuff ago tomorrow. I received my 2 1284P chips earlier today.

I've burned a number of 1284(P) chips using the UNO as a programmer. Probably easier than messing with an AVR programmer if you're not already used to using one.

Also, if you don't have an FTDI cable/USB dongle, you can probably pull the 328 chip out of your UNO board and jumper to its USB port.

In case it's not obvious, exactly the same bootloader is used for several of the 1284 variants in the maniac boards.txt file. The different variants simply assign the D0..D31 and A0..A7 Arduino callouts to different physical pins on the 1284 chip. Only the Bobuino variant in the maniacbug library has errors in it, AFAIK, but Bob's probably got all of those fixed now.

If you're really compulsive, there were several interminably long threads on the 1284 in this section back in Feb 2013.

The bootloader does not assign the pins - that is done in the pins_arduino.h in the different variant folders. The bootloader and pins_arduino.h I posted work fine with the boards I designed.

EDIT to previous: Yeah, as Bob indicates I didn't quite make it clear: "The different variants simply assign the D0..D31 and A0..A7 Arduino callouts to different physical pins on the 1284 chip", and "that is done in the pins_arduino.h in the different variant folders" when the sketch is compiled.

So, the bootloader is used to upload the sketches, and doesn't do the pin assignments - that's done when the sketch is compiled. So, this way many variants with different pin-assignments can use the same bootloader.

You've got the greatest write-ups Nick, wish I had time to create that kind of depth & detail.

AVR ISP MKii is easy to use once you get the drivers in place for the IDE. Read this thread for ways to set it up. http://forum.arduino.cc/index.php?topic=160226.msg1202909#msg1202909 You can download Atmel Studio if you like, I find under WinVista it takes ages to start up, so I stopped using it to set up 1284s. Now I just: Connect it to the SPI pins, reset, +5, Gnd (or plug it onto the ICSP header that you included in your design), power up the board (can be a 3 AA battery pack even; MKii only monitors the power line unless you mod it to connect USB 5V pin to the 5V header pin), select Tools:Board:your 1284 board type (I use Bobuino for mine), and select Tools:Burn Bootloader. Takes a minute or so. That sets the fuses for 16 MHz operation too. Then File:Upload Using Programmer if you want your sketch to start immediately after a Reset and not have any bootloader delay.

Atmel Studio does the fuses &lockbits & bootloader quicker, but all the time waiting for it to open offsets that. Occasionally (alright, most times) I forget to burn the bootloader first and jump right into downloading a sketch, which then runs ridicuously slow and I frantically check my wiring & stuff, and after a halfhour I recall that I didn't do anything with the fuses. Am slowly getting better about remembering that!

i am about to try fire up this 1284p chip. i have just installed the
mighty 1284p stuff under hardware and over written the arduino pins header
you gave me.

which board options do i use from the list to burn the bootloader? is it the top mighty optiboot one?

Look in the boards.txt file in the library, and choose a board that uses the optibootloader, like Bob said. It doesn't matter which of those several boards you select to burn the bootloader. You really need to learn this stuff, at least for 1284 dev work, because the 1284 support isn't nearly as wrung out as for UNOs/mega2560/etc. Many libraries don't properly support 1284. You have to hack them yourself.

It also doesn't matter which of those boards you then select when compiling sketches. They'll all compile and run ok. The only difference is in the pin assignments, so later on you can choose a board that has the pin assignments you want to use - if you're breadboarding, etc.

For my own work, I used Bobuino or one of the other optiboot variants to burn the bootloader, but I modified the boards.txt file to match the special pinout I use on my own pcb layout.

Like I said, I use Bobuino for the boards I design. Open the pins_arduino.h I posted earlier and review the pin assignments.

sorry i didn’t realise that there were mutiple board options untill in installed the files.
not to worry. i will give it a try