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?
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?
Can you post the schematic?
Why didn't I think of that? Actually I did but since the external crystal is required for the radio I dismissed it.
In order to try resolving the board problem I attempted to select the internal RC 16MHz clock but was unable to do it. It looks like something like the following must be in the code (but I don't know where to put it). I would think it should be in the startup code???
NRF_CLOCK->HFCLKSTAT = 0x00010000; // HFCLK running, use 16MHz RC oscillator
Default is 16 MHz RC so if you haven't changed it, it should startup with that. If you have specifically changed to the 16 MHz XO, the MCU will hang while waiting for the crystal to start. If this is the case, check the crystal connection and the load caps.
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.
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.