Saturday, 8 December 2012

That's odd?

So I've got the UART sending up to 16 bytes (the depth of the FIFO) but about half of the bytes have framing errors. Here's a trace showing the values 0 through 9 being transmitted.

Note the errors, values 1, 2, 4, 7 and 8 have framing errors, meaning that the stop bit was low when of course it should be high.

So here's a pop quiz, what do these values have in common.........don't feel bad if you haven't got it yet, it took me a while. They all have an odd number of bits. The bytes that don't have errors have an even number of bits.

Now if I didn't know better I'd say I have odd parity set on the UART. Let's look at the code.

Now you don't have to know anything about the parameters to the serialCreate() function to spot the reason for the framing errors here eh?

Problem solved.

No comments:

Post a Comment