Arduino Leonardo in Low Speed USB mode

Hi all,

searched the whole forum for a while now but did not find any related questions.
I would like to use the ATmega32U4 from the Leonardo in Low Speed USB mode but didn't get it to work. Background is, that with low speed mode there is no need for an external crystal oscillator.
The first test I made was to compile the caterina bootloader with low speed USB mode enabled. To do this I changed the makefile for the bootloader to compile the LUFA library with low speed mode. The bootloader works (the board enumerates as Arduino Leonardo and the LED breathes) but I can't upload sketches using the Arduino IDE. Always get avrdude error:

Connecting to programmer: .avrdude: Send: . [1b]
avrdude: ser_send(): write error: sorry no info avail

When I flash the full speed bootloader the upload works fine again.
I thought never mind lets try to compile the sketch using low speed USB mode. So I changed the function USBDevice_::attach() in "USBCore.cpp" to enable the low speed mode:

Changed the line: UDCON = 0;
to: UDCON = (1<<LSM);//Low Speed mode

Compiled the test sketch using the arduino IDE and flashed the hex. Now the Leonardo is not detected correctly when plugging in (USB device not recognized).
When I undo the change, compile again and flash the "Full Speed" hex everything works fine again.

What am I missing?
If you need more information please ask me.

I'm using Arduino IDE 1.0.3 on Windows XP.

Thank you in advance for any help.

I don't know what you want to achieve.

Do you have a standalone ATmega32u4 ?
And you want to use it without crystal ?

If the Arduino software connects to the ATmega32u4, it uses the (virtual) serial port over the usb. The baudrate of that (virtual) serial port is fixed, so if the usb is too slow, it wont' work.

Do you have to use a ATmega32u4 ?
The Arduino bootloader for the ATmega32u4 creates the (virtual) serial port in software. So it is fixed to the usb port and the RX and TX pins to upload a sketch are not available.

Hi Erdin,

yes I'm currently working on a project where I want to use the ATmega32u4 without crystal or with a resonator. The problem with the resonator is, that it is too inaccurate to operate the 32u4 in full speed mode.

My problem is as follows: When I flash the low speed bootloader the Leonardo is recognized correctly and shows up as virtual COM port in Windows device manager. But when I flash the low speed sketch (with the changed USBCore.cpp) it will not be recognized and shows in Windows device manager as unknown USB device and does not show the VID and PID.

Speed should not be the problem since low speed USB provides 1.5Mb/s.

Hope you understand what my problem is.

I understand, but I don't know how to solve it.
Perhaps the internal oscillator is not accurate.

The avr chips should not have a problem with a resonator at 16MHz. If a resonator is possible, you should try that perhaps once more.

For the proper low speed mode detection make sure your UCAP is at the proper 3.3V level.

From the Atmel datasheet:

21.8 Speed Control
The speed selection (Full Speed or Low Speed) depends on the D+/D- pull-up. The LSM bit in
UDCON register allows to select an internal pull up on D- (Low Speed mode) or D+ (Full Speed
mode) data lines.

USBSpeedMode.JPG

The USB CDC class that the Arduino bootloader uses is not compatible with USB Low Speed Mode, due to the endpoint sizes and type. It's not possible to run CDC over Low Speed USB mode (in a standards compliant manner). HID will work, but not many other standard USB classes will.

  • Dean

Thank you all for your answers. Did some google research and found an interesting thread where someone wanted to use a Xmega in low speed mode as CDC device, see the following link: Redirecting to Google Groups
As Dean says it is not possible to use CDC class in low speed mode because the bulk endpoints are not supported in low speed mode.

Edit: Thank you Dean, found this also in the google group.