cancel
Showing results for 
Search instead for 
Did you mean: 

Sensortile BlueNRG-MS Custom Service ACI

RADS1
Associate II
Posted on February 28, 2017 at 16:19

Hi,

I am working on Sensortile kit with the BlueNRG-MS radio.

As per ST document PM0237 section 3.3, pg 55/99, following commands are used to add custom service to BLE device :

//Add the service with service_uuid 128bits UUID

aci_gatt_add_serv(UUID_TYPE_

128, service_uuid, PRIMARY_SERVICE,

7

,&ServHandle);

//Add the characteristic with charUuid_1 128bits UUID

aci_gatt_add_char(ServHandle, UUID_TYPE_128, charUuid_1, 20,

CHAR_PROP_NOTIFY, ATTR_PERMISSION_NONE, 0,16, 1, &CharHandle_1);

//Add the characteristic with charUuid_2 128bits UUID

aci_gatt_add_char(ServHandle, UUID_TYPE_128, charUuid_2, 20,

CHAR_PROP_WRITE|CHAR_PROP_

WRITE_WITHOUT_RESP, ATTR_PERMISSION_NONE,

GATT_NOTIFY_ATTRIBUTE_WRITE,

16, 1, &CharHandle_2);

In above 7 indicates the maximum number of attribute records that can be added to this service. However, as per my understanding BlueNRG-MS always adds 6 mandatory attribute records in any custom service. So for above example, the maximum number of attribute records would be :

6(mandatory attribute records) + 1 (charUuid_1 attribute) + 1 (charUuid_2 attribute) = 8 attribute records

What is incorrect in the above calculated value of 8 as the maximum number of attribute records ? As 7 is used as the maximum number of attribute records in above example.

Any help on above would be appreciated.

#sensortile-bluenrg-ms-custom-service-aci*
7 REPLIES 7
Antonio Vilei
Senior III
Posted on March 03, 2017 at 10:04

Dear Rushikesh Suthar,

the mandatory attribute records you are referring to are probably the Generic Attribute Service and the Generic Access Service (i.e. GATT and GAP) that must be available for each BLE device. Please notice that these attributes are stored in the attributes database only once. This means that when you create your own custom service, there is no need to allocate room for them again.

If you want to create a new service that includes one characteristic with one value and one descriptor, you need:

1 attribute for the service + 1 attribute for the characteristic + 1 attribute for the characteristic value + 1 attribute for the characteristic descriptor = 4 attributes

For more information about the Aci_Gatt_Add_Serv command, please refer to page 79 of the

BlueNRG-MS Bluetooth LE Stack Application Command Interface (ACI) User Manual (UM1865):

4.6.2 Aci_Gatt_Add_Serv

Add a service to GATT Server. When a service is created in the server, the host needs to

reserve the handle ranges for this service using Max_Attribute_Records parameter. This

parameter specifies the maximum number of attribute records that can be added to this

service (including the service attribute, include attribute, characteristic attribute,

characteristic value attribute and characteristic descriptor attribute). Handle of the created

service is returned in command complete event.

Also, you may use the BlueNRG GUI and its 'Service Management...' feature within the 'ACI Utilities' tab if you want to experiment with custom service and characteristics creation. The tool will automatically calculate the number of attributes records that you need.

Hope that helps,

Antonio

Posted on March 04, 2017 at 11:38

Hi Antonio,

Thanks for your reply pointing out BlueNRG GUI ACI utility.

If only custom attributes are to be included in the 'Max_Attribute_Records' parameter, then what is the correct interpretation of '7'(breakup in terms of sum of individual attributes) in the following as mentioned in 

PM0237 section 3.3, pg 55/99

  :

//Add the service with service_uuid 128bits UUID

aci_gatt_add_serv(UUID_TYPE_

128, service_uuid, PRIMARY_SERVICE,

7

,&ServHandle);

Can you clarify further ?

Posted on March 07, 2017 at 10:39

Hi,

for the example mentioned in PM0237 and according to what

Vilei.Antonio

correctly indicated, you should have:

Max_Attribute_Records:

1 (attribute for the service) + 1 (attribute for char_uuid1 declaration) + 1 (attribute for char_uuid1 value) + 1 (attribute for char_uuid2 declaration) + 1 (attribute for char_uuid2 value) + 1 (attribute for char_uuid1 CCCD) = 6;

where CCCD is the Client Configuration Characteristic Descriptor (since char_uuid1 has CHAR_PROP_NOTIFY property).

In the example, 7 is big enough to also add the CHAR_PROP_NOTIFY property for char_uuid2.

Hope that clarifies.

Posted on March 07, 2017 at 21:08

Hi,

That brings in further clarification. I am trying to interface Sensortile kit with BlueNRG GUI so that I can know the exact attribute assignment details for custom bluetooth service.

I have BlueNRG GUI v2.2.2 installed.

Can someone point out the correct firmware for interacting with Sensortile kit from BlueNRG GUI ?

I am using Nucleo board(F401RE) for flashing the Sensortile kit. I hope it is possible to interact with Sensortile kit via BlueNRG GUI v2.2.2, however, I could not find the relevant information in UM2058(BlueNRG GUI SW package) the path 'C:\Program Files (x86)\STMicroelectronics\BlueNRG GUI 2.2.2\Firmware'.

Thanks.

Posted on March 08, 2017 at 11:43

Hi,

for the time being you can't interface the SensorTile with the BlueNRG GUI. As starting point you could use your  Nucleo F401RE+BlueNRG-MS expansion board and setup your use case through the GUI. To do that you should upload the Virtual_COM_Port program (for Nucleo F401RE) included in the

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-software/x-cube-ble1.html

 package.

Regards.

Posted on March 15, 2017 at 10:30

Hi,

What are the major differences between BlueNRG-MS(in Sensortile) and SPBTLE-RF( in BlueNRG-MS Expansion board) module radios as far as firmware programming/SPI interface is concerned ?

Posted on March 27, 2017 at 10:18

Dear Rushikesh Suthar,

there is no difference in the BlueNRG-MS chip that you find in the SensorTile and the one included in the SPBTLE-RF module: it's exactly the same.

If you want to use the BlueNRG-GUI, however, you need code running on your MCU to exchange commands and events between the PC and your BlueNRG-MS chip. This code is already available for some STM32 Nucleo boards, but not yet for the SensorTile. If you want to, you could port the code to the SensorTile board yourself by starting from the Virtual_COM_Port project for Nucleo-L476RG included in the X-CUBE-BLE1 package. You basically need to change the pin configuration to match that of your SensorTile board (which is based on the same MCU, i.e. STM32L476).

If you already have a NUCLEO-F401RE and a BlueNRG-MS expansion board (X-NUCLEO-IDB05A1), however, you could follow Andrea's advice and save a bit of time.

Hope that helps,

Antonio