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

about service change can't receive BLE_GATTS_EVT_WRITE

nrf52832     SDK14.2       s132_nrf52_5.0.0_softdevice     PCA10040       ble_app_hids_keyboard  

I modify the project : 

two  service :  one  is   hid   another  is  different  hid_1 

press button 2  init  hid

presss button 3  init  hid_1

connect  the  android  phone , press button2   reset ,and ,init  hid;  press button3   reset  ,and, init  hid_1, reconnect  the phone,

turn  off and on the bluetooth(android  phone),but I can‘t receive   BLE_GATTS_EVT_WRITE(gcm_ble_evt_handler),  I  enable  the  NRF_SDH_BLE_SERVICE_CHANGED

I  can’t  know the reason,  but  SDK15.2   it  succeed,  why?   How  can  i do?

  •  The operation is as follows:

    1  Firstly,   Fi  mode  that   the hid descriptors just has keyboard connect to the  android phone. It  can typewrite ‘’hello‘’ through  button 1.

    2  Then directly  press button 2 ,the mode  change into Di mode that the hid descriptors has keyboard and mouse. The android phone will reconnect to the PCA10040 automatically. It can typewrite  ‘’capson‘’through  button 1.

    3 Importantly,  Then  turn off  and  on  the android phone's bluetooth. The android phone will also  reconnect to the PCA10040 automatically,but at this  time  it can't  typewrite.

    Additionally,

    Although I make changes  within  the SDK library/component files, it donsn't  matter and  has nothing to do with  the question.

    Thank you!  I expect your reply!

  • Hi

    Thanks for the updated instructions. I've been able to recreate this issue now, on an Android 7 device as well, so it is not an Android 9 "exclusive" issue. Your project had to be built in Keil to make buttons 2 and 3 work properly and was the reason I couldn't reproduce it. I will get to debugging it now.

    A few questions:

    • Are there any differences between gatt_mode 0x00 and gatt_mode 0x02 in your application?
    • Do you get this error every time you turn off the Android Bluetooth? 

    Also, please post any updates on what you've accomplished/discovered as well.

    Best regards,

    Simon

  • 1  The difference  between gatt_mode 0x00 and gatt_mode 0x02  is the hid init funcition.You  can  compare them.

    2  Yes,and you can try more.

    3  It  can works well by using SDK15.2.

    Thanks,I expect your reply!

  • Hi

    I've found that the only change between the gcm_ble_evt_handler in SDK14.2 and SDK15.2 is that the #if PM_SERVICE_CHANGED_ENABLED is present in SDK15.2. So, the most obvious fix would be to add this into your SDK14.2 project. You'll have to define it in gatt_cache_manager.c and in your sdk_config.h file as well as implement it just like in SDK15.2 in order to patch this. That's the patch we provided to the gatt_cache_manager from SDK 14.2 to SDK 15.2, so that would be what fixes this in SDK 14.2 as well.

    I must admit that I still don't see why you can't use SDK 15.2 as your actual project, seeing how it's fixed there already, but that's up to you to decide.

    Best regards,

    Simon

  • Hi,Do  you  try  as  you suggest? 

    I  feel  that  you just give me advice,but you don't prove it.

    Now that you find the reason,can you  prove it?

    Thank you , I expect  your reply!

Related