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

Changing UART0 pins for Custom nrf9160 board?

Hello,

I have recently used the new toolchain manager to upgrade to ncs v1.3.0.

Now I am using Segger Embedded Studio to flash an nRF9160 with the at_client sample. 

My issue is that I am not able to use pins 0 and 1 as UART0 on my custom nRF9160 board.

I have created the file ncs\v1.3.0\nrf\samples\nrf9160\at_client\nrf9160_pca10090ns.overlay


&uart0 {
status = "okay";
tx-pin = <1>;
rx-pin = <0>;
rts-pin = <0xFFFFFFFF>;
cts-pin = <0xFFFFFFFF>;
};

I also put this same text into a new file: ncs\v1.3.0\nrf\samples\nrf9160\spm\nrf9160_pca10090.overlay


Other than the fact that I don't get any response when I send AT commands to these pins, or get any data out at reset, I found that if I look at the file ncs\v1.3.0\nrf\samples\nrf9160\at_client\build_nrf9160_pca10090ns\zephyr\include\generated\devicetree_unfixed.h


I can find the lines:

#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_tx_pin 29
#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_tx_pin_EXISTS 1
#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_rx_pin 28
#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_rx_pin_EXISTS 1
#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_rts_pin 27
#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_rts_pin_EXISTS 1
#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_cts_pin 26
#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_cts_pin_EXISTS 1
#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_current_speed 115200
#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_current_speed_EXISTS 1
#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_label "UART_0"
#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_label_EXISTS 1
#define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_status "okay"

So I think maybe this shows me that my attempts to change the UART0 pins are not taking?

Any help would be much apprecaited.

  • Hello! 


    SES requires that you reload the project if you add/edit a .overlay file. I recommend trying that! Furthermore, see that you are using the pca10090 overlay file. Could you try to change the names to respectively nrf9160dk_nrf9160ns.overlay and nrf9160dk_nrf9160.overlay?


    Hope this helps!

    Best regards,
    Carl Richard

  • I renamed the files as specified, and reloaded the project in SES.

    Now, ncs\v1.3.0\nrf\samples\nrf9160\at_client\build_nrf9160_pca10090ns\zephyr\include\generated\devicetree_unfixed.h does show the correct pin numbers:

    /* Generic property macros: */
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_reg {32768 /* 0x8000 */, 4096 /* 0x1000 */}
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_reg_IDX_0 32768
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_reg_IDX_1 4096
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_reg_EXISTS 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_interrupts {8 /* 0x8 */, 1 /* 0x1 */}
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_interrupts_IDX_0 8
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_interrupts_IDX_1 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_interrupts_EXISTS 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_hw_flow_control 0
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_hw_flow_control_EXISTS 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_tx_pin 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_tx_pin_EXISTS 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_rx_pin 0
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_rx_pin_EXISTS 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_rts_pin 4294967295
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_rts_pin_EXISTS 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_cts_pin 4294967295
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_cts_pin_EXISTS 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_current_speed 115200
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_current_speed_EXISTS 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_label "UART_0"
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_label_EXISTS 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_status "okay"
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_status_ENUM_IDX 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_status_EXISTS 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_compatible {"nordic,nrf-uarte"}
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_compatible_IDX_0 "nordic,nrf-uarte"
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_compatible_LEN 1
    #define DT_N_S_soc_S_peripheral_40000000_S_uart_8000_P_compatible_EXISTS 1

    However, I am getting no activity on P0.01 on either the DK board or my custom board at reset or in response to "AT+CFUN?\r\n" on P0.00.

    One thing that has changed is if I load the .hex onto the DK board then I no longer get any of the SPM messages or any output in the LTE Link Monitor. Which I think is correct behavior with the UART0 pins changed.

  • Hello again! 

    It seems that UART2 are bound to P0.00 and P0.01 on the DK, as stated in the documentation. Could you try to disable UART1 by the following to both application and spm overlays?

    &uart2 {
    status = "disabled";
    };

    Best regards,

    Carl Richard

    Edit:
    The documentation link was wrong. It is updated now. In addition I corrected the UART number, it was supposed to be UART2.

  • I'm not seeing that in the documentation for the nrf9160DK which I found using the contents bar on the left side of the page you linked. I looked over at the schematic and saw P0.00 and P0.01 were labeled as UART_2.

    I tried disabling UART_1 and UART_2 using this method here but nothing happened. I

    I also tried to use the project configurations for "Device Name for UART device of UART Console" to set that to UART_2 because I don't actually care which UART it is I just want it to use P0.00 and P0.01. But that didn't work either.


    Perhaps I need to rephrase what I want to do:

    If I go back to default configuration then I can do this in any serial program on my laptop:

    
    

    AT+CFUN?
    
    +CFUN: 0
    
    OK


    I'm looking to make this interaction occur over pins P0.00 and P0.01. Regardless of UART number.

    
    




    EDIT:

    Actually disabling UART1 does make a difference. On my PC this DK always connects to COM6, COM7, and COM8.

    COM7 is usually where I get SPM messages at reset and can communicate with the AT Client app. This appears to be the one used by LTE Link Monitor.

    After disabling UART_1 the LTE Link Monitor shows no communication but I can get that functionality now on COM6 with other terminal applications. 

  • Hello!

    My apologies, I provided the wrong link to documentation. Let's try a different approach. 
    Could you try to remove the overlay files, and add the following line to your prj.conf:

    CONFIG_AT_HOST_UART_1=y

    I managed to communicate with the modem over P0.00 and P0.01 this way. It might not be the ideal solution as it only routs the AT_HOST to UART_1, not anything else. 

    Best regards,
    Carl Richard

Related