Hi,
I am using the example projects ble5_multi_role project and ble5_simple_peripheral prjects running on two CC2640R2F Launchpads, multi_role acting as the client and the peripheral as the server.
My SDK version is 1.35.00.33.
Once connected, I use the keys on the Launchpad to perform read/writes to the characteristic on the peripheral.
But when I try to automate this process, there are some situations where this fails.
For example, I try to perform a write immediately after the characteristic is discovered i.e.:
if ((pMsg->method == ATT_READ_BY_TYPE_RSP) &&
(pMsg->msg.readByTypeRsp.numPairs > 0))
{
// Store handle
discInfo[connIndex].charHdl = BUILD_UINT16(pMsg->msg.readByTypeRsp.pDataList[0],
pMsg->msg.readByTypeRsp.pDataList[1]);
//perform write here
mr_doGattRw(0); //No other connection, hence index is 0
}
the write attempt fails and I don't see any change on the peripheral side.
However, if I start a clock at the same place instead i.e.
if ((pMsg->method == ATT_READ_BY_TYPE_RSP) &&
(pMsg->msg.readByTypeRsp.numPairs > 0))
{
// Store handle
discInfo[connIndex].charHdl = BUILD_UINT16(pMsg->msg.readByTypeRsp.pDataList[0],
pMsg->msg.readByTypeRsp.pDataList[1]);
Util_startClock(&testingClock);
}
with a delay of 5 seconds, and then perform the write when it times out, the write goes through.
i experimented with a couple of delay values i.e 1s, 2s and 5s. I found that the write is successful for 2s and 5s but fails for 1 s delay.
What's going wrong?