Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF58232/SDK15 Where can I find sample code to use NRFX_UARTE ?

Hi,

I'm looking for an example of how NRFX_UARTE works.

I would like to set up a serial port with EasyDMA to send and receive a thirty bytes.

Thanks in advance for your help.

Best regards, 

Parents Reply Children
  • The "uart" example in the SDK uses UARTE0 (and therefore DMA) by default.

    If you are looking for a more direct way of calling nrfx_uarte_init, you could have a look at the small wrapper in nrf_drv_uart.h.

     

    Cheers,

    Håkon

  • Hi Häkon,

    Thanks for your answer.

    I'm sorry but I'm always lost. We have lots of files (app_uart, nrf_uarte,nrfx_uarte, ...)

    I need to be closer to the nRF52832 datasheet to manage all I want.

    In this example, how to enable or disable events for uart_error_handle ? I don't want to systematically go into the handler at every byte received, otherwise eDMA is useless ...

    Many thanks for your help, I'm not sure I'm very clear.

    Best regards,

  • In your case, I recommend that you omit the app_uart libraries, and use nrf_drv_uart.h (which wraps around calls to nrfx_) directly, by using the functions nrf_drv_uart_rx(...) and nrf_drv_uart_tx(...). The nrf_cli and our serializers use this directly (and app_uart as well, just that it sends/receives only 1 byte at the time).

     

    Best regards,

    Håkon

    .

  • I don't understand how to get all the interruption that I wish as an event in the handler.

    For example, how to be informed of RXSTARTED for load another buffer as seen in Figure 95 of the nRF52832 datasheet.

    If I use another way of doing this, for example :

        NRF_UARTE0->ENABLE = (UARTE_ENABLE_ENABLE_Enabled << UARTE_ENABLE_ENABLE_Pos);
        NRF_UARTE0->BAUDRATE=NRF_UARTE_BAUDRATE_115200;
        NRF_UARTE0->PSEL.RXD=RX_PIN_NUMBER;
        NRF_UARTE0->PSEL.TXD=TX_PIN_NUMBER;
        NRF_UARTE0->CONFIG=NRF_UARTE_HWFC_DISABLED;
     
        NRF_UARTE0->TXD.PTR = (uint32_t)((uint8_t *)txUarteBuffer);
        NRF_UARTE0->TXD.MAXCNT = sizeof(txUarteBuffer);
        NRF_UARTE0->TASKS_STARTTX = 0;
    
        NRF_UARTE0->RXD.PTR = (uint32_t)((uint8_t *) rxUarteBuffer);
        NRF_UARTE0->RXD.MAXCNT = sizeof(rxUarteBuffer);
        NRF_UARTE0->TASKS_STARTRX = 1;

    How to create an handler for event ?

    if I use : 

        NRF_UARTE0->INTENCLR = 0xFFFFFFFF;
        NRF_UARTE0->INTENSET = NRF_UARTE_INT_ENDRX_MASK;
        NVIC_ClearPendingIRQ(UARTE0_UART0_IRQn);
        NVIC_SetPriority(UARTE0_UART0_IRQn, NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY);
        NVIC_EnableIRQ(UARTE0_UART0_IRQn);

    I have : 

    <error> app: ERROR 3735928559 [Unknown error code] at .......\modules\nrfx\drivers\src\prs\nrfx_prs.c:81

    PC at: 0x0002C49F

    <error> app: End of error report

    Someone can help me ?

    Thanks in advance.

    Best regards,

  • Hi,

     

    It looks like you are mixing bare metal implementation, and using the nrfx_uarte driver. You must disable the nrfx_uarte module in order to use the UARTE peripheral directly.

     

    Best regards,

    Håkon

Related