Skip to content

Commit 8d12e20

Browse files
committed
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.
1 parent 48fa293 commit 8d12e20

File tree

1 file changed

+3
-0
lines changed
  • libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822

1 file changed

+3
-0
lines changed

libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/serial_api.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
7777
obj->uart->EVENTS_RXDRDY = 0;
7878
// dummy write needed or TXDRDY trails write rather than leads write.
7979
// pins are disconnected so nothing is physically transmitted on the wire
80+
obj->uart->PSELTXD = 0xFFFFFFFF;
81+
obj->uart->EVENTS_TXDRDY = 0;
8082
obj->uart->TXD = 0;
83+
while (obj->uart->EVENTS_TXDRDY != 1);
8184

8285
obj->index = 0;
8386

0 commit comments

Comments
 (0)