Hey folks,
I'm having a problem where after multiple writes into the EEPROM I'm only able to read back the last value that was written.
Look at the difference between a read immediately after a write vs multiple writes and multiple reads. It's as if the value of EEDATA is only updated on a write.
Notes:-
*******************************************************************************
RESULTS:-
Test set A:-
Step1. Write to EEPROM @ 0xA0 with value 'A'
Step2. Write to EEPROM @ 0xB0 with value 'B'
Step3. Write to EEPROM @ 0xC0 with value 'C'
Step4. Write to EEPROM @ 0xD0 with value 'D'
Step5. Read EEPROM @ 0xA0 and write in USART => value printed:- 'D'
Step6. Read EEPROM @ 0xB0 and write in USART => value printed:- 'D'
Step7. Read EEPROM @ 0xC0 and write in USART => value printed:- 'D'
Step8. Read EEPROM @ 0xD0 and write in USART => value printed:- 'D'
test set B:-
Step1. Write to EEPROM @ 0xA0 with value 'A'
Step2. Read EEPROM @ 0xA0 and write in USART => value printed:- 'A'
Step3. Write to EEPROM @ 0xB0 with value 'B'
Step4. Read EEPROM @ 0xB0 and write in USART => value printed:- 'B'
Step5. Write to EEPROM @ 0xC0 with value 'C'
Step6. Read EEPROM @ 0xC0 and write in USART => value printed:- 'C'
Step7. Write to EEPROM @ 0xD0 with value 'D'
Step8. Read EEPROM @ 0xD0 and write in USART => value printed:- 'D'
*******************************************************************************
The results are the same as Pommie in this thread but I already had the delays etc in my code without success.
My code attached (N.B. I did not set 'EECONbits.CMD = 0b001' and 'EECONbits.CMD = 0b000' in the example code as when I do there isn't any actual data being read whether I cater for 32bit or 8bit data).
Thanks in advance.
I'm having a problem where after multiple writes into the EEPROM I'm only able to read back the last value that was written.
Look at the difference between a read immediately after a write vs multiple writes and multiple reads. It's as if the value of EEDATA is only updated on a write.
Notes:-
- Strangely, Reads only work when I DON'T set 'EECONbits.CMD = 0b000' otherwise I get non-printable characters, this happened whether I worked in 32bit or 8bit data
- I get the same result whether I use the DEVEE0->DEVEE3 initialisation routine or not
- CFGCON2bits.EEWS = 0 as I'm using a low clock speed, setting this to '1' did not matter
- Got the same results whether I used 'char' or 'uint32_t' as the type on the EEPROM routines
- I included a read-back test inside the EEPROM write function that would cause the execution to stay in a loop if there was a mismatch in the written vs read value and it's not locking up, implying that the written value matches the read value.
- Strange again.. If I include 'EECONbits.CMD = 0b000' in the WRITE function's read-back test, the data being read & printed from the READ function is affected and becomes a non-printable character.
- Physical external clock speed 8MHz... had no issue with any other peripheral.
*******************************************************************************
RESULTS:-
Test set A:-
Step1. Write to EEPROM @ 0xA0 with value 'A'
Step2. Write to EEPROM @ 0xB0 with value 'B'
Step3. Write to EEPROM @ 0xC0 with value 'C'
Step4. Write to EEPROM @ 0xD0 with value 'D'
Step5. Read EEPROM @ 0xA0 and write in USART => value printed:- 'D'
Step6. Read EEPROM @ 0xB0 and write in USART => value printed:- 'D'
Step7. Read EEPROM @ 0xC0 and write in USART => value printed:- 'D'
Step8. Read EEPROM @ 0xD0 and write in USART => value printed:- 'D'
test set B:-
Step1. Write to EEPROM @ 0xA0 with value 'A'
Step2. Read EEPROM @ 0xA0 and write in USART => value printed:- 'A'
Step3. Write to EEPROM @ 0xB0 with value 'B'
Step4. Read EEPROM @ 0xB0 and write in USART => value printed:- 'B'
Step5. Write to EEPROM @ 0xC0 with value 'C'
Step6. Read EEPROM @ 0xC0 and write in USART => value printed:- 'C'
Step7. Write to EEPROM @ 0xD0 with value 'D'
Step8. Read EEPROM @ 0xD0 and write in USART => value printed:- 'D'
*******************************************************************************
The results are the same as Pommie in this thread but I already had the delays etc in my code without success.
Can't get EEPROM to work.
I have a (long and complex) program that saves data to EEPROM. It doesn't work. To test this out I wrote a small program, const uint8_t data[10] __at(0xF00000)={0,1,2,3,4,5,6,7,8,9}; uint8_t data2[10]={0,0,0,0,0,0,0,0,0,0},temp; void writeEEPROM(uint8_t,uint8_t); uint8_t readEEPROM(uint8_t)...
www.electro-tech-online.com
My code attached (N.B. I did not set 'EECONbits.CMD = 0b001' and 'EECONbits.CMD = 0b000' in the example code as when I do there isn't any actual data being read whether I cater for 32bit or 8bit data).
Thanks in advance.