cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO491RE I2C COMMUNICATION WITH TCA9537

ishu
Associate II

I am using nucleo491re MCU  to communicate with tca9537 GPIO-Expander . I want to use GPIO  for on/off  in tca9537 based on i2c . IN tca9537 I have four resister 1. Input(read) address( 0x01) 2.output (read/write) address(0x02) 3.polarity address( 0x03) .4.configuration address(0x04). and slave address (0x49).

For changing all pins to output mode .

HAL_I2C_Mem_Write(&hi2c, (slave address<<1), configuration address , 1,(uint8_t*) 0xF0, 1, I2C_TIMEOUT);

FOR making pins to high state .

HAL_I2C_Mem_Write(&hi2c, (slave address<<1), output , 1,(uint8_t*) 0xFF, 1, I2C_TIMEOUT);

 

I am getting only slave address on SDA LINE and IO pins not showing anything not high and not law

anyone tell me how to use GPIO-Expander pins for on/off purpose.

 

TCA1.PNGTCA2.PNGTCA3.PNG

6 REPLIES 6
Foued_KH
ST Employee

Hello @ishu , 

Could you please share a screenshot from the analyzer?

Foued 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

analysr.PNG

SDA-YELLOW ,SCL-GREEN,PIN P0 =RED

TDK
Guru

> (uint8_t*) 0xF0

This doesn't do what you think it does. Do this instead:

uint8_t data = 0xF0;
HAL_I2C_Mem_Write(&hi2c, (slave address<<1), configuration address, 1, &data, 1, I2C_TIMEOUT);

 

If you feel a post has answered your question, please click "Accept as Solution".
Foued_KH
ST Employee

Hi @ishu ,

Do this instead: 

 

#define slave address 0x49 << 1
uint8_t data = 0xF0;
HAL_I2C_Mem_Write(&hi2c, slave address, configuration address , 1,&data , 1, I2C_TIMEOUT);

 

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Verify the TCA register addresses your using relative to Table 8-2.