nRF UART central data send error

I'm trying to connect a nRF52832 DK to a secondary device (BLUETOOTH LOW ENERGY TINYSHIELD (ST)) where the nRF is the central. The example correctly connects to the board when it starts advertising but when I enter data over UART via PuTTY, I'm faced with an error (128).

I've tried to connect to a nRF52840 dongle with nRF connect and an Android phone setup with the UART service UUID and UART TX / UART RX characteristics. This behaves the same.

My second thought was that it has to do with security/bonding. However, since this is initiated from the Central, this would've been included in the NUS service included in the example so this doesn't seem correct. 

Since the error (128) means socket not connected, I figured there must be something wrong with the connection. I've tried to modify &nus_client in bt_nus_client_send() to NULL so it would be sent to any connection available. However, this results in an 'Operation already in progress' error (120). 

Any idea what I'm missing?

  • Hi

    What SDK and SDK version are you using for building and flashing the nRF52832 DK project? And have you made any changes to the sample project on your end?

    I just tried with the central_uart application on an nRF52832 DK and the peripheral_uart  (as well as the nRF5 SDK version of the UART peripheral) and was not able to see this error. Are you sure the service and characteristics are set up correctly on the devices on your end? You should be able to use the peripheral UART sample code as reference. Bonding/pairing should not be an issue when just using the central UART project and Nordic UART service.

    Best regards,

    Simon

  • Hi Simon,

    Thanks for your reply. I'm using nRF Connect v1.7.1.

    Unfortunately, I do not have a second DK yet to try both the Peripheral and Central example at the same time. I've been trying to use the nRF Dongle in the mean time. I've tried to send UART data (PC->nRF52DK Central->nRF52 dongle) towards the dongle (set up as peripheral). This also results in the error. 

    When I use the nRF dongle as central, I can correctly communicate with my peripheral. When I send 'ab' over serial I see 61 62 appear in UART TX. When I enter 31 32 in UART RX, I see '12' over serial. 

    I've slightly modified the example to echo any UART data entered and I've added an extra scan filter so my peripheral is connected to when turned on. 

    Glenn

  • Hi

    Can you show me the full server setup you've done when setting up the Dongle (or phone for that matter) as a peripheral device? And what does the PuTTY window in the first image show? Are you able to transmit data one way but not the other?

    Best regards,

    Simon

  • Hi Simon,

    I've included the content of the .ncs file I use in nRF connect in the code block below. 

    The PuTTY window shows the characters I've entered in to the nRF52 DK which result in the error messages shown by the same nRF52 DK over RTT.

    I'm not able to send data any direction. When I enter data in nRF Connect to be sent via nRF Dongle I see nothing on the nRF52 DK (RTT nor UART). When I enter data via UART to be sent to the nRF Dongle / nRF Connect I get the error message highlighted in yellow via RTT.

    {"selectedComponent":"local.server.4.6","showingDeleteDialog":false,"showingApplyDialog":false,"showingClearDialog":false,"children":{"local.server.1":{"instanceId":"local.server.1","uuid":"1800","name":"Generic Access","expanded":false,"discoveringChildren":false,"children":{"local.server.1.1":{"instanceId":"local.server.1.1","uuid":"2A00","name":"Device Name","value":[110,82,70,53,117],"properties":{"read":true,"write":true},"readPerm":"open","writePerm":"open","fixedLength":false,"maxLength":20,"expanded":false,"discoveringChildren":false,"children":{},"errorMessage":null},"local.server.1.2":{"instanceId":"local.server.1.2","uuid":"2A01","name":"Appearance","value":[0,0],"properties":{"read":true},"readPerm":"open","writePerm":"open","fixedLength":false,"maxLength":20,"expanded":false,"discoveringChildren":false,"children":{},"errorMessage":null},"local.server.1.3":{"instanceId":"local.server.1.3","uuid":"2A04","name":"Peripheral Preferred Connection Parameters","value":[255,255,255,255,0,0,255,255],"properties":{"read":true},"readPerm":"open","writePerm":"open","fixedLength":false,"maxLength":20,"expanded":false,"discoveringChildren":false,"children":{},"errorMessage":null}}},"local.server.2":{"instanceId":"local.server.2","uuid":"1801","name":"Generic Attribute","expanded":false,"discoveringChildren":false,"children":{}},"local.server.4":{"instanceId":"local.server.4","uuid":"6E400001B5A3F393E0A9E50E24DCCA9E","name":"UART over BLE2","expanded":true,"discoveringChildren":false,"children":{"local.server.4.5":{"instanceId":"local.server.4.5","uuid":"6E400002B5A3F393E0A9E50E24DCCA9E","name":"UART RX","value":[],"properties":{"broadcast":false,"read":false,"writeWoResp":true,"write":true,"notify":false,"indicate":false},"readPerm":"open","writePerm":"open","fixedLength":false,"maxLength":20,"expanded":true,"discoveringChildren":false,"children":{},"errorMessage":null},"local.server.4.6":{"instanceId":"local.server.4.6","uuid":"6E400003B5A3F393E0A9E50E24DCCA9E","name":"UART TX","value":[],"properties":{"broadcast":false,"read":false,"write":false,"notify":true,"indicate":false},"readPerm":"encrypt","writePerm":"open","fixedLength":false,"maxLength":20,"expanded":true,"discoveringChildren":false,"children":{"local.server.4.6.7":{"instanceId":"local.server.4.6.7","uuid":"2902","name":"Client Characteristic Configuration","value":[0,0],"readPerm":"open","writePerm":"open","fixedLength":false,"maxLength":20,"errorMessage":null}},"errorMessage":null}}}}}

  • Hi again

    So, I set it up on my phone as well, just to make sure it works, and it does indeed, the settings on the nRFConnect app for the full Nordic UART service is just not as straight forward as you might think. I exported mine as an .xml file here so you can add it as a server in nRF Connect on your Android phone as well to make sure it works. 

    <server-configuration name="SLM_UART - copy">
       <service uuid="6e400001-b5a3-f393-e0a9-e50e24dcca9e">
          <characteristic uuid="6e400002-b5a3-f393-e0a9-e50e24dcca9e" value-string="fr99oooootkrororororororororororororororotoorororororororororrorororororororororoororororororoororor">
             <permission name="WRITE"/>
             <property name="WRITE"/>
             <property name="WRITE_WITHOUT_RESPONSE"/>
          </characteristic>
          <characteristic uuid="6e400003-b5a3-f393-e0a9-e50e24dcca9e">
             <descriptor configure="CCCD"/>
             <property name="NOTIFY"/>
          </characteristic>
       </service>
    </server-configuration>

    Best regards,

    Simon

Related