A simple flowcode reads first and then writes data from and to an EEPROM. In this case a simple string "Hello" has been used.
After programming the microchip the string read should be empty. So far so good.
The second and following starts of this microchip should read "Hello" from the EEPROM. I found always an empty string.
What I'm doing wrong???
Kind regards
Jan
EEPROM losses data
Moderator: Benj
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: EEPROM losses data
Hi Jan,
There was a few issues.
For example in the read EEPROM, read EEPROM address loop continued when value read was greater than 0.
By default, the value of each EEPROM address is 255 if never used, not 0.
Try the attached flowchart.
There was a few issues.
For example in the read EEPROM, read EEPROM address loop continued when value read was greater than 0.
By default, the value of each EEPROM address is 255 if never used, not 0.
Try the attached flowchart.
- Attachments
-
- Test_ReadandWrite_EEPROM_V2.fcfx
- (13.99 KiB) Downloaded 208 times
Martin
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: EEPROM losses data
Hi Martin,
What can be more simple as programming an EEPROM? It tooks me a lot of testing and puzziling.
But let me first thanks you for help with the flowcode V2. Indeed I made a lot of errors in version 1. Perhaps to long puzzeling and thus making errors?
This is what I found. In the attached version, I showed the contents of each EEPROM address on the LCD screen. I did:
1) loading this flowocode into the microchip.
2) The EEPROM is, as expected, empty. In this programm the EEPRON will be filled with "Hello"
3) Next start the string read is indeed "Hello". Again as expected
4) I loaded thesame flowcode again into the microchip
5) A now the EEPROM is NOT empty, but shows "Hello". There can only one conclusion: the EEPROM is not cleared during the loading of the program. There was no message about EEPROM during loading. And the "Initial values" of the EEPROM are empty. This would make the EEPROM to be cleared. Why does that not work????
Kind regards
Jan
What can be more simple as programming an EEPROM? It tooks me a lot of testing and puzziling.
But let me first thanks you for help with the flowcode V2. Indeed I made a lot of errors in version 1. Perhaps to long puzzeling and thus making errors?
This is what I found. In the attached version, I showed the contents of each EEPROM address on the LCD screen. I did:
1) loading this flowocode into the microchip.
2) The EEPROM is, as expected, empty. In this programm the EEPRON will be filled with "Hello"
3) Next start the string read is indeed "Hello". Again as expected
4) I loaded thesame flowcode again into the microchip
5) A now the EEPROM is NOT empty, but shows "Hello". There can only one conclusion: the EEPROM is not cleared during the loading of the program. There was no message about EEPROM during loading. And the "Initial values" of the EEPROM are empty. This would make the EEPROM to be cleared. Why does that not work????
Kind regards
Jan
-
- Posts: 444
- Joined: Tue Apr 15, 2014 4:19 pm
- Location: Kajaani, Finland
- Has thanked: 345 times
- Been thanked: 227 times
- Contact:
Re: EEPROM losses data
Hi Jan!Jan Lichtenbelt wrote: 5) A now the EEPROM is NOT empty, but shows "Hello". There can only one conclusion: the EEPROM is not cleared during the loading of the program. There was no message about EEPROM during loading. And the "Initial values" of the EEPROM are empty. This would make the EEPROM to be cleared. Why does that not work????
I have to say, that most of the time its good that the EEPROM is not emptied, as it might have some calibration, serial number or other important data, and if the chip is re-programmed with updated software, it can be done on field, without risk that you need to carry all calibration equipment with you to do a lab-grade calibration there.
To erase EEPROM every time, it would mean that on development bench, the EEPROM would burn out extremely fast and cause erratic behavior.
Many times i have seen that the EEPROM might contain gibberish as new part, and usually i load a "preset+test" code on production devices to format EEPROM to default values and to do Unit Functional Tests before loading final firmware and calibrations.
On older MIAC units, i remeber to have seen the EEPROM be totally anything from 0-255 when they come in as new.
Ill just keep the good work up!
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: EEPROM losses data
Hi Etsdriver,
Thanks for your help.
The problem is, if you expect the EEPROM to be erased by loading the hex file, you have to take other actions compared to the case the EEPROM will not be erased. Fortunately it can be easily checked by the particular EEPROM address to be 255 or <255.
Kind regards
Jan
Thanks for your help.
The problem is, if you expect the EEPROM to be erased by loading the hex file, you have to take other actions compared to the case the EEPROM will not be erased. Fortunately it can be easily checked by the particular EEPROM address to be 255 or <255.
Kind regards
Jan
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: EEPROM losses data
Hello,
I think the EEPROM is erased on a programming cycle unless specifically told not to in the config or in the PICkit settings. mLoader & E-blocks will always do it automatically.
After programming the chip likely gets reset a couple of times and so the first run you are seeing is probably not the actual first run. Try adding a couple of seconds delay before you set the EE values and you should then see it happen on the first "stable" run.
I think the EEPROM is erased on a programming cycle unless specifically told not to in the config or in the PICkit settings. mLoader & E-blocks will always do it automatically.
After programming the chip likely gets reset a couple of times and so the first run you are seeing is probably not the actual first run. Try adding a couple of seconds delay before you set the EE values and you should then see it happen on the first "stable" run.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel