[sdiy] Serial Ports

Jason Tribbeck jason.tribbeck at argogroup.com
Thu Sep 23 10:36:23 CEST 2004


Hi,

> So I'm reinventing the wheel on something, writing my own bit banging
> routines for the fun of it.  And now I'm curious, I mean  start
> bit/data/stop bit is fine and all, but what happens if you
> come in in the
> middle of a conversation?  How do you sync, or do you not?
> Or do you just
> hope you have a moment of silence longer then 10 bits so you
> can go "Hey,
> I'm between bytes!" ?

It depends on the exact sequence of bytes that are being transmitted.

You could end up with the very first byte not being framed correctly, and
then it starts working on the next byte. Or, you could end up in the middle
of the middle of a conversation that on the surface looks good, but it'll
end up being gibberish in the end. With random data (and especially with
pauses or a break), you should eventually get back to the right place -
however, if you were sending repeated 0x19, then you could end up with
repeated 0x38 instead (frame is 1000110011, which if you started in the
centre would be 1001110001). Note that I think data is actually transmitted
inverted - but the effect is the same.

You'd get a legitimate byte if you had a start and a stop bit with 8 bits in
between. UARTs generally will indicate a framing error if the stop bit isn't
correct, but you may get the bits in between. It'll then wait for the next
start bit before capturing it again.

If you were really adventurous, you could write out a sequence of
start/data/stop bits, and work out what will happen if you start at any
point in time.

The really clever stuff is when you also need to autobaud as well. The bit
sequence for "AT" was apparently designed so that it's easier to work out
what baud rate is in use.
--
Jason Tribbeck




More information about the Synth-diy mailing list