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.

Problems with GATT_PERMIT_AUTHEN_WRITE

Other Parts Discussed in Thread: CC2541

I'm using the SensorTag code and the SensorTag App from TI to understand how the whole Bluetooth LE system is working.  Out of the box this all seems to work as expected. 

Now I'm investigating how the Pairing/Bonding works.  I'm using the accelerometer.c code as my example for this; I'm assuming this is typical and will represent how authentication works.  If I change the Service and Characteristics read permissions to GATT_PERMIT_AUTHEN_READ, this triggers the iPhone to prompt for the pairing passcode; if I enter the passcode this all seems to work OK, and I can read the Characteristics without any problems. 

However, if I change the write permissions to GATT_PERMIT_AUTHEN_WRITE, things seem to get stuck or lost...  The iPhone App executes the writeValue:forCharacteristic:type method but the delegate method peripheral:didWriteValueForCharacteristic:error: never gets called (this method is always called when using the GATT_PERMIT_WRITE permissions on the SensorTag).  I can still read the GATT_PERMIT_AUTHEN_READ characteristics so it appears things are Paired OK. 

On the SensorTag the acc_WriteAttrCB() function never gets called for the characteristics with GATT_PERMIT_AUTHEN_WRITE permissions.  If this is GATT_PERMIT_WRITE instead, then the acc_WriteAttrCB() function is always called. 

Is there some configuration I could be missing on the SensorTag to enable authenticated writes?  (Authenticated reads seem to be working fine).

Are there any known issues with this feature when using iOS6? 

How can I get more debug information out of the SensorTag code?  I've been digging around but it looks like the acc_WriteAttrCB() function is called directly from the protocol stack binary; I'm not sure what else I could be checking to understand what is going wrong...  Any suggestions on how to debug what is happening would be great... 

Thanks for your help

Mike

 

  • I found that I could get GATT_PERMIT_AUTHEN_WRITE...  There were a couple of issues that seemed to be confusing me: 

    - Whenever I re-downloaded the code to the CC2541 it seems that this would clear out some information that would stop the writes happening... 

    - Whenever the iOS device pairs with the CC2541 it seems to cache some information.  So if the permissions changed in a different build of the CC2541 code this could also stop the writes happening... 

    Interestingly, neither of these seemed to cause problems for the reads. 

    But, as long as I always download the CC2541, and clear out the pairing from the iOS device (Settings => Bluetooth => forget device, and then turn Bluetooth off/on), then things would pair, and both reads and writes would occur without issue. 

    So at this time, it looks like there isn't a problem.  I'll keep an eye on this and see if I notice any issues.