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

nrf51822 Not Running

We have 2 identical development boards and have been using only one until now. I was able to download code into the 2nd board successfully but it will not run. It does not run in either standalone or debug mode (PICKit3). What are the likely causes? 

Parents Reply
  • Hi,

     

    To see if the external HFCLK starts up, you can trigger it manually, by adding this at the top of your main (before softdevice init):

    NRF_CLOCK->TASKS_HFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;

    If it hangs in the while-loop, it has problems starting up the xtal. 

     

    When you enter debug mode, where does it stop when you break/pause the debug session? Have you remembered to program the softdevice onto the device?

     

    Kind regards,

    Håkon

Children
  • I placed a breakpoint at the first instruction in main(). After clicking on RUN icon it immediately stops and never gets to the breakpoint.

    I inserted the 3-line test code you offered and placed breakpoints at every line. It doesn't stop at any of them. Again, after clicking on RUN it immediately stops. Clearly it is not running at all.

    No, I have not installed the softdevice. I am assuming that it should run basic code without it. Of course without it the BLE will not work - but that is not an issue right now.

    Can the softdevice be written using uVision or must nRFgo Studio be used? It has been a long time since I used nRFgo Studio so I don't remember the physical connections. Can I use the Segger programmer/emulator connected to SWDIO and SWDCLK on the target to write the softdevice. If I remember correctly there may have been a different cable that I used with nRFg Studio.

  • In debug mode, even when the breakpoint is at the 1st or 2nd line in main(), it immediately stops after clicking RUN but never gets to the break.

    I added the 3 code lines suggested and put breaks on each line. But it never reached any of them. Just stops after clicking RUN. Clearly the MCU is not running.

    No, the softdevice has not been loaded. Shouldn't that just affect BT? Shouldn't the MCU run instructions without it?

    It has been so long since I loaded the softdevice on targets I forgot how though I do know that nRFgo Studio was used. I just unsuccessfully tried using nRFgo with the Segger JTAG. If I remember correctly there is other hardware used for this purpose. What is it?

  • Hi,

     

    My apologies for the delayed answer.

     

    If your application does not rely on the SoftDevice, you can then omit it.

    A softdevice application will be offset wrt. to flash and RAM, like 0x18000 for flash and 0x20002000 for RAM. If there is no softdevice present in flash then, you will never start your application, as there's nothing at address 0 (and onward).

      

    Tom said:
    I placed a breakpoint at the first instruction in main(). After clicking on RUN icon it immediately stops and never gets to the breakpoint.

    Where is it stuck if you break (or pause) the debug session?

    Tom said:
    I just unsuccessfully tried using nRFgo with the Segger JTAG. If I remember correctly there is other hardware used for this purpose. What is it?

     Try using nrfjprog directly:

    nrfjprog -e # this will erase the device

    nrfjprog --program <hex file> -f nrf51 --reset # program a .hex and reset the device afterwards.

     

    Kind regards,

    Håkon

Related