Hello everyone,
I'm trying to set up entirely open source project for my NRF51822 chip. Everything works fine so far but something strange happens during debugging.
I use nRF5_SDK_11.0.0_89a8197 and I've taken a template with a softdevice. I'm flashing the s130_nrf51_2.0.0_softdevice.hex softdevice, then my application nrf51422_xxac_s130.hex and I've done an example with printf over UART. I'm using a Tayo Yuden demo board and I have a virtual COM port that outputs the expected result.
However if I try to run gdb here is what happens:
Breakpoint 1, main () at main.c:593
593 timers_init();
(gdb) next
halted: PC: 0x0002051c
594 buttons_leds_init(&erase_bonds);
(gdb) next
halted: PC: 0x00020bbc
halted: PC: 0x00020bbe
halted: PC: 0x00020b40
595 uart_init();
(gdb) next
halted: PC: 0x00024880
596 ble_stack_init();
(gdb) next
halted: PC: 0x0002082c
597 device_manager_init(erase_bonds);
(gdb) next
halted: PC: 0x00020bcc
halted: PC: 0x00020bce
halted: PC: 0x00020bd0
halted: PC: 0x000209c4
598 gap_params_init();
(gdb) next
halted: PC: 0x00020550
599 advertising_init();
(gdb) next
halted: PC: 0x00020ab4
600 services_init();
(gdb) next
halted: PC: 0x000205f4
601 conn_params_init();
(gdb) next
halted: PC: 0x00020658
604 application_timers_start();
(gdb) next
halted: PC: 0x000206cc
605 err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
(gdb) next
halted: PC: 0x00020bea
halted: PC: 0x00021e48
halted: PC: 0x00020bf0
halted: PC: 0x00020bf2
606 APP_ERROR_CHECK(err_code);
(gdb) next
halted: PC: 0x00020bf4
halted: PC: 0x00020bf6
halted: PC: 0x00020bf8
halted: PC: 0x00020bfa
halted: PC: 0x00020c04
608 printf("Starting application!\n\r");
(gdb) next
halted: PC: 0x00020c06
halted: PC: 0x00020c08
halted: PC: 0x00024c4c
Breakpoint 1, main () at main.c:593
593 timers_init();
(gdb)
i.e. as soon as I try to read address 0x00024c4c my PC goes back to the beginning of main. I do not see this behavior if I just flash the chip and let it run freely.
What could be the cause of this behaviour? I tried to disable watchdog, the MPU is not on during debug ...
Regards,
L. Bogdanov