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

UART unresponsive on custom board

I have designed a custom board using nRF52832. As per my understanding, we can configure any GPIO pin for UART communication. However, I am not able to configure the board for this communication.
I tried declaration of tx,rx,RTS,CTS using almost all spare pins, but there is no sign of UART communication successfully established. I tried to debug step by step and can see UART pins getting initialized and corresponding registers being assigned.
I am using nRF52840 for programming and debugging my target custom board through SWD. As a first step, I tried loop test on DK (shorting GPIO pin 6 & 8) and it is working fine, however my custom board doesn't have any exposed GPIO pin so I cannot do loop test. Please help me with UART on my custom board. Is there any special hardware connection arrangement needed for this communication?
  • As per kenneth reply on my question, I tried one GPIO pin with 2.2KOhm pull-up resistor which I tried to use for RXD. Still there is no sign of communication being established properly.

  • Hi Prasan

    Can you provide a schematic for your board?
    What are the UART pins connected to?

    Are you able to connect a scope to the pins to see what is happening on the bus?

    As you say there is no limit on which of the GPIO pins can be used for UART, as long as they are not used for anything else. 

    Best regards
    Torbjørn

  • Attached the schematic as needed. I am trying to use pin 26 or 27 as it is having pull up resistor. Note that I have not mounted the sensor yet and thus unused pins.

    Let me know which pins do you think would be best for UART communication. As already explained before, I only have these two pins 26 & 27 where I could connect some scope for testing and there is no any other exposed pin. 

    Ultimately I cannot use them for UART communication as these will be going to be used for TWI communication.

    Schema.pdf

  • Hi 

    Have you made sure to remove the TWI initialization for those pins so that you don't have a conflict between the TWI and UART interfaces?

    If you are using 2.2kOhm pull up resistors it is possible you have to configure the TX pin to use the high drive mode, or it might not be able to pull the lines low. 
    To set an output as high drive you can run the following command after enabling the UART:

    nrf_gpio_cfg(TX_PIN_NUMBER, NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_CONNECT, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_H0S1, NRF_GPIO_PIN_NOSENSE);

    Also, if you only have two pins available, how can you use RTS and CTS? 
    Is hardware flow control necessary, or could you disable this to reduce the IO requirement?

    Best regards
    Torbjørn

  • Hi,

    I am using basic UART example so there is no scope for TWI initialization. 

    I put TX pin in high drive mode in main program just after UART initialization like this:

    int main(void)
    {
        ...
        const app_uart_comm_params_t comm_params =
          {
              RX_PIN_NUMBER,
              TX_PIN_NUMBER,
              RTS_PIN_NUMBER,
              CTS_PIN_NUMBER,
              UART_HWFC,
              false,
    #if defined (UART_PRESENT)
              NRF_UART_BAUDRATE_115200
    #else
              NRF_UARTE_BAUDRATE_115200
    #endif
          };
    
        APP_UART_FIFO_INIT(&comm_params,
                             UART_RX_BUF_SIZE,
                             UART_TX_BUF_SIZE,
                             uart_error_handle,
                             APP_IRQ_PRIORITY_LOWEST,
                             err_code);
        nrf_gpio_cfg(TX_PIN_NUMBER, NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_CONNECT, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_H0S1, NRF_GPIO_PIN_NOSENSE);
    
    ...
    }

    I also disabled flow hardware control from driver file. Still there is no sign of any communication. 

    I even tried to do loop back test but there is no success. Is UART communication necessary for sending ADC or any sensor data over BLE?

Related