Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UART pin change

Hello,

I'm using SDK v16.0. I'm trying to change the default UART pins from 6,8 to 45,46. In the pca10056.h I have made following changes.

//#define RX_PIN_NUMBER 8
//#define TX_PIN_NUMBER 6

// Changed in hardware v1.6
#define RX_PIN_NUMBER 45
#define TX_PIN_NUMBER 46

But I still see log on pin 6 and 8.

I also tried to change pins in sdk_config.h like following, but no success:

// <o> HCI_UART_RX_PIN - UART RX pin 
#ifndef HCI_UART_RX_PIN
//#define HCI_UART_RX_PIN 8
#define HCI_UART_RX_PIN 45
#endif

// <o> HCI_UART_TX_PIN - UART TX pin 
#ifndef HCI_UART_TX_PIN
//#define HCI_UART_TX_PIN 6
#define HCI_UART_TX_PIN 46
#endif

Tried this: https://devzone.nordicsemi.com/f/nordic-q-a/53691/re-changing-the-uart-tx-rx-pins

But it throws error: Cannot find definition of app_uart_comm_params_t

Thanks

Parents
  • I'm not using any development kit, we have our custom board. Basically we were using default pin 6/8 for UART logging. Then we had to assign these pins for some other peripheral. Now pin 45/46 are reserved for UART and no peripheral is connected to them. We just wanted to output the logs on these pins. 

    This is the error I get on terminal:

    <error> app: ERROR 8 [NRF_ERROR_INVALID_STATE]

    The error is on last line of the following code snippet:

    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);
    }

Reply
  • I'm not using any development kit, we have our custom board. Basically we were using default pin 6/8 for UART logging. Then we had to assign these pins for some other peripheral. Now pin 45/46 are reserved for UART and no peripheral is connected to them. We just wanted to output the logs on these pins. 

    This is the error I get on terminal:

    <error> app: ERROR 8 [NRF_ERROR_INVALID_STATE]

    The error is on last line of the following code snippet:

    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);
    }

Children
Related