2023-09-25 02:21 AM
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.
2023-09-25 03:17 AM
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.
2023-09-25 04:36 AM
SDA-YELLOW ,SCL-GREEN,PIN P0 =RED
2023-09-25 04:53 AM - edited 2023-09-25 05:41 AM
2023-09-25 06:20 AM
> (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);
2023-09-25 06:32 AM - edited 2023-09-25 06:33 AM
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.
2023-09-25 06:41 AM
Verify the TCA register addresses your using relative to Table 8-2.