PSoC 6 BLE in 2 roles write to peer issue

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

cross mob
lock attach
Attachments are accessible only for community members.
FaBi_2763241
Level 4
Level 4
10 likes given 5 likes given First like received

Hello PSoC 6 community,

I have my kit CY8CPROTO-063-BLE configured with 2 connections, 1 as central and 1 as peripheral, therefore communicating at the same time to a central like cysmart dongle and to another peripheral device at the client side. See attached workflow. I am also attaching the two test projects one is the peripheral device, the other is for the PSoC 6. Scanning, connecting, discovery all works okay, but writing to a custom characteristic on the peer device from PSoC 6, only works if I delete the instance of the custom service from the server GATT of the PSoC 6 (which is needed as well to receive write request from cysmart). If any custom service is present in the PSoC 6 GATT server side then the write process done with Cy_BLE_GATTC_WriteCharacteristicValue will fail. My aim is to receive write request from the cysmart into the PSoC 6 server and direct the same data to the central side of PSoC 6 for writing to the peer device connected as peripheral. In my case the PSoC 6 should act as a proxy in between Cysmart and a BLE peripheral. I don't understand what I am missing, I can't explain why it works only when I delete the service from the PSoC 6 GATT server, it should be able to be central/peripheral concurrently.

0 Likes
1 Solution

Yes, that is what I meant in previous post.

As for writeToPeerDevice(), API Cy_BLE_GATTC_WriteCharacteristicValue() is called inside. It's the correct one to write data from GATT Client to GATT Server.

View solution in original post

5 Replies
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

I roughly looked through your PSoC 6 code, but not test it yet.

One issue I found out is about below line in HostMain.c -

       

writePacketdata.handleValPair.attrHandle = cy_ble_customCServ[CY_BLE_CUSTOMC_TEST_SERVICE_INDEX].customServChar[CY_BLE_CUSTOMC_TEST_TEST_PACKET_CHAR_INDEX].customServCharHandle[0];

It looks the data array cy_ble_customCServ[] is just stuff regarding to local GATT Client custom service.

The structure "writePacketdata" is the only parameter of API - Cy_BLE_GATTC_WriteCharacteristicValue(). I believe that writePacketdata.handleValPair.attrHandle should be the target attribute handle of peer GATT Server.

If you delete the GATT Client custom service - Test, the content of cy_ble_customCServ[] might be modified.

Can you try again just with replacing the content of writePacketdata.handleValPair.attrHandle with the actual target attribute handle of peer PSoC4 device?

lock attach
Attachments are accessible only for community members.

Thank you for taking the time to look into my test projects.

I changed the attrHandle to the peer service/characteristic, even deleting or not the service from the local client Gatt, did not seem to work.

see attached edited archive02 projects and screen from debug terminal, which show connection, discovery okay but not receiving write response from psoc4.

I used the cysmart pc dongle to write to the server in PSOC6, the aim was that on receiving the write request, the function writeToPeerDevice() would write the same packet to the PSOC4 peer, but I can't make it to work.

0 Likes

I have the impression that the function writeToPeerDevice() is writing to the local Gatt server instead of writing to the Psoc4 Gatt server as I was intended to do.

0 Likes

Hard coding the characteristic handle of the peer PSoC4 into writePacketdata.handleValPair.attrHandle seems to be a solution.

0 Likes

Yes, that is what I meant in previous post.

As for writeToPeerDevice(), API Cy_BLE_GATTC_WriteCharacteristicValue() is called inside. It's the correct one to write data from GATT Client to GATT Server.