Good day all. I am working on a project that requires me to
connect a 24LC512 eeprom to my PIC. I've boarded the hardware
and now I need to test. I have the put together a program that
increments a number 10 times and places it in an address location
starting at address 10. I then have a loop that reads back the number
at each location and flashes an led the said number of times.
in the simulation I can see that the number is being written to the
location. But for some reason the read keeps showing 255. I have attached
the file can someone have a look and see if I'm missing a step I've been
at it for hrs. Thanks in advance.
Ondra
I2C 24LC512 eeprom sim not working
Moderator: Benj
I2C 24LC512 eeprom sim not working
- Attachments
-
- Ext EEPROM test 18F6722.fcf
- (9 KiB) Downloaded 249 times
Last edited by Ondra on Tue Jul 19, 2011 3:40 pm, edited 1 time in total.
- 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: I2C 24LC512 eeprom sim not working
Hello Ondra,
Have you tried the program on hardware?
The simulation cannot know what return values are available on your device and if you do not have anything in the queue then the component will return 255. Adding some values to the queue seems to be working correctly with your program.
Have you tried the program on hardware?
The simulation cannot know what return values are available on your device and if you do not have anything in the queue then the component will return 255. Adding some values to the queue seems to be working correctly with your program.
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
Re: I2C 24LC512 eeprom sim not working
I did try the hardware and it not working. Knowing that the programs working eliminates
that from the problem I continue to look further thanks.
Ondra
that from the problem I continue to look further thanks.
Ondra
Re: I2C 24LC512 eeprom sim not working
Hi Ben
I'm having no success with this. I have a couple of questions. My setup is a follows. I have a PIC18F6722 communicating through Port D 5 and 6 (which is the hardware SPI2 ports SDA2 and SCL2) using the I2C software emulation. I'm connected to a 24LC512 chip with pins A0 and A1 connected to VSS and A2 connected to VDD. My questions are: -
1) I have a Device ID of 0xA8. Is this correct?
2) Looking at the 6722 is it possible that there could be a software timing issue that can be tweaked.
3) Is it possible to change the I2C to use the second SPI2 ports SCL2 and SDA2?
The setup look straight forward I don't know what else to look for. I've included the latest copy of the code.
Ondra
I'm having no success with this. I have a couple of questions. My setup is a follows. I have a PIC18F6722 communicating through Port D 5 and 6 (which is the hardware SPI2 ports SDA2 and SCL2) using the I2C software emulation. I'm connected to a 24LC512 chip with pins A0 and A1 connected to VSS and A2 connected to VDD. My questions are: -
1) I have a Device ID of 0xA8. Is this correct?
2) Looking at the 6722 is it possible that there could be a software timing issue that can be tweaked.
3) Is it possible to change the I2C to use the second SPI2 ports SCL2 and SDA2?
The setup look straight forward I don't know what else to look for. I've included the latest copy of the code.
Ondra
- Attachments
-
- Ext EEPROM test 18F6722.fcf
- (9 KiB) Downloaded 276 times
- 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: I2C 24LC512 eeprom sim not working
Hello Ondra,
Your device address 0xA8 looks correct to me.
The I2C component in the file you posted is in hardware mode and as such is using pins RC3 and RC4. You should be able to switch to the hardware I2C channel by using the custom code feature and renaming the I2C registers from channel 1 to channel 2. Looking at the code this will probably not be straightforward. You might be better off using the software I2C if you need alternate pins.
Have you got external pull up resistors connected to the SCL and SDA signals? Pullup resistor values of 10K or 2K are recommended depending on the I2C rate you are using.
Your device address 0xA8 looks correct to me.
The I2C component in the file you posted is in hardware mode and as such is using pins RC3 and RC4. You should be able to switch to the hardware I2C channel by using the custom code feature and renaming the I2C registers from channel 1 to channel 2. Looking at the code this will probably not be straightforward. You might be better off using the software I2C if you need alternate pins.
Have you got external pull up resistors connected to the SCL and SDA signals? Pullup resistor values of 10K or 2K are recommended depending on the I2C rate you are using.
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
Re: I2C 24LC512 eeprom sim not working
After I sent the file I did realizes that I hadn't checked the use "Software Settings". though that was the option I was using.
Ondra
Yes I do have 10K pullup resistors on SCL and SDA. Is the I2C rate set by the resistors? Do I have to set anything in the software to communicate at the same rate as the eeprom or is it auto by way of the resistors.Benj wrote: Have you got external pull up resistors connected to the SCL and SDA signals? Pullup resistor values of 10K or 2K are recommended depending on the I2C rate you are using.
Ondra
Re: I2C 24LC512 eeprom sim not working
I got it Ben.
Looking at the C code I saw this " Device_ID = Device_ID << 1;" Well using a scope I notice that the first bit was missing. For my device 1010 is the device ID what was being sent was 0101 as the first 4 bits So changing the address to 0xD7 or 0x54, I got the bit back and it works fine. I must have missed that in the help files.
Ondra
Looking at the C code I saw this " Device_ID = Device_ID << 1;" Well using a scope I notice that the first bit was missing. For my device 1010 is the device ID what was being sent was 0101 as the first 4 bits So changing the address to 0xD7 or 0x54, I got the bit back and it works fine. I must have missed that in the help files.
Ondra
- 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: I2C 24LC512 eeprom sim not working
Hi Ondra,
That's great glad you got it running, thanks for letting us know what the problem was.
That's great glad you got it running, thanks for letting us know what the problem was.
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