2020-01-17 08:15 AM
I am not using the touchscreen interface, just using the SMPTE811 device as a GPIO expander. I am talking to it over I2C using the STM32F217IGH6. In fact it's wired together exactly the same as the STM3220g-eval board.
I have two STMPE811 chips on my board. One connected to 8 LEDs and one connected to 8 switches. I am able to toggle the LEDs using the switches in an infinite loop. However I would prefer to only update the state of the LEDs when a switch has been pressed using the INT pin connected to pin PI2 on the STM32F217IGH6, but the INT is always high with the Pullup and never de-asserted.
The STMPE811 for the switches is initialised as below:
static void STMPE811_SW_Init(void)
{
//Issue Software Reset
buffer[0] = SYS_CTRL1;
buffer[1] = SOFT_RESET;
HAL_I2C_Master_Transmit(&hi2c1, STMPE811_SW_ADDRESS, buffer, 2, 100);
HAL_Delay(10);
//Enable GPIO
buffer[0] = SYS_CTRL2;
buffer[1] = TS_OFF|GPIO_ON|TSC_OFF|ADC_OFF;
HAL_I2C_Master_Transmit(&hi2c1, STMPE811_SW_ADDRESS, buffer, 2, 100);
HAL_Delay(10);
//Set GPIO to INPUT
buffer[0] = GPIO_DIR;
buffer[1] = 0x00;
HAL_I2C_Master_Transmit(&hi2c1, STMPE811_SW_ADDRESS, buffer, 2, 100);
HAL_Delay(10);
//Set GPIO MODE
buffer[0] = 0x17;
buffer[1] = GPIO7|GPIO6|GPIO5|GPIO4|GPIO3|GPIO2|GPIO1|GPIO0;
HAL_I2C_Master_Transmit(&hi2c1, STMPE811_SW_ADDRESS, buffer, 2, 100);
HAL_Delay(10);
//INT_CTRL - Interrupt Control Register
buffer[0] = 0x09;
buffer[1] = 0x01;
HAL_I2C_Master_Transmit(&hi2c1, STMPE811_SW_ADDRESS, buffer, 2, 100);
HAL_Delay(10);
//INT_EN - Interrupt Enable Register
buffer[0] = 0x0A;
buffer[1] = 0x80;
HAL_I2C_Master_Transmit(&hi2c1, STMPE811_SW_ADDRESS, buffer, 2, 100);
HAL_Delay(10);
//INT_STA - Interrupt Status Register
buffer[0] = 0x0B;
buffer[1] = 0xFF;
HAL_I2C_Master_Transmit(&hi2c1, STMPE811_SW_ADDRESS, buffer, 2, 100);
HAL_Delay(10);
//GPIO_INT_EN - GPIO Interrupt Enable Register
buffer[0] = 0x0C;
buffer[1] = 0xFF;
HAL_I2C_Master_Transmit(&hi2c1, STMPE811_SW_ADDRESS, buffer, 2, 100);
HAL_Delay(10);
//GPIO_INT_EN - GPIO Interrupt Status Register
buffer[0] = 0x0D;
buffer[1] = 0xFF;
HAL_I2C_Master_Transmit(&hi2c1, STMPE811_SW_ADDRESS, buffer, 2, 100);
HAL_Delay(10);
}
I also read back the state of INT_STA and GPIO_INT_STA registers and they are always 0.
Any help would be gratefully appreciated.