nrf52832 and S112

Hello,

I am trying to use a blinky example from Nordic SDK (V17.1.0) as a starting point for our custom project. The device on our custom board is nrf52832 with 256k flash, so I wish to use an S112 soft device as it uses less flash space than an S132. I copied and modified the blinky example from the pca10040e directory. This project uses an S112 soft device and nrf52810 microcontroller, so I changed the project settings (preprocessor definitions) to use the nrf52832 microcontroller (see attached photo). I also replaced the startup files with the correct ones. Everything builds ok, but when I try to run it, it crashes at line 574 in main.c (call to function gap_params_init()). When I try to load the same project from directory pca10040 (which uses S132 and nrf52832) it works ok. I also tried to erase the whole flash every time I change the project just to make sure the right soft device is used. Any idea, how to fix this?

Best wishes,

Matjaz Tome

  • Hi there,

    You're preprocessor definitions looks ok.

    What exactly do you mean by crash? Does it go into an error handler or does it hardfault? Can you share the call stack and use breakpoints and specify how far the program reach before it crashes? 

    Also, if you're starting a new project then I would recommend using nRF Connect SDK instead of nRF5SDK, as the former is our primary SDK with active development vs the nRF5SDK is only in maintenance mode. 

    regards

    Jared 

  • Hi Jared,

    my program stops in error handler (app_error_weak.c) on line 100 (NRF_BREAKPOINT_COND;). I will post the call stack in the evening, as currently, I don't have the hardware with me.

    I am aware, that nRF Connect SDK is currently the preferred SDK, but we already have some experience using nRF5SDK, so that is why this SDK has been chosen. 

  • Hi,

    The error handler in app_error_weak.c is usually called when you call APP_ERROR_CHECK(err_code) and passing a non-zero err_code as parameter. So somewhere in your code, APP_ERROR_CHECK() is called with a non-zero return value which cause the program to go into the error handler. It would be nice if you could use breakpoints, the debugger and figure exactly what function that returns this non-zero return value.

    regards

    Jared 

  • Thanks, Jared I will do this in the evening when I will have access to the dev board. I will report back the error code.

  • Hi,

    So I checked the call stack and it seems that the function that causes the crash is sd_ble_gap_device_name_set (main c, line178). As I was having a hard time figuring out witch error code is reported, I turned off compiler optimization (before it was set to optimize for size). When I run debug session again, the before-mentioned function returned 0 and the blinky demo is now running! 

    But it would be nice if size optimization would work, as we only have 256 kB of flash available.

Related