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

RE: Changing the UART TX RX pins

Hi,

I am having difficulty changing the UART Tx/Rx pins of nrf52840 (custom board) in the direct_test_mode example project in the SDK 16.0.0.

Based on https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Findex.html

I should be able to easy modify these pins:

"The default selection of GPIO pins are pin 8 for RX and pin 6 for TX. These defaults are defined in <InstallFolder>\examples\bsp\board.h and can be changed by editing the values of the symbols RX_PIN_NUMBER and TX_PIN_NUMBER"

But the <InstallFolder>\examples\bsp does not exist in SDK 16.0.0, Where are these files?And also which compiler can I use to compile the project?

Thank you

  • You don't need to redefine the RX and TX pins in the pca10056.h file, you can just modify the main.c to use whatever pins you want for RX and TX: 

    #define DTM_RX_PIN NRF_GPIO_PIN_MAP(0, 11) // p0.11
    #define DTM_TX_PIN NRF_GPIO_PIN_MAP(1, 08) // p1.08
    
    
    /**@brief Function for UART initialization.
     */
    static void uart_init(void)
    {   
        uint32_t err_code;
        const app_uart_comm_params_t comm_params =
          {
              DTM_RX_PIN,
              DTM_TX_PIN,
              RTS_PIN_NUMBER,
              CTS_PIN_NUMBER,
              APP_UART_FLOW_CONTROL_DISABLED,
              false,
              DTM_BITRATE
          };
    
        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);
    }
    



    The SDK supports SES, Keil, IAR, and GCC. 

Related