5 Replies Latest reply on Nov 27, 2017 5:18 AM by srds

    How to transfer multi channel data via Bluetooth?

    user_504416177

      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

        • 1. Re: How to transfer multi channel ADC data via Bluetooth?
          vsrs

          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

          • 2. Re: How to transfer multi channel ADC data via Bluetooth?
            user_504416177

            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

            • 3. Re: How to transfer multi channel ADC data via Bluetooth?
              srds

              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.

              1 of 1 people found this helpful
              • 4. Re: How to transfer multi channel ADC data via Bluetooth?
                user_504416177

                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!

                • 5. Re: How to transfer multi channel ADC data via Bluetooth?
                  srds

                  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.

                  2 of 2 people found this helpful