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

How to run UART using just RX, TX on custom PCB with nRF52840

Hi,
I want to run UART on my custom PCB module that uses Wuerth Elektronik Thyone-I module that has nRF52840 chip. The project has just a RX, TX pins (and power supply, of course) on GPIOs. How to run this kind of UART in software? it's crucial that data come through every typical serial terminal (RealTerm, SerialPlot etc.), because they ought to be plotted in real-time.

What I'm mostly confused is:
1) Which modules should I enable in "sdk.config.h"?
2) Am I supposed to use "NRF_LOG_(...)" macro-functions or "printf()"? It probably depends on modules from 1. question.
3) Which pins should I assign in .h file (like "pca10056.h")? I'm confused with two sets of UART pins (Application and Connectivity) and their RTS/CTS.


Anyway, the step-by-step solution would be appriecieated too. 
Thank you!

  • Hi,

    I'd recommend using the Logger module if you only want to output data. It doesn't use the RX pin either, so you only need to select a TX pin in sdk_config here:

    Best regards,

    Vidar

  • Thank you so much. So easy and simple!
    I have just a one additional question - in "sdk_config.h" TX pin is defined with just a number, that means pin P0.given_number. What if I want to assign some pin from P1? It's impossible to include "nrf_gpio.h" file, because after this include whole code becomes "inactive" (like it's inside #ifdef that's false).


  • To select a pin on Port 1 you can simply offset the pin number you want with '32'. For instance, if you want to assign TX to P1.10:

    NRF_LOG_BACKEND_UART_TX_PIN (10 /* pin number */ + 32 /* Offset for port 1 */) // Select P1.10

Related