5 Replies Latest reply on Mar 9, 2018 7:48 AM by e.pratt_1639216

    BTLE-212019 programming in C

    giorgio.maselli_1919926

      Hi All, I am developing the bluetooth firmware of system already built with two CYBLE-212019-00 modules, one in a wireless keyboard and another in a fixed receiver in a clienrt/server environment.

      Everything is implemented with Microchip PIC32 processors programmed in C. I cannot use Psoc Creator and its libraries and I must use text mode commands to talk with modules because hardware has been already produced.

      Is there any example code to use as reference ?

      My requirements are simple: search for a server, connect with a passkey entered by the user, transfer a few messages, disconnect and so on.

      Thank you in advance.

      Giorgio

        • 1. Re: BTLE-212019 programming in C
          e.pratt_1639216

          So the CYBLE-212019-00 modules are already programmed? Are they using a serial/text interface for the EZ-Serial image for the BLE chips? Or are you using some proprietary text interface?

           

          If you are using an already programmed proprietary text interface, then that is something that would have been created when you programmed the BLE chips, and wouldn't be documented with Cypress. So I'm not sure what we can do to help you as far as that goes.

           

          To do your "My requirements":

          Tell the Client module to start scanning

          When a device is found, connect to it

          When authentication is requested, answer using the passkey entered by the user

          Read/Write messages

          Disconnect

           

          What kind of example code are you looking for? All of the example code we could give you would be for programming/running the CYBLE modules, Not for PIC32s

           

          PS: I guess I'm not sure what you are asking for help with? The BLE modules communicate with the BLESS radio on the CYBLE chip directly, so any commands interpreted with say UART communications would be subject to some interpretation code written when you programmed the BLE chip in the first place.

          • 2. Re: BTLE-212019 programming in C
            giorgio.maselli_1919926

            Hi, thank you for your answer.

            Module is programmed with EZ-serial image and I can interact with it with uart/text commands like SPEM, SDN and so on using EZ-Serial BLE Firmware Platform User Guide - V1.1.1 manual.

            I understand that you cannot provide any example specific to Microchip PIC32 processors but all the code I have found is based only on Psoc Creator IDE and environment (100 projects and so on) and nothing based to a more generic UART or binary mode interface, of course without the details of hardware interface, PIC32 in my case.

            Now, for example, I am fighting with the request and editing of the passkey tyhat doesn't popup in my mobile phone.

            Thank you again

            Giorgio

            • 3. Re: BTLE-212019 programming in C
              e.pratt_1639216

              Ah, I see the issue

               

              Once you setup the PSoC 4 to be an EZ-Serial image, the only real interaction with the cypress module is the single UART interface, so most examples would turn into application development/examples for writing a program to send out specific UART commands of specific sequences to get the operation you want.

              On the EZ-Serial BLE Firmware page you can find API examples for interacting with the UART as you are asking for, but obviously the example won't be specific to the PIC32: http://www.cypress.com/documentation/software-and-drivers/ez-serial-ez-ble-module-firmware-platform  The "EZ-Serial Host API Protocol Library" link will download an example for interfacing with the EZ-Serial module image. The file "ezsapi.c" contains a constants declaration of all of the APIs for commands/responses you can send to the module for interaction. That should be enough information to at least get you going, and if you read the "main.c" file within the PSoC 4 example folder it should show some example state/flow control for interacting with the EZ-Serial module from an application standpoint. For example, the ezsapi.c contains:

              0x07,0x06,  0x05,   0x02,T_U8,T_U32,                        /*  51 | / 51, /PE (smp_send_passkeyreq_response) */

              0x07,0x0D,  0x04,   0x01,T_U32,                             /*  82 | S 20, SFPK (smp_set_fixed_passkey) */

              0x07,0x0E,  0x00,   0x00,                                   /* 108 | G 20, GFPK (smp_get_fixed_passkey) */

              0x07,0x05,  0x05,           /*  26, PKD (smp_passkey_display_requested) */

              0x07,0x06,  0x01,           /*  27, PKE (smp_passkey_entry_requested) */

               

              These are all declared at various lines, and should be easy to find within the file

               

              PS: If you have more specific questions, like how to use a specific command or how it works, go ahead and post it on the thread here and we can all help you out with it.

              • 4. Re: BTLE-212019 programming in C
                giorgio.maselli_1919926

                Hi,

                tahnks again for your answer.

                I downloaded the files at your link and I will study them.

                Unfortunately BT is a very complex environment and probably I have understimated it..

                Thank for the possibility to explain more specific questions !!!

                Giorgio

                • 5. Re: BTLE-212019 programming in C
                  e.pratt_1639216

                  Yeah; Bluetooth is complicated in so far as understanding how it is setup, but once you have something working, adding or changing data you can send/receive becomes extremely simple. The trick is in security and setup for the chips

                  Feel free to ask more questions as you run into them (I generally check weekday mornings)