Skip to content

Commit e023bb6

Browse files
author
Cruz Monrreal
authored
Merge pull request #6771 from marcuschangarm/fix-uart-init
Fix UART initialization for NRF52
2 parents 2ddce27 + a1a3296 commit e023bb6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/serial_api.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,24 +1046,22 @@ void serial_init(serial_t *obj, PinName tx, PinName rx)
10461046
uart_object->rx = rx;
10471047
}
10481048

1049-
/* Set default parity and baud rate. */
1049+
/* Set default parity, baud rate, and callback handler. */
10501050
uart_object->parity = NRF_UART_PARITY_EXCLUDED;
10511051
uart_object->baudrate = NRF_UART_BAUDRATE_9600;
10521052
uart_object->cts = NRF_UART_PSEL_DISCONNECTED;
10531053
uart_object->rts = NRF_UART_PSEL_DISCONNECTED;
10541054
uart_object->hwfc = NRF_UART_HWFC_DISABLED;
1055+
uart_object->handler = 0;
10551056

10561057
/* The STDIO object is stored in this file. Set the flag once initialized. */
10571058
if (obj == &stdio_uart) {
10581059
stdio_uart_inited = 1;
10591060
}
10601061

1061-
/* Initializing the serial object does not make it the owner of an instance.
1062-
* Only when the serial object is being used will the object take ownership
1063-
* over the instance.
1064-
*/
1062+
/* Take ownership and configure UART. */
10651063
uart_object->update = true;
1066-
uart_object->handler = 0;
1064+
nordic_nrf5_serial_configure(obj);
10671065
}
10681066

10691067
/** Release the serial peripheral, not currently invoked. It requires further

0 commit comments

Comments
 (0)