BLE Serial Profile buffer size (MTU) in NimBLE stack

whowhatwhere1234
Posts: 2
Joined: Mon Nov 15, 2021 11:57 am

BLE Serial Profile buffer size (MTU) in NimBLE stack

Postby whowhatwhere1234 » Thu Mar 03, 2022 8:37 am

Hello.

I'm working on SPP (serial profile) service with NimBLE stack, and I have a question about buffer size.
Maximum buffer size that I can send is 79 bytes, even though my MTU size is set to 150 bytes.

So my question is, how does the stack or BLE in general, handle notification writes/reads? Why do I only receive 79 bytes on the other device, even if I send 140 bytes for example?
I read that maximum characteristic size is 512 bytes so that should not be a problem.
What I expected to happen was that the stack would automatically broke down the message if the size is larger than MTU size, and I could see that by multiple notification events, however this does not seem to happen.

Here is a code snippet. I generate array of numbers and copy it to a string. Size is defined via terminal command.

Code: Select all

    char txbuf[size];
    int index = 0;
    char tx[size];
    for(int i = 0; i < size; i++) {
        txbuf[i] = i;
        index += sprintf(tx + index, "%d", txbuf[i]);
    }
    spp_send(tx);
Thank you!

Who is online

Users browsing this forum: No registered users and 66 guests