Weird behaviour with Arduino BLE on Nano 33 Iot


I have a weired problem with tthe Nano 33 IoT and BLE.
I am using the <ArduinoBLE.h> library and among others I have in my setup loop following characteristic:
`setup() {

BLECharacteristic Peripheral_One_Characteristic("4aa7c925-f4fe-4c42-a642-9f2b9c0b5d91", BLERead | BLEWrite, 120);


I have another idetical board acting as a peripheral.

In my clients loop at some point I have a function
Peripheral_One_Characteristic.writeValue(TransferValues, 120);

TransferValue is an Array of 120 bytes. When I reduce the array size to 16 bytes and the code to
Peripheral_One_Characteristic.writeValue(TransferValues, 16);
the 16 bytes are transferred to the peripheral, however, it is not working at 120 bytes.
What could be the reason?

I am trying to solve it for a long time, but I can't find the solution to it and I need a solution urgently by now :frowning:

This might be relevant:

MTU stands for "maximum transmission unit".

I'm not sure I understand what it says. Haven't I changed the MTU to 120 bytes in my charactersitic?

I'm sure that I don't. It's only that I have noticed often when the subject of "x bytes works but y bytes doesn't" in relation to BLE, where y > x, the discussion usually ends up involving MTU. Perhaps that gives you a useful search keyword for your research.

After researching quite a bit it turns out, that you are right.
I am thoroughly annoyed about The reference webpage and github readme claim, that 512 bytes can be send, but that is obviously not the case.There is a limitation in the utilities\att.cpp.

Within att.h and att.cpp I can see there is a function void ATTClass::setMaxMtu(uint16_t maxMtu) . I don't see, however, how to invoke it and if it is actually doing anything. How would I go about this?

Unfortunately, I don't know anything about this subject. Hopefully one of the other forum members will be able to answer your question.

I am interested in learning more about it, so I appreciate you sharing your findings and I will continue to follow this topic.

1 Like