[SOLVED]Leonardo Clone 32u4 based board it is not recognized in USB port

Well except that I tied the AVCCs directly to VCC and that I'm using an oscillator and not a crystal, my (working) schematic is the same. However, I've seen similar dmesg outputs on some of my devices due to soldering problems at the USB connector. Also, are you sure the caterina bootloader is installed correctly? Fusebits set correctly?
Quote from my internal Wiki:

Bootloader Installation

In order to use the Atmega32U4 with the Arduino SDK, the Atmel bootloader that is factory-default has to be replaced. In our setup, we use the Arduino Leonardo bootloader. It is called 'Caterina' and can be found in the Arduino directory:

arduino-1.0.2/hardware/arduino/bootloaders/caterina

Flash the bootloader to the chip using AVRDude:

avrdude -p m32U4 -P /dev/ttyS0 -U flash:w:Caterina-Leonardo.hex

After that, set the correct fusebits:

avrdude -p m32U4 -P /dev/ttyS0 -U lfuse:w:0xe0:m -U hfuse:w:0xd8:m -U efuse:w:0xcb:m

Try everything out:

avrdude -p m32U4 -P /dev/ttyS0 -nv

And you should get:

avrdude: safemode: lfuse reads as E0

avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB




Now start the Arduino IDE. Select 'Arduino Leonardo' as your board and the matching '/dev/ttyACMn' port as port.

You can also check if the bootloader is running by connecting an LED to PC7. It should "breathe" (fade in/out) after startup.

Good Luck!

Well, I have good and bad news.

Good news, I did what you said, I had set the fuses as you propose and it worked. With "dmesg" command the board was recognized as a full speed usb device correctly (I think it was recognized as a mouse).
Then, just to check, I unpulgued the usb wire, and plugued it again, and nothing happened. This time, the board wasnt recognized. After that the board it's not working anymore. Microprocessor looks like dead. The voltage at Ucap (was 3.3v) now it is 0v. I cant reset de fuses with avrdude...I dont know whats happened.

Any Idea...??

I setted the fuses, plugued in, works, and then..die :S

Could the fuses be responsible of this? how?

The low fuse byte is wrong. 0xE0 is set for an external clock signal, not a crystal. You need to set the low fuse back to 0xFF for external Crystal Oscillator.

hiduino:
The low fuse byte is wrong. 0xE0 is set for an external clock signal, not a crystal. You need to set the low fuse back to 0xFF for external Crystal Oscillator.

Well, you were right. I didnt realize that kopfkopfkopfaffe said he wasnt using a cristal. Now the board It's live again, but with this configuration

avrdude: safemode: lfuse reads as E0
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB

(and external clock) I have the same problem at the begining of this post.

also with

leonardo.bootloader.low_fuses=0xff
leonardo.bootloader.high_fuses=0xd8
leonardo.bootloader.extended_fuses=0xcb

(and a cristal) Same problem... :S

is the last configuration the default configuration for the fuses at leonardo board?

kopfkopfkopfaffe this is the output after burn the Caterina-Leonardo.hex file...but the led it is not breathing...

fede@leni:~$ avrdude -p m32U4 -P /dev/ttyUSB0 -c avrisp -b 19200 -U flash:w:arduino/arduino/hardware/arduino/bootloaders/caterina/Caterina-Leonardo.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9587
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "arduino/arduino/hardware/arduino/bootloaders/caterina/Caterina-Leonardo.hex"
avrdude: input file arduino/arduino/hardware/arduino/bootloaders/caterina/Caterina-Leonardo.hex auto detected as Intel Hex
avrdude: writing flash (32722 bytes):

Writing | ################################################## | 100% 9.66s

avrdude: 32722 bytes of flash written
avrdude: verifying flash memory against arduino/arduino/hardware/arduino/bootloaders/caterina/Caterina-Leonardo.hex:
avrdude: load data flash data from input file arduino/arduino/hardware/arduino/bootloaders/caterina/Caterina-Leonardo.hex:
avrdude: input file arduino/arduino/hardware/arduino/bootloaders/caterina/Caterina-Leonardo.hex auto detected as Intel Hex
avrdude: input file arduino/arduino/hardware/arduino/bootloaders/caterina/Caterina-Leonardo.hex contains 32722 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 19.13s

