This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PCA9539 always puts out 0xFF while reading.

Other Parts Discussed in Thread: PCA9539

Hi All,

 I am new to TI forums. I need some support from you people.

  I am using PCA9539 IO Expander and configuring through two GPIO lines from PIC32 microcontroller . The I2C protocol is implemented through bit banging.

I am not reading the actual logic levels available  on the pins. I am trying to read the input port register 0 and 1 , but always 0xFF is put out .

Can anyone let me know with snapshot of working drivers (in C without Linux or OS API please......since I have not ported my application on Linux)

for reading and writing to this chip. The device Address I use  is 0xE8 while writing and 0xE9 while reading. The A0 and A1 lines are at logic 0.

All the other H/W connections are taken care as per the datasheets.

Looking forward to hear from anyone who have a working C code without OS.

thanks

BLTR

  • Hello BLTR,
    I'll be happy to help you figure out the issue.

    You mention that you've implemented a software I2C protocol.

    Can you supply any scope shots of the I2C transaction?

    To verify, can you explain what your exact procedure is when you read the registers (the register/address/commands sent to the device).

    Do you have any thing connected to the ports that would pull them low?
  • Hello Jonathan Valdez,

    Thanks for your response.

     The details are:

    1. I am not in a position to send you snaps of the scope since they are Analog CRO.

     2.  The procedure I follow  to read are

         1. Send Start condition

        2. Send Device Addres 0xE8 (0x74 with last bit as 0 for writing and hence it is 0xE8) and read ACK.

       3. Send Command Byte of 0x00 and read Ack then send Stop condition.

      4. Again Start condition

     5. send  Device Address 0xE9 (0x74 with last bit as 1for reading and hence it is 0xE9) and read ACK

    6. Now I call the Read function and store the Byte given out by the device in a variable . This variable is 0xFF.(after every byte read, ACK is sent except for last byte read)

    7. Out of Two ports P0 and P1, one is  connected to some testpoints which are open without pullups and pull downs and the other to input pins of Buffer 244.

    Unfortunately both the ports read 0xFF.

    By the way you had asked "any thing connected to the ports that would pull them low?" May I know why this point was asked?

    If it is pulled low will it read 0xFF ?

    I hope I have provided the details you had asked.

    Thanks again

    BLTR

     

  • Thank you BLTR,

    1) Since you are unable to provide a scope shot, I ask that you verify that start and stop conditions as well as the acknowledges are being sent properly.

    2) In regards to the procedure you use to communicate, everything you are doing looks correct. For step 5 in your procedure) On the scope, do you find that you are actually receiving the ACK as expected from the slave? Can you also check to make sure that the slave is sending 0xFF?

    3) You mention that you have ports connected to test points that are open without pullups or pull downs. Please note that the PCA9539 does not have any internal pull up or pull down resistors, if you are using a port as an input, and the source is open, the state of the port will be unknown due to floating inputs.

    For your other port which is connected to the input pin of a buffer, do you mean to say the output pin of a buffer? Can you measure the voltage of this pin to see what voltage you are getting?

    4) The reason I asked if there is anything pulling it low, is that if you have your polarity register set (registers 0x04 and 0x05), then a low port would set a 1 for the input port register, but I do not believe this is issue, as you are powering the device up, and by default, this is not enabled.