USBasploader mega128

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
dg

USBasploader mega128

Post by dg » Fri Jul 15, 2011 10:42 pm

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

dg

Re: USBasploader mega128

Post by dg » Sat Jul 16, 2011 12:04 am

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.

dg

Re: USBasploader mega128

Post by dg » Mon Jul 18, 2011 8:39 pm

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. :D

nd

Re: USBasploader mega128

Post by nd » Sat Aug 20, 2011 9:11 pm

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.

Post Reply