This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to add custom service to the Ble_app_template example

Hello i am using nrf52810 with SDK version 17.0.2 , i want to add custom service to the ble_app_template example and i followed this tutorial link https://github.com/edvinand/custom_ble_service_example so at first debug i got this error as expected 

next i have change the RAM_START AND RAM_SIZE as per the memory size mentioned in the error then i DEBUG it again so the i got 

so i don't know what's happening please help me to resolve this . 

thank you.

Parents
  • Hello,

    Please make sure to have DEBUG defined in your preprocessor defines, like shown in the included image:

    This will make your logger output a detailed error message whenever a non-NRF_SUCCESS error code is passed to an APP_ERROR_CHECK.
    Please do this, and let me know what the error message reads, along with which function that returned the error code pointed to in the error message.

    Best regards,
    Karl

Reply
  • Hello,

    Please make sure to have DEBUG defined in your preprocessor defines, like shown in the included image:

    This will make your logger output a detailed error message whenever a non-NRF_SUCCESS error code is passed to an APP_ERROR_CHECK.
    Please do this, and let me know what the error message reads, along with which function that returned the error code pointed to in the error message.

    Best regards,
    Karl

Children
  • Hello,

    mr Karl i am very happy to communicate with you and thank you so much for your reply, i tried as you said  and i got this error,

    thank you,

  • sagarnayakm said:
    mr Karl i am very happy to communicate with you and thank you so much for your reply

    No problem at all, I am happy to help!

    sagarnayakm said:
    i tried as you said  and i got this error,

    Which function returns this error code? Please check the end of the error message to see where the APP_ERROR_CHECK was triggered.

    Best regards,
    Karl

  • Hello,

    yes, i got where exactly its the function service_init()  in that ble_cus_init() it returns err_code 7 please

    have a look at this ,

    thank you,

  • So it seems your ble_cus_init function is returning the NRF_ERROR_INVALID_PARAM error.
    How does this function look? Under what conditions will it return this error code?
    Likely it is just forwarding the error code generated by a SDK function it itself is calling.

    Best regards,
    Karl

  • Hello,

    How does this function look?

    the service_init() function is look this.

    static void services_init(void)
    {
    ret_code_t err_code;
    nrf_ble_qwr_init_t qwr_init = {0};

    // Initialize Queued Write Module.
    qwr_init.error_handler = nrf_qwr_error_handler;

    err_code = nrf_ble_qwr_init(&m_qwr, &qwr_init);
    APP_ERROR_CHECK(err_code);

    /* YOUR_JOB: Add code to initialize the services used by the application.
    ble_xxs_init_t xxs_init;
    ble_yys_init_t yys_init;

    // Initialize XXX Service.
    memset(&xxs_init, 0, sizeof(xxs_init));

    xxs_init.evt_handler = NULL;
    xxs_init.is_xxx_notify_supported = true;
    xxs_init.ble_xx_initial_value.level = 100;

    err_code = ble_bas_init(&m_xxs, &xxs_init);
    APP_ERROR_CHECK(err_code);

    // Initialize YYY Service.
    memset(&yys_init, 0, sizeof(yys_init));
    yys_init.evt_handler = on_yys_evt;
    yys_init.ble_yy_initial_value.counter = 0;

    err_code = ble_yy_service_init(&yys_init, &yy_init);
    APP_ERROR_CHECK(err_code);
    */

    ble_cus_init_t cus_init;


    // Initialize CUS Service.
    memset(&cus_init, 0, sizeof(cus_init));

    err_code = ble_cus_init(&m_cus, &cus_init);
    printf("err_code:%d",err_code);
    APP_ERROR_CHECK(err_code);
    }

    next, like i want to send some data from

    aa-ble_app_template - Custom_service1.zip

    nrf_connect mobile app to the device. If i am not wrong i need to add custom_service to my code right.?? so for this i used this code please have look at the zip.file

    thank you.

Related