nRF52832 Internal Oscillator Softdevice Enable Hanging

ConfusedIndividual gravatar image

asked 2017-04-21 18:31:31 +0200

I'm using the nRF52832 chip without an external crystal. I configured it to use the internal RC with:

nrf_clock_lf_cfg_t clock_lf_cfg;
clock_lf_cfg.source = NRF_CLOCK_LF_SRC_RC;
clock_lf_cfg.rc_ctiv = 16;
clock_lf_cfg.rc_temp_ctiv = 2;
clock_lf_cfg.xtal_accuracy = 0;

// Initialize SoftDevice.

However, the device seems to be hanging upon enabling the SoftDevice. When going through with a debugger, it just jumps to address 0 continuously. I have the Monitor Mode debugging set up based on the blog post, so I wouldn't think that would be the issue.

Am I doing something wrong in configuring the Softdevice to use the Internal RC?

edit retag flag offensive close delete report spam


Have you tried regular debugging and checking if you are running into the error-handler? See this post on how to debug. That the address jumps to 0 continuously indicates that the device is restarting (default behavior when running into the error-handler.)

Sigurd ( 2017-04-21 18:49:12 +0200 )editconvert to answer

I had a fault every time I tried to start with temp_ctiv. Seems like it might be a bug in some SD's. Try setting temp_ctiv to 0. If you are running on the internal RC, then likely RTC accuracy isn't supremely important. So a calibration cycle every 4 seconds will be sufficient. The temp measurement isn't that important.

AmbystomaLabs ( 2017-04-21 20:19:13 +0200 )editconvert to answer

I'm seeing it reset to 0, even if I set the temp_ctiv to 0. Even with regular debugging, I'm not seeing it hit any error handlers. I've put breakpoints in app_error and softdevice_handler and I'm not seeing anything.

Definitely Confused ( 2017-04-26 16:57:53 +0200 )editconvert to answer

Did you remember to add DEBUG as a Preprocessor symbol?

Sigurd ( 2017-04-26 17:00:39 +0200 )editconvert to answer

Yes, I added DEBUG is a preprocessor symbol. If I go through with the debugger step by step, I can eventually reach the error handler, but just hitting "Continue" always jumps me back to 0

Definitely Confused ( 2017-04-26 17:02:39 +0200 )editconvert to answer

Have you tried starting it without the app scheduler? I haven't ever used the scheduler but my understanding is that it only affects the way interrupts are handled and provides more resources to main. Assuming you aren't running gobs of code in handlers, you should get plenty of time back at main to run housekeeping even without the scheduler.

So try:

#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_RC, \ .rc_ctiv = 16, \ .rc_temp_ctiv = 0}

nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;


AmbystomaLabs ( 2017-04-26 18:39:20 +0200 )editconvert to answer