Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Serial data throughput via QBluetooth issues
QtWS25 Last Chance

Serial data throughput via QBluetooth issues

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 375 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mjsillu
    wrote on last edited by
    #1

    Hi,

    I'm having issues receiving data from a device via bluetooth on Linux (Ubuntu 20.04.2). The device has both serial and bluetooth functionality and is sending data at 921600 baud on the serial bus. There are no issues reading the data from /dev/ttyUSB0 using QtSerialPort via the readyRead() Signal. I receive data packets (31 bytes custom protocol) at exactly 1kHz. Among the data is a counter which increases by 1 for each packet sent.
    However, when the connection is established via bluetooth I seem to be missing several packets (even in the lower 100s) at a time (number of missed consecutive counts) resulting in an average rate of ~500Hz. These "gaps" appear irregularly and independent of the distance between the receiver and the device (within a reasonable range). Using a proprietary Windows software with the same receiver in the same conditions does not have these issues.
    When I establish the connection externally via BlueZ (5.53-0ubuntu3.3)

    rfcomm -E -S connect /dev/rfcomm0 $DEVICE_MAC
    

    I can use QtSerialPort on /dev/rfcomm0 instead of /dev/ttyUSB0 and the issues seem to be a lot better, only dropping exactly 2 packets at a time at irregular intervals. This is still not ideal but a lot better.
    So, the question is, what does QBluetooth do differently and are there any parameters which I could set for QBluetoothSocket, QBluetoothLocalDevice, etc.? Qt is version is 5.12.8-0ubuntu1

    ocgltdO 1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • M mjsillu

        Hi,

        I'm having issues receiving data from a device via bluetooth on Linux (Ubuntu 20.04.2). The device has both serial and bluetooth functionality and is sending data at 921600 baud on the serial bus. There are no issues reading the data from /dev/ttyUSB0 using QtSerialPort via the readyRead() Signal. I receive data packets (31 bytes custom protocol) at exactly 1kHz. Among the data is a counter which increases by 1 for each packet sent.
        However, when the connection is established via bluetooth I seem to be missing several packets (even in the lower 100s) at a time (number of missed consecutive counts) resulting in an average rate of ~500Hz. These "gaps" appear irregularly and independent of the distance between the receiver and the device (within a reasonable range). Using a proprietary Windows software with the same receiver in the same conditions does not have these issues.
        When I establish the connection externally via BlueZ (5.53-0ubuntu3.3)

        rfcomm -E -S connect /dev/rfcomm0 $DEVICE_MAC
        

        I can use QtSerialPort on /dev/rfcomm0 instead of /dev/ttyUSB0 and the issues seem to be a lot better, only dropping exactly 2 packets at a time at irregular intervals. This is still not ideal but a lot better.
        So, the question is, what does QBluetooth do differently and are there any parameters which I could set for QBluetoothSocket, QBluetoothLocalDevice, etc.? Qt is version is 5.12.8-0ubuntu1

        ocgltdO Offline
        ocgltdO Offline
        ocgltd
        wrote on last edited by
        #3

        @mjsillu Did you ever find an explanation / solution?

        M 1 Reply Last reply
        0
        • ocgltdO ocgltd

          @mjsillu Did you ever find an explanation / solution?

          M Offline
          M Offline
          mjsillu
          wrote on last edited by
          #4

          @ocgltd Not exactly. I tried 5 Bluetooth adapters of which 2 worked as expected (no dropped packets) using rfcomm. IIRC the QBluetooth connection worked correctly only if the application doesn't scan for the device, but instead uses a hard-coded/argument provided MAC address. I haven't looked into the issue since then so I can't verify it on newer Qt versions.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved