Go Down

Topic: Installing bootloader on atmega32u4 (Read 31662 times) previous topic - next topic

schodavi

Sep 03, 2012, 11:15 pm Last Edit: Sep 04, 2012, 12:08 am by schodavi Reason: 1
Hello everyone

A friend of mine has made a board with an atmega32u4. It is a simple board, more or less just the chip, a 16mhz crystal with 22pF caps, 10kO resistor for pullup of RST line, USB connector.

All pins are connected simply to pinheaders and have no other things attached.

I thought that when I plugin the board, it should automatically try to install the driver on my windows XP (32bit) pc. But nothing happens at all!

There is no new device showing up in the device manager, nor any kind of "driver install" messages.

Now I am not sure what to do. I attached the schematic of the board. I don't see any errors, but maybe I just don't want to see it ;-)??



If the schematic is ok (than the layout should be right too, board was made with a professional manufacturer), the only reason for that problem I see is that the atmega32u4 is empty.

How can I solve that? I used the search function on different forums, but haven't found a solution yet....

I have an USBasp, on one board (we have 4) I tried to burn the leonardo bootloader with the arduino ide 1.01, but the process stops with an "out of sync" error.

I also have a STK500 V2 (from ebay, I guess its a clone?).

Until now, I used Avr Burnomat to set fuses and Khazmara for burning hex files (all over USBasp). But both programs don't support the atmega32u4 unfortunately.

Any help would be greatly appreciated.

Regards,
Dave

CrossRoads

You have a Programmer that connects to the SCK-MISO-MOSI-RESET-+5V-GND pins for downloading the bootloader code?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

westfw

It looks like 32u4s are supposed to come with a bootloader already loaded, but it's one that requires that you pull the HWBE  pin (PE2 - chip pin 33) "low" during reset to activate it...

the default bootloader may not be compatible with the Arduino bootloader.

schodavi

#3
Sep 04, 2012, 09:03 am Last Edit: Sep 04, 2012, 11:29 am by schodavi Reason: 1
Quote
You have a Programmer that connects to the SCK-MISO-MOSI-RESET-+5V-GND pins for downloading the bootloader code?


Yes, I have an USBasp and a STk500v2. With the USBasp it doesn't work, I can not install the bootloader. It looks like it is a fuse settings problem. I already had that with an atmega328p, which was unprogrammable with the usbasp. After settings the fuses with my stk500v2 it worked. But I can't read the fuses with it, because I don't know any software that supports the atmega32u4 fuses.

Quote
It looks like 32u4s are supposed to come with a bootloader already loaded, but it's one that requires that you pull the HWBE  pin (PE2 - chip pin 33) "low" during reset to activate it...


As you can see on the picture (sorry for the low quality, will make a better one), pin 33 is connected to GND. Do you mean it should be conntected to GND all the time?

EDIT: I just contacted the pcb manufacturer. They told me, that the chips they soldered are completely empty.

Now I can back to my question: How can I install the bootloader and set the fuses. What programmers do you recommend?

CrossRoads

Atmel AVR ISP MKii and AVR Studio 5.1, or 6.
Will let you easily see and change all the fuses, lock bits, and download the bootloader.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

schodavi

Thank you for the tipp. I will try that. Hopefully it works!

Will post my results here.

Regards,
David

schodavi

#6
Sep 10, 2012, 06:12 pm Last Edit: Sep 10, 2012, 06:23 pm by schodavi Reason: 1
Ok, now I have the AVRISP mk2 from Atmel.

After installing, I plugged in the programmer and it showed me an upgrade in Atmel Studio 6. Upgrade was fine.

Then I connected it to the main atmega32u4 using the ISP Pins, plugged in a 5V Powersupply to supply the proc during programming.
When I try to read the voltage over the AVRISP it works and shows 5.3V (a bit high, but is still ok with the atmega32u4).

But when I try to read the signature it doesn't work (reading failed).
I rechecked the lines, etc... but nothing found.

For a comparsion, I hooked up another board with an atmega328p on it and tried to read the fuses, flash, .....
Everything worked fine! So it is not programmer.

I will go back to it tomorrow or so, maybe I' m trying to fix this for too long now.

But I guess it is not a hardware wiring problem.

My ideas:

The HWB pin is connected to ground, maybe thats the problem
The fuse settings are wrong (the chip is not programmable  over ISP)

The schematic I added a few posts above is still the same, I added it in higher resolution again.
I don't see any errors....
http://old.werkstattonline.ch/schematic.png

Any ideas would be appreciated!?



Regards,
David

schodavi

Ok, strange things happend  :)

After taking a break, I went back to our little project and still had no luck with accessing the atmega32u4 over ISP.
So I decided to test it with an other board (we have 4 in total for testing), and IT worked. I was able to read signature, set the fuses correctly and upload the leonardo bootloader XD

So the board works correctly according to plan.

Strange thing: The other two boards don't work, eventhough they are exactly the same, maybe the were damaged during manufacuring. For the next board we will use genuine atmega32u4 from Atmel.

Regards,
David

schodavi

Ok, I was able to solve the problem.

Usually when avrs can't be programmed over ISP it is a fuse settings problem, normally wrong set clock fuses.

I suspected this to be the same problem with my board:

So I used another board with a running atmega328p and 16mhz crystal. I uploaded this little programm to the 328p. It constantly switches on/off the PORTD Pins of the 328p:
Code: [Select]
int main(void)
{
DDRD = 0xFF;
while(1)
{
PORTD = 0xff;
PORTD = 0x00;
}
return 0;
}

and then connected the signal ouput of one of the PORTD pins to the Xtal1 input of the atmega32u4, and I was able to read and change the fuses.
Now the software is running properly :-)

Hope it helps someone.

Regards,
David

Shivank

Hi David,
You find it correct that it is wrong set clock fuses.
Mine 32u4 having the same problem, u connected your continuously changing portd pins to xtal1 of 32u4.
but how u read and change the fuse bits...
also what are the correct values of fuse bits...??

relic1974

Question:  Since the 32U4 has it's own USB host on chip, and assuming you're using a crystal oscillator on your own board, proper schematic & wiring, and the latest Arduino IDE build (which supports the pro micro/leonardo/32U4) then shouldn't you be able to program the bootloader over USB from within the IDE itself? Would this not eliminate the need for ICSP header pins and external programmer?

I'm asking because I plan on making my own project based upon the pro micro's ATmega32U4.  I may or may not buy chips pre-loaded and this is my first project using the 32U4.  In the past I've had to burn the bootloader on 328's over ICSP via an external programmer.

Just want to make sure I don't need to add ICSP pins to my PCB design before having boards made.

ShapeShifter

then shouldn't you be able to program the bootloader over USB from within the IDE itself?
The Arduino IDE loads sketches into the '32U4 by communicating with the bootloader. Until you have a bootloader programmed into the '32U4, there is nothing there to initialize the USB interface and talk to the IDE. The IDE cannot load a bootloader without an external programmer.

You have two options to get that bootloader into the chip:
  • Use an external programmer and the ICSP pins to load the bootloader
  • Buy a '32U4 that is already programmed with the correct bootloader.

Go Up