How to set fuse bits for Tiny2313 when implementing USB ?

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
chisteven
Posts: 2
Joined: Wed Dec 19, 2007 8:10 am

How to set fuse bits for Tiny2313 when implementing USB ?

Post by chisteven » Wed Dec 19, 2007 8:23 am

I try to implement USB with AVR-CDC using ATtiny2313

I referenced the datasheet but can't get the right setting for fuse bits,

(or it doesn't need to program the fuse bit ? )

can anyone tell me which fuse bits should be programmed (set to 0) ?

( use 12MHZ crystal oscillator )

please give me a hand, thanks a lot~~

Guest

Post by Guest » Sat Dec 22, 2007 9:23 am

Christeven,

this MAKEFILE snipplet is from Osamu Tamura's own tiny2313 example. It worked fine for me (version 2007-10-03).

To use it you need to run "make fuse_tiny2313" before or after flashing the actual code,

Code: Select all

# Fuse low byte:
# 0xef = 1 1 1 0   1 1 1 1
#        ^ ^ \+/   \--+--/
#        | |  |       +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz)
#        | |  +--------------- SUT 1..0 (BOD enabled, fast rising power)
#        | +------------------ CKOUT (clock output on CKOUT pin -> disabled)
#        +-------------------- CKDIV8 (divide clock by 8 -> don't divide)
#
# Fuse high byte:
# 0xdb = 1 1 0 1   1 0 1 1
#        ^ ^ ^ ^   \-+-/ ^
#        | | | |     |   +---- RSTDISBL (disable external reset -> enabled)
#        | | | |     +-------- BODLEVEL 2..0 (brownout trigger level -> 2.7V)
#        | | | +-------------- WDTON (watchdog timer always on -> disable)
#        | | +---------------- SPIEN (enable serial programming -> enabled)
#        | +------------------ EESAVE (preserve EEPROM on Chip Erase -> not preserved)
#        +-------------------- DWEN (debug wire enable)
fuse_tiny2313:   # only needed for attiny2313
   $(AVRDUDE) -U hfuse:w:0xdb:m -U lfuse:w:0xef:m


Cheers
Gert

chisteven
Posts: 2
Joined: Wed Dec 19, 2007 8:10 am

Post by chisteven » Sun Dec 23, 2007 8:38 am

Thank you~~

I'll try it later and tell you if it works fine or not !

magwas

DWEN

Post by magwas » Tue Dec 30, 2008 3:26 am

Be warned that this snippet enables DebugWire, which means you cannot program the processot without a MKII (and STK500?) anymore.

If you program is with SPI, do not ever alter the DWEN bit, or you have to find a friend with a MKII to set the fuse back.

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Sun Jan 04, 2009 7:06 pm

Setting DWEN to 1 disables it, setting it to 0 enables it. This is "fuse" logic: a logic 0 means that the fuse is "blown", 1 is the default state.

Post Reply