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

Crystal initialization problem

I'm experimenting problems with a nRF51822 custom board. Recently I managed to run the blinky sample project. Now I'm trying to test a BLE project, but I'm having problems with my external crystal. I have the 16MHz and the 32KHz crystals (There are details of the board on a previous post here).

I was starting the 32KHz crystal with this code

NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRCCOPY_SRC_Xtal << CLOCK_LFCLKSRCCOPY_SRC_Pos);
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0);

In the checking while the program get stuck. I thought that I had problems with the crystal itself, so I tried to use the 16MHz instead, with the same result.

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

Then I tried just to simulate (By the way, I'm using Keil 5) and I was surprise to see that the code stop at the same place. I noticed that the simulation is giving constantly the following error:

*** error 65: access violation at 0x40000100 : no 'read' permission

So, if I understand well, I'm having problems to read the status of the NRF_CLOCK. What I'm doing bad? I'm missing something?

Some more information:

  1. I'm not using the softdevice.
  2. It's possible, that the board has some mistakes. It's hand made.
  3. I don't have a lot of experience with microprocessors

Thank you for your time. I'm really stuck here, don't know how to fix this.

Parents
  • The board is the OpenBeacon Physical-Web Tag. I'm trying the example code from here. And with the library that openbeacon provide, instead of the Nordic packages (and the Softdevice). I'm really don't sure that I'm doing the right thing. Just experimenting here. (from the openbeacon site: "our beaconing firmware is implemented on the bare SoC: no annoying SoftDevice that limits your possibilities", I don't have nothing against the SoftDevice :) So, the thing is that the code get stuck in the check of the 32 kHz crystal. For now, it works commenting that line, but I'm not sure if the beacon is working with the 32 kHz crystal, or the 16 MHz cristall, or the internal one! How can I check that? Thank you!

Reply
  • The board is the OpenBeacon Physical-Web Tag. I'm trying the example code from here. And with the library that openbeacon provide, instead of the Nordic packages (and the Softdevice). I'm really don't sure that I'm doing the right thing. Just experimenting here. (from the openbeacon site: "our beaconing firmware is implemented on the bare SoC: no annoying SoftDevice that limits your possibilities", I don't have nothing against the SoftDevice :) So, the thing is that the code get stuck in the check of the 32 kHz crystal. For now, it works commenting that line, but I'm not sure if the beacon is working with the 32 kHz crystal, or the 16 MHz cristall, or the internal one! How can I check that? Thank you!

Children
No Data
Related