This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Odd behavior with nRF52810 UART transmission

I seem to be getting odd behavior of the UARTE0. Actually, this same behavior happens with the standard UART0.

I have a loop that sends a two byte message every 1 second. But actually, the message is sent at random times.

When the message is sent, it is correct data and bit timing is as expected with 9600 baudrate. I checked the loop

by illuminating an LED and it is 1 second as expected. I've studied the nRF52810 data sheet and it seems like I

have all the configuration registers set properly. Hopefully someone has some tips.

void uart_init( void )
{
    NRF_UARTE0->PSEL.RXD = TESTRX;                      /// Set UARTE0 Rx pin
    NRF_UARTE0->PSEL.TXD = TESTTX;                      /// Set UARTE0 Tx pin
    NRF_UARTE0->BAUDRATE = UARTBAUD;                    /// Set UARTE0 baudrate
    NRF_UARTE0->TXD.PTR = (uint32_t)&uarte0TxBuffer;    /// Assign UARTE0 Tx buffer
    NRF_UARTE0->RXD.PTR = (uint32_t)&uarte0RxBuffer;    /// Assign UARTE0 Rx buffer
    NRF_UARTE0->TXD.MAXCNT = TXBUFMAX;                  /// Set Tx buffer max size to 8 bytes
    NRF_UARTE0->RXD.MAXCNT = RXBUFMAX;                  /// Set Rx buffer max size to 8 bytes
    NRF_UARTE0->ENABLE = 0x08;                          /// Enable UART0
    nrf_delay_ms(1);
}

while (nrf_gpio_pin_read(TESTMODE) == LOW)
    {
        // do stuff

        uarte0TxBuffer[0] = 0xDF;
        uarte0TxBuffer[1] = 0xA2;
        NRF_UARTE0->TASKS_STARTTX = true;

        nrf_delay_ms(1000);

    }

Parents Reply Children
Related