Problem reading 24FC1025 EEPROM with 18f14k22


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170


    Did you find this post helpful? Yes | No

    Default Re: Problem reading 24FC1025 EEPROM with 18f14k22

    (Can't believe I have the PBP manual on my phone. lol )

    You don't mention the osc speed. The manual mentions up to 20MHz, the 18Fs can go much faster.

    Odd that your clock is whacked. What about pull-ups on your pins?

    Robert

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Problem reading 24FC1025 EEPROM with 18f14k22

    I bet it's that there are no pullup resistors on the SCL and SDA lines when using I2C command. The SHIFTOUT and SHIFTIN command use the pins in a sink and source mode but the I2C mode reverses the the data pin direction at the end of the byte sequence looking for the ACK bit from the slave device. There must be a pullup on the data line to provide sourcing current back to the PIC. If the PIC does not see the proper ACK signal then the command sequence is aborted.
    Dave Purola,
    N8NTA
    EN82fn

  3. #3
    Join Date
    Feb 2012
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Problem reading 24FC1025 EEPROM with 18f14k22

    I am running at 16MHz with the Internal OSC. I do have a 10k pullup on the SDA line. I tried a 2k as well and it did the same thing. I don't have any pullups on the SCL line now, but I did try that before with no luck. I will try it again. I may drop a 16f690 in for testing purposes (Pin compatable with the 18f14k22 and I know they work with this EEPROM).


    Quote Originally Posted by Dave View Post
    I bet it's that there are no pullup resistors on the SCL and SDA lines when using I2C command. The SHIFTOUT and SHIFTIN command use the pins in a sink and source mode but the I2C mode reverses the the data pin direction at the end of the byte sequence looking for the ACK bit from the slave device. There must be a pullup on the data line to provide sourcing current back to the PIC. If the PIC does not see the proper ACK signal then the command sequence is aborted.

  4. #4
    Join Date
    Feb 2012
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Problem reading 24FC1025 EEPROM with 18f14k22

    Dave & DEMON,
    Problem solved! I added the 10k pull-up resistor to the SCL line as you suggested and everything started working. I did have a 10k on both the SCL and SDA lines originally, but at that time I must have had something else wrong. I checked the datasheet which only stated pullup of 2k-10k on the SDA line so I removed the SCL pull-up and never put it back. I was able to fully load the EEPROM and now I can read an entire string from EEPROM at a time (Much better than the ShiftIn/Out way). I guess since the Shiftin/out was working I assumed the electronics was correct. I have used these EEPROMS in the past and never had an issue. I guess I should have looked at my old schematics before pointing the finger at Pic Basic!

    Thank you all for the help!

    Jim

    Quote Originally Posted by JimAvanti View Post
    I am running at 16MHz with the Internal OSC. I do have a 10k pullup on the SDA line. I tried a 2k as well and it did the same thing. I don't have any pullups on the SCL line now, but I did try that before with no luck. I will try it again. I may drop a 16f690 in for testing purposes (Pin compatable with the 18f14k22 and I know they work with this EEPROM).

  5. #5
    Join Date
    Feb 2012
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Problem reading 24FC1025 EEPROM with 18f14k22

    I am running the Internal OSC at 16MHz. I did try slowing the clock down and it still didn't work. I am not sure if the Clock is whacked or if my Logic Analyzer is just too slow to capture it (500kHz is as fast as it will run on my computer for some reason).

    I am still leaning toward a bug in Picbasic Pro 2.60C (Not because it isn't working at all, but because the value being returned is directly related to to the binary value of the pin it is connected to). If I connect to pin ra.0 I get a return value of 1, ra.1 returns a value of 2, ra.2 = 4... This shouldn't be happening unless I either made some strange mistake with variable ussage, or if there is an internal bug in the compiler. I saw a similar wierd sort of incremental value on the 18f46k22 while reading ADC lines and it turnned out to be a bug in the complier (which got fixed with 2.60c).

    One other thing to note is that the EEPROM address on the Shiftin uses two byte variables while the I2Cread/write uses one 16-bit word variable for the address.

    Jim


    Quote Originally Posted by Demon View Post
    (Can't believe I have the PBP manual on my phone. lol )

    You don't mention the osc speed. The manual mentions up to 20MHz, the 18Fs can go much faster.

    Odd that your clock is whacked. What about pull-ups on your pins?

    Robert

  6. #6
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Problem reading 24FC1025 EEPROM with 18f14k22

    This routine has worked for me just fine since PBP2.32 w/4 each 24LC1025's. Just exchange the I2CWRITE for I2CREAD and your done....

    CNTRL_BYTE CON $A0 'CONTROL BYTE FOR I2C EEPROM MEMORY (A0/A1 USED FOR CHIP SELECT)

    BLOCK VAR WORD '128 BYTE BLOCK ADDRESS
    ADDRESS VAR WORD 'ADDRESS WORD FOR SERIAL EEPROM
    CNTROL_BYTE VAR BYTE 'CONTROL BYTE TO SEND TO SERIAL EEPROM
    EEDEVICE VAR BYTE 'PHYSICAL DEVICE ADDRESS
    STOR_DATA VAR BYTE[128]'STORAGE DATA ARRAY

    EEDEVICE = BLOCK / 512 'SELECT WHICH PHYSICAL ADDRESS BOUNDRY & EEPROM
    ADDRESS = BLOCK << 7 'CALCULATE 12C ADDRESS TO STORE DATA TO
    CNTROL_BYTE = CNTRL_BYTE 'COPY CONTROL BYTE
    CNTROL_BYTE.1 = EEDEVICE.1 'SET LSB OF HARDWARE ADDRESS
    CNTROL_BYTE.2 = EEDEVICE.2 'SET MSB OF HARDWARE ADDRESS
    CNTROL_BYTE.3 = EEDEVICE.0 'SET 64K BLOCK BIT
    I2CWRITE SDA,SCL,CNTROL_BYTE,ADDRESS,[STR STOR_DATA\128] 'SAVE DATA TO 12C
    PAUSE 6 'ALLOW TIME FOR I2C WRITE ~5Ms.

    Also a MAXIMUM resistance on each SCL and SDA lines to VCC of 2.2k. The faster the bus speed the smaller the resistance.

    Dave Purola,
    Dave Purola,
    N8NTA
    EN82fn

Similar Threads

  1. 18F14k22 eTouch
    By warrier in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 28th July 2009, 05:20
  2. Problem reading 93c46 EEprom
    By dj.lambert in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 27th March 2009, 06:10
  3. Reading eeprom
    By Lotondo in forum Off Topic
    Replies: 1
    Last Post: - 21st February 2007, 17:37
  4. problem of reading eeprom 24lc515
    By mike12 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 1st January 2006, 17:36
  5. Writing / Reading EEPROM 24LC256 Problem
    By schmoddel in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th February 2004, 18:55

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts