Writing from CYBLE-416045-02 BLE Chip to phone app

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

cross mob
Moomixx
Level 1
Level 1
5 sign-ins First like given First question asked

Hello all. I have been working with the GATT_OUT example program. Using my phone app nRF Toolbox. I am able to transmit text from the app to the ble chip then read it out the Tx serial port. I understand that the CY_BLE_EVT_GATTS_WRITE_REQ is handling this operation.

My issue now is I am trying to go in the reverse direction. I set up this function

void App_UART_BLE_Tx(uint8_t *data, uint16 len)
{
// Use UART_Transmit to send the received data over UART to the terminal

// Here should be implemented interface to sent UART
// to BLE by Notification TX characteristic....

cy_en_ble_api_result_t apiResult;
cy_stc_ble_gatt_handle_value_pair_t handleValuePair;


// send notification to TX....
//DEBUG_BLE("Cy_BLE_GATTS_SendNotification \r\n");
handleValuePair.attrHandle = CY_BLE_UART_SERVICE_TX_CHAR_HANDLE;
handleValuePair.value.val = data;
handleValuePair.value.len = len;
apiResult = Cy_BLE_GATTS_SendNotification(&appConnHandle, &handleValuePair);


if(apiResult)
{
DEBUG_BLE("Attrhandle = 0x%4X Cy_BLE_GATTS_Notification API Error:"\
"0x%2.2x \r\n", handleValuePair.attrHandle, apiResult);
}

}

Which when I add it to the CY_BLE_EVT_GATTS_WRITE_REQ event will echo whatever I type in the phone app so I know it works. 

 

Is there an example or an event already written that handles writing from the BLE chip to the phone app?

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
1000 replies posted 5 likes given First comment on blog

Hello @Moomixx ,

To send data from BLE Chip to the phone, you have to use either Notifications or Indications for the BLE. 

Please refer to the attached BLE_UART project. It has server and client projects, once you connect two devices then the data(through UART Terminal) which is write at one end will appear at the other end and vice-versa. 

Thanks,

P Yugandhar. 

View solution in original post

0 Likes
1 Reply
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
1000 replies posted 5 likes given First comment on blog

Hello @Moomixx ,

To send data from BLE Chip to the phone, you have to use either Notifications or Indications for the BLE. 

Please refer to the attached BLE_UART project. It has server and client projects, once you connect two devices then the data(through UART Terminal) which is write at one end will appear at the other end and vice-versa. 

Thanks,

P Yugandhar. 

0 Likes