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?

  • Hey

    I'm having some trouble understanding your problem. Are you saying that your application works in SDK version 15.2 but not in version 14.2? Why do you want to make it work in SDK v. 14.2 in that case? What exactly happens when you expect the BLE_GATTS_EVT_WRITE function? Have you tried debugging the application to see if you get an error code somewhere? 

    Best regards,

    Simon

  • My  formal project  is  SDK14.2 .  I  use  SDK15.2  to   see  whether  it  works  well.  I  want  to see  whther it  relates to  SDK.    (gscm_service_changed_ind_send)   return   NRF_ERROR_NOT_SUPPORTED,and  (gcm_ble_evt_handler) can't  receive BLE_GATTS_EVT_WRITE,the hid descriptor have  keyboard  and  mose, the  another is different; I  use adb  debug  to  see  the event (the  command  is  adb  shell  getevent -i),but  I  can't  see  information. How  can  I do.   SDK15.2  works  well.

  • Hi

    My initial advice would be to update your project's SDK to version 15.2 (or 15.3 for that matter), but if you're not inclined to do so we can probably find out what's wrong in the older version too.

    When gscm_service_changed_ind_send returns NRF_ERROR_NOT_SUPPORTED it means that the service changed characteristic is not present. How does your nrf_sdh_ble_default_cfg_set function look? Have you made any changes to it compared to the other 14.2 examples and/or the 15.2 version.

    When are you trying to send the gscm_service_changed_ind_send? It might be that the SoftDevice hasn't initialized properly yet and that you're sending it too early.

    Best regards,

    Simon

  • I don't change the normal sdh logic SDK14.2.( gscm_service_changed_ind_send function is  automatic called by SDK). the  nrf_sdh_ble_default_cfg_set   function  enables the NRF_SDH_BLE_SERVICE_CHANGED.

    My operation:

    two  mode:  'FI' and 'DI'

    'FI' mode  can  be  entered  by  pressing button2.  'FI' mode  init  hid which has  keyboard and mouse descriptor.    'DI’ mode can  be  entered  by pressing button3. 'DI' mode init hid_1 which just has  keyboard.

    Switching different mode  between 'FI'and'DI' by pressing button2 and button3. for example ,first mode is 'FI',

    it can works well. Then  pressing  button3, it will reset ,  and  enter in  'DI'  mode. At the same time  it will  reconnect  the  android phone .  Then  turn  off  and  on  the  android phone's bluetooth, it  will  reconnet  again,

    but  'DI' mode can't  work.

    it's  strange in  SDK15.2  ,sometimesgscm_service_changed_ind_sendreturns  NRF_ERROR_NOT_SUPPORTED , but (gcm_ble_evt_handler) can  receive BLE_GATTS_EVT_WRITE,and  the mode can work  well.  the SDK14.2 can't  receive  BLE_GATTS_EVT_WRITE.     How  can  I do.

  • Hi

    I guess we'll start trying to narrow down the source of the issue. Do you get the NRF_ERROR_NOT_SUPPORTED error if you go directly into DI mode as well (when the reconnection is happening)? Also, does this happen when you go from DI to FI mode or just the other way around? Have you tried connecting it to anything else than the Android phone (Either a PC with BLE, another phone, or another nRF device?

    Can you confirm that you have set BLE_HIDS_ENABLED to 1 in your sdk_config.h file? I assume it is as you're basing the project on the hids example, but I just want to make sure. 

    Best regards,

    Simon

Related