Announcement

Collapse
No announcement yet.

I2C Diagram in Manual- Clarification

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I2C Diagram in Manual- Clarification

    My current venture is to write 24-character strings to a MicroChip 24LC65 EEPROM using a PIC 16F628A as the processor. The strings will arrive via serial port from a PC application. In doing so I have decided to start at square one even though 5 years ago I started a project to do this.

    Yesterday on square one I took the sample program "i2c_pbp" from your web site to make sure I can replicate even the most simple operations. I modified it to make it run on the 16F628A with an 8Mhz clock and configured it for MCLR on and comparators off, OSC = 8, etc. the usual setup to get the 628A to behave. I also set up HSEROUT for 9600 to send output to my PC terminal application.

    I didn't get correct results so in my usual mode of operating I will attempt to be sure the hardware is correct first. I did get readable characters in my terminal window but the #B1 & #B2 values are equal to "0" each loop.

    So my question is this:

    My PBP manual in the I2CREAD chapter shows a connection diagram it shows 4.7k pullups on both SDA and SCL, however the MicroChip product datasheet section 8 "Pin Descriptions" mentions the pullup only on the SDA pin but makes no mention of a pullup on the SCL pin.

    I would just like to know if there is some new information I should know about this hardware design condition. On the board I etched, I left pads for the pullup but in '09 when I populated the board, I did not put the pullup on SCL. I sort of remember that some of my code back then actually worked to some extent.

  • #2
    I2C is a multi-master specification.
    Which means that any device on the bus can be the master, and talk to any slaves on the bus.
    In order to do that, no master can "Drive" the clock line in bi-polar mode, because that would keep other devices from using the clock line.

    Therefore both lines have pull-ups, and only open-drain outputs are used.

    However, if it is known that only one master will ever control the bus ... the clock line can be driven in bi-polar mode, which saves 1 resistor from the circuit.

    In PBP, you set bi-polar clock mode with ...
    Code:
    DEFINE I2C_SCLOUT 1
    PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
    Never download a PIC datasheet from anywhere but microchip.com

    Comment


    • #3
      Thanks Darrel,

      With the PIC as the master in this case, and only one pull-up on the board. It looks like the best practice is to use the DEFINE you recommended.

      Thanks also for the greater enlightenment on the clock behavior with multiple devices on the bus.

      A.

      Comment

      Working...
      X