Summary of Atmel AVR-firmware based universal USB-Interface using ATTiny2313
This article details building a USB interface using an Atmel ATTiny2313 microcontroller with Objective Development's PowerSwitch reference design. The author overcame initial setup challenges by utilizing freeware tools like WinAVR, AVR Studio 4.13, and PonyProg2000. A critical step involved reprogramming the MCU fuse bits to use a 12 MHz crystal instead of the internal oscillator. The modified project interfaces with Analog Devices Direct Digital Synthesizer (DDS) chips while maintaining hardware compatibility with the original design.
Parts used in the ATTiny2313 USB Interface:
- Atmel ATTiny2313 Microcontroller
- Objective Development PowerSwitch Reference Design
- 12 MHz Crystal Oscillator
- Analog Devices Direct Digital Synthesizer (DDS) Chips
Scanning the web on microcontroller based USB solutions, I stumbled over Objective Development’s freeware USB solution based on Atmel’s AVR architecture. I decided to build up their reference design PowerSwitch with an ATTiny2313 MCU.
Since I never used AVR chips before, the first challenge was to set up a code development environment enabling me to modify the firmware to my needs and get it into the MCU chip.
Amazingly enough, I found excellent freeware tools to get this accomplished:
AVR-C-Compiler: WinAVR
IDE including simulator: AVR Studio 4.13, build 528 (Release) Download 75 MB
AVR flashing tool: PonyProg2000 (for simple hardware for flashing AVRs look here)
WinAVR and PonyProg work nicely from within AVR Studio as plug-ins.
Beware that in order to make PowerSwitch (and my own application) work, the fuse bits of the MCU need to be reprogrammed, since the factory default lets the MCU run on the internal RC-oscillator, but for the USB-firmware it’s crucial that the MCU is clocked with a 12 MHz crystal.
Here are the correct fuse bit settings as seen in PonyProg:
DG8SAQ-DDS application:
After successfully having set up the software development environment for AVRs and having managed to get the AVR-USB reference project PowerSwitch to work properly, I decided to modify it to interface Analog Devices Direct Digital Synthesizer (DDS) chips. On top, any Port pin can be configured and used through the host software as logical input or output widening the possible applications without mofification of the firmware.
The below schematic shows, that the hardware is still basically identical with OD’s PowerSwitch.
For more detail: Atmel AVR-firmware based universal USB-Interface using ATTiny2313
- What microcontroller was used for the USB solution?
The project utilizes the Atmel ATTiny2313 microcontroller. - How can I modify the firmware for this project?
You can modify the firmware using the WinAVR compiler within the AVR Studio IDE. - Does the factory default clock setting work for USB firmware?
No, the factory default uses an internal RC-oscillator, but the USB firmware requires a 12 MHz crystal. - Which tool is recommended for flashing the AVR chips?
PonyProg2000 is the recommended freeware tool for flashing AVRs. - Can port pins be configured as inputs or outputs?
Yes, any Port pin can be configured and used as a logical input or output through host software. - Does the modified design require new hardware components?
No, the hardware remains basically identical to the original OD PowerSwitch design. - What freeware IDE includes a simulator for this project?
AVR Studio 4.13 serves as the IDE including a simulator.