avrdude: verifying ...
avrdude: 32722 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

fede@leni:~$

The actual fuse state is

fede@leni:~$ avrdude -p m32u4 -P /dev/ttyUSB0 -c avrisp -b 19200 -nv
avrdude: Version 5.11.1, compiled on Oct 30 2011 at 10:41:10
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/fede/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : avrisp
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       1024    8      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel AVR ISP
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9587
avrdude: safemode: lfuse reads as E0
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB

avrdude: safemode: lfuse reads as E0
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

fede@leni:~$

weird, isn't it?

Any clue?

Well,

the led in pin pc7 its blinking :slight_smile:
Still the same problem of the beginning, but now we know that bootloader its running.

Here it is a short video Arduino Leonardo Clone it isn't recognized with problems at usb comunication - YouTube

If the low fuse byte is still at 0xE0 it may not be running stable.

Try to set it again:

avrdude -p m32u4 -P /dev/ttyUSB0 -c avrisp -b 19200 -v -U lfuse:w:0xFF:m

I am sorry, low fuse it is FF, I think I had paste an old output,

actually it is

avrdude: Device signature = 0x1e9587
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

How often does it blink? In the video it looks like it's breathing a few times (soft fading blinking) and then it stays lit for a while and then continues with a regular blink of about .5 Hz. Is that correct? In my application, the bootloader breathes a few times and then the LED is constantly OFF. Did you upload a blink-skech or something like that?

What you can also do is try the LUFA bootloader by Adafruit:

(Quote from my Wiki)

Lufa Bootloader

Bootloader Installation

In order to use the Atmega32U4 with the Arduino SDK, the Atmel bootloader that is factory-default has to be replaced. In our setup, we use the Adafruit fork of the LUFA bootloader that can be downloaded here: GitHub - adafruit/lufa-lib: Git mirror for the LUFA USB AVR Framework Library.

Flash the bootloader to the chip using AVRDude:

avrdude -p m32U4 -P /dev/ttyS0 -U flash:w:BootloaderCDC.hex

After that, set the correct fusebits:

avrdude -p m32U4 -P /dev/ttyS0 -U lfuse:w:0xe0:m -U hfuse:w:0xd8:m -U efuse:w:0xcb:m

Try everything out:

avrdude -p m32U4 -P /dev/ttyS0 -nv

And you should get:

avrdude: safemode: lfuse reads as E0

avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB




**Modification in the Arduino IDE**

The bootloader will not be recognized by a fresh installation of the Arduino IDE. You need to modify the file "arduino-1.0.*n*/hardware/arduino/programmers.txt".
Add the following:



avr109.name=Adafruit Bootloader
avr109.communication=usb
avr109.protocol=avr109




Now restart the Arduino IDE. The bootloader should be listed as Adafruit Bootloader. Select that one to flash the Atmega32U4.

Again please note that I run the controller on an external clock. I can really recommend the Engbedded fusebit calculator to look up fusebit issues.

Hi kopfkopfkopfaffe,

How often does it blink? In the video it looks like it's breathing a few times (soft fading blinking) and then it stays lit for a while and then continues with a regular blink of about .5 Hz. Is that correct? In my application, the bootloader breathes a few times and then the LED is constantly OFF. Did you upload a blink-skech or something like that?

It is exactly as you said. Start with a breathing and then continues with a regular blink of 1Hz. I only burned the bootloader Caterina-Leonardo.hex.

Something weird to me is that after I had set the fuses like (e0, d8, cb - which was wrong because I have a external cristal), it works! The problem is that works only one time. That time My Ubuntu recognized as a high-speed usb device and also as a mouse. But after that doesnt work anymore (wich has sense because e0 its for external clock).

About the fuses, yep I read the datasheet, I am trying a fuse calculator, and this

leonardo.bootloader.low_fuses=0xff
leonardo.bootloader.high_fuses=0xd8
leonardo.bootloader.extended_fuses=0xcb

configuration looks ok for me, but it isn't working :S

What you can also do is try the LUFA bootloader by Adafruit:

I will try right now.

Ok, I tried but no luck. The LUFA bootloader works right (led is working at pc6) but still no luck with usb.

I also tried a lot of configurations, with internal RC oscilator, with external clock. The bootloader seems to be working right because of the led (both LUA and Caterina-Leonardo) usb connection stills fails.

