I am trying to understand how the sender and receiver react to each other in UART communication.
As I understand it, when we send data through UART, we follow a frame format. The first bit is the start bit, which is used to indicate the beginning of communication. After that come the data bits, whose number depends on the configured frame format. Next is the parity bit (optional), which can be used to detect a single-bit error, followed by the stop bit.
I believe that the UART line remains high when it is idle. When the sender wants to transmit data, it pulls the line low, creating the start bit. The receiver detects this transition and understands that communication has started.
What I do not fully understand is the timing relationship between the sender and receiver. For example, if the baud rate is 9600, how do the transmitter and receiver stay synchronized? How does the receiver know when to sample each data bit after detecting the start bit?
At what exact time does the sender pull the line low, and at what time does the receiver sample or read the line? There must be some timing period that both sides follow.