Go Down

Topic: Default Value of Fuse Extended Byte of ATtiny85 -- is it 0xFF or 0xFE? (Read 262 times) previous topic - next topic

GolamMostafa

As per data sheets of ATtiny85, the default (factory set) values of the fuse bytes are:
Code: [Select]
Fuse Lowe Byte = 0x62
Fuse High Byte = 0xDF
Fuse Extended Byte = 0xFF


I connected a brand new ATtiny85 MCU with UNO in 'In System Serial Programming' Mode and then executed the following sketch. I got FE (Self Programming Mode is enabled) and not FF (Self Programming Mode is disabled) for the value of Fuse Extended Byte. Is it OK or am I reading corrupted value? The other two fuse bytes are alright.


Code: [Select]
#include<SPI.h>
byte progEnb[] = {0xAC, 0x53, 0x00, 0x00}; //prog enable command bytes
byte fuseLCmnd[] = {0x50, 0x00, 0x00, 0x00}; //Fuse Low Byte (fac: 0x62) read command
byte fuseHCmnd[] = {0x58, 0x08, 0x00, 0x00}; //Fuse High Byte (fac: 0xDF) read command
byte fuseECmnd[] = {0x50, 0x08, 0x00, 0x00};  //Fuse Extended Byte (fac: 0xFF)--> 0xFE; read command
byte myDataL[4];
byte myDataH[4];
byte myDataE[4];

#define RSTAL 4    //active Low DPin-4 drives the RESET/-pin of ATtiny85.
#define MOSI 11
#define MISO 12
#define SCK 13

void setup()
{
  Serial.begin(9600);
  SPI.begin();        //PB2 - PB5 are converted to SS/(OUT-H), MOSI(OUT-L), MISO(IN), SCK(OUT-L)
  bitSet(SPCR, 4);    //UNO-1 is Master
  SPI.setBitOrder(MSBFIRST);  //bit transmission order
  SPI.setDataMode(SPI_MODE0); //CPOL and CPHA (Clock polarity; Clock phase)
  SPI.setClockDivider(SPI_CLOCK_DIV128); //data rate = fosc/128 = 125 kbit
  bitClear(SPCR, 7);  //local SPI interrupt is disable
  //------------------------------------------------------
  pinMode(RSTAL, OUTPUT);
  pinMode(MOSI, OUTPUT);
  pinMode(MISO, INPUT);
  pinMode(SCK, OUTPUT);
  //------------------------------------------------------

  mcuRST();

  for (int i = 0; i < 4; i++)
  {
    SPDR = progEnb[i];  //SPI.transfer() does not work
    while (bitRead(SPSR, 7) != HIGH)//SPIF is cleared when SPSR is read
    {
      ;
    }
  }
  //----------------------------------------
  for (int i = 0; i < 4; i++)
  {
    SPDR = fuseLCmnd[i];  //SPI.transfer() does not work
    while (bitRead(SPSR, 7) != HIGH)//SPIF is cleared when SPSR is read
    {
      ;
    }
    myDataL[i] = SPDR;
  }
  //-------------------------------------------
  for (int i = 0; i < 4; i++)
  {
    SPDR = fuseHCmnd[i];  //SPI.transfer() does not work
    while (bitRead(SPSR, 7) != HIGH)//SPIF is cleared when SPSR is read
    {
      ;
    }
    myDataH[i] = SPDR;
  }
  //-------------------------------------------
  for (int i = 0; i < 4; i++)
  {
    SPDR = fuseECmnd[i];  //SPI.transfer() does not work
    while (bitRead(SPSR, 7) != HIGH)//SPIF is cleared when SPSR is read
    {
      ;
    }
    myDataE[i] = SPDR;
  }
  //------------------------------------------------
  Serial.print("Fuse Low Byte : "); Serial.println(myDataL[3], HEX);
  Serial.print("Fuse High Byte : "); Serial.println(myDataH[3], HEX);
  Serial.print("Fuse Extended Byte : "); Serial.println(myDataE[3], HEX);
  
  SPI.end();
}

void loop()
{

}

void mcuRST()
{
  digitalWrite(RSTAL, LOW);
  digitalWrite(SCK, HIGH);
  delayMicroseconds(500);
  digitalWrite(SCK, LOW);
  digitalWrite(RSTAL, HIGH);
  delay(50);
  digitalWrite(RSTAL, LOW);
  delay(50);
}

Jiggy-Ninja

Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

GolamMostafa

The data sheets show 0xFF; but, I am getting 0xFE.

Jiggy-Ninja

How sure are you that it's really new? Where did you get it from?
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

GolamMostafa

How sure are you that it's really new? Where did you get it from?
I have to honor your opinion as most of the vendors/shop keepers of my country buying/selling secondhand stuffs of China though they claim that they went to China and purchased brand new items. I take mine ATtiny85 as a used one and the Fuse Extended Byte as 0xFE.

Thanks for interaction that has helped me to come out of the mess.

pert

I gave your code a try with a couple fresh out of the tube ATtiny I bought from Digikey and got 0xFF.

GolamMostafa

I gave your code a try with a couple fresh out of the tube ATtiny I bought from Digikey and got 0xFF.
Thank you @pert for the efforts; now, it is confirmed that mine ATtiny85 is an used one.

Go Up