I am new to ARM and nRF51822. I am using a development kit with the PCA10000 dongle and the PCA10005 daughter card. I wrote a simple C program (attached) to blink the LEDs on the dongle. I also hooked up LEDs to the same GPIO pins on the daughter card. The program works fine on the daughter card, but does not work on the dongle.
For both setups I am using emIDE and the JLink GDB Server. For the daughter card, I am using the provided J-Link lite device.
I carefully stepped through the program on each device to narrow down the difference in execution. The execution diverges in this code segment:
76 {
0x00000194 push {r7, lr}
0x00000196 sub sp, #16
0x00000198 add r7, sp, #0
0x0000019A str r0, [r7, #4]
77 uint32_t *pCnf;
79 pCnf = (uint32_t *) (GPIO_PINCNF + (4 * iLedPin));
0x0000019C ldr r3, [r7, #4]
Location 0x194 is the entry point into a subroutine. When I step on each assembly level instruction from 0x194 to 0x19c, everything is fine, and the stack pointer value at 0x19c is 0x20001c28. However, if I put a breakpoint at 0x19c, and run the program, then, when the breakpoint is triggered, the stack pointer's reported value is 0x20001c38. It seems (to me) that the subtraction instruction at 0x196 does not get executed at full speed.
What could be wrong?
Thanks for any help.