I'm trying to run two UARTs out of my NRF52840. Do you have an example in which both SoftDevice UARTs are used? The Nordic Infocenter SDK 14.0.0 documentation lists one of the advantages of the new serial port library as multi-instance capability, but there is no example demonstrating such usage.
I started in SDK 12 and wrote my own alternative to app_uart that would allow multiple UART instances. After enabling UART0 and UART1 in the SDK config, I was unable to get both working at the same time. When I initialized a single UART using the board's default TX/RX pins (6 & 8 for pca10056) and NRF_UARTE0 (0x0002000) I was able to see all my serial data come through fine. However, switching to use NRF_UARTE1 (0x40028000) causes the app to crash and restart on attempting to read or write data, despite my using the same pins and configuration parameters as with UART0.
I've seen other questions regarding similar issues, and the general response was that the SDK 14 serial class would resolve this issue. However, I have since downloaded SDK 14 and am seeing the same behavior. I can initialize one UART port with nrf_serial_init, provided the serial port instance uses NRF_UARTE0/NRF_UART0, but again the same parameters do not work with NRF_UARTE1.
Update 06.09.2018 :
Below example is available in SDK15.1 and following under location: sdk\nrf5\examples\peripheral\serial_uartes
I tested it on my NRF52840 DK (PCA10056).
There is following concept: PC -> UARTE0 -> UARTE1 -> PC
Simply open nrf_serial example: nRF5_SDK_14.0.0_3bcc1f7\examples\peripheral\serial for pca10056.
Replace main.c with attached main.c.
In SDK config set both UARTs to use EASY DMA:
Now run terminal like PuTTY with baud rate == 115200 and start typing text. You shall be able to see echo on the screen.
IMPORTANT! Connect PINs P0.27 with P0.26 (UARTE0 TX with UARTE1 RX).
UPDATE for SDK15 users:
In order to make it work you need to replace:
with attached files:
Ok, I'll give it a try today, thanks!
Just to be crystal-clear. I am using USB for serial connection between PC and DK.
Got it! It actually turned out I was using the wrong .S file! Thank you for the example!
Hey i tried to use the same example, It did not worked for me. can you please share the piece of code. It just print "H" for me.
Are you sure you used the correct SDK version, correct configuration, connected the right pins and used correct settings in your terminal software? I just tested it, and it worked as expected.