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

Battery service & debug problem

Hello,

I try to add battery service in ble_app_uart , but it has some problem.

The Problem is that I can see the Battery service on the phone , but it doesn't change by ADC .

the Operation is under SDK9 & s110 .

By the way , how to find errors in debug mode?

when i enter the keil c debug mode , i always see this situation following . image description where can i see error?

Thanks. --------------------Edit---------------------------------------------------------- My problem is that I can see the following picture if add the "APP_TIMER_INIT(......)" under the "timers_init()" in main loop. But Battery level is always 100%. image description

If i don't add the "APP_TIMER_INIT(......)" under the "timers_init()" , i can't find peripheral on phone.

This is my project . ble_app_uart.rar

Thanks.

Parents
  • Hi. You can see how to use the err_code and APP_ERROR_CHECK() here.

    You should also be able to see the value of err_code if you look in the "Call Stack + Locals" field.

    image description

    Do you get an error when you use the ADC?

    EDIT:

    It looks like your battery_level_meas_timeout_handler() timer is never called. This is because you are calling APP_TIMER_INIT() twice. You call it first inside timers_init(), as is standard procedure in the SDK. Then you create your battery timer with app_timer_create(). Then you call APP_TIMER_INIT() again, effectively overwriting the battery timer you just created. So the first thing you need to do is to uncommend APP_TIMER_INIT() in your main() function. If you start your debugger now you will see that ble_conn_params_init() returns an error. If you enter ble_conn_params_init() you will see that the error occurs when app_timer_create() is called. The returned error is error 4; NRF_ERROR_NO_MEM. This error is returned if the timer operations queue is full and what you need to do is to change

    #define APP_TIMER_MAX_TIMERS            (2 + BSP_APP_TIMERS_NUMBER)                 /**< Maximum number of simultaneously created timers. */
    

    to

    #define APP_TIMER_MAX_TIMERS            (3 + BSP_APP_TIMERS_NUMBER)                 /**< Maximum number of simultaneously created timers. */
    

    In your main file. This will allocate more memory to the app timer module.

  • I can't see your pictures. Can you please edit your original post and insert them there? Maybe you can post your main.c file as well? EDIT: never mind. I can see your pictures now.

Reply Children
No Data
Related