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

How to set up both UARTs and not use virtual Com port

We are currently developing on the PCA10056 as we wait for our development boards.  We would like to implement UART0 as a debug port, that we can output the log messages to, and use UART1 to communicate with an RS485 IC that will host a network interface.  I am having trouble finding an example that uses both UARTS without using the virtual COM port on SDK15.  I have four questions:

1. How should sdk_config.h be set in order to do what we are attempting?

2. How do we initialize two instances of the UARTE driver, then operate said uarts?

3. How do we redirect logging to a "normal" UART output?

4. It is my understanding that we can use any GPIO pins as UART output.  Is this accurate?

  • Hello,

    What do you mean by setting up a UART that does not use the virtual COM port?

     

    If I understand you correct, you want the UART as RX and TX pins, and not the microUSB cable, is that correct? That does not require any changes. When you set up the UART with pin 6 and pin 8 (default UART pins in sdk_config), you will use these pins as standard UART pins. It is actually the Segger On Board (OB) that translates these pins to the COM port. You don't need to use this. If you just attach a UART device to pins 6 and 8, it will operate as a standard UART device.

     

    Regarding setting up two UARTs on the PCA10056, can you please read through this post, as it explains how to set up two UARTs on the PCA10056.

     

    Best regards,

    Edvin

  • Okay, I understand the "Virtual Com Port" now.  I have been trying to instantiate an instance of APP_UART while logging is using UART0.  What happens is I initialize logging and that goes through just fine.  Then, I call APP_UART_INIT().  it gets to nrfx_uart_init() in nrfx_uarte.c.  When it checks the state of the driver it is already initialized, so it throws an error.  I can't seem to find a way to use a different instance of the app for my (non-log) UART application. 

    The link you posted is for SDK14 and we would like to use the SDK15 app if possible. 

  • Can you send your project, and I can take a look?

     

    Best regards,

    Edvin

  • Just zip the project folder and attach it here. Use Insert -> Insert image/video/file -> File Upload. 

     

    Please also describe what I should be looking for when trying your application. 

     

    I have not tested using one UART as logging and one for communication for another device before, so I don't know if there are any known issues here. But if you only intend to use the logging UART during development, have you considered using the RTT Backend instead of the UART backend for the NRF_LOG? You can view RTT logging in either RTT viewer from SEGGER or if you are using Segger Embedded Studio, you should be able to see it directly in the IDE.

     

    Best regards,

    Edvin

Related