USB bootloader on ATmega128

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 I try to run USB bootloader on Atmega128.

I use AVRUSBBoot from Thomas Fischl.

I change :

BOOTLOADER_ADDRESS = 1F800

Boot Flash section size=1024 words Boot start address=$FC00; [BOOTSZ=10]

 

and change :

    GICR = (1 << IVCE);  /* enable change of interrupt vectors */
    GICR = (1 << IVSEL); /* move interrupts to boot flash section */

 

to :

    MCUCR = (1 << IVCE);  /* enable change of interrupt vectors */
    MCUCR = (1 << IVSEL); /* move interrupts to boot flash section */

 

and set BOOTRST=0 fuse bit to  start boot loader after reset.

 

I comment BOOTLOADER_CONDITION and leaveBootloader() to run without exit from boot loader.

but it's not work. and my pc not detect usb AVRUSBBoot.

 

I try again and change :

 

BOOTLOADER_ADDRESS = 0000

and unprogrmmed BOOTRST fuse bit = 1

and comment the MCUCR

    //MCUCR = (1 << IVCE);  /* enable change of interrupt vectors */
    //MCUCR = (1 << IVSEL); /* move interrupts to boot flash section */

 

it's work usb and detect my pc AVRUSBBoot!

 

please help me to install usb bootloader on ATmega128.

 

thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Was your BL compiled for the M128?   Please provide a link to the BL.

Because of the large size flash it will require a BL designed for the large address space.

 

 

JC

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi ki0bk,
My problem is USB detection in Windows.
I attached two file :

 

  1. NotWork.rar -> USB not work and pc not detect it, (BOOTLOADER_ADDRESS = 1F800 , MCUCR = (1 << IVCE), MCUCR = (1 << IVSEL), BOOTRST = 0)
  2. USB_worked.rar - > USB work good, but without bootlader,  (BOOTLOADER_ADDRESS = 00, //MCUCR = (1 << IVCE), //MCUCR = (1 << IVSEL), BOOTRST = 1)

 

AVRUSBBoot - USB bootloader for Atmel AVR controllers : http://www.fischl.de/avrusbboot/

 

Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, lachini. Did you resolve you problem? I have such problem as you. I'm trying on mega128 and mega64, it not worked

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

stalker1424 wrote:

Hello, lachini. Did you resolve you problem? I have such problem as you. I'm trying on mega128 and mega64, it not worked

The OP has been here last on October 2016..... So do not think you will be getting an answer from him anytime soon.

Also this thread is over 8 years old..........

Best thing is that you make a new post were you describe your specific problem.

 

if the Mega128 was a virgin chip, what did you do to the fuses?

what are the current fuse settings you have?

what kind of OS are you running and what programs do you use?

were did you get your bootloader code from?

What things have you tried yourself and did not work or gave partial results?

 

A lot of questions that will help us pinpoint the problem without the need to start glaring at our crystalbals........

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,  meslomp . I was hoping he would answer.

1.  Сurrent fuse settings are LF:0xBF HF:0xC4 EF:0xFF.

2. Current OS is Windows 10, code writed in Microchip studio last, programmer USBasp and EXtremeBurner, AVRDUDE, Khazama AVR Programmer.

3. My bootloader same, as  lachini used, i am found this post when googled my problem. It is same 100% as lachini.

4. I've tried changing boot addresses, I've tried changing flags. I determined that the bootloader starts and runs normally from the boot area until the D+ pin interrupt is called. After this case, the processor correctly starts executing the program code from the interrupt call vector, but then jumps to address $00000. A lot of the VI-USB driver code is written in assembler, and I could not understand where and why the transition to the address $00000 occurs. In Proteus, I debugged and determined start bootloader, run and interrupt vector jumping, but Proteus cannot emulate USB in such a non-standard software connection to the microcontroller. At the start address $00000 i am adding while(1) cycle programm and catch the "transition to the address $00000 occurs". Please help find the bug. Ask me for more information if needed to help me.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


stalker1424 wrote:
2. Current OS is Windows 10,
V-USB is non-functional with certain USB HCI.

stalker1424 wrote:
code writed in Microchip studio last,
Is V-USB dependent on AVR GCC version?

stalker1424 wrote:
but Proteus cannot emulate USB in such a non-standard software connection to the microcontroller.
Can locate the defect by assertions and/or a logic analyzer.

stalker1424 wrote:
Image iconhardware_.png
Series termination is typical to impedance match the AVR to USB D+ and D-.

 


ATMEGA32 + V-USB vs ATMEGA32U4 ? | AVR Freaks

 

https://github.com/obdev/v-usb/blob/master/usbdrv/Readme.txt#L136

 

Adding Automatic Debugging to Firmware for Embedded Systems by Jack Ganssle

Troubleshooting real-time software issues using a logic analyzer - Embedded.com

 

V-USB - A Firmware-Only USB Driver for Atmel AVR Microcontrollers

Hardware

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

V-USB is non-functional with certain USB HCI.

Series termination is typical to impedance match the AVR to USB D+ and D-.

It works good when IVSEL=0 and BOOTRST=1 (bootloader program was flashed at $00000, reset vector addr. $00000), in this case PC detect USB-HID input device and got a valid VID/PID/Devise description. I tryed this code at mega8, no problems occured.

Can locate the defect by assertions and/or a logic analyzer.

i do non know, how to use it in relation to my problem. Internet links from you are not available

Last Edited: Mon. Jul 4, 2022 - 11:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

it still not works at mega64 or mega128 chips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hello, I found a bug. It was in the compiler and linker flags. Thanks everyone for the help