74HC14 for debouncing: output is too low with Vcc=3.3V
So here's the solution (which looks more like "How-To" for other electronics newbies like me):


Program your IO expander (PCF8574AT in my case) to have all the pins that used for buttons/encoders as INPUTS by writing logic 1's to them:

uint8_t* buffer;
buffer = malloc(1 * sizeof(uint8_t));
*(buffer + 0) = 0b11111111; // all pins are INPUTS
HAL_I2C_Master_Transmit(&amp;hi2c1, 0x38 &lt;&lt; 1, buffer, 1, 200);


where hi2c1 is your I2C port for PCF8574, 0x38 is a PCF's address (pay attention that it must be shifted 1 bit left — see the "&lt;&lt; 1") and buffer is a pointer to data that we want to send to PCF8574. If pins are not set up then you may experience the strange voltage dropdowns on Schmitt trigger outputs down to 0.87-0.90V and PCF will not react to these signals at all (sorry for not describing the phisics of this process here as I still don't understand this yet...);
Reset the interrupt pin by simply reading the data from PCF8574. This operation must be done after the every interrupt that your STM32 responds to:

*(buffer + 0) = 0;
HAL_I2C_Master_Receive(&amp;hi2c1, 0x38 &lt;&lt; 1, buffer, 1, 200);



(Sorry for my bad C and my English and correct me if/where I'm wrong...)



Oh, and here's full keypad schematic for those who want to use this in their projects: