SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
By okinesio
#188346
We made our own Arduino board with the ATMEGA32U4 microcontroller and currently struggle with flashing the bootloader.
There is no ISP pinout, just the USB connection.

Our setup contains the board plugged in the USB port. We tried to flash the microcontroller over USB via the command-line tool DFU-programmer (via Terminal on Mac) with the LilypadUSB bootloader, but receive the following Error:
Code: Select all
ERROR: Data exists outside of the valid target flash region.
Hex file error, use debug for more info.
commands.c:360: Error writing memory data.
I assume that there is not enough space available to flash the microcontroller, but why?
Do I use the appropriate bootloader? Or is it even the right approach to get it work?


We get the same/similar error in Windows with ATMEL FLIP:
Code: Select all
Adress is out of range.
Help is greatly appreciated.
By okinesio
#188371
Our board is based on the Lilypad USB Board, so the LilypadUSB hex file should be the right one, I guess?
We got the source file from here: https://github.com/arduino/Arduino/tree ... LilyPadUSB.

Here is the full debug from the terminal:
Code: Select all
   target: atmega32u4
   chip_id: 0x2ff4
   vendor_id: 0x03eb
   command: flash
   quiet: false
   debug: 10000
   device_type: AVR
------ command specific below ------
   validate: false
   hex file: Caterina-LilyPadUSB.hex

dfu.c:414: dfu_device_init( 1003, 12276, 0x7fff5ba50b60, true, false )
dfu.c:431: found device at USB:10,0
dfu.c:663: Found DFU Inteface: 0
dfu.c:293: dfu_abort( 0x7fff5ba50b60 )
dfu.c:204: dfu_get_status( 0x7fff5ba50b60, 0x7fff5ba50a78 )
dfu.c:230: ==============================
dfu.c:232: status->bStatus: OK (0x00)
dfu.c:233: status->bwPollTimeout: 0x0001 ms
dfu.c:235: status->bState: dfuIDLE (0x02)
dfu.c:236: status->iString: 0x00
dfu.c:237: ------------------------------
dfu.c:688: State: dfuIDLE (2)
atmel.c:1295: atmel_flash( 0x7fff5ba50b60, 0x7fff5ba50a28, false, false )
atmel.c:1158: atmel_flash_prep_buffer( 0x7fff5ba50a28 )
atmel.c:1335: Flash available from 0x0 to 0x6FFF (64kB p. 0 to 0), 0x7000 bytes.
atmel.c:1339: Data start @ 0xFFFFFFFF: 64kB p 65535; 128B p 0x1FFFFFF + 0x7F offset.
atmel.c:1343: Data end @ 0x7FF9: 64kB p 0; 128B p 0xFF + 0x79 offset.
atmel.c:1348: Totals: 0x7FFB bytes, 4261413121 128B pages, 4294901762 64kB byte pages.
atmel.c:1353: ERROR: Data exists outside of the valid target flash region.
Hex file error, use debug for more info.
commands.c:360: Error writing memory data. (err -1)
As far as I see and mentioned before, the hex file is too large.
How is it that the file is too large, even though we have the same microcontroller as Lilypad?
Did I miss something?