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?

  • Hi

    I've now set this project to private mode so that only you and Nordic engineers will be able to see it. You can safely upload your project (or code snippet) in your reply now. Could you please answer the other questions in my prior reply as well?

    Best regards,

    Simon

  • I'm sure the  android  phones  that are  tested  are  android  version  9.

    IOS  phone   often  don't  get  the NRF_ERROR_INVALID_STATE, but  sometimes can get. 

    Even if  IOS phone  get  the  errcode, it  still can  works well.

    You  can try  different  phone to  see  what  happens.

    Best regards,

  • Hi

    I see when trying to build your project that you've made changes within the SDK library/component files. This is ill-advised and I suggest you keep these files as is, as it makes the project a lot harder to debug. For example, the fact that you commented out a portion of code in ble_advertising.c gave an error when trying to build the project. I still get one error in line 1097 in your main file at: "char      gatt_mode   __attribute__((at(RAM_ADD))) =0x00;" as the at command doesn't exist in the project.

    Also, doing changes within the SDK files will likely cause other projects to have faults as well. Seeing as I don't know what you have changed or not I'm not sure I'll be able to debug this project efficiently, and suggest you make a project that is buildable, without any changes to the actual SDK library files. When you change the SDK files we can't even be sure that the error codes that are output are correct.

    Best regards,

    Simon

  • It' odd.  The project is  built  normally. I don't see any errors, and it  runs and debug very normally, sorry,I can't understand your meanings.

  • Hi

    I was able to build your project, and have tested it on a few phones now. An iPhone6. an old MotorOla running Android 7, and a Xiaomi mi6 running Android 9. I was not able to reproduce the error you're describing though. I connected to it, switched from FI to DI mode and DI to FI mode using buttons 2 and 3 without any issues. Are there any instructions as to how I can reproduce this error reliably?

    And again, the fact that you have made changes to the files within the SDK might be the reason that it won't work in SDK 14.2 for you. You could try downloading a "fresh" SDK14.2 and build your project there to see if that solves your issue.

    Best regards,

    Simon

Related