Strategies for persistent storage of calibration data.
Phil Pilgrim (PhiPi)
Posts: 23,514
I've designed a Propeller PCB that has two channels of sigma-delta A-to-D. Because their accuracy depends on the digital threshold of the Propeller's inputs, it's necessary to calibrate each channel, based on inputs of 0V and 3.3V. The response is very linear in between, as the following graph shows:
Once the endpoints are determined, it would be nice to store them in EEPROM persistently, so that programs that use A/D can access them. Unlike the BASIC Stamps, though, when a program is loaded to the Propeller's EEPROM, the entire EEPROM is written, not just the portion containing code or allocated variables. This makes the persistent storage of calibration settings impossible with a 32K EEPROM.
Aside from using a larger EEPROM, what strategies have you concocted for overcoming the lack of EEPROM persistence between downloads?
Thanks,
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!
Once the endpoints are determined, it would be nice to store them in EEPROM persistently, so that programs that use A/D can access them. Unlike the BASIC Stamps, though, when a program is loaded to the Propeller's EEPROM, the entire EEPROM is written, not just the portion containing code or allocated variables. This makes the persistent storage of calibration settings impossible with a 32K EEPROM.
Aside from using a larger EEPROM, what strategies have you concocted for overcoming the lack of EEPROM persistence between downloads?
Thanks,
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!
Comments
long cal1,cal2,cal3,cal4
then use a
12c.readlong(@cal1,4)
on startup.
When your calibration changes you update like this
12c.writelong(@cal1,4)
It makes it pretty seamless.
Pseudo code:
PUB Main | LocalVar
· LocalVar := DatVar
· repeat
··· PIDFunction( LocalVar )
PUB WriteGlobalToEEPROM
·· I2C.Write( @DatVar, DatVar)·· 'this MIGHT be @@, but I think it was just @
DAT
· DatVar··· long·· 10
Edit:
I just re-read your post, and you're talking about multiple programs accessing the same data after reloading the EEPROM with new code, which this code certainly doesn't address.· Ignore me.· [noparse]:)[/noparse]
Post Edited (JasonDorie) : 10/27/2008 11:27:27 PM GMT
I used exactly that. Is there some reason to avoid it ?
I leave the last one, to store the initial config data.
And I provided to the customer, more software programed eeproms for reserves.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Not programming/clearing all of Ram/Eeprom would be something useful to have built into the Prop II on-chip downloader.
·
"Aside from using a larger EEPROM,...·· ...I used exactly that. Is there some reason to avoid it ?" - There is no danger in using a larger EEPROM as long as it is backwards compatible with the current 24LC256.· In fact that's how I would probably approach Phil's dilemma.
·
If you don't go with a larger EEPROM (<--stay within the 24LC256) and your program writes to an unused memory address for storage this is perfectly acceptable.· The problem however arises when you download or update the·program... The Propeller IDE will overwrite and clear out the "unused" (<- as far as the IDE is concerned) memory address that you were using for storage from within the program.· A normal Propeller reboot should retain any self modified·memory, it's just the·IDE that will wipe it out during a re-program.
·
Using a larger memory, and writing to an area beyond the 24LC256 boundary for your program storage is the safest way that will not be affected by the Propeller IDE updating a program.
·
There is a thread here that discusses larger memory alternatives that are compatible with the Propeller.·
http://forums.parallax.com/showthread.php?p=625799
·
Note: Adding a larger EEPROM·does not increase program space, but only scratch pad memory available for your propeller program to use.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 10/28/2008 2:51:24 AM GMT
Another idea that came to mind was to do the calibration under control of a PC host program that writes the calibration data to a special Spin object containing just constants and a null Start routine. This object would be referenced by the ADC object, so the constants would be loaded into the EEPROM every time a new program using the ADC is loaded. The downside, of course, is that it will work with only one board. If a person is using multiples of the board, they would all get the same calibration data — not the desired outcome.
Hippy's special loader idea has merit and, in fact, I've written a bootloader for this board that can load programs via a BASIC Stamp. This EEPROM-resident loader could easily be modified to include room for some additional constants. But the board also includes a header for a Prop Plug, so it would be easy for the bootloader to get wiped out, taking the calibration data with it.
-Phil
Addendum: For those who, unlike me, have just a little extra room on their boards, Microchip has introduced their UNI/O serial EEPROMs, available in an SOT-23 package. (For my board, one of these would be the equivalent of the "wafer-thin mint" from Monty Python's The Meaning of Life.)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!
Post Edited (Phil Pilgrim (PhiPi)) : 10/28/2008 6:28:06 AM GMT
The Microchip product sounds interesting. Has anyone done an object to use the UNI/O bus?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"I have always wished that my computer would be as easy to use as my telephone.· My wish has come true.· I no longer know how to use my telephone."
- Bjarne Stroustrup
James
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon
www.norfolkhelicopterclub.com
You'll always have as many take-offs as landings, the trick is to be sure you can take-off again
BTW: I type as I'm thinking, so please don't take any offence at my writing style
Thanks for the heads-up regarding the Protoboard. I hadn't realized that Parallax was using the Atmel part. That gives me some reassurance that there's an adequate supply in the pipeline, which is always a concern with single-source components.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!
Post Edited (Phil Pilgrim (PhiPi)) : 10/28/2008 5:17:05 PM GMT
For the application I am working on, I am using an SPI 8Mbit flash - uses 4 I/O's, but MUCH faster & bigger than the eeprom.
Best Regards,
Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers
They're not single-source : Microchip do one too.
Not in the same package options as the Atmel one, might be a problem if you're committed to TSSOP.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!