0

i have been working on a code where both 24lc512 and pcf8563 are interfaced together. Here in the breakup board of pcf8563 there are two 1K pull-up resistor on SDA and SCL line so am planning on using the same resistors for eeprom.
I had a code for eeprom which worked perfectly before with 4.7K pull up resistor, so i for making the code work for 1K pull-up resistor i made the following changes.(Coding was done for PIC16f877a with XC8 compiler)

SSPSTAT=0x80  
SSPADD=(_XTAL_FREQ/(4*c))-1 //where c is 400,000  

But sadly the code is not working as expected.Could someone please lend me help by saying what all changes should i bring in the earlier code so that it can work with 1K pull-up resistor.

Thanks in advance :)

lalithkumar
  • 3,480
  • 4
  • 24
  • 40
Sreez..
  • 3
  • 5

1 Answers1

1

The datasheet says R = tr/Cb where tr is rise time (maximum specified at 1us) Cb is capacitive load for each bus line with specified max. of 400 pF.

1x10^6 / 400x10^12 = 2500, so 2.7K would be the best choice if you're close to the maximum capacitance.

1K ohm sounds a bit low though, I'd try to unsolder the resistors and use 2.7 to 4.7k ohm instead. Only one set is needed if the bus lines are kept short.

Use an oscilloscope to check the signal shape. If the traces aren't nice and square then you need to adjust the resistors or shorten the bus wires. If the rise time is longer than 1us it may have problems too.

It would make much more sense to use a much lower bus speed, capacitance won't be much of a big deal. For a calender and a small eeprom 100K or even lower is plenty fast enough in most circumstances.

imqqmi
  • 423
  • 2
  • 9
  • Thanks @imqqmi Could you tell me how to calculate the capacitive load(Cb) and tr. Is it better to keep tr and Cb as 1us and 400pF whenever going through these calculations? – Sreez.. May 19 '17 at 09:02
  • tr depends on the particular mcu you're using, and the capacitance of the entire trace or wires that's connected. You can measure it using an oscilloscope. Whenever the PIC sends data, a square wave is visible. The rise time can be read from the scope display. The capacitance can be derived from rise time as well and a series resistor. To get a ballpark figure, you can use the max. values from the datasheet and use that as a baseline. – imqqmi May 19 '17 at 11:38