AVR32DA32 EEPROM partial corruption after power cycle

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

I'm trying to write a 10 byte struct to EEPROM and it writes successfully but when I turn the device off and turn it on again one or two bytes and only one or two bytes will have reset to 0xFF. There's no consistency to which byte(s) resets and I've tried writing to different addresses in EEPROM with the same result. I have the BOD enabled and set to the highest possible voltage and sampling frequency. It may be worth noting I'm powering it with 3.3V.

void eepromWriteBlock(void *src, uint8_t* dst, uint8_t size)
{
	CCP = CCP_SPM_gc;				        //System instruction register unlock.
	NVMCTRL.CTRLA = NVMCTRL_CMD_EEERWR_gc;			//EEPROM erase/write command.
	
	uint8_t *pSrc = (uint8_t*)src;				//Cast void* to uint8_t*.
	for (uint8_t i = 0; i < size; i++)				
	{
		eepromWaitWhileBusy();
		*(dst++) = *(pSrc++);				//Copy RAM data to EEPROM.
	}
		
	CCP	= CCP_SPM_gc;					//System instruction register unlock.
	NVMCTRL.CTRLA = NVMCTRL_CMD_NOOP_gc;			//EEPROM no operation command.
}


void eepromReadBlock(uint8_t *src, void *dst, uint8_t size)
{
	uint8_t *pDst = (uint8_t*)dst;                  //Cast void* to uint8_t*.
	for (uint8_t i = 0; i < size; i++)
	{
		*(pDst++) = *src++;                     //Copy EEPROM data to RAM.
	}
}


void eepromWaitWhileBusy()
{
	while ((NVMCTRL.STATUS & NVMCTRL_EEBUSY_bm) != 0) {}    //Do nothing while EEPROM busy flag is set.
}

 

Attachment(s): 

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

What does the program DO with the EEPROM on bootup?

 

You might use the debugger and set break points at various locations in the system initialization. Walk through the initialization, and at each break point, check the EEPROM contents. 

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

ajegers wrote:
I have the BOD enabled and set to the highest possible voltage and sampling frequency.
This defect may be related to a BOD errata; some AVR DA errata were corrected in AVR DB.

ajegers wrote:
It may be worth noting I'm powering it with 3.3V.
A work-around is an external supervisor though some voltage regulators can generate the necessary reset signal (ie power good)

 


BOD Registers not Reset When UPDI Is Enabled | AVR32DA Silicon Errata and Data Sheet Clarification

Silicon Issue Summary | AVR32DB28/32/48 Silicon Errata and Data Sheet Clarifications

Silicon Issue Summary | AVR16/32DD28/32 Silicon Errata and DataSheet Clarifications

 

 

"Dare to be naïve." - Buckminster Fuller

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

 

ajegers wrote:
I have the BOD enabled and set to the highest possible voltage and sampling frequency. It may be worth noting I'm powering it with 3.3V.
Aren't those two comments oxymoronic?

 

The idea of BOD is that you set the threshold at just a little below your operating voltage so at Vcc=3.3VV you might have it set at something like 2.8V. The idea being that you don't want it operate until voltage sages but you don't want it to sag too far below Vcc before it does act.

 

EDIT: ah, OK, I didn't realize that it offers:

 

 

so, yeah, 2.85V would seem the sensible choice.

 

Last Edited: Fri. Sep 23, 2022 - 01:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try continuous BOD.

Reason : BOD sampling period is long

 

CTRLA | BOD | AVR® DA Family

RST and BOD | AVR® DA Family

8 ms is long compared to 3 microsecond.

Sampling BOD is more for VDD from cell, battery, or supercapacitor.

Peripherals Power Consumption | AVR® DA Family

Order-of-magnitude less current for sampled BOD versus continuous.

 

"Dare to be naïve." - Buckminster Fuller