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

How can I find source of problem?

Hi !

I'm trying to debug. I followed this video : https://www.youtube.com/watch?v=uP8RYgYGRvI&list=PLx_tBuQ_KSqGHmzdEL2GWEOeix-S5rgTV&index=7 .  But I can't completely.

the program stop at NRF_BREAKPOINT_COND in app_error_weak.c.

I used breakpoint to understand which function the error occurred after.  I guess there is a problem when setting Uart. What should I do to better interpret the problem? What can be the problem ?

The program enters the following functions respectively:

1- nrf_drv_uart_init(...);

2- nrfx_uart_init(....);

3- interrupts_enable(....)

4- NRFX_IRQ_PRIORITY_SET(nrfx_get_irq_number((void *)p_instance->p_reg), interrupt_priority);

5- nrfx_get_irq_number(.....)

I added the 5 step's photos to explain better

1)

2)

3)

4)

5)

after step 5, the program stop at at NRF_BREAKPOINT_COND in app_error_weak.c

Parents
  • Hello,

    Are you working on an example from the SDK? If so, which example is this?
    Are you using the RTT or UART logger backend?

    Could you also confirm for me that you have DEBUG defined in your preprocessor defines, like shown in the included image?

    This will print a detailed error message to your logger output, if a non-NRF_SUCCESS error is passed to an APP_ERROR_CHECK.

    Looking forward to resolving this issue together!

    Best regards,
    Karl

  • In fact, this is a project developed on ble_peripheral example. It is not an example of UART or RTT.

     

    Are you using the RTT or UART logger backend?

    Is this what you mean? actually, I do not have information on this subject:

    Could you also confirm for me that you have DEBUG defined in your preprocessor defines, like shown in the included image?

    the current settings are like this, what should I do ?

  • Hi,

    Please check that you have created the two timers in question, prior to attempting to start them.

    I already start all timers with the timers_init() function inside the main() function.

  • Hello again,

    cemalb said:
    I already start all timers with the timers_init() function inside the main() function.

    No, you currently attempt to start all the timers. You never actually check whether you were successful in doing so or not.
    You are not checking any of the error codes returned from all your calls to app_timer_create.
    Please always check the API reference / documentation of functions you are using that you have not written yourself - such as SDK functions - before using them, and please always check the returned error codes of functions you end up using in your code.
    If you do not check the returned error codes, you will have no way of knowing whether a function call has failed for whatever reason, or if you application to could proceed as usual.
    Checking the returned error codes is crucial - it is also why we have taken the time to implemented them in the first place.

    Please add error code checks to all functions currently missing them, see what error code is being returned by the functions, and then check the API Reference to see why the function call failed.
    Do this, and let me know if it resolves your issue.

    Looking forward to resolve these issues together.

    Best regards,
    Karl

  • Hi, I replied late because I had to deal with other projects.

    Please add error code checks to all functions currently missing them, see what error code is being returned by the functions, and then check the API Reference to see why the function call failed.

    While creating timers, I added error codes for all of them, but they didn't return any error codes. they all return 0.

  • cemalb said:
    I replied late because I had to deal with other projects.

    No problem at all - we continue whenever you have the chance! :) 

    cemalb said:
    While creating timers, I added error codes for all of them, but they didn't return any error codes. they all return 0.

    I am happy to see that you have added this!
    Please make sure to add APP_ERROR_CHECK to all places where it is appropriate in your code,
    not just the timer_init function.

    So they all return successfully, that is good news!
    Are you still getting the NRF_ERROR_INVALID_STATE returned from your two app_timer_start calls, or has that too disappeared? If so, what error code is being returned currently?

    Best regards,
    Karl

  • Please make sure to add APP_ERROR_CHECK to all places where it is appropriate in your code,
    not just the timer_init function.

    Ok, I will add immediately.

    Are you still getting the NRF_ERROR_INVALID_STATE returned from your two app_timer_start calls, or has that too disappeared? If so, what error code is being returned currently?

    I guess the error has changed. the last error is:

    <error> app: ERROR 536907338 [Unknown error code] at XXX\V1.5.9\examples\btc_ble_peripheral\xxxBluetooth\timer_init.c:377
    PC at: 0x000336CB
    <error> app: End of error report

Reply
  • Please make sure to add APP_ERROR_CHECK to all places where it is appropriate in your code,
    not just the timer_init function.

    Ok, I will add immediately.

    Are you still getting the NRF_ERROR_INVALID_STATE returned from your two app_timer_start calls, or has that too disappeared? If so, what error code is being returned currently?

    I guess the error has changed. the last error is:

    <error> app: ERROR 536907338 [Unknown error code] at XXX\V1.5.9\examples\btc_ble_peripheral\xxxBluetooth\timer_init.c:377
    PC at: 0x000336CB
    <error> app: End of error report

Children
  • cemalb said:
    Ok, I will add immediately.

    Great! If you now see that the previous developer never checked any error codes you might have to review your whole project for this, but rest assured that it is essential to check error codes to know whether a function has completed successfully or not.

    cemalb said:

    I guess the error has changed. the last error is:

    <error> app: ERROR 536907338 [Unknown error code] at XXX\V1.5.9\examples\btc_ble_peripheral\xxxBluetooth\timer_init.c:377
    PC at: 0x000336CB
    <error> app: End of error report

    What function is being called at line 377 of your timer_init.c file?
    Keep in mind that I do not have you project, so there is no way for me to know what is happening here unless you tell me.
    Please also share the snippet of code of the function containing line 377 of timer_init.c.

    Best regards,
    Karl 

Related