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

Unable to send data via UART using NRF52-DK on Ubuntu

Hi!

I'm using a barebones example project from SDK 12.3.0, under examples/peripheral/uart, with two versions of nRF52-DK boards (pca10056 and pca10040). The goal is to read and write UART data from a serial port.

I can confirm this works both ways on a Windows machine, but on an Ubuntu machine, I can only read. Furthermore, it *sometimes* works to send data, but it is not reliable. I suspect this has something to do on how Ubuntu is handling the serial ports, in reference to cdc_acm, as this isn't a problem that I'm seeing on nRF devices using a different UART solution. In fact, it seems related to this issue: https://devzone.nordicsemi.com/f/nordic-q-a/29209/nrf52-dk-embedded-serial-port-issues-on-ubuntu but I have removed ModemManager, with no effect.

My output in /var/log/syslog is as follows:

   53 Jun 13 10:44:06 tylerpc kernel: [ 8534.941739] usb 1-2.2.1: new high-speed USB device number 11 using xhci_hcd
   54 Jun 13 10:44:06 tylerpc kernel: [ 8535.054587] usb 1-2.2.1: config 1 interface 1 altsetting 0 bulk endpoint 0x83 has invalid maxpacket 64
   55 Jun 13 10:44:06 tylerpc kernel: [ 8535.054594] usb 1-2.2.1: config 1 interface 1 altsetting 0 bulk endpoint 0x4 has invalid maxpacket 64
   56 Jun 13 10:44:06 tylerpc kernel: [ 8535.055120] usb 1-2.2.1: New USB device found, idVendor=1366, idProduct=1015
   57 Jun 13 10:44:06 tylerpc kernel: [ 8535.055127] usb 1-2.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
   58 Jun 13 10:44:06 tylerpc kernel: [ 8535.055131] usb 1-2.2.1: Product: J-Link
   59 Jun 13 10:44:06 tylerpc kernel: [ 8535.055136] usb 1-2.2.1: Manufacturer: SEGGER
   60 Jun 13 10:44:06 tylerpc kernel: [ 8535.055140] usb 1-2.2.1: SerialNumber: 000683607511
   61 Jun 13 10:27:47 tylerpc gnome-session[8986]: (gnome-software:9697): Gs-WARNING **: failed to call gs_plugin_refine_app on icons: Ikonet "application-x-firmware" er ikke tilgængeligt i temaet (null)
   62 Jun 13 10:44:06 tylerpc mtp-probe: checking bus 1, device 11: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2/1-2.2.1"
   63 Jun 13 10:44:06 tylerpc mtp-probe: bus: 1, device: 11 was not an MTP device
   64 Jun 13 10:44:06 tylerpc kernel: [ 8535.111709] cdc_acm 1-2.2.1:1.0: ttyACM0: USB ACM device
   65 Jun 13 10:44:06 tylerpc kernel: [ 8535.113025] usbcore: registered new interface driver cdc_acm
   66 Jun 13 10:44:06 tylerpc kernel: [ 8535.113027] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
   67 Jun 13 10:44:06 tylerpc kernel: [ 8535.114276] usb-storage 1-2.2.1:1.3: USB Mass Storage device detected
   68 Jun 13 10:44:06 tylerpc kernel: [ 8535.116376] scsi host3: usb-storage 1-2.2.1:1.3
   69 Jun 13 10:44:06 tylerpc kernel: [ 8535.117242] usbcore: registered new interface driver usb-storage
   70 Jun 13 10:44:06 tylerpc kernel: [ 8535.121310] usbcore: registered new interface driver uas
   71 Jun 13 10:44:07 tylerpc kernel: [ 8536.146845] scsi 3:0:0:0: Direct-Access     SEGGER   MSD Volume       1.00 PQ: 0 ANSI: 4
   72 Jun 13 10:44:07 tylerpc kernel: [ 8536.148478] sd 3:0:0:0: Attached scsi generic sg1 type 0
   73 Jun 13 10:44:07 tylerpc kernel: [ 8536.148774] sd 3:0:0:0: [sdb] 21829 512-byte logical blocks: (11.2 MB/10.7 MiB)
   74 Jun 13 10:44:07 tylerpc kernel: [ 8536.149072] sd 3:0:0:0: [sdb] Write Protect is off
   75 Jun 13 10:44:07 tylerpc kernel: [ 8536.149080] sd 3:0:0:0: [sdb] Mode Sense: 0b 00 00 08
   76 Jun 13 10:44:07 tylerpc kernel: [ 8536.149380] sd 3:0:0:0: [sdb] No Caching mode page found
   77 Jun 13 10:44:07 tylerpc kernel: [ 8536.149393] sd 3:0:0:0: [sdb] Assuming drive cache: write through
   78 Jun 13 10:44:07 tylerpc kernel: [ 8536.153410]  sdb:
   79 Jun 13 10:44:07 tylerpc kernel: [ 8536.155003] sd 3:0:0:0: [sdb] Attached SCSI removable disk
   80 Jun 13 10:44:08 tylerpc udisksd[9849]: Mounted /dev/sdb at /media/tyler/JLINK on behalf of uid 1000

I am using the latest JLink software, V6.32f.

