UART is not working consistently

Hey,

I am in the process of testing the UART peripheral. Currently we are developing an application for which we need the nrf9160 and the nrf52840 chipset. We have decided to use UART communication between the two chips. However, after testing the UART on the nrf52840 DK and the nrf9160 DK, I have noticed some inconsistencies between the data sent and received.

I made a small test where I connected the RX and TX together. For this purpose I used the UART 1 peripehral. When I press button 1, an interrupt is generated which calls uart_tx() to send a trivial string from the TX to the RX. This calls the uart callback function in the code for the RX receive event and sends the data to the console (UART 0). After the first attempt, the entire message is sent to the console. However, after that, the message is only partially received on the console when I press button 1.

Below you can see a picture of the console and the graphical window of the logic analyzer:

I am always sending the same data. This can be seen in the on the left side of the snipped where the logic analyzer is. However, different chunk of the data is being shown in the serial terminal.

Why is this the case? 

I have added the whole project in the below zip file:

 6560.fund_less5_exer1_solution_1.zip

Basically, I took the example from the Nordic Academy and adapted it to my needs.

OS: Windows

SDK: 2.3.0-rc1

IDE: Visual Studio Code

Hardware: nRF52840 DK

Related