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

NRF52 UART initialisation issue/crash due to low state on pin

Hi

First I wrote a post because the initialization was crashing, but now I found out it was because the RX line was low. How to initialize the uart if the RX line is low without modifying the hardware. Thing is I have some devices which I power down to save power (gsm and such) and power up only when needed. I also have a uart exposed on the pin header which by default is not connected anywhere. How to make it ignore invalid input states?

  • So the problem is that the RX pin is floating and picking up noise (or just being pulled low)? It is possible to configure the RX pin as 'disconnected' by setting the PSELRXD register to 0xFFFFFFFF. Maybe that will help. If you are using the drivers and libraries in the SDK you can do it like this:

    const app_uart_comm_params_t comm_params =
      {
          RX_PIN_NUMBER,
          TX_PIN_NUMBER,
          RTS_PIN_NUMBER,
          UART_PIN_DISCONNECTED,
          APP_UART_FLOW_CONTROL_ENABLED,
          false,
          UART_BAUDRATE_BAUDRATE_Baud115200
      };
    
    APP_UART_FIFO_INIT(&comm_params,
                         UART_RX_BUF_SIZE,
                         UART_TX_BUF_SIZE,
                         uart_error_handle,
                         APP_IRQ_PRIORITY_LOWEST,
                         err_code);
    
    APP_ERROR_CHECK(err_code);
    

    But I suppose if you know what you are doing you can just write to the register directly after having initialized everything the usual way.

Related