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

Unable to receive on Rx pin because Tx is always high.

I have a custom board. It has its Tx and Rx combined into one wire bus. I am able to transmit data on the bus. But I am unable to receive any data on the board. This is because of circuit design.

In order to receive data I thought of disconnection the Tx pin when I am done transmitting the data. I did it by adding some code in `$SDK_ROOT/modules/nrfx/hal/nrf_uart.h`.

__STATIC_INLINE void nrf_uart_tx_pins_disconnect(NRF_UART_Type * p_reg)
{
#if defined(UART_PSEL_TXD_CONNECT_Pos)
    p_reg->PSEL.TXD = NRF_UART_PSEL_DISCONNECTED;
#else
    p_reg->PSELTXD = NRF_UART_PSEL_DISCONNECTED;
#endif
}

I thought of calling this function when I am done transmitting and want to receive data. This is works partially.

When I transmit and disconnect tx pin then I do not receive any data. But If I do not send any data and directly try to receive it works.

I want both way communication.

Is there anything to turn off Tx completely and just wait for receive, and when I want to transmit I enable the Tx and starts sending.

Parents Reply
  • Yes, good catch; I meant to either set the pin to default input before releasing from the uart or indeed use the correct pin number (which wasn't given in your post) in the order shown. I would advise setting the pull-up as well, as with the default config the pin will float which could cause issues with the remote device when the remote device reverts to listening to Tx which will float potentially low and look like spurious transmitted data without a pull-up.

      // Use p_reg->PSEL.TXD as we don't know which pin is being used
      nrf_uart_disable();
      // Pin is an output pin so must turn off output drivers - maybe also make enablee pull-up
      nrf_gpio_cfg_default(p_reg->PSEL.TXD);// Release pin
      p_reg->PSEL.TXD = NRF_UART_PSEL_DISCONNECTED;
      nrf_uart_enable();

    Anyway did it work?

Children
Related