I tried out all of this configurations after study the 32u4 datasheet and the avr fuse calculator (every time with the right clock or oscilator configuration in the board, i mean, with a 16mhz external clock signal or without oscilator, or with an 16mhz external cristal)

1)
external oscilator with clock out

avrdude: safemode: lfuse reads as BF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: safemode: Fuses OK

2)
external oscilator with clock out and dividing 8 times o clock

avrdude: Device signature = 0x1e9587
avrdude: safemode: lfuse reads as 3F
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB

3)
external clock signal and clock out

avrdude: Device signature = 0x1e9587
avrdude: safemode: lfuse reads as 92
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB

4)
external clock signal and clock out

avrdude: safemode: lfuse reads as A2
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: safemode: Fuses OK

nothing works.

I'm start thinking that the chip has a problem...which is really bad.

If anyone have any idea or anything else to test, it would be great.

I also had tested continuity from the chip microcontroller to the end of the usb wire, and its fine.
I had tested voltage in every pin of the microcontroller, and everything its perfect.

:frowning:

Can you post your layout and pictures of the board (bottom side)?

kopfkopfkopfaffe:
Can you post your layout and pictures of the board (bottom side)?

For Sure. The layout its in « Reply #2 on: April 03, 2013, 11:49:05 PM » on this thread. I added here anyway.
Its the third position from the initial post (the initial its the first).

I also attached a bottom side pictures. I dont know if you want to see something in particular. Just let me know.

This answer took a while because I made some small improves of the board, and i did a new one. New board, new components, new microcontroler, same problem.

I had the theory that It colud be something with the micro, but the new board has exactly the same problem, the bootloader (Caterina-Leonardo) looks like working because the blink, but USB is not working. Because of that I think I have a design electrical mistake, but..I dont now where :S

leolivre.pdf (62.4 KB)

Your circuit is missing the USB level conversion needed for the D- and D+ lines. You need to add 3.6V zener diodes for any USB interfacing directly to Atmel AVR chips. The 5V pin levels of the 32U4 is over driving the USB data lines. All the schematic references for Leonardo and Micro use the zener diodes for level conversion.

See this reference:

level-conversion-with-zener.gif

hiduino:
Your circuit is missing the USB level conversion needed for the D- and D+ lines. You need to add 3.6V zener diodes for any USB interfacing directly to Atmel AVR chips. The 5V pin levels of the 32U4 is over driving the USB data lines. All the schematic references for Leonardo and Micro use the zener diodes for level conversion.

See this reference:

Hi hiduino,

I will try adding zener diodes. What about the pull up resistor in the references?

When I did my schematic I mixed leonardo schematic and vinciDuino schematic (http://cdn.bitbucket.org/fmalpartida/vinciduino/downloads/vinciDuino%20RevC1.pdf). VinciDuino schematics doesn´t have the zener, thats why I didnt add them.

see you!

hiduino:
Your circuit is missing the USB level conversion needed for the D- and D+ lines. You need to add 3.6V zener diodes for any USB interfacing directly to Atmel AVR chips. The 5V pin levels of the 32U4 is over driving the USB data lines. All the schematic references for Leonardo and Micro use the zener diodes for level conversion.

See this reference:

Ok, I did it and same problem, nothing changes.
At first I tried with two zener diodes, same as the reference you post and doesn`t work, same error from initial post.
Then I added the pull up resistor (1k) and things get worst, but after that I removed the resistor and same error from initial post.

I am really lost with this problem...

Looking back at your schematic, it appears that you may have your RD-, RD+ swapped to D+, D-. The RD- should be going to D- and RD+ to D+. I would still recommend the zener diodes.

hiduino:
Looking back at your schematic, it appears that you may have your RD-, RD+ swapped to D+, D-. The RD- should be going to D- and RD+ to D+. I would still recommend the zener diodes.

You rock men!
Distraction problem so hard to see!
Thanks a lot!!

Sorry for digging this out again, but I just wanted to point out for you, dear future reader, that level conversion from USB to the ATmega32U4 is not necessary. The controller is designed to handle the USB signal.

Yes, you are correct. I realized that after looking into the 32U4 datasheet. Makes you wonder why they added it to the Leonardo and Micro designs. I guess for protection?