UART Configuration on Ezurio DVK

I'm working with a DVK that has an nrF52840 with a Sierra Wireless HL7800 modem.  The modem is connected physically to UART1 while the UART0 is used for the following as shown in the dts:

zephyr,console = &uart0;

zephyr,shell-uart = &uart0;

zephyr,uart-mcumgr = &uart0;
zephyr,bt-mon-uart = &uart0;
I need to repurpose UART0 to send and receive hex commands on an HMI.  It was suggested by Ezurio tech support that I push the shell and console to the nrf USB to free up UART0. Is it just changing these lines in the dts file?  How do I do that?
 
  • First I'd like to point out that you are not supposed to change the .dts or any of the other board files directly (although it probably works). The intended way is to create an .overlay file in your application folder. Then anything that is located in that will overwrite the .dts file for your application.

    So if you are using the nRF52840, create a file called nrf52840dk_nrf52840.overlay in the same folder as your CMakeLists.txt and in there you can add those snippets. (I usually copy from the .dts file, so that I get the right indentations and brackets, and then remove anything I don't want to change, and then I change what I want to change).

    As for the question, yes. You are onto something. If you need the console, it is possible to move it over to the USB, and I believe something like that can work. Did you test it?

    If you do not need it, you can just disable the logging, which will free up the UART for your own use. You can also move the logging overt to RTT, so that the UART is free to use for your application.

    If you have a look at the sample found in ncs\nrf\samples\bluetooth\peripheral_uart, then you will see that this one uses UART0 for the application, and then it uses RTT for logging. You can see this from the prj.conf:

    # Config logger
    CONFIG_LOG=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    CONFIG_LOG_PRINTK=n
    

    It actually doesn't disable the console, and the reason for this is that it on purpose uses printk() to print some messages over UART, but it also uses uart_tx() to send UART messages, and uart_cb() for reading. 

    Best regards,

    Edvin

  • Thank you Edvin,

    I will edit the overlay.  I'm still learning this whole zephyr process.  It seems that no matter which tutorial I start I always run into something that stalls me, or is out dated that doesn't match what I see, etc.  I moved that over to "nrf usb" but haven't tested it yet.  I do still need the console, because I still have to test the SMS messages I am getting from the HL7800 with AT commands.

    For the nrf usb, it that the right identifier for the usb on the nrf52840?

    Stephen

  • MontanaEE said:
    I'm still learning this whole zephyr process.

    It is indeed quite a lot to get familiar with.

    MontanaEE said:
    I do still need the console, because I still have to test the SMS messages I am getting from the HL7800 with AT commands.

    You don't need it. As mentioned, you can monitor the log using the RTT backend, like it is done in the peripheral_uart sample. If you still have a console, however, this is where everything will be written when you use printk(). But regardless of whether you have a console or not, you can still use uart_tx(), uart_rx() or a callback handler for the UART, like it is done in the peripheral_uart sample. (ncs\nrf\samples\bluetooth\peripheral_uart

    Best regards,

    Edvin

  • Oh okay, thanks for the clarification.  I am looking at that now. 

    Thanks,

    Stephen

Related