I2C Speed Problem


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136

    Default I2C Speed Problem

    I am using:

    Pic Basic Pro 2.50 with patch 250b installed and all working OK.

    My MCU chip is a PIC18F8722 and I need to read/write to an I2C EEPROM (24LC32) with a 400KHz clock frequency.

    1. Using DEFINE OSC 10 i.e. run at 10 MHz - all is OK and the EEPROM happily reads and writes.

    2. Using DEFINE OSC 40 ie. run at 40 MHz and programming with HSPLL- lots of garbled data .

    3. Using DEFINE I2C_SLOW does not work either ?

    4. I have PAUSE 10 after all read/writes and I'm only doing one read/write at a time.

    HELP! Any ideas?

    Regards Bill Legge

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358

    Default

    What value pull-up's have you got on the SCL & SDA lines?

    Try dropping them to say 1K.

    BTW... you don't need 10mS pauses after I2CREADs, just I2CWRITEs.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    and make sure your clock is lower than 400KHz & multiplexed stuff disabled as well.

    As usual, without code, config fuse, it's impossible to say the exact solution... have you ever tried to find a needle in a field with your eye closed?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136

    Smile I2C Speed Problem

    Melanie,

    Thanks very much - your advice worked.

    Original pull-up resistors were 10k.
    Changed to 5k and all works OK - without DEFINE I2C_SLOW.

    I sould have taken note of the PBP handbook that advises 4.7k!

    Regards Bill Legge

  5. #5
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271

    Default

    Bill, if speed is an issue, you might also consider reading the eeprom datasheet section on polling the chip. On a recent one I worked on, the spec was something like 5ms write time max, but there was an option to poll to see if it was done. I put that in with a 50uS delay between polls, and it ended up only taking three polls to finish!

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  2. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  3. Another I2C Slave Routine Problem
    By DanPBP in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th February 2009, 05:50
  4. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 19:33
  5. Replies: 14
    Last Post: - 26th September 2007, 05:41

Members who have read this thread : 0

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

Posting Permissions

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