This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

is it possible to use printk and AT command on the same UART port.

I'm working on nRF9160-dk. 

I built a sample application "serial lte modem" in NCS 1.6.1.

i can use AT command on the UART0, but i find the printk in source code is not printed on the UART0. 

is it possible to use printk to print log on the same UART0 port?

in addition, how to change output UART port of printk?

  • Hello,

    is it possible to use printk to print log on the same UART0 port?

    I would think so, that's how it is done in the at_client sample as far as I know. I will try to test this when I have time and report back, but I assume this should work.

    in addition, how to change output UART port of printk?

    I don't think you should mess around changing the UART instance for printk. I suggest you change UART for at_host instead, by changing this config.

  • is it possible to use printk to print log on the same UART0 port?

    Yes, this should be possible. I tested this on the at client sample (on NCS 1.6), and it works fine.

  • however, I built the application "serial lte modem", the logs of printk don't show on UART console.

    do you know how to configure it?

  • Hi,

     

    SLM uses RTT for logging by default. If you want to log printk() (and other logs) via UART instead, you have to disable RTT and enable UART:

    CONFIG_USE_SEGGER_RTT=n
    CONFIG_RTT_CONSOLE=n
    CONFIG_LOG_BACKEND_RTT=n
    # Enable UART
    CONFIG_UART_CONSOLE=y
    CONFIG_LOG_BACKEND_UART=y

     

    Kind regards,

    Håkon

Related