I would like to improve the performance of my push buttons, which sometimes don't respond when pressed. They have external pull-up resistors and have been initialised as floating input pins. Does not using the internal pull-up reduce performance?

Also, the code is using the internal HSI oscillator instead of external crystal. Could this also be affecting performance of the buttons?

[![enter image description here](https://i.stack.imgur.com/VR8mD.png)](https://i.stack.imgur.com/VR8mD.png)

The above image shows the circuit for the push button.
The initialisation is:

GPIO\_Init(PORT\_SWF, But\_Play, GPIO\_Mode\_In\_FL\_No\_IT);

And here is the code for the button being pressed:

```
if (GPIO_ReadInputDataBit(PORT_SWF, But_Play) == 0)
{

delay_test(0xff); //decrements from 0xff to 0 for delay

if (Key_Button.Pn == 1)
 { Mode = P1_Run; USART_Send("P1->Play\r\n", 13); }
...
}

```

The code goes through all the possible buttons that can be pressed (14 in total).

The buttons are being polled every 200ms:

```
void TIM2_ISR(void)// interrupt every 200ms
{
  Program_Run = Read_Button();
}

```

Should this period be shorter? Timer 2 clock is at 8MHz

I should say the performance is usually really good, most of the time the response is as expected, but not always, so the problem isn't that the buttons are broken or have stopped working. I would like to make it always responsive, naturally.

Finally, we don't appear to have any problems with buttons coming on inadvertently. They require firm user action.

Thanks in advance for any help!