Showing results for 
Search instead for 
Did you mean: 

BLE commands used by STM32WB, explanation needed??

Senior III

Good evening....

I have a few questions:

1.  Can someone please explain why with CHAR_PROP_WRITE_WITHOUT_RESP pairing does NOT work but if I change to CHAR_PROP_WRITE pairing works?  I am using Display Only, MITM and no bonding.  Using either one places CubeMX generated code within the same case statement. 



2.  Also with respect to #1 above I was wondering why CubeMX doesn't put (for either property above) statements within the case ACI_GATT_WRITE_PERMIT_REQ_VSEVT_CODE?

3.  Finally with respect to GATT events.  Who is GATT_NOTIFY_ATTRIBUTE_WRITE notifying, the application on the client, the application on the server???  Should you only be using GATT_NOTIFY_....AND_WAIT_FOR_APPL_RESP when Indications are enabled as that is certainly what the verbiage sounds like?

4.  Does ST have some good documentation somewhere describing a lot of these terms, as it appears to me you are at your own and the videos show some basic stuff and thats it?

Thank you



ST Employee

Hello @SWenn.11,

and Sorry to come back late to your question.

1. When you use CHAR_PROP_WRITE, the pairing process includes a response from the server. This response can be part of the security procedures, allowing the client to confirm that the server is legitimate. So, when you switch to CHAR_PROP_WRITE_WITHOUT_RESP, there is no response from the server. This lack of response might be interpreted by the client as a failure to establish a secure connection, especially when MITM protection is required, as there is no confirmation of the write operation's success. The behavior you're experiencing could be due to the client's security requirements not being met when using Write Command (CHAR_PROP_WRITE_WITHOUT_RESP). The client might require a Write Request (CHAR_PROP_WRITE) to ensure a secure channel can be established with the necessary MITM protection.

If you need to use Write Command and still want to establish pairing, you may need to adjust the client's security requirements or the server's characteristic properties to ensure that the security procedures can be successfully completed.

2. If you have set the characteristic property to CHAR_PROP_WRITE_WITHOUT_RESP, STM32CubeMX will not generate code for the ACI_GATT_WRITE_PERMIT_REQ_VSEVT_CODE event because this property indicates that the characteristic can be written without waiting for permission or sending a response back to the client (write command). Instead, the write operation is processed immediately without server-side intervention, and thus no permission event is generated. 

3. The GATT_NOTIFY_ATTRIBUTE_WRITE operation is typically used by the GATT server to notify the client that a characteristic's value has been updated. This is a server-initiated operation. The purpose is to inform the client's application that new data is available to be read from the server without the client having to poll for it.

The use of GATT_NOTIFY_...AND_WAIT_FOR_APPL_RESP or similar functions that wait for an application response is generally linked to indications. When the server sends an indication, it must wait for the client to acknowledge that the indication was received. This acknowledgment is part of the GATT protocol and ensures reliable delivery of the data. 

4. You can refer to AN5289 it guides you to build specific BLE applications.