Bluetooth BLE. Problem of packetsize when notify

Project context:

Server BLE for home trainer diy

Target (Bluetooth server) : Bluefruit nRF52 The feather
Library : BluefruitBLE
Client : nRF Connect (Android)

Problem description:

I work with the characteristic (CyclingPowerMeasurement (0x2A63, UUID GATT), which size is 32 bytes.

I check the characteristic with nRF Connect:

  • When Read : Good size (32 bytes) , and the good values.
  • When Notify: Only 20 bytes, and not the good values.
//init of the characteristic
  m_Measurement.setProperties(CHR_PROPS_NOTIFY |CHR_PROPS_READ );
    m_Measurement.setPermission(SECMODE_OPEN, SECMODE_NO_ACCESS);
    m_Measurement.setFixedLen(32);//(SIZE_CPS_MEAS_DATA);
    m_Measurement.setMaxLen(32);
    m_Measurement.setCccdWriteCallback( fctCCCdCallback);  // Optionally capture CCCD updates   ?????
    m_Measurement.begin();//validation de l'attachement de la caractéristique au service
  
// a write         m_pCyclingPower_Service->m_Measurement.write(m_pCyclingPower_Service->m_CPSMeasurementData.bPaquet_CPS_Meas, 32 );
//a notify[b][/b]
         if (!m_pCyclingPower_Service->m_Measurement.notify(m_pCyclingPower_Service->m_CPSMeasurementData.bPaquet_CPS_Meas, 32 ) )
            Serial.println("ERROR: Notify for CPS Measurement not set in the CCCD or not connected!");

Some suggestions:

I think there is a limitation of 20 bytes..
but i don't know how to modify or check it

thanks!!!!

I'm by no means an expert, but I do know that two BLE devices negotiate a maximum transmission unit (MTU), which is the maximum number of bytes that can be sent (or exchanged in general?) in a single frame.

I don't remember ever seeing an MTU less than 500 or so, so it's probably not your issue, but you could check it just to rule it out. The library most likely has some method to get the MTU.

Pieter

Thank you Pieter,
But with the read command it works fine.
So I think i have enough MTU.
and it's a very small packet of 32 octets only.

br.
Vincent