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

Making UART0 or UART1 externally accessible for serial_lte_modem

I am working on a custom board for the nRF9160 and currently have a DK and a thingy.

I need to make a serial interface available on the DK, thingy and a custom board I am working on for serial AT commands. I would prefer for it to be UART1 so I can still use the USB interface.

A few weird things I have run into, I tried to edit "nrf9160dk_nrf9160ns.overlay": (formatting gets screwed up if you try to insert as code)

&uart2 {
compatible = "nordic,nrf-uarte";
current-speed = <115200>;
status = "okay";
tx-pin = <10>;
rx-pin = <11>;
rts-pin = <12>;
cts-pin = <13>;
hw-flow-control;
};

I have tried changing pins and buadrate to no effect, even after reloading the project in SEGGER, but if I do the same for UART1/0 but still nothing.

When I goto make my own custom board how do I actually go about selecting pins for the AT command UART?

Edit:

I tried this solution: https://devzone.nordicsemi.com/f/nordic-q-a/45941/nrf9160-asset-tracker-configure-uart but the project gets errors when I try to open it

There was another one I tried, but I can't find it right now. Was to do with some kind of Arduino flag.

  • Hello Mr.Newlove,

    thank you for your request! I have to check some details around this issue and will come back to you as soon as possible.

    Regards,

    Markus

  • Hello again,

    on your customised board you select the UART pins as shown in the nrf9160dk_nrf9160ns.overlay of the Serial LTE modem application.

    If you want to use the UART2, you have to adapt your prj.conf as well, described here.

    This will have an affect in the function below in sim_at_host.c:

    int slm_at_host_init(void)
    
    {
    
    int err;
    
    uint32_t start_time;
    
    
    
    /* Initialize the UART module */
    
    #if defined(CONFIG_SLM_CONNECT_UART_0)
    
    uart_dev = device_get_binding(DT_LABEL(DT_NODELABEL(uart0)));
    
    #elif defined(CONFIG_SLM_CONNECT_UART_2)
    
    uart_dev = device_get_binding(DT_LABEL(DT_NODELABEL(uart2)));
    
    #else
    
    LOG_ERR("Unsupported UART instance");
    
    return -EINVAL;
    
    #endif

    On the nRF9160DK the Board controller might affect your choice of the pins, though.

    You can find an overview of the default settings here and how they can be routed here.

    I hope this will help you!

    Regards,

    Markus

  • Hello Markus,

    EDIT: Please see the end of the post.

    Lets use this board as an example: www.digikey.ca/.../13668137

    I have been trying to get this working over the last week with zero luck so far. I think you are right where most of my problems come from this board controller, but idk how to bypass it. I am so far really not a fan of this zephyr ROTS thing either. Nothing but pain.

    Can you please step me through what I need to do to simply compile the serial_lte_modem example to route UART0 pins to anything I specify on a board that has nothing except the nRF9160 on it? I am using SEGER to open the project right now. I desperately need to get this thing talking via external hardware in the next couple days.

    Really wish there was some kind of nice non-zephyr RTOS way to deal with this modem, like how the ESP32 chips handle it. Right now I am just trying to get the serial_lte_modem so I can write my actual application code in another chip.

    Thanks,

    Kyle

    Edit:

    Here is a quick video of me trying a few things. Please forgive slightly unprofessional nature, it is midnight here and its been a long day: https://youtu.be/wDnAex1CKxU that audio quality was *** sorry.

    Edit2: Found this: https://devzone.nordicsemi.com/f/nordic-q-a/72197/nrf9160-serial-lte-modem-does-not-compile and removed/reinstalled 1.5.1 and that fixed the last error I was having

    This got the modem talking via the USB serial connection.

    So I guess my main question is now:

    - How do I create a basic board definition that will allow me to pass the main serial UART for serial_lte_modem  AT commands to any specific data pins?

    I tried to create a "circuitdojo_feather_nrf9160ns.overlay" file but either I am doing something very wrong or it has no effect.

    &uart0 {
    current-speed = <115200>;
    status = "ok";
    tx-pin = <2>;
    rx-pin = <3>;
    rts-pin = <19>;
    cts-pin = <21>;
    };

    I would love to do a call with you tomorrow if possible to get this hammered out.

  • Hello Markus,

    I am a little bit of a loss on how to change what pins are actually used for the UART0 or UART2, nothing I do seems to make the serial appear on accessible pins.

    Thanks,

    Kyle

    Edit: I have tried editing "C:\ncs\v1.5.1\zephyr\boards\arm\circuitdojo_feather_nrf9160\circuitdojo_feather_nrf9160_common.dts" to change the uart2 pins, but then i get "create_nordic_project.py failed(1)" when i try to open the project

    Edit: I am just going to create a new post and cut this down to hopefully get to an answer faster

  • Hello,

    thanks for the feedback and the video!

    I’m honestly not quite sure what your main goal is. But anyway, the purpose of the Serial LTE modem application is to use the nRF9160 as a stand-alone LTE modem. So, what you could do is to flash the application to your DK and then connect an external MCU to it, as described in this section.

    On the external MCU, you have to run your own application that sends AT commands which will be received via the UART2 on the DK. My recommendation is to get that to work first, before starting to change the pin configurations. That would be a way to verify that the system is generally working.

    And example of an external application is given here.

    I hope this will help you!

    Regards,

    Markus

Related