Hello everybody
I am using MSP430G2302 for a sensor application
to store calibration data i am using information memory
i am able to write to this memory and can see the contents on memory read from external tools.
but once i recycle the power (hard reset power Off/ON) the information memory section is lost
Clock speed at this moment is 16 MHz, reset cap is 1.5nF
Changed the clock speed to 1MHz -> Same failuer
Changed the memory location from 0x1000 to 0x1040 -> same failuer
added startup delay after selecting the clock switch (16Mhz) -> improves the retention but it goes after 3 or 4 resets
Added start up delay at the beaning of the code -> solves the problem
I want to know how reliable is this solution?
do i have to change the reset circuit?
i wanted to enable brown out protection but could not find registers on this device to do that! but datasheet front page tell it has brown out!
moreover is this memory dependable? ( application is not life saving or life threatening)
Seen other threads but they seems to have solved the problem using SVS(not present ) or external Reset circuitry
Regards
Deepak
Hello Deepak,
there are many different possibilities where the trouble can result from.
Have you already checked the Understanding MSP430 Flash Data Retention App Note?
How do you wirte in to the Flash? Can you provide minimized sample code so for test purposes to see if this behaviour is reproducible?
What is the Vcc supply voltage? Minimum processor frequency is defined by system clock. Flash program or erase operations on the G2302 device require a minimum VCC of 2.2 V. Please check the datasheet at page 17.
Deepak Pathania... to store calibration data i am using information memory
Why storing Calibration data? As I can see it in the datasheet, Segment A already contains factory preprogrammed calibration data! Please check the datasheet. After reset, segment A is protected against programming and erasing. It can be unlocked, but care should be taken not to erase this segment if the device-specific calibration data is required.
Deepak Pathaniaadded startup delay after selecting the clock switch (16Mhz)
Deepak PathaniaAdded start up delay at the beaning of the code -> solves the problem
Deepak PathaniaI want to know how reliable is this solution?
This should be always considered , specially with slow rising Vcc supply at power-up.
Deepak Pathania i wanted to enable brown out protection but could not find registers on this device to do that! but datasheet front page tell it has brown out! moreover is this memory dependable? ( application is not life saving or life threatening)
The G2302 includes a Brownout reset that is by default activated and will not let the MSP430 operate unless the voltage is acceptable. However, powering the MSP430 device with an unstable power supply could be also problematic. would also highly suggest that you ensure that the power rails are clean and that any noise is kept to a minimum.
BR,
Mo.
Thanks Mo, for your early reply
Erase and Write Code
void write_EEPROM(unsigned char value, unsigned char Address)
{ char *Flash_ptr; // Flash pointer Flash_ptr = (char *)0x1000 + Address; // Initialize Flash pointer FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation *Flash_ptr = value; // Write value to flash FCTL1 = FWKEY; // Clear WRT bit FCTL3 = FWKEY + LOCK; // Set LOCK bit}
void erase_EEPROM(unsigned char Address){ char *Flash_ptr; // Flash pointer Flash_ptr = (char *)0x1000 + Address; // Initialize Flash pointer FCTL3 = FWKEY; // Clear Lock bit FCTL1 = FWKEY + ERASE;// + EEI; // Set Erase bit, allow interrupts *Flash_ptr = 0; // Dummy write to erase Flash seg FCTL1 = FWKEY; // Clear WRT bit FCTL3 = FWKEY + LOCK; // Set LOCK bit
}
Calibration data of micro is not touched but we want to write calibration data for our sensor so we arite to these location
page containinig micro calibration data starts from 0x10C0 not 0x1000 so i am writing my own calibration values used in sensor at 0x1000
data retention AN is good will read it again for better understanding but we are working at normal temperature
How do you define slow rising VCC? we have 10uF cap on supply for making supply rails smooth! is that causing trouble?
do u suggest some other solution? say if i reduce 10uF cap to 1uF but this will introduce more noise(anticipated) and will not filter glitches in supply at startup and power down phases
regards
Deepak Pathania Clock speed at this moment is 16 MHz, reset cap is 1.5nF Changed the clock speed to 1MHz -> Same failuer
The fFTG timing might be the problem here.
Can you please implement the below code just before writing/erasing to the Flash?
DCOCTL = 0x0; BCSCTL1 = CALBC1_1MHZ; // Set DCO to 1MHz DCOCTL = CALDCO_1MHZ; FCTL2 = FWKEY + FSSEL0 + FN1; // MCLK/3 for Flash Timing Generator
Mo.Why storing Calibration data? As I can see it in the datasheet, Segment A already contains factory preprogrammed calibration data!
The factory-stored values are a good starting point to get the ADC functions running. But for the final applicaiton, own calibration might be necessary if you don't want to risk a rather large tolerance.
_____________________________________Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.