What kind of microcontroller peripherals can help me to implement a timeout?
This microcontroller in particular has a compare/capture module.
This allows you to determine the duration of a given signal from the rising and falling edges.