Parents
  • Hi Tyler,

    Could you try the example from the newest SDK (v15) instead?

    Also I would recommend you to downgrade the Jlink software to v6.22 instead. (it is the latest known stable version)

    Please report back with your findings.

    Thanks

  • Hello Martin,

    This seems to solve the issue. It appears that the development kit is also connected in a different way, as such:

      13 Jun 14 08:38:23 tylerpc kernel: [  871.719864] usb 1-4: new high-speed USB device number 9 using xhci_hcd
      14 Jun 14 08:38:23 tylerpc kernel: [  871.860484] usb 1-4: config 1 interface 1 altsetting 0 bulk endpoint 0x83 has invalid maxpacket 64
      15 Jun 14 08:38:23 tylerpc kernel: [  871.860491] usb 1-4: config 1 interface 1 altsetting 0 bulk endpoint 0x4 has invalid maxpacket 64
      16 Jun 14 08:38:23 tylerpc kernel: [  871.860904] usb 1-4: New USB device found, idVendor=1366, idProduct=1015
      17 Jun 14 08:38:23 tylerpc kernel: [  871.860911] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
      18 Jun 14 08:38:23 tylerpc kernel: [  871.860916] usb 1-4: Product: J-Link
      19 Jun 14 08:38:23 tylerpc kernel: [  871.860920] usb 1-4: Manufacturer: SEGGER
      20 Jun 14 08:38:23 tylerpc kernel: [  871.860924] usb 1-4: SerialNumber: 000683607511

    Although I need to also support nRF51 as well, so that means I'm using SDK v12.3.0. Will this pose an issue? Was the problem in the JLink driver?

    Edit: Testing with SDK v12.3.0 seems to repeat the problem, and I'm almost certain it has to do with being classified as "cdc_acm". If I flash with SDK v12.3.0 and leave it connected, it works perfectly. As soon as I reconnect, I get this output with "cdc_acm":

    186 Jun 14 08:58:46 tylerpc kernel: [ 2095.495558] usb 1-4: new high-speed USB device number 12 using xhci_hcd
     187 Jun 14 08:58:46 tylerpc kernel: [ 2095.636358] usb 1-4: config 1 interface 1 altsetting 0 bulk endpoint 0x83 has invalid maxpacket 64
     188 Jun 14 08:58:46 tylerpc kernel: [ 2095.636367] usb 1-4: config 1 interface 1 altsetting 0 bulk endpoint 0x4 has invalid maxpacket 64
     189 Jun 14 08:58:46 tylerpc kernel: [ 2095.636962] usb 1-4: New USB device found, idVendor=1366, idProduct=1015
     190 Jun 14 08:58:46 tylerpc kernel: [ 2095.636970] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
     191 Jun 14 08:58:46 tylerpc kernel: [ 2095.636975] usb 1-4: Product: J-Link
     192 Jun 14 08:58:46 tylerpc kernel: [ 2095.636980] usb 1-4: Manufacturer: SEGGER
     193 Jun 14 08:58:46 tylerpc kernel: [ 2095.636985] usb 1-4: SerialNumber: 000683607511
     194 Jun 14 08:58:46 tylerpc kernel: [ 2095.638647] cdc_acm 1-4:1.0: ttyACM0: USB ACM device
     195 Jun 14 08:58:46 tylerpc kernel: [ 2095.640415] usb-storage 1-4:1.3: USB Mass Storage device detected
     196 Jun 14 08:58:46 tylerpc kernel: [ 2095.641006] scsi host3: usb-storage 1-4:1.3
     197 Jun 14 08:58:46 tylerpc mtp-probe: checking bus 1, device 12: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4"
     198 Jun 14 08:58:46 tylerpc mtp-probe: bus: 1, device: 12 was not an MTP device
     199 Jun 14 08:58:47 tylerpc kernel: [ 2096.668515] scsi 3:0:0:0: Direct-Access     SEGGER   MSD Volume       1.00 PQ: 0 ANSI: 4
     200 Jun 14 08:58:47 tylerpc kernel: [ 2096.670032] sd 3:0:0:0: Attached scsi generic sg1 type 0
     201 Jun 14 08:58:47 tylerpc kernel: [ 2096.670135] sd 3:0:0:0: [sdb] 21829 512-byte logical blocks: (11.2 MB/10.7 MiB)
     202 Jun 14 08:58:47 tylerpc kernel: [ 2096.670588] sd 3:0:0:0: [sdb] Write Protect is off
     203 Jun 14 08:58:47 tylerpc kernel: [ 2096.670598] sd 3:0:0:0: [sdb] Mode Sense: 0b 00 00 08
     204 Jun 14 08:58:47 tylerpc kernel: [ 2096.671166] sd 3:0:0:0: [sdb] No Caching mode page found
     205 Jun 14 08:58:47 tylerpc kernel: [ 2096.671184] sd 3:0:0:0: [sdb] Assuming drive cache: write through
     206 Jun 14 08:58:47 tylerpc kernel: [ 2096.675434]  sdb:
     207 Jun 14 08:58:47 tylerpc kernel: [ 2096.676814] sd 3:0:0:0: [sdb] Attached SCSI removable disk
     208 Jun 14 08:58:48 tylerpc udisksd[4618]: Mounted /dev/sdb at /media/tyler/JLINK on behalf of uid 1000
    

    Is there a way that I can force it to stay in "xhci_hcd" for SDK v12.3.0?

  • Hi Tyler,

    Could you share your .hex files you are using and the program/script which is reading/writing to the serial port?

    We could make this case private if it's sensitive information. 

    Thanks

  • Certainly.

    Both were compiled with unmodified SDK versions v12.3.0 and v15.0.0 under examples/peripherals/uart/pca10056/blank/armgcc.

    This is the version for SDK v15.0.0, which works.

    nrf52840_xxaa_sdk_15_0_0.hex

    This is the version for SDK v12.3.0, which does not work.

    nrf52840_xxaa_sdk_12_3_0.hex

    For both, I used this command:

    $> picocom /dev/ttyACM0 --baud 115200

    However, I've tried with other serial emulators (screen, etc) which all had the same effect. I have also tested with different baud rates, to no effect.

  • Hi Tyler,

    I would like you to try one more thing could you try with minicom with these settings?:

    Same result?

Reply Children
Related