Reading Fuse Bytes 0, 1, and 2 - XMEGA256A3

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am trying to read the fuse bytes in my application code and only get valid responses for fuses 4 and 5.

Default method that works for reading device ID, user signature, and calibration rows.

        NVM_CMD = NVM_CMD_READ_FUSES_gc;
        fuse = pgm_read_byte(FUSE_START + index);
        NVM_CMD = NVM_CMD_NO_OPERATION_gc;

However, this does not return anything valid for fuses.

Per Atmel App Note and this post https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=96962&start=0&postdays=0&postorder=asc&highlight= I tried the following assembly code:

fuse = SP_ReadFuseByte(index);

This assembly code gives 0x00 for all fuses except 4 and 5 which return valid responses.

I also tried the following code:

        do {
            // Block execution while waiting for the NVM to be ready
        } while ((NVM.STATUS & NVM_NVMBUSY_bm) == NVM_NVMBUSY_bm);
        NVM.ADDR0 = index;
        NVM.CMD = NVM_CMD_READ_FUSES_gc;
        CCPWrite1((u8 *)&NVM.CTRLA, NVM_CMDEX_bm);
        fuse1 = NVM.DATA0;
        NVM.CMD = NVM_CMD_NO_OPERATION_gc;

which gave me the same results as the assembly code (0x00 for all fuses except 4 and 5 which gave valid responses).

Anyone insight is appreciated :D

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you enabled any memory power saving, e.g. EEPROM or flash? There is a silicone bug that causes some NVM values to be unreadable when power saving is enabled.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does that mean that we can read them, if we just turn power saving off briefly?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, just disable it, read and turn it back on again. Took me a long time to figure that one out. It's in the errata for some parts now.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That was the trick, turned off power save and can now read all the fuse bytes. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I discovered it on the D3 and A3U models, but it looks like pretty much all XMEGAs are affected. When I get some E5s in early next year I'll see if they have the same bug.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Been Reading the device ID and user signature row in low power mode without issue. Do you know what else is affected besides fuses?

Thanks again for the help, it is greatly appreciated.