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

Can not enable Softdevice with nRF52 Preview DK

Hi,

I am trying to get my mesh running on the nRF52 Preview DK but calling

SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL);

will break my program. If I leave the Softdevice disabled, the rest of my code runs okay while constantly complaining, that the Softdevice is not enabled.

The debugger runs until it reaches the line with sd_softdevice_enable and then jumps to the Hardfault handler. How would I go on about debugging this? Is there an Errata that I am missing?

Thanks, Marius


I am using this GCC setup if that helps...: embeddedsoftdev.blogspot.de/.../ehal-nrf51.html

Parents
  • Hi

    Code stuck in SOFTDEVICE_HANDLER_INIT() usually indicates a faulty low frequency crystal. To see if this is an issue try to write:

    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, NULL);
    

    instead to synthesize a low frequency clock from the 16MHz crystal. You can also try to start the LFCLK manually and check whether it starts or not.

    It can also be a SDK/Softdevice incompatibility. Have you set your RAM and ROM addresses in "Target Options -> Target" so that they match your Softdevice?

  • Hi,

    thanks. I've tryed to start the clock with the synthesized source but did not notice any difference. Then, I used the following code to start up the low frequency clock:

    //Try to start Low frequency clock manually
    NRF_CLOCK->LFCLKSRC = NRF_CLOCK_LFCLKSRC_XTAL_20_PPM;
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    
    u32 a = 0;
    while(true){
    	while(a < 10000000){
    		a++;
    	}
    	logt("ERROR", "running? %d", NRF_CLOCK->LFCLKSTAT);
    	if(NRF_CLOCK->LFCLKSTAT != 0){
    		logt("ERROR", "continue");
    		break;
    	}
    }
    

    But this did not help either. The low frequency clock starts successfully after some time (65536: indicating that is is started and that it is using the RC source).

    Maybe this is the GCC ssetup that I am using where I had to change line 56 in the nrf_svc.h to:

            "bx r14" : : "I" ((uint16_t)number) : "r0" \
    

    to compile it. Maybe this is jumping to the wrong address.

Reply
  • Hi,

    thanks. I've tryed to start the clock with the synthesized source but did not notice any difference. Then, I used the following code to start up the low frequency clock:

    //Try to start Low frequency clock manually
    NRF_CLOCK->LFCLKSRC = NRF_CLOCK_LFCLKSRC_XTAL_20_PPM;
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    
    u32 a = 0;
    while(true){
    	while(a < 10000000){
    		a++;
    	}
    	logt("ERROR", "running? %d", NRF_CLOCK->LFCLKSTAT);
    	if(NRF_CLOCK->LFCLKSTAT != 0){
    		logt("ERROR", "continue");
    		break;
    	}
    }
    

    But this did not help either. The low frequency clock starts successfully after some time (65536: indicating that is is started and that it is using the RC source).

    Maybe this is the GCC ssetup that I am using where I had to change line 56 in the nrf_svc.h to:

            "bx r14" : : "I" ((uint16_t)number) : "r0" \
    

    to compile it. Maybe this is jumping to the wrong address.

Children
No Data
Related