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

How to make LOG_INF and LOG_ERR print over UART0 in nrf9160?

In the past I was able to get the Serial LTE Example application working over UART0 on the pins used in my custom board. I did so by adding a file called nrf9160dk_nrf9160.overlay with the lines 


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

Now I have upgraded to ncs v1.5.0 and am trying to move the mqtt_simple sample onto my custom board.

In this case adding my .overlay does not show any communication over UART 0. When the project is built with this overlay and put on the DK there is nothing in LTE Link Monitor at all.

I figure as good a place as any to start is trying to get LOG_INF and LOG_ERR to print to UART0 on pins 1 and 0.

How can I do that?

Parents Reply Children
  • Hi Markus,

    I received the information about the second overlay file here: https://devzone.nordicsemi.com/f/nordic-q-a/64677/changing-uart0-pins-for-custom-nrf9160-board

    This file was located at ncs/v1.5.0/nrf/samples/spm

    I removed it and rebuilt. It doesn't seem to have made any difference either way. 

  • Hi Markus,

    So I kept trying different things and I came up with something that seems to work okay. 

    I completely removed the .overlay from the SPM folder and changed my overlay in the mqtt_simple folder to

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

    &uart1 {
    current-speed = <115200>;
    status = "okay";
    tx-pin = <29>;
    rx-pin = <28>;
    rts-pin = <27>;
    cts-pin = <26>;
    };

    Basically I just swapped the pins and disabled the RTS and CTS for UART0. Seems like it really wanted UART1 to be enabled, because now I get this on my external MCU (edited to remove anything that might be identifying)


    *** Booting Zephyr OS build v2.4.99-ncs1 ***
    [00:00:00.205,566] <inf> at_host: UART check failed: 12. Dropping buffer and retrying.
    [00:00:00.215,667] <inf> mqtt_simple: The MQTT simple sample started
    [00:00:00.215,667] <inf> mqtt_simple: Provisioning certificates
    [00:00:00.537,261] <inf> mqtt_simple: Disabling PSM and eDRX
    [00:00:00.544,799] <inf> mqtt_simple: LTE Link Connecting...
    +CEREG: **REDACTED**
    +CSCON: 1
    +CEREG: **REDACTED**
    [00:00:08.957,733] <inf> mqtt_simple: LTE Link Connected!
    [00:00:09.139,678] <inf> mqtt_simple: IPv4 Address found **REDACTED**
    [00:00:09.139,709] <inf> mqtt_simple: TLS enabled
    [00:00:13.368,621] <inf> mqtt_simple: MQTT client connected
    [00:00:13.368,621] <inf> mqtt_simple: Subscribing to: **REDACTED** len 16
    [00:00:13.547,607] <inf> mqtt_simple: SUBACK packet id: 1234

    So far so good, only why does it say "at_host: UART check failed?" Best guess is at_host wanted to check UART 1 and nothing is connected to pins 26-29. On the up side I can issue AT commands and I get responses and everything checks out.

    On the down side I've got an error message in the bootup that I don't understand. If I can use at_host through UART0 why is UART1 necessary and what is the true meaning of the error message?

    I'll mark this as the answer anyway since it answers the question I asked directly.

Related