nrf_libuarte_async_init arguments

I'm trying to initialize the UART on an nRF52 to use libuarte. From the nrf_libuarte_async_init example, they have:

nrf_libuarte_async_config_t nrf_libuarte_async_config = {
.tx_pin = TX_PIN_NUMBER,
.rx_pin = RX_PIN_NUMBER,
.baudrate = NRF_UARTE_BAUDRATE_115200,
.parity = NRF_UARTE_PARITY_EXCLUDED,
.hwfc = NRF_UARTE_HWFC_DISABLED,
.timeout_us = 100,
.int_prio = APP_IRQ_PRIORITY_LOW
};

Where is the stop-bit setting for the UART here? The hardware supports none, one, or two stop bits. Is it being set to some default in the lower levels of the library? If so, what is the setting?

Also note that the hardware supports 3 parity settings - none, even, and odd. Why does the library support only two? And is the "included" mode even parity?

Parents
  • Hi,

    Where is the stop-bit setting for the UART here? The hardware supports none, one, or two stop bits. Is it being set to some default in the lower levels of the library? If so, what is the setting?

    The nRF52832 only supports one stop bit, and it can't be disabled/set to zero stop bits. The other nRF52xxx variants also supports 2 stop bits, but it does not look like this is supported by the libUARTE library. You can try to configure it manually after initializing libUARTE, if you use one of the chip variants that supports 2 stop bits, but it may not work correctly with the library. E.g if using UARTE0:

    NRF_UARTE0->CONFIG |= (UARTE_CONFIG_STOP_Two << UARTE_CONFIG_STOP_Pos) & UARTE_CONFIG_STOP_Msk;

    Also note that the hardware supports 3 parity settings - none, even, and odd. Why does the library support only two? And is the "included" mode even parity?

    The nRF52 series UART(E) hardware only supports even parity.

    Best regards,
    Jørgen

Reply
  • Hi,

    Where is the stop-bit setting for the UART here? The hardware supports none, one, or two stop bits. Is it being set to some default in the lower levels of the library? If so, what is the setting?

    The nRF52832 only supports one stop bit, and it can't be disabled/set to zero stop bits. The other nRF52xxx variants also supports 2 stop bits, but it does not look like this is supported by the libUARTE library. You can try to configure it manually after initializing libUARTE, if you use one of the chip variants that supports 2 stop bits, but it may not work correctly with the library. E.g if using UARTE0:

    NRF_UARTE0->CONFIG |= (UARTE_CONFIG_STOP_Two << UARTE_CONFIG_STOP_Pos) & UARTE_CONFIG_STOP_Msk;

    Also note that the hardware supports 3 parity settings - none, even, and odd. Why does the library support only two? And is the "included" mode even parity?

    The nRF52 series UART(E) hardware only supports even parity.

    Best regards,
    Jørgen

Children
Related