LUFA Encoding Example for AT90USB162

I have an open source USB library for AVR microcontroller USB devices, LUFA (2011-10-09), and I'm trying to encode a CDC (bootloader) to my AT90USB162 chip . The sample code is located in the /Bootloads/CDC folder and is ready to create a CDC for the AT90USB1287 . Therefore, I needed to change the parameters of the makefile to install the correct microchip.

In the makefile, I changed the following:

  • MCU = at90usb162
  • F_CPU = 16000000
  • FLASH_SIZE_KB = 16
  • BOOT_SECTION_SIZE_KB = 4

and built the code. This happened without errors, but when I tried to write a chip with a .hex file, it returns a message:

Address is out of range

Why could this happen?

Update

In the makefile , BOOT_START configured as:

 BOOT_START = 0x$(shell echo "obase=16; ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024" | bc) 

Maybe the error will be in accounting BOOT_START? Should I configure something else?

+4
source share
1 answer

According to page 239 of the at90usb162 table, the BOOTSZ0 and BOOTSZ1 fuses must be 0 for a 4 Kb bootloader. Have you checked this? You also need to check if other things match between at90usb1287 and at90usb162 (e.g. BOOT_START and others). How are you trying to write a new bootloader to AVR? Do you have the right programmer or are you trying to do this with the built-in USB device downloader?

Just complementing @avra's answer from @avra's comment

Saving another bootloader on top of the existing bootloader is not possible with the bootloader. Get it now? ;-) This is a limited area for the bootloader, and why does it fail for you. The bootloader is not able to overwrite it on its own. You need another type of programmer that does not come with this limitation. All AVRs with bootloaders must have initial programming using this special type of programmer (JTAG / ISP / SPI / PDI programmer).

+4
source

Source: https://habr.com/ru/post/1379308/


All Articles