We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
If we set different baud rates in an master-slave system,can the system work correctly?!thank you!
Addendum - the slave is not an oscilloscope that runs at an extremely high sampling rate to sample a nice-looking curve.
The normal design is that the receiver runs at 16 times the baudrate. It then takes 3 samples in the middle of each bit window and does a majority vote to decide if it's a one or a zero. If the baudrate is slightly off, this sampling window will drift so the receiver may sample during the transition between two bits. Or it may perform two sets of reads while the transmitter is still on the same bit, in case the receiver has too low baudrate.
Remember that the data transmitted may not toggle the data on every bit windw - you may have one start bit followed by four data bits of same polarity as the start bit. Then four data bits with the same polarity as the stop bit(s). If you didn't know the baudrate but just looked at the scope image - exactly what would you think about that square wave? How would a receiver compensate to make sense of it?
The baudrate is a "common secret" that the transmitter and receiver must agree on to get the communicatin working. It is possible to transmit test patterns and have the receiver autodetect. But you will have to write code for the autodetect unless you have a processor with hw autodetect. And you do need the test pattern - if you autodetect on live data, then one or more bytes will have been lost before the autodetect is done.
A modem can autodetect on the "AT" characters.
How will slaves autodetect when you have one master and multiple slaves and different slaves have different baudrate? Whenever you switch to talk to another slave, the baudrate may change - so the slave must either hope that the master returns later with the same baudrate, or it will have to retrain continuously - remember that the slave must be able to pick up protocol data to figure out the message address so it knows if it should care about the message or not.
Now, exactly why are you pushing this concept, in the first place?