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

How to find error causing code witch is caugt by app_error_weak.c

I have built a custom chip with nrf52840 on it.

I use Ses as development tool.

I took as startingpoint for software SDK15.3 with Softdevice 140

I took the ble_template from the SDK and copied my code init.

I can compile the code without any error, but when I flash it on the device it does not start to advertise.

In debugger mode it starts up well, but then runs into app_error_weak.c

now the function gives error code and stuff, but I don't know, how to find the code witch caused the error

that is what i got from ses and the error handler

I'm not sure if its relevant but in call stack ar two functions in it

the first is in app_error_weak.c

the secound is in app_error_handler_gcc.c

and shows those parameters 

because error_code in one handler and id in the other ar the same i guess, that 1 error is thrown and chaugt by both handlers, or

one handler calls the other.

But I don't know now how to solve this. And how to search for the code whitch caused the error.

thanks for any help

Parents Reply
  • sd_ble_evt_get returning NRF_ERROR_NOT_FOUND is a normal scenario where softdevice tells that there are no more events to be pulled out.

     

    bom4 said:
    but it did still not advertise

    If your application has called sd_ble_gap_adv_start without any errors, then I do not understand why the device is not advertising. Please make sure that your application starts in debug mode and put a breakpoint inside app_error_fault_handler to find out if any APP_ERROR_CHECK failures.

Children
  • at the moment I'm debugging

    the function sd_advertising_start() returns 8 invalid state

    in this funciton it is a call to 

    ble_advdata_set() returns 7 invalid parameter

    in this function is a call to

    sd_ble_uuid_encode() returns also 7

    after sd_ble_uuid_encode() returns error code the function hangs up in a infinity loop

    were it always enters sd_advertiseing_start() and always returns 8 

    but never ever passes the breakpoint by ble_advdata_set() or 

    sd_ble_uuid_encode()

    but in the infocenter i can not find clear informations about this function,

    All information I found about this is ...

    I don't have a clue what this minimalistic information should give me... 

  • Could it be, that SES whant's to load all on RAM in debugging? 

    The chip has 1MB Flash and 256 kB RAM...

    in SES it says : 

    that gives a total of 273.8 kB what is more then we have in RAM only

    I 'm looking for a needle in a haystack pleas show me the needle

  • When there is a stack corruption or stack overflow, then it is very likely that the app_error handler gives garbage values as references. You need to find out how much RAM your application is using. You could do this by paining your application part of the RAM with a pattern and letting the program run for a while and see if the whole RAM is being used by the application. If there are no written pattern values anywhere in your application specific RAM region, then we are sure that it is a stack corruption.

  • I have to apologize my questions were relatet on a project that seems to be SDK 15.3 but I was wron instructed.

    In truth they didn't take SDK 15.3 fore the project like they told me to begin, they used SDK 14.2

    I will first switch the SDK version and may that solves my problems already

    thanks a lot for your answers

Related