NICLA SENSE ME (nRF52832) UART RX Issue

Hello All,

I have ported the UART example (<InstallFolder>\examples\peripheral\uart) on top of blinky in nicla sense hardware. The TX is working only when rx pin is set as "UART_PIN_DISCONNECTED". 

The TX is also working if I comment out the below code portion.

// Turn on receiver if RX pin is connected
if (p_comm_params->rx_pin_no != UART_PIN_DISCONNECTED)
{
return nrf_drv_uart_rx(&app_uart_inst, rx_buffer,1);
}

Also I am not able to use the on chip debugger, if uart module enabled/initialized.

I assume the code is entering into app_error_fault_handler() when RX is enabled. 

I have also verified the PIN_CFN.

Following are the configurations used for reference:

const app_uart_comm_params_t comm_params =
{
RX_PIN_NUMBER_NICLA,          /* GPIO2 = p9 */
TX_PIN_NUMBER_NICLA,          /* GPIO1 = p20 */
RTS_PIN_NOT_CONNECTED,
CTS_PIN_NOT_CONNECTED,
APP_UART_FLOW_CONTROL_DISABLED,
false,
UART_BAUDRATE_BAUDRATE_Baud115200
};


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

APP_ERROR_CHECK(err_code);

------------------------------------------------------------------------------------------

Relevant sdk_config:

#define RETARGET_ENABLED 1

#define UART_ENABLED 1

#define NRFX_UARTE_ENABLED 0

#define APP_FIFO_ENABLED 1

Please let me know if you need any further information. Any support would be really appreciated. Thank you

-

ijf1

Parents
  • Hello,

    Please try to comment the "APP_ERROR_HANDLER(p_event->data.error_communication);" line in uart_error_handle() and see if that allows you to run the program with RX enabled.

    The APP_UART_COMMUNICATION_ERROR is often triggered if the UART RX pin is left floating.

    Best regards,

    Vidar

  • Hi Vidhar,

    There is an update, I would like to share. 

    I have tried configuring the RX pin as "nrf_gpio_cfg_input(RX_PIN_NUMBER_NICLA,NRF_GPIO_PIN_PULLUP)" after calling APP_UART_FIFO_INIT. 

    Also tried modifying UART driver portion that configures RX pin (Fun: apply_config, File: nrfx_uart.c). 

    The reception is not happening. Also observed that, in event handler "APP_UART_COMMUNICATION_ERROR" is getting triggered.

    For testing RX functionality I tried the following methods.

    1.

    case APP_UART_DATA_READY:
    //APP_ERROR_CHECK(nrf_drv_uart_rx((uint8_t *)rx_data, LENGHT_RX));


    printf("\r\nUART DATA Ready.\r\n");
    while(app_uart_get(&gb) != NRF_SUCCESS);


    if (gb == 'q' || gb == 'Q')
    {
    printf(" \r\nExit!\r\n");
    }
    break;

    ======================================================

    2.

    while (true)
    {
    uint8_t cr;
    while (app_uart_get(&cr) != NRF_SUCCESS);
    while (app_uart_put(cr) != NRF_SUCCESS);

    if (cr == 'q' || cr == 'Q')
    {
    printf(" \r\nExit!\r\n");

    while (true)
    {
    // Do nothing.
    }


    }
    }

    ==========================================================

    Please let me know what am I missing. Thank you.

    Regards,

    Ijas

  • Hi Ijas,

    Good point, I forgot that TX was working. This indicates that the baudrate accuracy is good enough for the receiver, at least.

    As a test, you can try to use the crystal oscillator to increase the baudrate accuracy on the nRF side. You can do so by running the following snippet at the start of main():

        NRF_CLOCK->TASKS_HFCLKSTART = 1;
        while(NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);

    Are you sending lots of data when the assert occurs?

  • Hi Vidar,

    I tried the above snippet as you mentioned. TX also not working. Some junk value getting printed sometimes. I am also doing the following init with respect to clock. Just for your reference.

    /* Initialize the low frequency clock */
    nrf_drv_clock_init()

    inrf_drv_power_init(NULL)

    /* Request the clock to not to generate events */
    nrf_drv_clock_lfclk_request(NULL);
    nrf_drv_clock_hfclk_request(NULL);

    while (!nrf_drv_clock_lfclk_is_running() && !nrf_drv_clock_hfclk_is_running())
    ;

    Regards,

    Ijaz 

  • Are you sending lots of data when the assert occurs?

    ==> No. I am just trying to send a char from PC terminal. In TX just printing some sample prints to make sure tx us working fine.

  • Hi Vidar,

    Please see the terminal screenshot for your reference. COMM. error triggered twice by default (Print from event handler), i have not even tried to send any data.

    Regards

  • Hi Ijaz,

    I noticed now that UART RX is assigned to P0.9, same pin that is used as the antenna input for NFC by default (Pin assignments, Pin configuration).

    To allow this pin to be used as a regular GPIO, you need to build your project with the CONFIG_NFCT_PINS_AS_GPIOS flag.

Reply Children
Related