Remove byte sent at 9600 baud on init on NRF51-DK

Disconnect the TX line before sending a dummy byte, and wait until the
dummy byte is completely sent before continuing.   This prevents
the byte from getting sent on init or re-init of the uart.
pull/1474/head
Russ Butler 2015-12-14 16:09:22 -06:00
parent 48fa2930e5
commit 8d12e206f6
1 changed files with 3 additions and 0 deletions

View File

@ -77,7 +77,10 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
obj->uart->EVENTS_RXDRDY = 0;
// dummy write needed or TXDRDY trails write rather than leads write.
// pins are disconnected so nothing is physically transmitted on the wire
obj->uart->PSELTXD = 0xFFFFFFFF;
obj->uart->EVENTS_TXDRDY = 0;
obj->uart->TXD = 0;
while (obj->uart->EVENTS_TXDRDY != 1);
obj->index = 0;