I am reading about the standard protocol for UART and I think that if the receiving UART does not have any idea on what baud rate the data was transmitted, there would be lots of problems. If the assumed baud rate is lower than the baud rate in which the data is transmitted, there will be bits that would not be 'seen' by the receiving UART. On the other hand if the baud rate used by the receiver is higher than than the baud rate in which the data is transmitted, there will be bits that will be counted twice and would result the data being 'read' incorrectly.
My knowledge around UART is that when the line is idle, it is kept to a '1', the Start bit is a '0' and the Stop bit is a '1'. Also, the Stop bit being '1' does not have any difference with the '1' when the line is idle or is there a way to differentiate?
Do two communicating UART's first agree on which baud rate they will use? If yes, how do they do it?