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

Custom nrf51422 Handle in BLE_STACK_INIT (SDK12.3.0)

Hi,

I'm pretty new to nordic development, so I'm sure the error I'm facing is easy to solve, but yet I can't do it by myself.

So, I'm using the nRF51422 on a custom board with the SDK12.3.0, S130 v2.0.1, and i'm actually trying to run the ble_app_uart example, but the program is stuck when the main call the BLE_STACK_INIT function.

When i'm trying to debug the program from ble_stack_init(), i go through the softdevice_handler_init(), which proceeds well untill the sd_softdevice_enable() function. Then I go directly to the SVC_HANDLER without any error returned nor any log in my debug terminal.

I've seen others posts which have the same issue, and they were discussing about two configuration problems :

  • The clock configuration, with NRF_CLOCK_LF_SRC_RC, which is indeed called with the sd_softdevice_enable() function.
  • The ram/flash placement, that I'm realy not sure about my actual configuration.

Of course, because I'm using a custom board, I've created my own file to setup the differents pins, which works fine with LEDs, and I also declared my NRF_CLOCK_LF_SRC_RC here :

// Low frequency clock source to be used by the SoftDevice
#define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_RC,            \
                                 .rc_ctiv       = 16,                                \
                                 .rc_temp_ctiv  = 2}
#endif

I've also enabled the Clocks in my sdk_config.h

#ifndef CLOCK_ENABLED
#define CLOCK_ENABLED 1
#endif
#if  CLOCK_ENABLED
// <o> CLOCK_CONFIG_XTAL_FREQ  - HF XTAL Frequency
 
// <0=> Default (64 MHz) 
// <255=> Default (16 MHz) 
// <0=> 32 MHz 

#ifndef CLOCK_CONFIG_XTAL_FREQ
#define CLOCK_CONFIG_XTAL_FREQ 255
#endif

Which seems coherent because my board is using a 16MHz HF clock and a 32kHz LF clock.

Even though I'm not sure about this whole clock config, I'm much more worried about my Flash/Ram configuration.

The first thing that makes me doubtful is that I had to declare an SRAM segment in my memory segment config, under the build menu of the project setings. This is shown like this : 

FLASH RX 0x0 0x00040000;SRAM RWX 0x20000000 0x00008000

Also, I'm not sure of the starting address of both FLASH and SRAM.

Indeed, I've seen in this tutorial from Nordic that the FLASH and RAM memory should have very specific starting addresses, and I tried to do so in the section placement macro under le Linker menu, using the values for S130 v2.0.1, namely  0x200013C8 for RAM and 0x1B000 for FLASH. 

The problem is, when I do so, that the debugger is stuck, I don't know why, without me launching it and isn't throwing any error, just saying he's running : 

So to have access to the debugger, I have to remove all of my section placement macro configuration. I would realy apreciate if someone could tell me why I don't have anymore access to the debugger when I add any section placement macro. It looks like my device isn't responding anymore, even if he's still connected.

I've also tried to know the correct RAM address exposed in the tutorial, but with this version of the SDK (SDK12.3.0) I don't have access to this SDK configuration (the NRF_SDH_BLE_LOG and the NRF_SDH_LOG doesn't exists), so I don't see anything in the debug terminal (part 8 of tutorial), and there ain't no nrf_sdh_ble.c file in my project (part 9 of tutorial)

But going back to my first issue, it would be great if someone could help me fixing this BLE_STACK_INIT() issue, maybe this has nothing to do with clock config or memory map.

Thanks a lot for any peace of advice, I know this post i quite long, but I'm realy lost at the moment.

Raph

Parents Reply Children
No Data
Related