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:
- I'm not using the softdevice.
- It's possible, that the board has some mistakes. It's hand made.
- 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.