This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2340R5: BLE Connection & Disconnect indication over GPIO

Part Number: CC2340R5

Tool/software:

Dear Experts,

Greetings!

We are using CC2340R5 with SDK Version: 8.10.01.02. Our application is based out of Data Stream example code, we are basically using the BLE Uart service for transparent uart communication with the end device.

Use Case: As per the client requirement we have to control the output GPIO status (*DIO24) according to the BLE connection with the central device. So once passkey is entered successfully & connection with BLE device is established the GPIO goes into High state & if disconnected it returns back to Low state.

Challenge: At present we are using evets defined in app_connection.c to control the status of the GPIO, but the problem we are facing is the BLEAPPUTIL_LINK_ESTABLISHED_EVENT triggers automatically once passkey entering process has just started. As per out use case we only want to turn the output GPIO to High state only after passkey is entered successfully which is causing the problem at our application end.

Query: How to do this thing in most graceful way, considering our use case. Kindly guide us.

Code Snippet for reff.:

void Connection_ConnEventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData)
{
switch(event)
{
case BLEAPPUTIL_LINK_ESTABLISHED_EVENT:
{
GPIO_write( BLE_OUT_24, CONFIG_LED_ON );
break;
}

case BLEAPPUTIL_LINK_TERMINATED_EVENT:
{
GPIO_write( BLE_OUT_24, CONFIG_LED_OFF );
break;
}

case BLEAPPUTIL_LINK_PARAM_UPDATE_REQ_EVENT:
{
...
break;
}

case BLEAPPUTIL_LINK_PARAM_UPDATE_EVENT:
{
...
break;
}

default:
{
...
break;
}
}
}

Please let me know if you need more details.

Thanks & Regards

Harinder Singh

  • Hi Harinder,

    You can take a look at the app_pairing.c file, where you can register for the BLEAPPUTIL_PAIRING_STATE_COMPLETE event inside the Pairing_pairStateHandler, you can drive high the led when the pairing is completed.

    I hope this help,

    Tanguy.