This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

iOS reading not permitted when adding dfu charactersitics to application

Hi everyone,

I have lately had some problems with my application which has different characteristics enabled, such as nus, battery service, dfu etc...

The problem I am facing lately is that when I connect to my device through my iOS application I am getting rx not permitted for nus. This occurs only when I have DFU enabled. If I would skip to initialize and add DFU my application doesn't seem to get this problem anymore. If I add it back again then the problem occurs again. Is there something weird that I am currently doing?Is there some specific order that I should initialize my device in. 

I currently initialize the DFU after have initialized all the other characteristic services.

I am currently using sdk15.0 and softdevice 6.0

Parents
  • Hello,

    It sounds like it may be related to a Bluetooth feature known as attribute caching (bt spec, vol 3, part g, section 2.5.2). This feature lets the GATT client remember attribute tables across connections and thus enables it to skip service discovery on every re-connect. The problem with attribute caching, if not accounted for, arises when you make changes to an existing attribute table (adding a new service after a DFU, etc) because the ios client will continue to access the device with the old attribute handles.

    Unless you know it's not attribute caching, please try to clear the cache by toggling the flight mode enable button in iOS settings (delete bonding first if bonded) before re-connecting with the DFU service. This should force the phone to perform a new discovery next time it connects to the peripheral.

  • Hello,

    First of all thank you for the immediate support!

    We had the same idea that it might be something related to the attr table as you mention. 

    Does this even occur when the service table is consistent between the re-connetions? Does the attr table still change?

    Currently we have added all the serivces and last we have added the dfu afterwards, that's when the problem occurs that the iOS device mentions that RX not permitted. If I don't initialize the dfu service at all then the application runs without these problems.

    The services are added like this:

    - system_service_init
    - battery service init
    - nus init
    - peer manager init
    - and lastly dfu init
  • This occur inside peer_mgr.c at PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED.

    However, it later directly triggers this event :BLE_GATTS_EVT_SC_CONFIRM

    I assume then that the attr table is triggering a update of the table correctly, right?

    The fix you have linked to has unfortunately already been made in my project and seem. 

  • The SC indication should make the receiving client (iOS) perform new service discovery and re-enable subscriptions to notification and indications.

    Once you have added the DFU service, do you always get the "rx permitted" error, or does it go away next time you re-connect? Have you tried to delete the bonding information and cache as I suggested?

  • Hello Vidar,

    Yes, when I have enabled the DFU service then the RX not permitted seem to be triggered. If I totally remove the DFU from my application then it works without any problems and do not get this error. This seem to still also trigger after a re-connection too the same error.

    I tried to remove the device totally and also the cache by turning off Bluetooth and also putting the device in airplane mode, but seem the problem will still be there when re-bonding and connecting again. However, I am able to receive nus data and send, so technically it shouldn't be any problem right? or am I wrong? because if I could send and receive data through the nus service then it is working, or is this RX Not Permitted error referring to something else?  

  • Thanks for confirming. Could this "RX Not Permitted" error possibly be a custom error that's raised by your application? It doesn't sound like a standard error message. I don't think this is related to attribute caching based on what you've said.

  • Ok, thank you for all your help!

    I'll check with the app if could debug and see what might be causing this problem. Could maybe be some custom error as you mention, but very weird that the error only occur when I enable the DFU service though.

Reply Children
No Data
Related