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

Serial Example help

I'm using a nRF52840 DK (PCA10056 2.0.1 2020,14 683193023) with an adafruit FTDI serial TTL-232 USB cable (part number P70C uses the FTDI -FT232R chip inside a translucent case with a red LED for TX and a green LED for RX). All the USB ports on the computer are USB3 and supply power.

Using SES in Ubuntu. I compile and flash the DK with the nordic_sdk/examples/peripheral/serial example. I'm using putty with a serial session connected to /dev/ttyUSB0 at 115200baud, 8 data bits, i stop bit, no parity, no flow control. I'm certain that I have the cable's RTS connected to GPIO pin 5, TXD connected to GPIO pin 6, CTS connected to GPIO pin 7, and RXD connected to GPIO pin 8. I compile and run the code right out of the box, no changes.

I expect to see the string, "Hello nrf_serial!" with a new line appear in my terminal window when I turn the DK board on. Nothing appears and there is no led flashing in the USB-to-serial cable.

I compile the debug version and debug through SES. I step through the program no problems. The "Hello nrf_serial!" string never appears even though there is no error returned. The nrf_serial_read never returns an NRF_SUCCESS on a keystroke, even though the cable's red led flashes on each keystroke.

Funny thing, I open another putty terminal but this time I connect to /dev/tty/ASM0, the USB/j-link. I have a breakpoint set on the nrf_serial_write call. I hit a key while the /dev/ttyASM0 terminal has focus and the key's character immediately appears in the /dev/ttyUSB0 terminal with a flash of the cable's green led, (but not in the /dev/ttyASM0 terminal yet), and then I break on the nrf_serial_write line in the program. I step over the command and the keystroke character is sent to the /dev/ttyASM0 terminal.

So I think to myself, OK maybe this serial library can't function when you have the DK board connected to the computer via the USB/j-link. I'll just turn the DK board off. Properly connect my trusty Otii set at 3.5 volts at 1A to P21. Make sure the nRF Power Switch is still set in the Vdd position and turn the DK board on with Sw8 the Power switch. Nothing. The DK board isn't powered. I turn the DK board off with Sw8. I disconnect the external supply and connect the nRF-USB J3 to a usb port on my computer that I know supplies power. I make sure the nRF Power Swiitch is set to USB position I turn the DK board on with Sw8. Nothing. The DK board isn't powered. I've used this DK board for 6 months but I've never tried to power it up in any other way except through the USB/j-link.

Now I have two questions.

Question 1 : Any idea why the Serial example doesn't work right out of the box?

Question 2: Any idea why I can't power the DK board through J3 or an external supply?

I have another DK board, (PCA10056 2.0.0 2019, 47 683325727) It does the same thing for the serial example and external power.

Thanks for reading this and any insights will be greatly appreciated.

Parents
  • Hi,

    1. Have you tried swapping the TXD and RXD pins? I'm not sure about the FTDI device you are using, but normally UART are connected TXD<-->RXD and RXD<-->TXD. This could explain why you could see the character from the J-Link USB COM port.

    2. How do you determine that the board is not powered? Note that these ways of supplying power to the board only powers the nRF domain, not the J-Link OB interface MCU. LED5 will for instance not work. I tested that it is working on my DK by flashing a BLE sample to the board before swapping from J2 USB power to J3/P21 power supply, and it is advertising as expected when checking with nRF Connect app on my phone.

    Best regards,
    Jørgen

Reply
  • Hi,

    1. Have you tried swapping the TXD and RXD pins? I'm not sure about the FTDI device you are using, but normally UART are connected TXD<-->RXD and RXD<-->TXD. This could explain why you could see the character from the J-Link USB COM port.

    2. How do you determine that the board is not powered? Note that these ways of supplying power to the board only powers the nRF domain, not the J-Link OB interface MCU. LED5 will for instance not work. I tested that it is working on my DK by flashing a BLE sample to the board before swapping from J2 USB power to J3/P21 power supply, and it is advertising as expected when checking with nRF Connect app on my phone.

    Best regards,
    Jørgen

Children
Related