lufa AVRISP-MKII compile error on atmega32u4

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

Hi there,
I'd like to use AVRISP from the LUFA project for my teensy 2.0 board. I have changed the makefile:

MCU=atmega32u4
F_CPU = 16000000
TARGET_ADC_CHANNEL = 0

2 compile errors appear:

../..//LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h:306: error:  "˜ADCSB' undeclared 
AVRISP.c:66: error: "˜clock_div_1' undeclared 

Is there a resolution for this?

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

You will need to remove that call from the code, and use an external programmer to ensure that the Teensy does not have any CPU prescaling enabled in the fuses. It's an issue with avr-libc, and the function being incorrectly disabled for the (comparatively) new U4 parts.

If you don't have an external programmer, I can walk you though editing the avr-libc headers to make it work.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

Great,
In AVRISP.c, I did:

//      clock_prescale_set(clock_div_1);

But that still leaves me with the

//../..//LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h:306: error: ‘ADCSB’ undeclared

Could you help me out there as well?
thanks, Theo

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

Ooh, good catch - that would have been annoying if that made it into the official release next week. It's a typo, the register should be called "ADCSRB" instead. Just edit the LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h header file to fix up those references.

You will also need to change the VTARGET_ADC_CHANNEL=2 line in the makefile to a different ADC channel, as the U4 does not have an ADC channel 2.

- Dean :twisted:

PS: All this will be fixed up for the release in a week, I'm working on a new revision of the code and schematic...

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

Good job!
I'm glad I could help you out there :roll:

I already changed the ADC channel to 0. Software compiles ok now, used teensy loader to download it to a new Teensy2.0. selecting AVRISP mkII / USB in AVR studio 4.18 gives me a "connect failed".

On another (debian) machine it gives: Device descriptor read/64, error -62.

and with avrdude -c avrispmkII -t -p m32 reports:
stk500_2_ReceiveMessage(): timeout

[edit]And I installed a more recent version of the libc which solved the 32u4 ommission.[/edit]
Thanks for your quick responses btw.
Theo

Attachment(s): 

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

As a form of testing, I compiled AudioOutput, with changes in the makefile:

BOARD=TEENSY
F_CPU = 16000000
MCU=atmega32u4

and programmed it with teensy loader.

Same result unfortunately: windows does not recognise it, debian reports the same error message

I might be overlooking something obvious? but I just don't know (obviously;-)

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

That points to a configuration error - did you do a "make clean" followed by a "make all" once you had made those board changes? Does your board really run off a 16MHz crystal and not an 8MHz crystal?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

You were right. The make clean and/or BOARD=TEENSY must have solved the problem. It is now registered on the USB bus with Product: LUFA AVRISP MkII Clone.
I have no target board connected as I am waiting for headers. The LED lights constantly but avrdude -c avrispmkII -t -p m32 still times out. I'll wait for my headers and when I get it connected, check further.

[edit:] dont know why avrdude would not take it under linux, but the teensy2 is properly recognized by AVR studio (after it installed a bunch of drivers for it).

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

Hate to dig up a really old post, but I'm having similar problems and wondered if you ever made Teensy2 be happy with the LUFA AVRISPMKII clone project?