I2C 24LC512 eeprom sim not working

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

I2C 24LC512 eeprom sim not working

Post by Ondra »

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
Attachments
Ext EEPROM test 18F6722.fcf
(9 KiB) Downloaded 237 times
Last edited by Ondra on Tue Jul 19, 2011 3:40 pm, edited 1 time in total.

User avatar
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

Post by Benj »

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.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: I2C 24LC512 eeprom sim not working

Post by Ondra »

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

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: I2C 24LC512 eeprom sim not working

Post by Ondra »

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
Attachments
Ext EEPROM test 18F6722.fcf
(9 KiB) Downloaded 268 times

User avatar
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

Post by Benj »

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.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: I2C 24LC512 eeprom sim not working

Post by Ondra »

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.
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.
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.

Ondra

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: I2C 24LC512 eeprom sim not working

Post by Ondra »

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

User avatar
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

Post by Benj »

Hi Ondra,

That's great glad you got it running, thanks for letting us know what the problem was.

Post Reply