- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello every one,
I like to read data from ADC via Bluetooth. I just edit one example project and can successfully read data from one channel of ADC.
I like to read two channels, but for somehow I am unable to get data from both channels at the same time.
I will look forward to your suggestions.
Best regards
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I mean - Just implement a switch case in the firmware to set serverTemp.value.val to ChA or ChB each time the loop is executed (to send notification in below order).
ChA value
ChB value
ChA value
ChB value
ChA value
ChB value
If you think that's inconvenient to read from a Central device, as I mentioned before use separate service for each channel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Awais,
When you said " I like to read two channels, but for somehow I am unable to get data from both channels at the same time." what exactly are you observing at your end. Do you see any of the results going wrong ? Did you try debugging observing the values returned by ADC APIs?
Best Regards,
VSRS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello VSRS,
Thank you for your reply!
The data from ADC is correct. I can see it via oscilloscope.
However, when i say " I am unable to get data from both channels". I mean that i cannot see both channels data at the same time on my BLE app.
Means, I can send one channel at a time but not both channels at the same time.
Looking forward to your reply!
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Try sending the ADC output from both channels one by one in alternate notifications and see if that helps.
You can also try appending both ADC channel output to a single variable and send it in a single notification (increased notification size).
I think having a separate service for both channels will make it easy to read the notifications from corresponding ADC channel and avoid any dependencies.
BTW, I saw below code in the attached project that will not help you send all ADC output values together. It will always send ChB data.
//Send notification
serverTemp.attrHandle = CYBLE_POTENADC_POTEN_CHAR_HANDLE; // For Updates.
serverTemp.value.val = value_ChA; // Read value of Custom Characteristics (Data).
serverTemp.value.val = value_ChB; // Read value of Custom Characteristics (Data).
serverTemp.value.len = sizeof(value_ChA); // Define size
serverTemp.value.len = sizeof(value_ChB); // Define size
if(CYBLE_ERROR_OK==CyBle_GattsNotification(cyBle_connHandle,&serverTemp))
You need to have a switch to send either ChA or ChB alternatively.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello SRDS,
Thank you for your reply!
"Try sending the ADC output from both channels one by one in alternate notifications and see if that helps."
Can you please elaborate it? How i can send them one by one?
Looking forward to your reply!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I mean - Just implement a switch case in the firmware to set serverTemp.value.val to ChA or ChB each time the loop is executed (to send notification in below order).
ChA value
ChB value
ChA value
ChB value
ChA value
ChB value
If you think that's inconvenient to read from a Central device, as I mentioned before use separate service for each channel.