DIY Leonardo Project with internal 8 MHZ RC

Hi!

I am planning to build a small project with the 32U4RC, emulating a USB keyboard. The board is supposed to be built into a Sub-D connector; that´s why I want to use as few components as possible.

Is it possible to use the "usb hid device / keyboard" function with an 8MHz ATmega32U4RC with the leonardo bootloader?

Can anyone tell me the correct modifications to the "boards.txt" file to tell the MCU the following:

  • use the internal RC Oscillator with the clock divider set to 8 MHz operation
  • the MCU will be an ATmega32U4RC-AU

Thanks a lot!
Florian

P.S. do you need more detailed information?

I think you may need to build an 8 MHz bootloader and burn it to your chip. The bootloaders are pre-built as .hex files so they don't adjust when you change FCPU in boards.txt.

John,

thank you for your answer.
Do I need a different bootloader or do you think it will work with the "caterina-leonardo.hex"-File, contained in the "hardware"-section of Arduino does also work with a 8 MHz "RC-Leo"?

greetings
Florian

If you use hardware/arduino/bootloaders/caterina/Caterina-Leonardo.hex on an 8MHz Leonardo then anything that depends on the system clock (including the USB interface) will be running at half the expected speed. On a regular serial bootloader you can just specify the slower baudrate but I don’t know if the USB interface will work at half the expected rate.

The proper way to fix it is to change “F_CPU = 16000000” to “F_CPU = 8000000” in hardware/arduino/bootloaders/caterina/Makefile and re-build the bootloaders. This isn’t something that the Arduino IDE can do for you. You will have to learn how to re-build the bootloaders using the Makefile.

Okay.

Do you have a link for me where I can find a good source for learning this?
Maybe at this point it should be possible to also change the Vendor ID / Product ID?

Thanks!

iFlorduino:
Do you have a link for me where I can find a good source for learning this?

A quick Google search turned up this:

http://n0m1.com/2012/04/01/how-to-compiling-the-arduino-bootloader/

Not quite, the caterina bootloader also requires LUFA code.

  1. Install LUFA-111009.
    Memos From the Cube » LUFA 111009 Released!

Unzip the contents to some path relative to ....\arduino-1.0.5\hardware\arduino\bootloaders\caterina.
it should be something like ..\LUFA\LUFA-111009.

  1. I would also recommend installing WinAVR-20100110 to help with compiling the bootloader.
    WinAVR - Browse /WinAVR/20100110 at SourceForge.net

  2. You will need to edit the ..\caterina\Makefile for the VID/PID values. Also note in the Makefile, the path for the LUFA_PATH line should match where you unzipped the LUFA-111009 files.

  3. Note: That in addition to the bootloader USB code, there is a separate sketch core USB code that will need to be updated. See ....\arduino-1.0.5\hardware\arduino\cores\arduino\USBCore.cpp for the VID/PID and name definitions. This is the USB core code for your sketch to communicate via USB Serial.

Hello,
did this project go anywhere? If so, would you mind sharing it? By mistake I replaced a damaged chip on a Leonardo with an RC-version and would like to make it work.
Thank you!
Seb