EEPROM Operation
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: EEPROM Operation
Which data sheet? Do you have a link to the one for your device? As is mentioned before the are different manufacturers and the devices might not be compatible.greentech wrote:Then what to do? The datasheet for 24c04 advices the same sequence. why that doesn't work? i have also tried this with 24lc512 with the same results.....
Fairy
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: EEPROM Operation
Sorry for the delay Jac.kersing wrote:Martin,
What is the exact hardware you tried? (Model and Manufacturer)
I'm using
Microchip 24LC512
Data sheet:
http://ww1.microchip.com/downloads/en/D ... 21754M.pdf
Last time I tried, it took a few attempts to display the correct information.
It was on a separate bread board to microcontroller, so could have been caused by stray capacitance, or as Jac has been saying flowchart is not correct?
Hope this helps
Martin
Martin
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: EEPROM Operation
I'm looking into this more.
I can confirm that reading EEPROM works 100% of the time.
It looks like the issue is writing to EEPROM.
I changed 2013 to a different number to test and the number read was still 2013.
So the reason I thought it was working is because with a previous flowchart I must of successful programmed with 2013.
So I'm changing flowchart to take that into account.
At least that could be one reason your still getting 255's and I'm not?
So I will see if I can sort out flowchart and only when working 100% I will post it.
I do want to solve this...determined
I can confirm that reading EEPROM works 100% of the time.
It looks like the issue is writing to EEPROM.
I changed 2013 to a different number to test and the number read was still 2013.
So the reason I thought it was working is because with a previous flowchart I must of successful programmed with 2013.
So I'm changing flowchart to take that into account.
At least that could be one reason your still getting 255's and I'm not?
So I will see if I can sort out flowchart and only when working 100% I will post it.
I do want to solve this...determined
Martin
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: EEPROM Operation
There was a bug in 3. EEPROM read and write.fcf that greentech posted on Wed Aug 07, 2013 6:54 am
I have corrected bug, and now my hardware works 100% of the time.
To confirm both read and write works, I have been changing the data values.
Read now always matches write.
Still not sure if it will simulate or not?
I will see if flowchart works with other I2C EEPROMs.
I have corrected bug, and now my hardware works 100% of the time.
To confirm both read and write works, I have been changing the data values.
Read now always matches write.
Still not sure if it will simulate or not?
I will see if flowchart works with other I2C EEPROMs.
- Attachments
-
- 3. EEPROM read and write V3.fcf
- (19.85 KiB) Downloaded 366 times
Martin
Re: EEPROM Operation
Hello,
I tried a porting in Flowcode 10 but without a successful result.
It seems that the data is not stored in the eeprom locations.
Please help me.
Thank you!
I tried a porting in Flowcode 10 but without a successful result.
It seems that the data is not stored in the eeprom locations.
Please help me.
Thank you!
- Attachments
-
- test eeprom.fcfx
- (19.08 KiB) Downloaded 41 times
Re: EEPROM Operation
Hello,
They came eeprom 24LC512, I put them in the circuit, but without result. Is there someone who can correct the flowchart? What must be done? The flowchart is made in Flowcode 10 after "3. EEPROM read and write V3".
They came eeprom 24LC512, I put them in the circuit, but without result. Is there someone who can correct the flowchart? What must be done? The flowchart is made in Flowcode 10 after "3. EEPROM read and write V3".
- Attachments
-
- eeprom test.png (1.13 MiB) Viewed 2252 times
-
- Valued Contributor
- Posts: 1208
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
Re: EEPROM Operation
Hi,
You look to be using i2c generic read/write register The eeprom needs more than this to work correctly. Have you tried the eeprom component?
Have a look at viewtopic.php?t=22422 for some more detail
Martin
You look to be using i2c generic read/write register The eeprom needs more than this to work correctly. Have you tried the eeprom component?
Have a look at viewtopic.php?t=22422 for some more detail
Martin
-
- Valued Contributor
- Posts: 1208
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
Re: EEPROM Operation
I tried the official component - good to check you have comms first
After a little fiddling - using an Arduino Uno - and enabling the inbuild pull-ups (I also needed external pull-ups but it wouldn't work with either the enable or the hardware removed - very odd, but the resistors I used were just two at 'random')
Then - address - I had pins 1 and 2 connected to VCC (using an old project with 4 x 256Mb chips) so set address to 3 for the component. Set this property to 0 unless you have a0/a1 (pins 1 or 2) connected to VCC.
Then - a simple write followed by a read. I read the data twice, once a byte at a time, and once using the block read. The data is sent to UART at 115200.
So - this is using an 24LC256 but either should work (this using v10)
Martin
After a little fiddling - using an Arduino Uno - and enabling the inbuild pull-ups (I also needed external pull-ups but it wouldn't work with either the enable or the hardware removed - very odd, but the resistors I used were just two at 'random')
Then - address - I had pins 1 and 2 connected to VCC (using an old project with 4 x 256Mb chips) so set address to 3 for the component. Set this property to 0 unless you have a0/a1 (pins 1 or 2) connected to VCC.
Then - a simple write followed by a read. I read the data twice, once a byte at a time, and once using the block read. The data is sent to UART at 115200.
So - this is using an 24LC256 but either should work (this using v10)
Martin
- Attachments
-
- eeprom.fcfx
- (16.17 KiB) Downloaded 38 times
Re: EEPROM Operation
Hi Martin
I did the porting on the PIC16F877A, without any modification, but it does not compile, I am attaching the image. What should I do? I am using Flowcode 10.
I did the porting on the PIC16F877A, without any modification, but it does not compile, I am attaching the image. What should I do? I am using Flowcode 10.
- Attachments
-
- does not compile.png (276.01 KiB) Viewed 2202 times
-
- Valued Contributor
- Posts: 1208
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
Re: EEPROM Operation
You'll need to change the i2c pins (and the eeprom address) in the component properties.
Also delete the macro pullup (and the two calls to it). You'll need to have pull-up resistors as per i2c.
Martin
Also delete the macro pullup (and the two calls to it). You'll need to have pull-up resistors as per i2c.
Martin
-
- Valued Contributor
- Posts: 1208
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
Re: EEPROM Operation
Just tried compiling and seems the PIC you have has too little RAM to use the component.
I stripped everything out - apart from Read and Write of 10 bytes (no display etc) - and get an error insufficient memory to allocate _FCL_BUFF (130 bytes) - which would (space permitting) be used by the Page Read and Write functions.
Options:
1) Use a PIC with more memory.
2) Modify the component - remove the 'page' functions and create a new 'cut-down' component. MatrixTSL now kindly supply all the source code for the components.
3) Use my code from the above link - this did have 'block' read and write functions, but relied on the space from the 'caller'
4) Depending on how much data you want to save - use the PICs internal eeprom (the PIC has 256 bytes available)
Looking at the data sheet - the MCU you are using should have 368 bytes of RAM - so I'm a little surprised it doesn't allow this to work, so some memory being used by i2c buffers?
Martin
I stripped everything out - apart from Read and Write of 10 bytes (no display etc) - and get an error insufficient memory to allocate _FCL_BUFF (130 bytes) - which would (space permitting) be used by the Page Read and Write functions.
Options:
1) Use a PIC with more memory.
2) Modify the component - remove the 'page' functions and create a new 'cut-down' component. MatrixTSL now kindly supply all the source code for the components.
3) Use my code from the above link - this did have 'block' read and write functions, but relied on the space from the 'caller'
4) Depending on how much data you want to save - use the PICs internal eeprom (the PIC has 256 bytes available)
Looking at the data sheet - the MCU you are using should have 368 bytes of RAM - so I'm a little surprised it doesn't allow this to work, so some memory being used by i2c buffers?
Martin
Re: EEPROM Operation
I use PIC16F877A for the test, for microcontrollers with RAM and reduced eeprom I will use external eeprom. I saw the source code on the wiki, can it be found elsewhere?
Thank you again for your help
Thank you again for your help