Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Having a problem with the EEPROM on PIC32MK1024MCF064

R-K-8592

New Member
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:-

  • 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.
Thanks in advance for any assistance.

*******************************************************************************

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.
 

Attachments

  • EEPROM CODE.txt
    11.8 KB · Views: 69

Latest threads

New Articles From Microcontroller Tips

Back
Top