Page 1 of 1

BootLoadHID and Mega16 problem

Posted: Fri Aug 28, 2009 8:56 am
by alexn
Hi, All.

I've tried to use BootLoadHID with ATMEGA16 device and mini-USB (B-type) connector. This does not work.
I changed the makefile, setting

DEVICE = atmega16
BOOTLOADER_ADDRESS = 3800

D+ is wired to PD2, D- to PD1
The programming mode jumper is on PD0

The code is changed to:

Code: Select all

static inline void  bootLoaderInit(void)
{
char i;
    PORTD = 1;      /* activate pull-up */
    for(i=0;i<10;i++);  /* delay to allow pin voltage to stabilize */
}

#define bootLoaderCondition()   ((PIND & 1) == 0)


Code: Select all

#define USB_CFG_IOPORTNAME    D
#define USB_CFG_DMINUS_BIT      1
#define USB_CFG_DPLUS_BIT        2


The device appears as "unknown USB device" that means that USB is not functional.
What else could be wrong ?

The crystal is 12 MHz, all other values are default.

Re: BootLoadHID and Mega16 problem

Posted: Thu Feb 18, 2010 12:27 am
by VYTAS
HI I'am going to do the same fing. Do you reset atmega after boot PIN set to ground?

Re: BootLoadHID and Mega16 problem

Posted: Fri Mar 05, 2010 12:34 pm
by Arkanoid
alexn wrote:The device appears as "unknown USB device" that means that USB is not functional.
What else could be wrong ?


Hi!

BootLoadHID works fine with ATmega16, but only for:

Code: Select all

#define USB_CFG_IOPORTNAME    D
#define USB_CFG_DMINUS_BIT      0
#define USB_CFG_DPLUS_BIT        2


I don't know why. Any suggestion?

Re: BootLoadHID and Mega16 problem

Posted: Sat Mar 13, 2010 9:58 am
by Vytas
I use folowing settings:

Code: Select all

#define USB_CFG_IOPORTNAME      D
/* This is the port where the USB bus is connected.

#define USB_CFG_DMINUS_BIT      3
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.

#define USB_CFG_DPLUS_BIT       4
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.


static inline void  bootLoaderInit(void)
{
    PORTD = 1 << 5; /* activate pull-up for key */
    _delay_us(10);  /* wait for levels to stabilize */
}

#define bootLoaderCondition()   ((PIND & (1 << 5)) == 0)   /* True if jumper is set */




I conected wire betwen -D (PORT3) and RXT on my atmega16 and it started to work. In pdf of atmega16 found that

"Entering the Boot Loader takes place by a jump or call from the application program.This may be initiated by a trigger such as a command received via USART, or SPI interface."

Re: BootLoadHID and Mega16 problem

Posted: Sat Mar 13, 2010 10:03 am
by alexn
VYTAS wrote:HI I'am going to do the same fing. Do you reset atmega after boot PIN set to ground?


Hello.

I do not use RESET at all. My problem was simple - bad electrical contact. It was hard to find, however.
Now everything works fine, and I'll soon make a WEB page of another proto board. Now with SD card slot
and Mega16 chip.