Read data BLE between PSoC6 and CySmart

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
user_4264721
Level 1
Level 1

Hi,

Im looking to use BLE for my application and I got some troubles with the communication. In fact, I can send datas form CySmart and get it on my PSoC6 without any troubles by using CY_BLE_EVT_GATTS_WRITE_REQ. But I cant read datas from my PSoC6 on CySmart.

First I thought that they was a similar way for reading, like a CY_BLE_EVT_GATTS_READ_REQ but by looking on the forum, I found that I dont need to do anything to get the values updated. I just need to use the function CyBle_GattsWriteAttributeValue(). I tried this but it doesn't work, I still receive only 0 on my datas.

I looked on the forum, especially on that topic how to make 'read' callback between PSOC6 ~ mobile(CYsmart) but I didn't find an answer. I already looked on the 2 topics linked on the other one, but I couldnt find any answer. So Im asking you some help!

Here is the code I tried, I got a BLE task and this is the code I wrote.

pastedImage_1.png

test is only a random value I initialize to get something to read.

However, I cant find a solution that works so maybe anyone can help me or show me a simple example of a similar application ?

Thank you very much!

Alex

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello Alex,

Cy_BLE_GATTS_WriteAttributeValuePeer() function is used to write to the value field of the specified attribute in the GATT database. We have to specify the attribute handle before calling this function using "myHvp.attrhandle=0x000F". You can find list of handles in BLE_Config.h file.

Please refer to the attached example project in which I'm writing one byte of data from Cysmart to PSoC6 and these values are updating in the GATT Database. Also, you can read the data values on Cysmart.

Please let me know if this helps.

Thanks,

P Yugandhar.

View solution in original post

0 Likes
2 Replies
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello Alex,

Cy_BLE_GATTS_WriteAttributeValuePeer() function is used to write to the value field of the specified attribute in the GATT database. We have to specify the attribute handle before calling this function using "myHvp.attrhandle=0x000F". You can find list of handles in BLE_Config.h file.

Please refer to the attached example project in which I'm writing one byte of data from Cysmart to PSoC6 and these values are updating in the GATT Database. Also, you can read the data values on Cysmart.

Please let me know if this helps.

Thanks,

P Yugandhar.

0 Likes

Hi,

First thanks for you response. It helped me a lot actually! With your explanations and your example project I can now send datas from PSoC6 to CySmart.

Thanks a lot again!

Best regards

Alex

0 Likes