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

Using UART and virtual COM port concurrently on the nRF52 DK

Hi,

I am currently working on a project with nRF52 preview DK.

In my system, an ECG chip is used to measure the heart rate and the data will be transferred back to nRF52 through the UART interface.

My question is, since the nRF52 has only one UART port (pin05-pin08 on the DK), if I connect my chip to aforementioned UART pins, would I still be able to use the virtual COM port to see the debug messages? (say, use UART to get data from ECG chip and print debug messages to the virtual COM port at the same time.)

According to the Nordic documentation, those pins are designed to be tri-stated, but I am still a bit confused about how I can actually make it work. (Source: infocenter.nordicsemi.com/index.jsp

Any insights are appreciated! Thank you!

  • No you can't use the UART to talk to two things at the same time. UART isn't a bus, it's a directly connected interface. Nor do you have to use pins 5-8 to connect your ECG device, you can use any pins you want and configure them in the UART code. You also can use pins 5-8 if you want and all the tri-state means there is that the interface MCU will not interfere with your UART signal if you don't configure the USB terminal port by sending it a DTR. It's a better idea not to however, just choose 4 pins which aren't used, eliminates one source of problems where you accidentally configure the MCU/USB-UART interface and now you have two things trying to drive one set of lines, that always ends badly.

    Segger RTT is a much, much better way for debugging than UART printfs, so if you can use that, use that.

  • Hi, Above comments are really helpful! Thank you a lot! Now I am able to get the data byte from my ECG chip through UART. However, I encounter another weird behavior. I configured my UART module with the FIFO option enabled. In this way, I suppose to get an event APP_UART_DATA_READY every time when a data byte is available in the FIFO. Nevertheless, instead of having APP_UART_DATA_READY, I am getting APP_UART_DATA event every time when receiving a byte. My program can still work correctly with above setting, but I am just puzzled and wondering why its not triggering the proper event. Thank you!

Related