cancel
Showing results for 
Search instead for 
Did you mean: 

ST Sensor tile.box pro with FP-SNS-DATALOG2 , can't find the BLE UUID for Data Logging

makerbox
Associate II

I am using a ST Sensor tile.box pro with FP-SNS-DATALOG2 function pack, I have already used the Python GUI software with USB connection and ST BLE Sensor app for data logging to save into the microSD card, which works fine. 

Now , I would like to use python program to start the data logging process and possibly selecting the sensors for logging, for this, I am looking for the UUID related to these, and I can not find from the FP-SNS-DATALOG2 program. Where can I find related information for these? 

I have used a BLE Sniffer app to look for the available UUID but little to no description I found from the FP-SNS-DATALOG2 code how it actually works with the app so that I can replicate for my needs.

 

Primary service/Unknown service 01: 
COPY_CONSOLE_SERVICE_UUID	00 00 00 00 00 0E 11 e1 9a b4 00 02 a5 d5 c5 1b

Unknown Characteristics:
COPY_TERM_CHAR_UUID	00 00 00 01 00 0E 11 e1 ac 36 00 02 a5 d5 c5 1b
COPY_STDERR_CHAR_UUID	00 00 00 02 00 0E 11 e1 ac 36 00 02 a5 d5 c5 1b


Primary service/Unknown service 02: 
COPY_FEATURES_SERVICE_UUID	00 00 00 00 00 01 11 e1 9a b4 00 02 a5 d5 c5 1b

Unknown Characteristics:
COPY_MACHINE_LEARNING_CORE_CHAR_UUID	00 00 00 0F 00 02 11 e1 ac 36 00 02 a5 d5 c5 1b
COPY_HIGH_SPEED_DATA_LOG_CHAR_UUID	00 00 00 11 00 02 11 e1 ac 36 00 02 a5 d5 c5 1b
COPY_EXT_CONFIG_CHAR_UUID	        00 00 00 14 00 02 11 e1 ac 36 00 02 a5 d5 c5 1b
COPY_PNPLIKE_CHAR_UUID	                00 00 00 1b 00 02 11 e1 ac 36 00 02 a5 d5 c5 1b
COPY_RAW_PNPL_CONTROLLED_CHAR_UUID	00 00 00 23 00 02 11 e1 ac 36 00 02 a5 d5 c5 1b

 @SimonePradolini @Federica Bossi 

8 REPLIES 8
casadeib
ST Employee

Hi @makerbox,

You can find a lot of information for datalog2 package in this attached document.
Also consider the various links present for descriptions of downloadable SW packages for the BLE.

 

Hope this could help.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

I have checked this file over and over and it is clear to me, and I went through the example code itself for Sensor tile box pro. I can’t find how the android software is communicating with the Datalog2 software. I get the gest that, it is communicating with datalog2 with pnpl and some internal mechanism. But i want to communicate with the datalog2 with python script and BLE.. I cant find the UUID related to each commands, for example which UUID is responsible for Start Logging? or which command is it x01 or start or START? I have used nRF BLE app to find UUIDs exposed, i have listed them above, those matches with what i can find in the code examples. But, which one really communicating that was my question! 

 

 

Hello @makerbox 

I'm sorry for the very long response, but I need to describe you all the communication process to give you the best answer as possible.


DATALOG2 communication channel is based on two concepts: PnPL communication protocol and Device Template models. We’re describing a bit those concepts also in the User Manual chapter 2.5 and 2.6.

A Device Template is a JSON file expressed with the Digital Twins Definition Language (DTDL) V.2 language, as defined by Microsoft Azure. It defines the characteristics and behaviors of a type of device that connects to an application. Telemetries, property changes, and commands get encapsulated into the so called PnPL messages and exchanged between the SDK, the cloud, and devices that have direct internet access. DATALOG2 device models are distributed both in STDATALOG-PYSDK (to be used locally) and in an online catalog (used by BLESensor app).

