Interface the TCA9535 with LPC55S16 Microcontroller

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

Interface the TCA9535 with LPC55S16 Microcontroller

2,123 Views
VIGNESH_BABU
Contributor II

Hi,

I was using TCA9535(I/O Expander) interface with LPC55S16 microcontroller. We use the I2C communication to communicate with I/O Expander. Set the I2C with given device address,register address and 16 bit data passes through TCA9535.But the I/O Expander can't response with given configuration.

0 Kudos
Reply
5 Replies

2,037 Views
frank_m
Senior Contributor III

Use a logic analyzer or scope, and check if the slave responds with an ACK to the address.

0 Kudos
Reply

2,078 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I have searched on Google, the TCA9535 is TI product, this is the website of TCA9535:

https://www.ti.com/lit/ds/symlink/tca9535.pdf?ts=1684719588873&ref_url=https%253A%252F%252Fwww.ti.co...

 

The I2C of LPC55S16 is the master, the I2C of the TCA9535 is slave.

The 7 bits I2C slave address is dependent on the A0/A1/A2 pins connection, if the A0/A1/A2 pin are all connected to GND, the I2C address will be 0x20.

If you want to set/clear the Port logic of TCA9535, you have to set the corresponding bit as 0 in configuration register, then write the port logic.

This is the sequence of writing configuration reg:

I2C slave address + configuration register address + configuration register data

 

In SDK example, there is I2C example.

xiangjun_rong_0-1684722413108.png

 

#define #I2C_MASTER_SLAVE_ADDR_7BI 0x20

#define #I2C_DATA_LENGT 1

deviceAddress=0x06; //configuration reg

g_master_txBuff[0]=0;

/* subAddress = 0x01, data = g_master_txBuff - write to slave.
start + slaveaddress(w) + subAddress + length of data buffer + data buffer + stop*/
uint8_t deviceAddress = 0x01U;
masterXfer.slaveAddress = I2C_MASTER_SLAVE_ADDR_7BIT;
masterXfer.direction = kI2C_Write;
masterXfer.subaddress = (uint32_t)deviceAddress;
masterXfer.subaddressSize = 1;
masterXfer.data = g_master_txBuff;
masterXfer.dataSize = I2C_DATA_LENGTH;
masterXfer.flags = kI2C_TransferDefaultFlag;

Hope it can help you

BR

XiangJun Rong

0 Kudos
Reply

2,050 Views
VIGNESH_BABU
Contributor II

Thank you for the Code flow Mr.@xiangjun_rong

 

0 Kudos
Reply

2,060 Views
VIGNESH_BABU
Contributor II

Hi @xiangjun_rong ,

What if we try in the I2C polling method?.Because I was actually try in the I2C polling method.Where I was got only slave address but not got a register address and the data.

0 Kudos
Reply

2,020 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

If you use the polling mode, you have to write register and develop the code yourself.

BR

XiangJun Rong

0 Kudos
Reply