Close

DFU made me jump around

A project log for Game Boy Cartridge plus Programmer

not the first cartridge on this platform

davedarkodavedarko 01/17/2017 at 01:140 Comments

This board is way out of my Arduino comfort zone... so I'm writing down what I've managed to learn or am able to estimate. I was trying to get this code running http://www.ssalewski.de/AT90USB_firmware.html.en - and the way it was given to upload was via a program called dfu_programmer, that is probably best installed via homebrew for mac (my given machine).

brew install dfu_programmer

I tried and tried and couldn't figure out what I'm doing (wrong) until I've read someone writing in a forum that in a case of a flashed program there wouldn't be the generic dfu bootloader anymore. Luckily Atmel gives you the DFU hex files on the download page. Here is the datasheet for the bootloader: http://www.atmel.com/Images/doc7618.pdf

To activate the bootloader you have to have pulled down the HWE pin when releasing the RST pin, a state that my board is constantly set to, since I've copied the teensy design not knowing "better". At this point I'm not sure if this is working well with the bootloader, but I have my concerns since I can't flash anything, but see the devices as " AT90USB128 DFU" in my USB list.


I have to bodge some buttons and resistor / capacitor thingies together, like in the Hardware Guide of the AT90USBKEY http://www.atmel.com/Images/doc7627.pdf


The following link [http://www.engbedded.com/fusecalc/] is still pretty useful for getting the values for the fuse bytes to set the HWBE fuse and the Boot Reset fuse. They seem to be important. Also weird:

sudo dfu-programmer at90usb1287 getfuse 
target doesn't support fuse set operation.

And this is my log of failure, when trying to flash the Atmega1287. Another thing to do is looking up the Halfkey bootloader on the teensy.

dfu-programmer at90usb1287 flash main.hex --debug 100
     target: at90usb1287
    chip_id: 0x2ffb
  vendor_id: 0x03eb
    command: flash
      quiet: false
      debug: 100
device_type: AVR
------ command specific below ------
   validate: true
   hex file: main.hex

atmel.c:1153: atmel_flash( 0x7fff5d5b1b40, 0x7fff5d5b1a08, false, false )
intel_hex.c:673: intel_flash_prep_buffer( 0x7fff5d5b1a08 )
atmel.c:1193: Flash available from 0x0 to 0x1DFFF (64kB p. 0 to 1), 0x1E000 bytes.
atmel.c:1197: Data start @ 0x0: 64kB p 0; 128B p 0x0 + 0x0 offset.
atmel.c:1201: Data end @ 0x17F: 64kB p 0; 128B p 0x2 + 0x7F offset.
atmel.c:1206: Totals: 0x180 bytes, 3 128B pages, 1 64kB byte pages.
atmel.c:819: atmel_blank_check( 0x7fff5d5b1b40, 0x00000000, 0x0000017F )
atmel.c:927: atmel_select_memory_unit( 0x7fff5d5b1b40, 0 )
atmel.c:941: Ignore Select Memory Unit for non GRP_AVR32 device.
Checking memory from 0x0 to 0x17F...  
atmel.c:986: atmel_select_page( 0x7fff5d5b1b40, 0 )
atmel.c:1000: Selecting page 0, address 0x0.
atmel.c:752: __atmel_blank_page_check( 0x7fff5d5b1b40, 0x00000000, 0x0000017f )
atmel.c:784: Flash region from 0x0 to 0x17F is blank.
atmel.c:862: Flash blank from 0x0 to 0x17F.
Empty.
atmel.c:927: atmel_select_memory_unit( 0x7fff5d5b1b40, 0 )
atmel.c:941: Ignore Select Memory Unit for non GRP_AVR32 device.
Programming 0x180 bytes...
atmel.c:986: atmel_select_page( 0x7fff5d5b1b40, 0 )
atmel.c:1000: Selecting page 0, address 0x0.
atmel.c:1289: Program data block: 0x0 to 0x17F (p. 0), 0x180 bytes.
atmel.c:1424: __atmel_flash_block( 0x7fff5d5b1b40, 0x7fff5d5b1a08, false )
atmel.c:1386: atmel_flash_populate_header( 0x7fff5d5b14a0, 0x0, 0x17F, false )
atmel.c:1340: atmel_flash_populate_footer( 0x7fff5d5b14a0, 0x7fff5d5b1640, 65535, 65535, 65535 )
atmel.c:1485: atmel_flash: flash data dfu_download failed.
atmel.c:1487: Expected message length of 432, got -9.
atmel.c:1292: Error flashing the block: err -2.
ERROR
Memory write error, use debug for more info.
commands.c:514: Error writing memory data. (err -4)

Discussions