PCA 8574 I/O expander

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PCA 8574 I/O expander

1,298 Views
deekshith_kv
Contributor I

#

I am using PCA 8574 I/O expander along with linkit 7688 module. I have both input and output ports in this I/O expander(P0 to P3 as input, P4 as output).

How can I configure this using mraa library?

How can I write value to this output port only?

Also I need to configure interrupt for these inputs using I2C interrupt which is connected to Linkit 7688.

please help.

0 Kudos
Reply
3 Replies

1,223 Views
deekshith_kv
Contributor I

Thank you.

Input and output works for me. I have installed interrupt for this I/O expander for both edge (P0 to P3 as input and output P4). I change this output port in every 100ms to control an LED(writing data - 0x0F and 0x1F). 

When I change the input port to LOW (externally via switch and keep it as LOW for 10 sec), the interrupt service routine is invoked. In between, the output port will be changing every 100ms. But the issue is, in this 10 sec interval, ISR is invoked for every data write to this LED(here also I am writing the data 0x0F and 0x1F to toggle the LED). 

Regards,

Deekshith K V

0 Kudos
Reply

1,223 Views
lisettelozano
NXP Employee
NXP Employee

Hello Deekshith K V,

An interrupt is generated at any rising or falling edge of the port inputs. After time tv(Q) (max. 4us as shown in table 10), the signal INT is valid. The interrupt will reset to HIGH when data on the port is changed to the original setting or data is read or written by the master. For more details please check section 8.5.

Have a great day,

Paulina

0 Kudos
Reply

1,223 Views
lisettelozano
NXP Employee
NXP Employee

Hello Deekshith K V,

This quasi-bidirectional I/O can be used as an input or output without the use of a control signal for data directions. All ports programmed as input should be set to logic 1. At power-on the I/Os are HIGH.

Output data is transmitted to the ports in the Write mode. To write, the master sends the START condition and the slave address setting the last bit of the address byte to logic 0. 

Input data is transferred from the ports to the microcontroller in the Read mode. To read, the master (microcontroller) addresses the slave device and sets the last bit of the address byte to logic 1 (address byte read). During the Read mode, it is important to meet the setup and hold times so the master can read and avoid losing data. For more details, please refer the datasheet section 8.3.

In section 10, you can see a bidirectional application and sample code for setting the GPIOs as input and outputs.

Regarding the interruption, you can check the functionality in section 8.5. We do not know the functionality of the Linkit 7688 that you are using, therefore we cannot provide further details.

Have a great day,

Paulina



-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply