5 Replies Latest reply on Dec 29, 2017 8:38 AM by e.pratt_1639216

    EZ-Serial connection to smartphone

    mail_1627586

      Is there a simple example project I can give to our app developers to transfer data in SPP mode with the actual EZ-serial software to and from a smartphone with iOS and / or Android? I looked for such an example, as it seems to me the most flexible way to handle Bluetooth transfer for a wide variety of applications, but could not find one, instead I found lots of examples for specialized profiles or beacons. The available specialized Bluetooth-profiles don´t fit to our application, so we decided to use SPP as an extremely flexible solution. Moreover this allowes to use the Bluetooth modules (in our case CYBLE-022001) with the pre-programmed application software.

       

      Ideally it would be just an extremely simple code example to send some text to the module and to receive the answer (and show it on the screen for example), just to show what library functions on iOS / Android to use. The only special requirement is, the code should preferrably handle messages that are longer than 20 bytes automatically (segmentation in several Bluetooth-messages) to avoid any pitfalls regarding segmentation.

       

      Thanks for your help,

       

      Hermann

        • 1. Re: EZ-Serial connection to smartphone
          e.pratt_1639216

          You mean a simple serial to Bluetooth example like this: Project #020: UART to BLE Bridge | Cypress Semiconductor ?

          It should be easy to modify it to follow your criteria if it doesn't work out of the box.

          1 of 1 people found this helpful
          • 2. Re: EZ-Serial connection to smartphone
            mail_1627586

            Hello,

             

             

            thanks for the fast reply, but the example is not what we need: We use

            EZ-Serial firmware on the CYBLE-022001 module, so we don´t need any

            firmware application for the module like the suggested PSOC-Creator

            project. This has already been solved by Cypress with the EZ-serial

            firmware  and we don´t want to change anything at this end of the

            communication.

             

             

            Instead we need the counterpart on the smartphone: An application

            example under iOS and / or Android to receive / send messages from / to

            the CYBLE-022001 module with its EZ-Serial firmware. We can build up the

            communication with the CySmart app, as can be seen on the example

            attatched. The only thing that still lacks is some function for actually

            transferring a string via SPP from smartphone to CYBLE-022001 module and

            another one for receiving the response. This is the missing link between

            our app and the CYBLE module.

             

             

            If you answer to this mail, please include my colleagues in CC.

             

             

            Thanks for your support,

             

            Hermann Ramsauer

            1 of 1 people found this helpful
            • 3. Re: EZ-Serial connection to smartphone
              e.pratt_1639216

              That should be relatively simple if I am understanding you correctly:

              When receiving an indicate message from the SPP, pass it to the app.

              When sending a string from the app, write it to the SPP using an indicate.

               

              Or use confirmed write as an alternative as well.

               

              Unfortunately, I have no experience working with android/iOS applications for phones and wouldn't be able to give you an example or help in that regard. However, what you are describing should be achievable using the SPP interface with the CYBLE-022001-00 module from the app on the phone to send and receive messages.

               

              Some pseudo code for the code flow:

              • setup system settings
              • setup SPP CYBLE-022001-00 module
              • connect to desired bluetooth device using the SPP
              • send/receive data through the SPP
              • disconnect the bluetooth on the SPP when done
              • disconnect from the SPP
              • close the app
              • 4. Re: EZ-Serial connection to smartphone
                mandeepkaur.mehrok_3039046

                I do have the same kind of problem, that when I am trying to get the data from the circuit in my Android/iOS apps its giving me the same kind of data which is shown is screenshot. I debug the code given by sample apps from Cypress, but none of them shows any ways to give me back the data.

                 

                So I am not getting any way to read the required data from the server like its written in the device/circuit documentation to pass strings to get the relevant dat, but apart from the first connection...I am no way getting any data.

                 

                So if anyone could provide me some information about SDK or 3rd party libraries to retrieve the data....basically any help would be helpful.

                • 5. Re: EZ-Serial connection to smartphone
                  e.pratt_1639216

                  There are some examples of communication/serial interaction with the EZ-Serial here:

                  EZ-SERIAL™: EZ-BLE MODULE FIRMWARE PLATFORM | Cypress Semiconductor

                  The first download (User Guide) has the information you are asking about I believe. It has both peripheral and central example usage.

                  http://www.cypress.com/file/384521/download

                  Page 57 has the beginning of the GattC examples.

                  Page 144/145 has the exact command for reading/writing a remote server attribute/characteristic:

                  gattc_read_handle (/RRH, ID=6/4)

                  Binary Header: Type Length Group ID Notes CMD C0 03 06 04 None. RSP C0 02 06 04 None. Text Info: Text Name Response Length Category Notes /RRH 0x000A ACTION None. Command Arguments: Data Type Name Text Description uint8 conn_handle C Connection handle to use for read operation (Ignored in current release due to internal BLE stack functionality, set to 0) uint16 attr_handle H* Handle of remote attribute to read