2024-10-07 09:35 PM - edited 2024-10-07 09:47 PM
Here's a revised version of your message:
---
Hi,
I am using the NUCLEO-WB15CC board for a custom application where I read an analog sensor value with a 12-bit ADC resolution. The issue arises when I try to transmit this data over BLE. I am using the following code to update the BLE characteristic:
In the BLE Toolbox app, I see the hex value `0x0F` when I connect 3.3V to the analog pin. Since `0x0F` is not the expected equivalent of 4095, I believe the data isn't being transmitted correctly. However, when I use `APP_DBG_MSG` to print the ADC value in the Serial Terminal, I can correctly see `4095`.
My second issue is related to low-power mode. I want to update the BLE characteristic every two seconds and enter low-power mode when idle. I'm using an LPTIM IRQ handler to trigger the task every two seconds, and this works fine. But when I set `CFG_LPM_SUPPORTED` to 1, the device no longer shows up in the BLE Toolbox app. Does this mean we can't enter low-power mode while maintaining a BLE connection?
Any insights would be greatly appreciated!
UpdateCharData[0] = (uint8_t)(adc_val & 0xFF);
UpdateCharData[1] = (uint8_t)((adc_val >> 8) & 0x0F);
Custom_STM_App_Update_Char(CUSTOM_STM_MYCHAR, UpdateCharData);
2024-10-07 10:28 PM
Hi,
I really have no idea about this, however, does the BLE Toolbox app break the message into 2 hex strings like "0xFF\n0x0F\n"...?
Kind regards
Pedro
2024-10-21 09:07 AM
Hello @nayeemcron
For your first question, I suggest you create a function that collect the data via ADC and send it. Then, implement it as a task on your Sequencer system. It should work fine.
For the Second request, please have a look at this post. It should help your and use the timer server instead of the LPTIM. More details available on the AN5289.
Best Regards.
STTwo-32
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.
2024-10-22 02:23 AM
Hello
I might be wrong, but in Lowpower mode, am I not be able to see the debug messages in the terminal? If Debugger is enabled, it defines the lpm mode to 0 disabling low power option.
2024-10-22 02:47 AM
Are you testing the same behavior with our Examples?
Best Regards.
STTwo-32
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.
2024-10-22 11:14 PM
Hi, change the "Value Length" parameter to "2" which indicates 2 bytes.
Hope that helps.