Multiple UART on NRF52833

Hello Everyone,

                   I am using NRF52833 in my project and I have my NRF module connected to 2 other microcontrollers on UART peripherals. The details are mentioned as below:-

1) NRF52833 connected to MCU A

   RX pin of nrf- P0.29

   TX pin of nrf- P0.28

2) NRF52833 connected to MCU B

   RX pin of nrf- P0.30

   TX pin of nrf- P0.31.

I have successfully configured connection to MCU and I am able to transmit data from NRF to MCU A and receive data on NRF from MCU A.

Now I have to add another UART in the code so as to communicate with MCU B. What will be the steps to add one more UART configuration?? What is the procedure to do so.

Thanks & Regards,

Snehal.

Parents
  • Hi,

    The nRF52833 has only 1 UART, but 2 UARTE. So you would have to add a UARTE peripheral to your project. To add the peripheral you need to:

    1. Enable the Instance in your sdk config file and add necessary files to your project. 
    2. Initialize the peripheral and instance
    3. Use the peripheral Slight smile

    You can follow the procedure as in the UART example. If you're already using the UART example, then you're actually using the UARTE peripheral. If so, then you need to make sure that you add instance 1 instead of 0, because the example already use instance 0. 

    regards

    Jared 

  • Hi Jared,

                 Thanks for your reply. You mean to say I will have to edit in sdk_config.h from 

    #ifndef APP_UART_DRIVER_INSTANCE
    #define APP_UART_DRIVER_INSTANCE 0
    #endif

    to 

    #ifndef APP_UART_DRIVER_INSTANCE
    #define APP_UART_DRIVER_INSTANCE 1
    #endif

    ??

    Will this enable 2 uarts? As well as for uart1 i am using function below:-

    void sys_uart_init(void)
    {
    uint32_t err_code;
    const app_uart_comm_params_t comm_params =
    {
    UART_RX_PIN_NUMBER,
    UART_TX_PIN_NUMBER,
    UART_RTS_PIN_NUMBER,
    UART_CTS_PIN_NUMBER,
    APP_UART_FLOW_CONTROL_DISABLED,
    false,
    UART_BAUDRATE_BAUDRATE_Baud9600
    };

    APP_UART_FIFO_INIT(&comm_params,
    UART_RX_BUF_SIZE,
    UART_TX_BUF_SIZE,
    uart_event_handle,
    APP_IRQ_PRIORITY_LOWEST,
    err_code);


    APP_ERROR_CHECK(err_code);
    }

    will i have to creae another function for adding 2nd uart using the same method???

    Thanks & Regards,

    Snehal 

  • I disabled this in sdk_config.h. Had enabled it according to our previous discussion. Now again i have disabled it. I have attached my sdk_config file. 3566.sdk_config.h

    #ifndef UART1_ENABLED
    #define UART1_ENABLED 0
    #endif
    // <q> UART1_CONFIG_USE_EASY_DMA - Default setting for using EasyDMA

    #ifndef UART1_CONFIG_USE_EASY_DMA
    #define UART1_CONFIG_USE_EASY_DMA 0
    #endif

    #ifndef APP_UART_DRIVER_INSTANCE
    #define APP_UART_DRIVER_INSTANCE 1
    #endif

  • Hi,

    The SDK config should look somewhat similar to this. 

    5415.sdk_config.h

  • I tried to edit the sdk_config according to the file you have provided. Now I am getting new errors. 

    Please help. 

  • I solved the issue. I had to put some defines like APP_TIMER_V2 & APP_TIMER_V2_RTC1_ENABLED in the preprocessor definitions. 

    I am also using "app_timer_freertos.c" in my project as I have to run some timers through schedulers. So the problem is I am getting multiple definition error after including the app_timer2.c.

    Any way to solve this issue?

    I actually removed 2 files app_timer2.c and drv_rtc.c and the errors are gone now. But still libuarte gives error while running the code on the device.

    Thank you.

  • Hi,

    Are you actually  using freeRTOS? 

    sne_333 said:
    my project as I have to run some timers through schedulers.

    Please elaborate on this.

    regards

    Jared

Reply Children
Related