atMega1284P-AU @ 20Mhz

Hello,

Yes, lots of 1284P chats going on at the moment.

I havent yet found a 1284P-AU (SMT Package) bootloader though for 20Mhz. Just wondering if anyone knows of one?

CrossRoads suggested the mighty1284 bootloader, GitHub - maniacbug/mighty-1284p: Mighty 1284P Platform for Arduino, but I believe this only goes to 16Mhz and if changing it to 20Mhz then millis() and micros() will be off etc.
Its been many months since I have played with these things, but rusty. Having to catch up.

If anyone knows of anything suitable, can you post a reply.

Thanks
J

I have optiboot for atmega1284p at 20MHz - I needed the extra 4MHz to make an application fast enough. I will upload it this evening.

Edit:
This is my boards.txt entry. Use it as a guide for fuses, etc. The bootloader uses 115200 Baud, using UART1, the TX1 and RX1 pins. The status led is on PD7. If you want UART0 or a different LED pin and I will recompile it for you.

cube1284p_20.name=Cube 1284P (PCB, 20MHz)
cube1284p_20.upload.protocol=arduino
cube1284p_20.upload.maximum_size=130560
cube1284p_20.upload.speed=115200
cube1284p_20.bootloader.low_fuses=0xFF
cube1284p_20.bootloader.high_fuses=0xDE
cube1284p_20.bootloader.extended_fuses=0xFD
cube1284p_20.bootloader.path=optiboot
cube1284p_20.bootloader.file=optiboot_atmega1284_20.hex
cube1284p_20.bootloader.unlock_bits=0x3F
cube1284p_20.bootloader.lock_bits=0x0F
cube1284p_20.build.mcu=atmega1284p
cube1284p_20.build.f_cpu=20000000L
cube1284p_20.build.core=arduino
cube1284p_20.build.variant=Cube

optiboot_atmega1284_20.hex (1.38 KB)

Awesome thank you!
Can you please recompile it to use UART0?
That would be amazing.
Much appreciated.

You are using the smt part right?
What core are you using?

Thanks
J

Sure, I will do that.

I am using the SMD part as well, though both the THT and SMD parts are the same, so it makes no difference. In terms of core, I am using the standard Arduino core, with the pins_arduino file is a modified version of the one found here: GitHub - stevemarple/Calunium: Arduino clone based on the ATmega644P/ATmega1284P . (I called my variant Cube as it was for an LED cube).

EDIT: UART0 version attached - though this has not been tested. Let me know if it works.
I have also attached the pins_arduino.h file I am using.

optiboot_atmega1284_20_UART0.hex (1.38 KB)

pins_arduino.h (6.25 KB)

You are the man, thank you very much.

My PCB will be arriving tomorrow, so I will text it as soon as its built, no doubt the same day it arrives, and let you know.

again, thanks heaps

J

Hi again...

Is that pins_arduino.h file correct?
It looks to be the TH version with 40 pins... the SMT version has 44 pins.

Thanks
J

The extra four pins are VCC2 + GND2. The actual pin map works fine as in the software doesn't care where the physical pins are on the IC, just which bit in which port/ddr/pin register they are. You will have to consult the datasheet to work out where each of the port bits (eg PD2) are in relation to the SMD version pins.

Ok thats fine, thanks.

Ill give it a try

Cheers
J

@Tom Carpenter,

Using 20Mhz, do you have any issues using serial monitor, or any other functions? Did you have to make any code adjustments to work around any issues/

Thanks for sharing your opti-boot!
Mark

Everything works fine without having to do any adjustment. Arduino will quite happily compile for this frequency as long as you set it in the boards.txt file. Also, FCPU = 20000000 is a nice multiple of a 1000000 and of 4, so there are no issues with the delay() and millis() functions.

Great to hear!

Out of interests sake, what version of Optiboot is this bootloader?

Just been reading the "ATmega1284P: End to End using 1.0 IDE " thread.

Cheers
J

Its my own modified version.

Burnt the bootloader, but got this error:

avrdude: verification error, first mismatch at byte 0x10000
0xff != 0x04
avrdude: verification error; content mismatch

I have had it before, so I tried the blink sketch modified to D10 for my board, and it seems to work.
Was running off internal oscillator /8 at initial power up, so the blink was incredibly slow, but after the bootloader it is 1s on 1s off, so that appears to have worked.

Using Sparkfun AVR Pocket Programmer for ICSP programming, USBtinyISP selection in the IDE.

Bootloader took a good few minutes to burn... seemed longer than usual. 1Mhz internal clock probably didnt help...

Cheers
J

No luck with serial programming yet.

Constantly get

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

Reloaded bootloader, took another 5 minutes or so (is this normal?) and now I can program over serial, strange. But Yay :slight_smile:

yeah, it takes quite some time to burn the bootloader. I think there is a mistake in the avrdude.conf file, but i can't be bothered to find it as you only have to burn the bootloader once.

Processor seems to be locking up constantly, not sure what is going on.

Changed to 16Mhz version of "Mighty 1284p 16MHz using Optiboot", but I cant get that to let me upload over the uART0.
Not sure if this is setup for UART0 or UART1.

Programming over ICSP at the moment, and it seems stable.
Not sure whats going on at 20 Mhz

Which is the prefered 16Mhz 1284P bootloader for UART0 ?

Thanks
J

The reason I used UART1 is from what I have read there is some obscure glitches between optiboot and UART0 for the 1284. The UART1 works flawlessly.

In what way is it locking up?

Code stops executing.
Im writing to the serial port, and now and then it just stops dead in its tracks, LED stops blinking (that I have to indicate it being alive) and it just grinds to a halt.

Sadly I cant use UART1 as I have my 4 layer PCB already printed :frowning:

Found an Optiboot version 4.5 using UART0 @ 16Mhz which seems to be working so far, for the few minutes of testing I have done.
Ideally would like a 20Mhz version working though, but such is life.

Thanks
J