Page 1 of 1
USBasploader mega128
Posted: Fri Jul 15, 2011 10:42 pm
by dg
Hi,
anyone has a _real_ working version for the 128k flash version?
The access to the upper 64k page for the device descriptor does not work on my at90can128.
AVR catches the start of the communication, but does not move any further after the request for device descriptor, because of the address above 0x1E000.
Thanks in advance.
Regards
dg
Re: USBasploader mega128
Posted: Sat Jul 16, 2011 12:04 am
by dg
More infos:
I know about the pgm_read_far solution, but there is a pointer named like usbmsg, which is still only 16 bit and can not store a 24bit wide address.
Re: USBasploader mega128
Posted: Mon Jul 18, 2011 8:39 pm
by dg
In
usbportability.h there is a switch for handling the memory pages:
#if USB_CFG_DRIVER_FLASH_PAGE
# define USB_READ_FLASH(addr) pgm_read_byte_far(((long)USB_CFG_DRIVER_FLASH_PAGE << 16) | (long)(addr))
#else
# define USB_READ_FLASH(addr) pgm_read_byte(addr)
#endif
The include order in
usbdrv.c is
#include "usbportability.h"
#include "usbdrv.h"It means
USB_CFG_DRIVER_FLASH_PAGE is not known for
usbportability.h, so no FAR access is generated.
By adding
#include "usbconfig.h" before
#include "usbportability.h" solves the problem, my devices reports itself correctly.
Re: USBasploader mega128
Posted: Sat Aug 20, 2011 9:11 pm
by nd
Didn't want to start an extra thread for this:
When uploading the bootloader to an at90can128 you have to set the BOOTLOADER_ADDRESS in the makefile to 0x1E000 and change:
Code: Select all
LDFLAGS = -Wl,--relax,--gc-sections -Wl,--section-start=.text=$(BOOTLOADER_ADDRESS)
to
Code: Select all
LDFLAGS = -Wl,--relax,--gc-sections -Wl,--section-start=.bootloader=$(BOOTLOADER_ADDRESS)
otherwise it would always throw an out-of-range error when trying to flash (I used avrdude with a jtagmkI-compatible dongle if it matters) the bootloader.
Also, thanks to dg for solving the memory issue, I had the same problem.