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

Device is not advertising stuck at SOFTDEVICE_HANDLER_INIT Macro

I have created a customized Services according to nAN36 Document.

  1. SDK using 8.0
  2. Stack S110 8.0
  3. DEV kit PCA10028 nRF51.
  4. J-LInk RTT DEbugger

When the function ble_stack_init(void) get called from main. It stuck somewhere with MACRO

SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL); 

This Macro is defined softdevice_handler.h file. Now how to Proceed further to check where I am lagging...

 ble_uuid_t adv_uuids[] =
    {				
				{SOS_BLE_BAS_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN},
				{SOS_UUID_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN},
				{FIND_ME_ALERT_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN}        
    };

This is service I passed for advertising. And these are defined as

/*-------------------------------------------------------------------------------------------------------*/
#define   SOS_UUID_BASE	{0xFA,0xFF,0xBE,0x11,0xA7,0x63,0x1C,0xBB,0x7F,0x48,0x27,0x66,0x00,0x00,0x8C,0xF0}

//-----------------------SERVICES UUID VENDOR
#define   SOS_UUID_SERVICE					0x1602
#define   FIND_ME_ALERT_SERVICE			0x1604
#define	SOS_BLE_BAS_SERVICE				0x1606

//-----------------------SERVICE CHARACTERISTIC UUID
#define	  SOS_UUID_EMR_MSG_CHAR			0x1608
#define 	ALERT_UUID_FIND_ME_CHAR		0x1610
#define		SOS_BLE_BAS_CHAR					0x1612 

______________________________________________________________

Some one if suggest me the step I follow next to know the problem. And please revert on same if any other part of code require here.

  • No i would doubt it. In fact those two lines of code wouldn't really compile down to anything which does anything much. Just moves the address of and size of a chunk of statically allocated memory into program memory somewhere.

    Do you have an error handler? Put a breakpoint in that as well to check something else isn't landing you in there. None of the places highlighted so far are places which could send the chip into reset (and hence start main() again)

  • yes that two line has nothing to do. I am just to annotating a point so you can easily get it where I am stuck.

    Look that things goes inside the stack_init function

    there it is defined as err_code = sd_softdevice_enable(clock_source, softdevice_assertion_handler); APP_ERROR_CHECK(err_code);

    which means I am calling an error handler function. But things happened here is when this Function get call it won't get inside this error handler (APP_ERROR_CHECK) it reset the program.

    Softdevice and Application IROM and IRAM memory allocation is correct. Cause I did the same As it was shown in case of proximity service , which come within the SDK.

  • One of the default error handler functions does reset the chip, which is why I suggested putting a breakpoint in the function before it does anything to see what the error code is. Or write your own error handler function which loops and you can break into it.

    Usually the error handler is only defined to reset the chip in release code, but I don't know what flags you've built with so it's possible you have the 'reset the chip' error handler.

  • .. and if you've single stepped all the way to the line err_code = sd_softdevice_enable(clock_source, softdevice_assertion_handler); what is err_code? If it's not zero, you have an error and APP_ERROR_CHECK() is going to fail on the very next line.

  • Yes I have added my own Error handler there, but execution point may be not reached till that point. Because if it reached there till my error handler than also print the printf statement there. But it reset somewhere inside the sd_softdevice_enable Function which is simply an API, under SVCALL. SO I cant see what is happening inside there... Please clear my one doubt. As I have added three customized services and three characteristics for each services. May be this the main issue?? anything happening inside the sd_softdevice_enable function which is hardwired but I may be providing excessive values to any related parameters.

Related