bugAVR C Runtime Library - Bugs: bug #25929, boot.h Fuse read not compatible...

 
 

bug #25929: boot.h Fuse read not compatible with Tiny48/88.

Submitted by:  Bob Paddock <bpaddock>
Submitted on:  Thu 19 Mar 2009 12:45:38 PM UTC  
 
Category: LibrarySeverity: 4 - Important
Priority: 9 - ImmediateItem Group: libc code
Status: FixedPercent Complete: 100%
Assigned to: Eric Weddington <arcanum>Open/Closed: Closed
Release: 1.6.5Fixed Release: 1.6.4

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 25 Mar 2009 12:58:14 PM UTC, comment #1:

Problem is most likely not limited to ATtiny48/88. As far as I can tell it affect also:
ATmega8/16HVA
ATtiny13/13a
ATtiny167
ATtiny2313
ATtiny43
ATtiny87
ATtiny24/44/84
ATtiny25/45/85
ATtiny261/461/861

The following seems to work. Might consider it as a temporary patch.

#include <avr/io.h>
#include <avr/boot.h>

#define __READ_FUSE_LOCK_BIT_SET (_BV(__SPM_ENABLE) | _BV(RFLB))

#define boot_lock_fuse_bits_get_tiny(address) \
(_extension_({ \
uint8_t __result; \
_asm_ __volatile__ \
( \
"ldi r30, %3\n\t" \
"ldi r31, 0\n\t" \
"sts %1, %2\n\t" \
"lpm %0, Z\n\t" \
: "=r" (__result) \
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
"r" ((uint8_t)__READ_FUSE_LOCK_BIT_SET), \
"M" (address) \
: "r0", "r30", "r31" \
); \
__result; \
}))

I don't have the required chips to test the above, but it match the datasheet.

Frédéric Nadeau <fnadeau>
Thu 19 Mar 2009 12:45:38 PM UTC, original submission:

boot_lock_fuse_bits_get() Assumes that BLBSET is defined.

In the Tinyx8 RLFB is used, not BLBSET:

SPMCSR – Store Program Memory Control and Status Register
"Bit 3 – RFLB: Read Fuse and Lock Bits An LPM instruction within
three cycles after RFLB and SELFPRGEN are set in the SPMCSR
Register, will read either the Lock bits or the Fuse
bits (depending on Z0 in the Z-pointer) into the destination
register. See 'Reading the Fuse and Lock Bits from Software' on
page 176 for details."

Bob Paddock <bpaddock>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by fnadeau (Posted a comment)
  • -unavailable- added by arcanum (Updated the item)
  • -unavailable- added by bpaddock (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 25 Apr 2009 09:29:39 PM UTCarcanumStatusNone=>Fixed
      Percent Complete0%=>100%
      Assigned toNone=>arcanum
      Open/ClosedOpen=>Closed
      Fixed ReleaseNone=>1.6.4
    Thu 19 Mar 2009 01:01:16 PM UTCarcanumSeverity3 - Normal=>4 - Important
      Priority5 - Normal=>9 - Immediate

    Back to the top


    Powered by Savane 3.1-cleanup1