PnP-Like messages are derived by a Device Template and are independent of the communication interface used (BLE, USB, serial, …). PnP-Like is a language shared and known by each element in the whole platform virtualization architecture. Knowing the Device Template each host can parse or create PnP-Like messages. They are used to:

  • configure device parameters (pnpl SET (writable) Property messages, for example: Set a specific sensor's ODR)
  • get current parameters values (PnPL GET Component/Device status messages: for example: Properties of a sensor (ODR, FS, enabling status, …))
  • control the device behavior using commands (PnPL COMMAND messages: for example: Start/stop logging).

 

So, going back to your original question: there’s no specific UUID for each command, but each command is a JSON and all of them are streamed on the same BLE characteristic (you called COPY_PNPLIKE_CHAR_UUID). The BLE app knowing the related Device Template can generate/parse the JSON command properly. PYSDK is doing the same through the dedicated pnpl package. From the firmware side, commands and properties are exposed as a sort of API in the files contained into the PnPL folder of the project.

If you'd like to build up your Python/BLE application, we’re also providing some Python example scripts you can have a look into. Refer to these scripts and these Python notebooks. I strongly suggest starting from them.

 

I wish this (very long) post can clarify a bit and answer you question.

Best regards,

Simone

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

ok, so the Sensor tile box pro with datalog2 has a device tree model which has all the information about the sensors and devices capabilities. Now, if the user sends PnP like json scripts, the software uses that scripts to do the tasks? 

 

here for example, if I want to enable STTS22H_TEMP temperature sensor so my configuration will be 

{'stts22h_temp': {'odr': 1.0, 'fs': 100.0, 'enable': True, 'samples_per_ts': 1, 'dim': 1, 'ioffset': 0.9999943971633909, 'measodr': 0.9999998807907104, 'usb_dps': 12, 'sd_dps': 16, 'sensitivity': 1, 'data_type': 'float', 'sensor_annotation': '', 'sensor_category': 0, 'st_ble_stream': {'id': 3, 'temp': {'enable': False, 'unit': '°C', 'format': 'float', 'elements': 3, 'channels': 1, 'multiply_factor': 1, 'odr': 1}}, 'c_type': 0, 'stream_id': 0, 'ep_id': 0, 'unit': 'degreeCelsius'}} 

note : I found this on the debug message when connecting with USB.

 

So, what I understood was to start my logging, I just use above debug message as text utf-8  write to this UUID ?

 

COPY_PNPLIKE_CHAR_UUID = "00000023-0002-11e1-ac36-0002a5d5c51b"

I sent a simple configuration as a text UTF-8 write to that UUID,

{'log_controller': {'start_log': True}}

then, 

{'stts22h_temp': {'odr': 1.0, 'fs': 100.0, 'enable': True}} 

then,

{'log_controller': {'start_log': False}}

 

Although doing this didn't work. Do you mind explaining this part as well?

SimonePradolini
ST Employee

Hello @makerbox 

I'm sorry, but it is not clear to me the purpose of your application. I'd like to help you, but I need to better understand your final goal. Would you like to create a "BLESensor app" in Python, so to enable a new BLE channel between a PC and a board? If so, you can have a look into the BLESensor Android application source code or BLESensor iOS application source code.

The commands you are creating seems well formatted, but remember that the DATALOG2 firmware manages BLE channel only for configuration. Sensor data will be saved onto SD card only, no sensor data are streamed via the BLE characteristic. Considering your application working properly, is already there an SD card into the board?

 

Best regards

Simone

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Yes, you have guessed it exactly what i want to do. 

Basically we have few Sensor tile box pro, and we want to use the Datalog 2 software. We want to select each Sensor tile box and start data logging into the SD card. Not much of functionality is needed so far, just to control 5/6 available sensors on board and save logged data onto the sd card. If BLE allows, stream the data through BLE later on but not the current priority. Currently, we are using BLE sensor app to control the Datalog 2 firmware, but it needs to be done by a Raspberry Pi hence the Python BLE combination.

 

I have actually went through the Android and IOS app before, but as i am not really proficient on swift or android coding, i have to go through again, with keeping all the new information on mind. 

 

Hence, posting in here to know, if simply writing the text format to the UUID Would initiate the logging, so far i couldn't achieve, it works with BLE sensor app, simply writing it doesn't do anything.

Hello,

Once BLE connection is established between two nodes, they negotiate each other the packet length (MTU - do you know the acronym?). Maybe in your setup the length is less then the length of the message, so the message isn’t received correctly (and so isn’t valid).

By default it’s 20 (\0 character included). When the string is longer, we built a transfer protocol to manage this situation, both in firmware and in the BLE app.

From the firmware side, the code portion related to this protocol is in the BLE_Manager.c file. 

BLE_Command_TP_Parse and BLE_Command_TP_Encapsulate are the C methods that we developed to parse and to prepare the BLE packet.

I wish this can help you.

 

PS: have you ever launched the stdatalog_examples\function_tests\stdatalog_API_examples_HSDLink.py from the PYSDK? It will show you the main function that demonstrates the usage of the HSDLink API, including PnPL commands. It’s necessary to connect a compatible device to the PC to run the script. You can play with to check the validity of the JSON command you'd like to build.

 

 

Best regards,

Simone

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks Simone, i will check it, and get back to you.