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

Trying to send something over UART

Hello,

I am trying to send something by my own via UARTE0. This is only for testing/learning purposes:

    uint32_t enable0 = NRF_UART0->ENABLE;
    NRF_LOG_INFO("enable(UART0)=%d", enable0);

#if 1
    {
        uint8_t hello_world[] = "Hello\r\n";

        // Configure transmit buffer and start the transfer
        NRF_UARTE0->TXD.MAXCNT = sizeof(hello_world);
        NRF_UARTE0->TXD.PTR = (uint32_t)&hello_world[0];
        NRF_UARTE0->TASKS_STARTTX = 1;

        // Wait until the transfer is complete
        while (NRF_UARTE0->EVENTS_ENDTX == 0)
        {
        }
        // Stop the UART TX
        NRF_UARTE0->TASKS_STOPTX = 1;
        // Wait until we receive the stopped event
        while (NRF_UARTE0->EVENTS_TXSTOPPED == 0);
    }
#endif // 0

    uint32_t pseltxd0 = NRF_UART0->PSELTXD;
    uint32_t pselrxd0 = NRF_UART0->PSELRXD;

    NRF_LOG_INFO("pseltxd(UART0)=%d pselrxd(UART0)=%d", pseltxd0, pselrxd0);

    enable0 = NRF_UART0->ENABLE;
    NRF_LOG_INFO("enable(UART0)=%d", enable0);

This is what I see:

[00:00:00.000,000] <info> app: enable(UART0)=8
[00:00:00.000,000] <info> app: pseltxd(UART0)=7 pselrxd(UART0)=-1
[00:00:00.000,000] <info> app: enable(UART0)=8

I see NRF_LOG_INFO output before and also afterwards. I have ...DEFERRED off.

Do I need something else to send over NRF_UARTE0?

Many thanks!

Best regards,

Marie

Parents Reply Children
No Data
Related