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
  • Hi Aftab, 

    But it throws error: Cannot find definition of app_uart_comm_params_t

    You have to include app_uart.h and app_uart.c under nRF5_SDK\components\libraries\uart. See Including header files and Adding source files.

    -Amanda H.

  • I get this error after adding above files:

    undefined reference to `app_uart_init'

    In the app_uart.c file it seems that I need to enable APP_UART, this pre-processor directive is disabling the whole file:

    #if NRF_MODULE_ENABLED(APP_UART)

    BTW, why do we need to add this code, why not change some pin settings?

  • Hi Aftab, 

     

    Aftab said:

    In the app_uart.c file it seems that I need to enable APP_UART, this pre-processor directive is disabling the whole file:

    #if NRF_MODULE_ENABLED(APP_UART)

    You need to enable the app_uart - UART driver in the sdk_config.h as

    // <e> APP_UART_ENABLED - app_uart - UART driver
    //==========================================================
    #ifndef APP_UART_ENABLED
    #define APP_UART_ENABLED 1
    #endif

     

    Aftab said:
    why do we need to add this code, why not change some pin settings?

    You can just change the pin setting or rename the pin in the app_uart_comm_params_t as that case. It depends on your usage. 

     

    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.

     Are you using on nRF52840DK? If so, I don't think there are P0.45, P0.46 on nRF52840DK. You might consider other pins.

    -Amanda H.

Reply
  • Hi Aftab, 

     

    Aftab said:

    In the app_uart.c file it seems that I need to enable APP_UART, this pre-processor directive is disabling the whole file:

    #if NRF_MODULE_ENABLED(APP_UART)

    You need to enable the app_uart - UART driver in the sdk_config.h as

    // <e> APP_UART_ENABLED - app_uart - UART driver
    //==========================================================
    #ifndef APP_UART_ENABLED
    #define APP_UART_ENABLED 1
    #endif

     

    Aftab said:
    why do we need to add this code, why not change some pin settings?

    You can just change the pin setting or rename the pin in the app_uart_comm_params_t as that case. It depends on your usage. 

     

    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.

     Are you using on nRF52840DK? If so, I don't think there are P0.45, P0.46 on nRF52840DK. You might consider other pins.

    -Amanda H.

Children
No Data
Related