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

Device loops on sd_softdevice_enable

I am new to Nordic, and Keil, and not especially strong in microprocessors yet. I am trying to get currently developed firmware for a nRF52382 chip to operate on a custom built board.

I submitted the following problem to the rest of my team, but I am trying to reach out and get any help I can as I am on a tight schedule. The question resides at the bottom.

I am currently operating with the pre-built s132_nrf52_2.0.1_softdevice.hex (was originally using s132_nrf52_2.0.0_softdevice.hex) soft device, because I have yet to be able to build the custom soft device from the project.

When operating at main() ble_stack_init() is called which calls: SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL); where clock_If_cfg is set at xtal_accuracy of NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM; which calls: (at line 285 on softdevice_handler.c) err_code = sd_softdevice_enable(p_clock_lf_cfg, softdevice_fault_handler); who's passed in values are the same object with xtal_accuracy NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM and second variable is NULL.

the function sd_softdevice_enable is not defined in any files, however the assembly is as follows: 0x00009076 BF20 WFE 0x00009078 F8D40104 LDR r0,[r4,#0x104] 0x0000907C 2800 CMP
r0,#0x00 0x0000907E D0FA BEQ
0x00009076

WFE (which i believe is the source of my problem) waits for an IRQ or FIQ interrupt to the system. When one is seen, it is supposed to make an immediate return, www.keil.com/.../armasm_dom1361289926047.htm

LDR loads the value in memory from address in r4 (0x40000000) with offset (0x104) into register r1. That value in memory is 0x00000000.

CMP compares register r0 with the value 0x00 which results in both being equal, resulting in the zero flag set to 1 (resulted in zero).

and BEQ finds that the zero flag is set to true and jumps the next command back up toe the WFE statement.

My suspicion is that I need to trigger an IRQ/FIQ event somehow for it to escape this loop, but I am not sure how. I'm not even sure what type of event needs to be happening, but since the function is called by handing in the p_clock_lf_cfg data, I'm assuming it is an event triggered by the clocking system. I have tried bypassing this problem by skipping over the BEQ statement, and then one more additional bypass, but after it leaves the function, pretends to act nicely, it just loops back around to this function because it didn't start properly.

Any ideas would be absolutely great. I'm not sure if it is that I need the custom softdevice working properly, or if there is something up with the clock settings, or if we need a callback function set, but I suspect it is one of those three.

So, apologies if there isn't enough detail, but any input would be appreciated.

Related