- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Together,
we made a Bluetooth Dongle, which sends Data from Com-Port to a BLE-Device.
we use the CyBle_GattcWriteLongCharacteristicValues, but only 16 Bytes where received on the BLE-Device.
The handler is build up like this:
CYBLE_GATTC_PREP_WRITE_REQ_T tempHandle;
tempHandle.handleValuePair.attrHandle = cyBle_customCServ[CYBLE_CUSTOMC_SERVER_UART_SERVICE_INDEX]
.customServChar[CYBLE_CUSTOMC_SERVER_UART_SERVER_UART_RX_DATA_CHAR_INDEX]
.customServCharHandle;
tempHandle.handleValuePair.value.val = UART_data;
tempHandle.handleValuePair.value.len = dataLen;
volatile CYBLE_API_RESULT_T t = CyBle_GattcWriteLongCharacteristicValues(cyBle_connHandle, &tempHandle);
The dataLen is 60 and all Data are in the UART_data.
We dont know the mistake yet, maybe you guys have an idea, what is wrong with this method.
Thank you.
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
After sending data from client to server using the API CyBle_GattcWriteLongCharacteristicValues(), you can wait for the event CYBLE_EVT_GATTS_EXEC_WRITE_REQ instead of CYBLE_EVT_GATTS_PREP_WRITE_REQ. Server receives the event CYBLE_EVT_GATTS_EXEC_WRITE_REQ at the end of write operation. Please see the information from BLE component datasheet below,
You can read data sent from client as below.
//CLIENT COMPLETED LONG WRITE
CYBLE_GATTS_EXEC_WRITE_REQ_T * execwrresp;
case CYBLE_EVT_GATTS_EXEC_WRITE_REQ:
printf("CYBLE_EVT_GATTS_EXEC_WRITE_REQ \r\n");
execwrresp = (CYBLE_GATTS_EXEC_WRITE_REQ_T *)eventParam;
for(i=0;i<execwrresp->prepWriteReqCount;i++)
{
for(j = 0; j< execwrresp->baseAddr.handleValuePair.value.len; j++)
{
printf("%02X ",execwrresp->baseAddr.handleValuePair.value.val
); }
printf("\r\n");
}
break;
I have updated the SERVER project that we already shared on 13th November and attached with this response. Could you test with the updated SERVER project and see if meets your requirement?
Thanks and Regards,
Sudheesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
What is the MTU size you have set in your application?
Please note that if the data size you want to transmit is greater than MTU size, then the data will go to server in multiple packets. The size of data that will be transferred in a single packet is MTU-3. So on the server side, the event CYBLE_EVT_GATTS_PREP_WRITE_REQ triggers multiple times.
//CLIENT PERFORMING LONG WRITE
uint16 longwritecount=0;
CYBLE_GATTS_PREP_WRITE_REQ_PARAM_T * longwriteparam;
case CYBLE_EVT_GATTS_PREP_WRITE_REQ :
longwriteparam = (CYBLE_GATTS_PREP_WRITE_REQ_PARAM_T *)eventParam;
if(longwritecount==0)
printf("CYBLE_EVT_GATTS_PREP_WRITE_REQ\r\n");
for(uint16 i=0;i<longwriteparam->baseAddr[longwritecount].handleValuePair.value.len;i++)
printf("%02X ",longwriteparam->baseAddr[longwritecount].handleValuePair.value.val);
printf("\r\n");
longwritecount++;
break;
So on the server side, the event CYBLE_EVT_GATTS_PREP_WRITE_REQ triggers multiple times.
Please find the attached code examples for Server and Client and check if they are working for you.
Thanks and regards
Ganesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
the MTU size is on 23.
Can i Turn this up or does this dont work?
When i would use your type of implementation, it would trigger multiple events on the server AND the Client side?
Because our type of implementation processes the message every time, so i had to wait for the full message.
Do i get a trigger for Message_Send or smth. like this to know we are at the end?
Thanks and regards
Sven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
we set up the MTU and tried it again, but this dont help, the message received in the Server is still the same length.
It showed up, that the entered length in the handle got overwritten due the process of sending. We dont get, how this is possible.
We compaired our settings to your Programs and they are even, so why does the datalen got overwritten in the process?
Do you have a clue, why this happen?
Thanks and regards
Sven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
After sending data from client to server using the API CyBle_GattcWriteLongCharacteristicValues(), you can wait for the event CYBLE_EVT_GATTS_EXEC_WRITE_REQ instead of CYBLE_EVT_GATTS_PREP_WRITE_REQ. Server receives the event CYBLE_EVT_GATTS_EXEC_WRITE_REQ at the end of write operation. Please see the information from BLE component datasheet below,
You can read data sent from client as below.
//CLIENT COMPLETED LONG WRITE
CYBLE_GATTS_EXEC_WRITE_REQ_T * execwrresp;
case CYBLE_EVT_GATTS_EXEC_WRITE_REQ:
printf("CYBLE_EVT_GATTS_EXEC_WRITE_REQ \r\n");
execwrresp = (CYBLE_GATTS_EXEC_WRITE_REQ_T *)eventParam;
for(i=0;i<execwrresp->prepWriteReqCount;i++)
{
for(j = 0; j< execwrresp->baseAddr.handleValuePair.value.len; j++)
{
printf("%02X ",execwrresp->baseAddr.handleValuePair.value.val
); }
printf("\r\n");
}
break;
I have updated the SERVER project that we already shared on 13th November and attached with this response. Could you test with the updated SERVER project and see if meets your requirement?
Thanks and Regards,
Sudheesh