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

nRF52 USB-UART broke, half-duplex?

Hi there,

I have multiple PCA10040 boards, and about a year's worth of experience developing code for them. I have suddenly started to have problems with USB-UART connections. Not even Nordic's SDK example code (in ../examples/peripheral/uart) is dependable for me. This may not be a Nordic problem, but someone here may recognize what is wrong.

Occasionally, my problem is that Nordic programs which use UART are receiving characters from my keyboard over USB, but the Nordic is apparently not transmitting. Mostly, I have the opposite problem. My terminal emulator receives input from the Nordic, but I can't transmit characters to it. Once in a rare while, I do recover bidirectional communications. Then it disappears again.

I have two PCA10040 boards in active development. Both are showing the same symptoms. I have tried different USB cables. This does not solve the problem. This rules out damaged boards or cables.

Meanwhile: PROGRAMMING the boards over JLink is working perfectly. I can connect. I can reset the board and restart it. I can flash binary files. If I try to flash the same binary file twice in a row, I receive a message informing me that the board does not need to be flashed, since the contents match. That means that I do have bidirectional communication with the Nordic board, just not through the UART.

My development system is normally configured as follows:

OS : Ubuntu Linux 16.04, recently upgraded from 16.04.1 to 16.04.2 (that may be relevant)

Compiler : GCC (whatever version is current in the Ubuntu repository, currently 5.4.0)

Toolchain : gcc-arm-none-eabi-4_9-2015q1, as recommended by Nordic

Nordic SDK : 11.0.0

JLink : recently upgraded from 6.01 to 6.14, but only after I started to have problems

Terminal : GTKterm, whatever version is provided by Ubuntu (currently 0.99.7)

The standard UART configuration in the Nordic SDK 11 example code is 115200 baud, 8 bits, 1 stop bit, no parity, RTS/CTS hardware flow control. I have had no reason to alter these settings, they have worked well for my applications.

In an attempt to diagnose my problem, I have tried two changes:

  1. Connecting to a different computer, also running Ubuntu 16.04.2, JLink 6.14, and gtkterm 0.99.7. Nothing changed. This rules out a hardware failure in the USB circuitry of my desktop computer (although it would have to be a very weird USB failure to affect the UART, but not the SWD).

  2. Booting my usual computer into Windows 10. I found a program called RealTerm. The problem mostly persisted, although at least once I got a full handshake. When I ran the USB-UART example code, I didn't see the "Start:" prompt that I should have seen. But the characters I typed were echoed, and when I pressed "q" I did receive an "Exit!" message. That suggests a Linux related problem.

There are at least two possible problems on the Linux side: 1) my compiler setup may have changed with the upgrade. 2) GTKterm may have changed with the upgrade.

I have not tried compiling binaries with any setup other than my current setup. I have a few older programs which use UART, which I compiled several months ago, using SDK 0.9.2. These too are now showing half-duplex behavior. These binaries used to work.

I am now left wondering whether there is some subtle incompatibility that was introduced when I upgraded Ubuntu. For example, the version of gcc I now have may not play nicely with the ARM toolchain. I may need to change the compiler flags in the makefile to get the UART to behave again. Maybe I need to upgrade the toolchain at last (it's from 2015), or upgrade the Nordic SDK to version 12?

As I mentioned above, I did upgrade JLink to the latest version, 6.14. But I only did this after I started having problems. JLink upgraded the firmware on the Nordic boards each time I connected a board for the first time. This does not appear to have altered the bad UART behavior. But it won't be easy for me to roll back the JLink firmware if it is relevant.

Alternately, something may have broken in the latest version of GTKterm? I am zeroing in on this possibility, but I don't (yet) have another working terminal emulator as proof. When I booted into Windows, I might have gotten halfway there. But RealTerm is pretty broken. I have also searched through the various Linux terminal emulator options. I am dismayed at how poor terminal emulator software is in general...

If anyone has any advice, I would greatly appreciate it. Thanks!

  • I have similar problem. I had to switch off hardware handshake and stop using UART interrupt while transmitting. So I have typical half-duplex. I dont know where is the problem. Maybe the cause is interchange gpio logic? Recently I figure out, that setting gpio with LED connected to high (1) switch OFF diode and oposite, setting low (0) light ON diode.

  • Check that you are using the correct ttyUSB or ttyACM port. Newer JLinks also contain a USB2Serial capability.

  • EDIT, 2018-01-18:

    I searched in various places for months for advice. The folks in the SEGGER forums implied that there could be something wrong with the Linux serial drivers. The folks over at Ubuntu Forums assured me that a problem that large would not go unaddressed for long.

    When I upgraded to Ubuntu 17.04, problems persisted. When I upgraded to Ubuntu 17.10, problems disappeared. I also have a more current version of SEGGER JLink (v6.22d), and a more current EABI from ARM, and the GTK version has changed, etc., etc. I'm not sure exactly what the problem was, but with the configuration I have now, I have restored full-duplex UART capability.

    My old followup is below the line. I am leaving it here for reference, but I think that I was chasing a false lead.


    I am about to provide a partial answer to my own question, but I need further guidance.

    We have several nRF52 PCA10040 DK boards floating around our lab. I have just determined that we have two slightly different versions. The boards that are causing my UART problem are V1.1.1 boards. All of my UART programs are working flawlessly when I flash to a V1.1.0 DK board.

    I am looking over the compatibility matrix documents:

    infocenter.nordicsemi.com/index.jsp

    I do not see any documentation that distinguishes the nRF52 1.1.0 DK boards from the 1.1.1 boards.

    Have I uncovered an undocumented problem? Whether I have or not, I would appreciate any guidance. Trying a more current SDK would seem to be the obvious next step.

    I will ask a more general question about the differences between the board revisions at the top level.

    Thanks.

  • There should not be any differences between the two rev's. Have you checked if some of your kits have the "SB9" cut for current-measurement?

Related