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 Children
  • That makes sense. If there is no external crystal connected it needs a clock from somewhere - hence the internal RC. I am not (knowingly) changing the the external crystal. I have searched for "HFCLKSTAT" and it is nowhere to be found in the project. So I assume that means it is running off the internal RC, correct?

    My understanding is that the radio requires the more accurate crystal. But the radio is working fine. That's why I thought the external crystal was in use.

    If it is using the RC oscillator then the clock is not the problem.

    How do I switch to the external oscillator? As stated before, where should code be located (startup or main code) and what are the instructions? Load NRF_CLOCK->HFCLKSTAT? 

  • 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

  • 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