You are here

Create a BLE peripheral | Cypress Semiconductor

Create a BLE peripheral

Summary: 3 Replies, Latest post by p.schroeer_1536336 on 08 Dec 2015 06:53 AM PST
Verified Answers: 1
Last post
Log in to post new comments.
p.schroeer_1536336's picture
12 posts

Hi folks,

I'm new in the Cypress world and try to get in touch as fast as possible with the nice features of Cypress MCU's, especially with BLE components. At the moment I use the CYBLE-014008-00 BLE Module in combination with the BLE Pioneer Kit.

At first, I would like to create a BLE peripheral which includes some custom services and characteristics. The characteristic values should be updated when there are new values available. The new values are transferred from another MCU to the BLE Module via UART interface and a small protocol. The last day, I played a bit with the UART communication and feel well, to implement the UART interface and communicate with another MCU. I have also created two UART interrupts (TxD transfer complete / RxD buffer not empty) to implement these communication. So this part should work! I just get one warning: "Warning-1366: Setup time violation found in a path from clock (CyHFCLK) to clock (UART_IntCLK)" Maybe someone has got an idea to solve this warning?!

Right now, my main problem is to understand how the BLE module exactly works. In the attached example file, I initialized the BLE module with one custom service and one custom characteristic. I looked at some examples and implemented two function calls. First I use this function:

apiResult = CyBle_Start(StackEventHandler);

Afterwards I call this function in the infinity loop:


Now I can find and connect to my new BLE Peripheral. But how am I able to update the value of my custom characteristic? I tried to use this function:


But that doesn't work. I just receive the default values, set up in the TopDesign.cysch


1.   How am I able to fix the shown warning in the UART module?

2.   Why do I have to call the "CyBle_ProcessEvents();" function in my infinity loop? This seems a bit confusing to me.

3.   How am I able to update my characteristic values?


Thank's in advanced!



user_242978793's picture
973 posts

Have you checked out 100 projects in 100 days ble examples.  Here is one that you may want to study.  The one I am sending you simulates sensors for a bike.

p.schroeer_1536336's picture
12 posts

Thanks for your answer!

p.schroeer_1536336's picture
12 posts

How am I able to write a new descriptor value? To update the characteristics, I use the following function:


void UpdateCharacteristic(uint8* Data, uint8 len, uint16 attrHandle) 


    Handle.attrHandle = attrHandle; 
    Handle.value.val = Data; 
    Handle.value.len = len;                                                                                    

    CyBle_GattsWriteAttributeValue(&Handle, FALSE, &cyBle_connHandle, CYBLE_GATT_DB_LOCALLY_INITIATED); 


To call the function:


UpdateCharacteristic(Data, sizeof(Data),CYBLE_CUSTOM_CHARACTERISTIC_CHAR_HANDLE);


This works very well. But when I try to change: "CYBLE_CUSTOM_CHARACTERISTIC_CHAR_HANDLE" into "CYBLE_CUSTOM_CHARACTERISTIC_CLIENT_CHARACTERISTIC_CONFIGURATION_DESC_HANDLE" I'm not able to update the descriptor. So do I have to change the "CYBLE_GATT_HANDLE_VALUE_PAIR_T" struct? Or is there any other issue?





Log in to post new comments.