How to transfer multi channel data via Bluetooth?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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

0 Likes
1 Solution

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.

View solution in original post

5 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

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

0 Likes
Anonymous
Not applicable

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

0 Likes

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.

Anonymous
Not applicable

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!

0 Likes

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.