🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    How to set MTU for BLEUARTClient

    UiFlow 2.0
    1
    3
    36
    Loading More Posts
    • 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
      mchott
      last edited by mchott

      Hello, I am trying to receive data on a Core2 that I am sending from an Atom S3 Lite.

      On the S3, I send the data via BLE server with a simple ‘write’ and I can read the data on a smartphone.

      When I establish a connection on the Core2 as a BLE client, the connection works, but with ‘read’ I only get the first 20 characters of the sent data.

      This is probably normal for BLE connections, but I get the full length on the smartphone, so sending is not the problem. Normally, you can set an MTU on the receiving side. However, the ‘set_mtu’ command does not seem to exist on the Core2.

      The ‘new’ library contains this ‘set_mtu’ command.

      HOW can you set the MTU on the Core2 BLE client?

      M 1 Reply Last reply Reply Quote 0
      • M
        mchott @mchott
        last edited by

        I have now tested the ‘new’ BLE Brick, and although it has an MTU command, the following error occurs:

        Traceback (most recent call last):
        File ‘<stdin>’, line 27, in ble_client_on_connected_event
        File ‘m5ble/m5ble.py’, line 556, in set_mtu
        ValueError: Not connected to a server

        I set the MTU within the ‘ble_client_on_connected_event’ function, which is only called after connecting to the server, and I can both read and write with the server.

        1 Reply Last reply Reply Quote 0
        • M
          mchott
          last edited by

          Btw:

          The BLE server can send and receive long messages.

          The BLE client can send long messages, but has this limitation for received messages.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post