Welcome! Log In Create A New Profile

Advanced

I can't burn bootloader for Atmega1284p-PU. Please help!

Posted by Reprap-ken 
I can't burn bootloader for Atmega1284p-PU. Please help!
April 10, 2013 10:36AM
Hello friends,

I just built a Gen7 Board-AVR1.5 with a blank ATmega1284P-PU at 16 / 20 MHz as the intruduction at wiki web. But when I burn the bootloader using Arduino IDE and USBtinyISP, the follwoing error warning alway appeared:
"
avrdude: verification error, First mismatch at byte 0xF800
0x8F !=0xFF
aurdude: verification error: content mismatch

"
Please give me some clue to solve this problem!

Thanks!
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 10, 2013 11:49AM
I don't think USBtinyISP handles chips that big.


[www.hydraraptor.blogspot.com]
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 10, 2013 01:20PM
[arduino.cc]


- akhlut

Just remember - Iterate, Iterate, Iterate!

[myhomelessmind.blogspot.com]
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 11, 2013 02:55AM
Quote
nophead
I don't think USBtinyISP handles chips that big.

*sigh* yet another pitfall.


@Reprap-ken: can you try to upload a firmware other than a bootloader? The bootloader goes to the top of the flash space, so 16-bit address handling isn't sufficient. Uploading something < 64 kB should work, though. And, as you have a programmer, you can upload firmwares directly, without bootloader. Works the same way as when using the bootloader, just send the .hex file to the programmer's serial device instead of the "real" serial device.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
mcp
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 11, 2013 03:39AM
Sorry,
but why should a USBtinyISP not be able to program any AVR with an ISP interface, no matter what size the Flash has ?
It is just a sequential programming process, and the ISP is just a simple Hardware Interface... Look at the old famous ponyprog serial interfaces...
Even USBASP is based on a Atmega8 only ;-)

Edited 1 time(s). Last edit at 04/11/2013 03:41AM by mcp.
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 11, 2013 03:13PM
It can program it, but it can't address the full memory. The usbtiny uses a 16 bit *byte* address, so it can only address the first 64K of memory before it wraps around and starts overwriting what was already written. You might say "but my bootloader is only about a kilobyte!". Well, the AVR bootloader is written to the last few kilobytes of the program memory space. I believe with default reprap fuses on the atmega1280 the bootloader is written at 0xFC00 in *words* which is 1F800 in bytes. The usbtiny will overflow and write your bootloader to 0xF800, and when verifying avrdude expects 0xF800 to be blank, which it will no longer be due to the previous overflow. And that's what's going on in the above error. Your options are to get a programmer that supports larger chips, get a smaller chip, or burn a compiled hex file smaller than 64K directly and forgo the arduino bootloader.

Oh, BTW, you may find that the bootloader is actually working if you try to hook it up to the arduino ide. The atmega overflows and starts executing the first instruction it encounters, your misplaced bootloader. It'll work once to load via arduino, but subsequent resets will execute the loaded sketch and never the bootloader.

For reference: [www.adafruit.com]

Edited 2 time(s). Last edit at 04/11/2013 03:28PM by Rezer.
mcp
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 13, 2013 07:53AM
You are right, but I guess, this is a strange software limitation on the USBTiny firmware, as both programming and USB are serial communication and should be capable of doing any size of flash ;-(
The reason is within the USBTiny only an unsigned int is used for address, while for example the USBASP uses an unsigned long
I have no clue about the reason the USBTiny is only using a 16 Bit data type, but this will limit the adressing.
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 14, 2013 03:37AM
Quote

both programming and USB are serial communication

Programming isn't serial. .hex files contain addresses and the programming protocol programs block by block. That's why a bootloader .hex is much smaller and uploaded much faster than a 40kB firmware.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
mcp
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 14, 2013 03:53AM
Hi,
both USB and ISP use one wire to communicate per direction. Each Byte is serialized and send as an ordered form of Low and High signals. This is serial. The Address is multiplexed with the data and the Programming protocol uses about 17 Bit addresses. (See code of USBasp and USBTiny) The address is shifted rigth by 9 and 1 bit for the two transfer telegram used to address.
So this would even work with a nibble processor as long as enough data is stored. So programming by tiny has no physical limitation (onyl maybe program space) but the data type used will wrap the address after 16 Bit, meaning you can only address 64k and not 128k ;-(
The possible address space is only limited by the address bits transferred on the ISP connection (SPI) where also a limited amounts of bis is used for the address.
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 14, 2013 09:01AM
So more to the point. (I'm having the same problem) How do we get around the limitation. Can we use an arduino (or gen7, sanguinololu, etc. ) as a programmer or would that run into the same problem? Does a parallel cable programmer avoid this limitation?

Bryan
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 14, 2013 10:03AM
I use a Pololu ISP programmer.


[www.hydraraptor.blogspot.com]
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 14, 2013 12:55PM
The only reason usbtiny has the 64KB limitation is because they had to do a little trickery to get the usb implementation and programmer to fit on an attiny2313...addressing larger than 16 bit wouldn't have fit. The "fix" is to get practically any other programmer, as I haven't heard of any others that have a similar issue.
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 16, 2013 02:03PM
Even though USBtiny fails on the verification (reads), it actually writes perfectly

You can safely ignore that... If there was an issue sketch upload would fail

Set arduino to verbose mode - you'll see AVRDUDE writes all the way to the end. The read back to verify is all that fails

Been doing this for months and no issues whatsoever with 1284p and 2560s even

Edited 1 time(s). Last edit at 04/16/2013 02:06PM by peter6960.
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 16, 2013 11:56PM
peter6960 Wrote:
-------------------------------------------------------
> Even though USBtiny fails on the verification
> (reads), it actually writes perfectly
>
> You can safely ignore that... If there was an
> issue sketch upload would fail
>
> Set arduino to verbose mode - you'll see AVRDUDE
> writes all the way to the end. The read back to
> verify is all that fails
>
> Been doing this for months and no issues
> whatsoever with 1284p and 2560s even


Well of course it says it wrote all the way to the end, avrdude can't tell there was an address overflow nor does the usbtiny check for one. The verify failing is the hint that something isn't quite right (as well as the maker of usbtiny saying it won't work over 64K). Have you uploaded a sketch > 64K and had it work?
Re: I can't burn bootloader for Atmega1284p-PU. Please help!
April 18, 2013 10:15AM
You're going to need to make a few modifications to the boards file ./hardware/sanguino/Boards.txt

Add the following at the bottom


##############################################################

atmega1284p-pu.name=Sanguino W/ ATmega1284p 20mhz

atmega1284p-pu.upload.protocol=stk500
atmega1284p-pu.upload.maximum_size=131072
atmega1284p-pu.upload.speed=57600

atmega1284p-pu.bootloader.low_fuses=0xD6
atmega1284p-pu.bootloader.high_fuses=0xDC
atmega1284p-pu.bootloader.extended_fuses=0xFD
atmega1284p-pu.bootloader.path=atmega
atmega1284p-pu.bootloader.file=ATmegaBOOT_168_atmega1284p.hex
atmega1284p-pu.bootloader.unlock_bits=0x3F
atmega1284p-pu.bootloader.lock_bits=0x0F

atmega1284p-pu.build.mcu=atmega1284p
atmega1284p-pu.build.f_cpu=20000000L
atmega1284p-pu.build.core=arduino
atmega1284p-pu.build.variant=standard

Grab the bootloader from [github.com]
Sorry, only registered users may post in this forum.

Click here to login