Author Topic: Programming Atmega32u4  (Read 2041 times)

0 Members and 1 Guest are viewing this topic.

Offline layornos

  • Thread Starter
  • Posts: 23
Programming Atmega32u4
« on: Sat, 10 December 2016, 07:55:51 »
Dear all,

i tried to design a PCB, using a Atmega32u4 instead of a Teensy to save some space. After the soldering, i tried to program the uC via the JTAG interface and a JTAGICE clone from eBay. That wasn't successful, so i ordered this http://www.ebay.de/itm/172399352607?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT. I connected the respective pins to a USPASP programmer, then i tried via AVRDUDE to program the uC with the following command:

avrdude -c usbasp -p m32u4 -u -U flash:w:ATMega32U4-usbdevice_dfu-1_0_0.hex

But then i get the following error-message:
avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: error: programm enable: target doesn't answer. 1
avrdude.exe: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.

avrdude.exe done.  Thank you.


The -B flag has no effect:
avrdude -c usbasp -p m32u4 -u -U flash:w:ATMega32U4-usbdevice_dfu-1_0_0.hex:a -B 120

avrdude: set SCK frequency to 8000 Hz
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude.exe done.  Thank you.


I double checked the pins and even tried the JP3 jumper for lower programming speed.
The programmer is a USBASP v2.0.

I am out of ideas, any suggestions?



Offline pomk

  • Posts: 470
  • Location: Finland
Re: Programming Atmega32u4
« Reply #1 on: Sat, 10 December 2016, 08:31:42 »
What does your board look like and have you measured that all solder connections are good?

Offline Tactile

  • Posts: 1299
  • Location: Portland, OR
Re: Programming Atmega32u4
« Reply #2 on: Sat, 10 December 2016, 09:33:34 »
Here are some troubleshooting tips for that error. Hope this helps.

https://learn.adafruit.com/usbtinyisp/help

Offline trebbu

  • Posts: 3
Re: Programming Atmega32u4
« Reply #3 on: Sat, 10 December 2016, 09:47:54 »
I'm not entirely sure what I'm talking about, but I was able to install a bootloader and set some fuses  with a similar setup plus a quartz and two capacitors connected.

Offline hasu

  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Programming Atmega32u4
« Reply #4 on: Sat, 10 December 2016, 17:16:02 »
No pic? It would be useful to show how you coneect. I'm suspecting your wiring and power supply.
IIRC, you need to give power to both VCC and AVCC, not sure but Xtal may be needed also. You'd better check datasheet yourself in the end :D
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline layornos

  • Thread Starter
  • Posts: 23
Re: Programming Atmega32u4
« Reply #5 on: Sat, 10 December 2016, 17:47:23 »
I was able to flash the uC after connecting all VCC's and GND's. Now i get an ”Over current condition” error, but that might be a topic for a new thread. Thanks for your help.

Offline hasu

  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Programming Atmega32u4
« Reply #6 on: Sat, 10 December 2016, 17:55:14 »
nice.
Xtal was not needed?
If you can post how you connected and programmed the uC it would be great for future reference.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline layornos

  • Thread Starter
  • Posts: 23
Re: Programming Atmega32u4
« Reply #7 on: Sun, 11 December 2016, 03:51:57 »
As you can see in attachment 2, i've soldered wires to a smd quarzoszillator to connect it to the breadboard. I used 2 22pF capacitors.

155179-0155181-1