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
  • Hi Vidar,

    Thank you for the help!

    I'll try to replicate these steps in nRF connect and get back with the result.

    Regarding the service changed notification I currently have enabled NRF_SDH_BLE_SERVICE_CHANGED. However, we pair our devices which I assume that this will bond the device and therefore cause this issue with RX not permitted.

    When you mention that "...you will have to send a service changed indication." how is this done in the software? I assume this need to be called upon reconnecting again, because we currently pair the device and disconnect and later again connect to the device again after disconnecting.

  • Hi again,

    I am trying to replicate the same steps in the mobile application on the nRF Connect app now, but is there some way to see errors when I do this or is it just to observe the value? The error on custom application is triggered on only subscribes to the RX when re connecting. I have tried to get the data on the RX with the arrow down and get a value on of 0x7A. Is it then working?

    Also I checked the know issues list and saw this one:

    devzone.nordicsemi.com/.../nus-sdk15-evt_comm_started-onconnect

    Is it relateable to this same issue I am experiencing?

  • Hi,

    Hadi Deknache said:
    I assume this need to be called upon reconnecting again, because we currently pair the device and disconnect and later again connect to the device again after disconnecting.

    Thee Peer Manager module includes an API for issuing the service changed indication to all bonded peers, see pm_local_database_has_changed. However, there was a problem with the implementation in SDK 15.0.0 that could in some cases lead to the notification not being sent. This is fixed in SDK 16.0.0.

    Hadi Deknache said:
    The error on custom application is triggered on only subscribes to the RX when re connecting. I have tried to get the data on the RX with the arrow down and get a value on of 0x7A.

     Does the custom app raise the error when it does not receive any notifications? The problem may be related to the bug you linked to in that case

  • Ok, yes I could see the Peer managed Local DB cache fail upon reconnecting to the device. Is there any quick fix for this without having to upgrade to sdk16?

    I made the change from RX to TX as mentioned in the other case and the same issue persisted unfortunately.

  • Hadi Deknache said:
    Ok, yes I could see the Peer managed Local DB cache fail upon reconnecting to the device. Is there any quick fix for this without having to upgrade to sdk16?

     Where is this error reported? It doesn't sound like it is related attribute caching. That said, it should be pretty straight forward to patch the service changed bug in your current project. I've tried to explain how in this thread here:

    https://devzone.nordicsemi.com/f/nordic-q-a/46633/peer-manager-silently-drop-service-changed-indications-if-an-att-mtu-exchange-was-happening/204968#204968

     

Reply Children
Related