@makerbox wrote:
@SimonePradolini Ok, now i have got an idea about how to create PnPL messages. Sorry again if i am going round in round. This is my test script in python using USB
message = "{\"stts22h_temp\":{\"enable\":true, \"odr\":1}}"
print(PnPLCMDManager.create_set_property_cmd("stts22h_temp", "enable", True ))
print(hsd_link.send_command(hsd_link_instance, device_id, message))
print(PnPLCMDManager.create_command_cmd("log_controller", "start_log", "interface", 0))
message = PnPLCMDManager.create_command_cmd("log_controller", "start_log", "interface", 0)
print(hsd_link.send_command(hsd_link_instance, device_id, message))
time.sleep(4)
print(PnPLCMDManager.create_command_cmd("log_controller", "stop_log", "interface", 0))
message = PnPLCMDManager.create_command_cmd("log_controller", "stop_log", "interface", 0)
print(hsd_link.send_command(hsd_link_instance, device_id, message))
this is the output
2025-07-01 13:10:03,796 - HSDatalogApp.stdatalog_core.HSD_link.communication.PnPL_HSD.hsd_dll - INFO - Platform Architecture: 64bit
2025-07-01 13:10:04,258 - HSDatalogApp.stdatalog_core.HSD_link.HSDLink - INFO - Commmunication Opened correctly
HSDLink Version: High Speed Datalog DLL v2
{"stts22h_temp": {"enable": true}}
2025-07-01 13:10:04,853 - HSDatalogApp.stdatalog_core.HSD_link.communication.PnPL_HSD.hsd_dll - INFO - PnPL Response: {"PnPL_Response":{"message":"","value":true,"status":true}}
{"PnPL_Response":{"message":"","value":true,"status":true}}
{"log_controller*start_log": {"interface": 0}}
Command sent successfully!
{"log_controller*stop_log": {"interface": 0}}
2025-07-01 13:10:09,236 - HSDatalogApp.stdatalog_core.HSD_link.communication.PnPL_HSD.hsd_dll - INFO - PnPL Response: {"PnPL_Response":{"message":"Error: Acquisition stop failure. Already stopped.","status":false}}
{"PnPL_Response":{"message":"Error: Acquisition stop failure. Already stopped.","status":false}}
---> End of HSDLink APIs test script.
Wasn't it supposed to start the logging through USB? but the stop log command says it is already stopped, do i need any more commands?
USB channel is 1. Try with
message = PnPLCMDManager.create_command_cmd("log_controller", "start_log", "interface", 1)
But it is still not clear to me how your setup should work. Are you managing the DATALOG2 firmware via USB (so streaming data via USB) or via BLE (so saving data onto SD)? The firmware can't let you save data onto SD card if the controller is a USB interface or stream data via USB if the controller is a BLE device. Only USB to USB or SD/BLE to SD are managed by the firmware.
@makerbox wrote:
Question 2 : I am assuming this the same setup for BLE implementation? For BLE i need to write to UUID using following the Packet Headers
BLE_COMM_TP_START_PACKET = 0x00,
BLE_COMM_TP_START_END_PACKET = 0x20,
BLE_COMM_TP_MIDDLE_PACKET = 0x40,
BLE_COMM_TP_END_PACKET = 0x80,
BLE_COMM_TP_START_LONG_PACKET = 0x10
- What is the actual UUID to write? is it ( COPY_EXT_CONFIG_CHAR_UUID )?
No, BLE characteristics is the PNPL you already tested before: COPY_PNPLIKE_CHAR_UUID = "0000001b-0002-11e1-ac36-0002a5d5c51b"
@makerbox wrote:
-
- Does the messages looks like this? ( this is random hex )
#temp setup packets
packet1 = "007b22737474733232685f74656d70223a7b2265"
packet2 = "406e61626c65223a747275657d207b226f647222"
packet3 = "803a20317d7d"
#log start packets
packet4 = "007b226c6f675f636f6e74726f6c6c6572223a20"
packet5 = "407b2273746172745f6c6f67223a20747275657d"
packet6 = "807d"
#log end packets
packet7 = "007b226c6f675f636f6e74726f6c6c6572223a20"
packet8 = "407b2273746172745f6c6f67223a2066616c7365"
packet9 = "807d7d"
Packet message seems ok.
@makerbox wrote:
3. Is there any time (seconds) between sending this to specific messages? or what sequence? setup > start log > wait > stop log ? or any other?
There is no specific timeout, but the communication protocol is based on responses. In other words: for each command/ set-get property, the firmware always answers with a response. So that, the host can always be aware about the board status and if the request just sent has been executed or acknowledged.
So, I strongly suggest you to implement a mechanism with ack (i.e.: send a command and wait for a response before moving to the next one).
Best regards,
Simone