AT uart

I am trying to set up the AT library to directly talk to the modem through a uart on the nrf9160DK.  But when I enter the commands to test "AT+CFUN?" I just get it echoed back

I have a USB to UART converter connected to P0.00 and P0.01 to talk to the modem.

prj.conf

#Enable logger module
CONFIG_LOG=y

#Enable logging through UART
CONFIG_SERIAL=y
CONFIG_SHELL_LOG_BACKEND=y

#Enable shell
CONFIG_SHELL=y

CONFIG_AT_HOST_LIBRARY=y
CONFIG_AT_HOST_UART_INIT_TIMEOUT=10000
CONFIG_AT_HOST_CMD_MAX_LEN=32



Device overlay
&interface_to_nrf52840 {
    gpio-map = <0 0 &gpio0 17 0>,
               <1 0 &gpio0 18 0>,
               <2 0 &gpio0 19 0>,
               <3 0 &gpio0 21 0>,
               <4 0 &gpio0 22 0>,
               <5 0 &gpio0 23 0>,
               <9 0 &gpio0 24 0>;
};

&uart1 {
    status = "okay";
};

&uart0 {
    status = "okay";
};

/ {
    chosen {
        zephyr,console = &uart0;
    };
};

/ {
    chosen {
        zephyr,shell-uart = &uart0;
    };
};

&uart1_default {
    group2 {
        psels = <NRF_PSEL(UART_RX, 0, 0)>;
    };
};

&uart1_default {
    group1 {
        psels = <NRF_PSEL(UART_TX, 0, 1)>;
    };
};

&uart1 {
    hw-flow-control;
};

&uart1 {
    /delete-property/ hw-flow-control;
};

&uart0_default {
    group2 {
        psels = <NRF_PSEL(UART_RX, 0, 16)>, <NRF_PSEL(UART_CTS, 0, 26)>;
    };
};

&uart0_default {
    group1 {
        psels = <NRF_PSEL(UART_TX, 0, 17)>, <NRF_PSEL(UART_RTS, 0, 27)>;
    };
};
Parents Reply
  • Hi,

    AT Host library uses UART0 by default but this can be changed using ncs,at-host-uart choice in devicetree.
    Regarding the pins, there is likely pin conflict in your configuration, i.e. pins are not chosen correctly. You can check GPIO pin usage in the default pin settings table in the chapter 4.6 (GPIO interfaces) of the nRF9160-dk hardware user guide.
    You could try to use pins for buttons or leds which are routed to the pin header. 
    You should also use your own pinctrl instances instead of matching ones already set up in the board. For example,

    &pinctrl {
       my_pin_configuration: my_pin_configuration {
          group1 {
             psels = <NRF_PSEL(UART_TX, 0, 14)>,
                     <NRF_PSEL(UART_RX, 0, 16)>;
          };
       };
    };


    and 

    &uart0 {
      pinctrl-0 = <&my_pin_configuration>;
      pinctrl-names = "default";
    };


    Best regards,
    Dejan

Children
Related