The people at <ahref="https://www.pjrc.com/teensy/index.html"title="https://www.pjrc.com/teensy/index.html"target="_blank">https://www.pjrc.com/teensy/index.html</a> did a really good job with the Arduino integration <ahref="https://www.pjrc.com/teensy/teensyduino.html"title="https://www.pjrc.com/teensy/teensyduino.html"target="_blank">Teensyduino</a>. Thank you very much indeed.
Unfortunately they missed a feature which has been integrated in the Arduino library sometimes between version 1.0.5 and 1.5.2, don'`t know when exactly: advanced UART configuration.
In the documentation of <ahref="http://arduino.cc/en/Serial/Begin"target="_blank"><code>Serial.begin(...)</code></a> you see the option to give a <code>config</code> argument, where in particular you can configure the frame length, the parity and the number of stop bits.
While this is certainly not a very common feature, I need it in my MeterBus projects, since communication on the MeterBus is serial communication with an even parity enabled.
So far I was too lazy to put the stuff into a library, but this is required to enable even parity:
<pre>
#include <mk20dx128.h>
// [...]
// this is the new Arduino way of setting parity
//Serial3.begin(2400, SERIAL_8E1);
// this is the Teensy (Freescale K20) way:
Serial3.begin(2400);
UART2_C1 |= UART_C1_PE | UART_C1_M;
</pre>
Find the documentation for the <code>UARTx_C1</code> register on page pp. 1055-1056, cp. 45.3.3 of the Freescale K20 manual (find that one on the Teensy homepage at <ahref="https://www.pjrc.com/teensy/datasheets.html"target="_blank">https://www.pjrc.com/teensy/datasheets.html</a>).
Note: it is not enough to enable parity (setting the bit <code>UART_C1_PE</code>, you also need to increase the frame length to 9 bit by setting bit <code>UART_C1_M</code>, since the frame length seems to include the parity bit.
Right, this is a hack, and maybe the Teensy people will integrate it into the library the other day, but at least for the moment it works for me.