Skip to content

Commit a8616dc

Browse files
committed
Merge pull request #1474 from c1728p9/uart_null_byte
Remove byte sent at 9600 baud on init on NRF51-DK
2 parents 48fa293 + 0a6e345 commit a8616dc

File tree

1 file changed

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

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ static const int acceptedSpeeds[17][2] = {
3939
{28800, UART_BAUDRATE_BAUDRATE_Baud28800},
4040
{31250, (0x00800000UL) /* 31250 baud */},
4141
{38400, UART_BAUDRATE_BAUDRATE_Baud38400},
42+
{56000, (0x00E51000UL) /* 56000 baud */},
4243
{57600, UART_BAUDRATE_BAUDRATE_Baud57600},
4344
{76800, UART_BAUDRATE_BAUDRATE_Baud76800},
4445
{115200, UART_BAUDRATE_BAUDRATE_Baud115200},
@@ -77,7 +78,10 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
7778
obj->uart->EVENTS_RXDRDY = 0;
7879
// dummy write needed or TXDRDY trails write rather than leads write.
7980
// pins are disconnected so nothing is physically transmitted on the wire
81+
obj->uart->PSELTXD = 0xFFFFFFFF;
82+
obj->uart->EVENTS_TXDRDY = 0;
8083
obj->uart->TXD = 0;
84+
while (obj->uart->EVENTS_TXDRDY != 1);
8185

8286
obj->index = 0;
8387

0 commit comments

Comments
 (0)