8 Replies Latest reply on May 23, 2018 7:58 AM by epr_1639216

    BLE HID server setup


      Let me first explain what I want to achieve (I'm using the CY8CKIT-042-BLE).


      I have two standalone BLE dev kit modules and I want to connect and communicate between them (one module act as HID server one module as HID client).

      The connection should go pretty straight forward: server searches for devices that are in pairing mode and starts auto pair process until connected.

      The communication should go entirely standalone (paring process and communications process), no host system or PC is hooked up.


      So far I'm able to setup the HID client using the descriptors connecting to a regular Windows PC. This is actually pretty easy to setup (HID mouse / HID keyboard code examples were a great help).

      But now I want to connect to another Cypress Module that acts as a HID server. What I want to achieve is that the HID client (mouse for example) can operate a LED on the HID server side. This should work as a standalone setup.

      Eventually I also want to be able to use a BLE mouse from the store and hook it up to the HID server (which is the standalone cypress module).


      Short summary:

      After auto-pairing the client sends HID descriptors and server interprets HID descriptors and turns on a LED based on a certain event.



      • How can this be achieved (the server implementation)?
      • Is there an example project?


      Thanks in advance,



        • 1. Re: BLE HID server setup

          Hi Paul,


          I believe you are asking for the GATT client designs.

          PSoC Creator includes examples for BLE HID Keyboard and HID Mouse which are servers. I don't think there are examples of a client connecting to these devices.




          • 2. Re: BLE HID server setup

            Hi Ranjith,


            Maybe my terminology of server and client are not the proper naming in the BLE world, but I don't know how I should explain it better. I consider the mouse or keyboards as clients that pair to some host system which I call server.


            It is not that I want to connect to the mouse or keyboard, it is the other way around.


            I want to use a stand alone Cypress BLE module (Cypress) and connect a regular HID mouse with it. Let's say I use a Logitech or Microsoft BLE mouse and connect it to this Cypress module which runs on a battery and understands HID (meaning no intelligent PC/Windows system is hooked up in this usecase).

            All I want is operate a LED by pressing a mouse click, if that is feasible then I got a foundation to work from.


            See my picture below that explains my use case.




            Cheers, Paul

            • 3. Re: BLE HID server setup

              Hello Paul,


                    ->  In Bluetooth terminology ,Server is a device which has some information ( For example, in your case the Mouse has the 'Key' Click information and hence it is  a server)


                   -> Client is a device which request the information OR you send the information to it ( In your example, you are sending the Mouse information to Cypress BLE device and hence it is a client )


              Client and Servers are also known as Link Layer Master and Slave respectively and also Central and Peripheral respectively.


              Here , we do not have an HID Client Ready Firmware but as you told you can program the Cypress BLE device with a Client/Master Role, can connect to the Mouse and on Key press can blink a LED on Client device ( Cypress BLE device)


              Please refer a sample example from the below link on Central and Peripheral roles. Please find a document along with which has all the testing steps to communicate between Master and Slave device.


                   PSoC-4-BLE/100_Projects_in_100_Days/Day020_BLE_UART at master · cypresssemiconductorco/PSoC-4-BLE · GitHub




              • 4. Re: BLE HID server setup

                Hi Gyan,


                Thanks for pointing me out in the right Direction, it is the terminology that confuses me (GATT, GAP, Central, Peripheral, Observer, etc.).

                If found a nice explanation about the terminology at Nordic Semiconductor:



                I've spent quite some time to the Day20_BLE_UART example, but due to the fact that this is created in an older version I need to update the components (I'm using PSoC Creator 4.2) it first needs to be converted. This goes well for the "UART_to_BLE_central" part but for the "UART_to_BLE_peripheral" it fails to compile.

                I've checked and compared many config files and settings in the PSoC Creator and also the generated output files but I'm not able to find the root cause. The Directory is there, the files are there and the config is identical of that of "UART_to_BLE_central".


                The error I get:

                arm-none-eabi-gcc.exe: error: ..\..\..\..\..\..\..\..\Documents\PSoC Creator\4.2\Downloads ( 4.2).cylib\BLE_v3_51\Library\gccCyBLEStack_BLE_SOC_PERIPHERAL.a: No such file or directory

                The command 'arm-none-eabi-gcc.exe' failed with exit code '1'.

                But the file is definitely there, and the amount of folders that it tries to go back from the ${ProjectDir} is also correct.

                Although I was able to compile by hand (cli) using full path's and then it generates the "UART_to_BLE_peripheral.elf" file, but the IDE doesn't pick it up.



                I wonder where I can find the definitions of ${ProjectDir} and the other IDE variables (see below).


                I got stuck at this part where it fails compiling/linking at the part where arm-none-eabi-gcc.exe gave issues.


                Any idea's here?





                • 5. Re: BLE HID server setup

                  When you "Update Components" through the right-click popup interface for the two separate projects, you need to update the components for both projects to get good results

                  Also, make sure you clean when you build to remove extraneous/unneeded build files with old object code in them (Usually not an issue to clean + build every time from what I've seen).

                  • 6. Re: BLE HID server setup

                    Unfortunately I did all of that already


                    But after a long search I discovered the problem! A bug in PSoC creator 4.2 regarding path length's in combination with using the home folder in Windows. I've created a separated topic for this as I did some test scenario's to prove this.

                    • 7. Re: BLE HID server setup



                      Let's continue the the thread about HID Server, which is in fact is "HID Central" I believe.


                      I've found the project to analyse further: Day011_Central_Observer.


                      Once I've got a grip on it I have to implement a HID Parser?

                      Or is there any other library to use for this?

                      • 8. Re: BLE HID server setup

                        There are not HID parsers from what I've seen. Generally, Windows/OS handles the HID servers connected to it, and thus you wouldn't be implementing the HID client yourself.

                        See: HID BLE Host keyboard

                        The HID server examples implement a sort of HID library iirc, so implementing an HID client might be as simple as mimicking that but in reverse.