Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NRF52 Support #80

Open
KevinUrrutia opened this issue Jun 28, 2021 · 1 comment
Open

NRF52 Support #80

KevinUrrutia opened this issue Jun 28, 2021 · 1 comment

Comments

@KevinUrrutia
Copy link

Hello,
I was looking to add my Adafruit NRF52 bluefruit board and am having trouble setting up the timer registers. The NRF52 has a NRF_TIMER0 type definition where there are separate registers that set the prescaler, start the timer etc. But, the issue that I am having is that when I initialize the NRF_TIMER0 it does not begin to count and hangs in the comparison while loops such as the one in write char

while((uint32_t)(NRF_TIMER0_BASE) < txBitWidth) {}

This is an example of where the timer causes the code to hang.

This is how I initialize the timer

void SDI12::init_timer(void) {
  NRF_TIMER1->TASKS_STOP = 1;
  NRF_TIMER1->MODE = TIMER_MODE_MODE_Timer;
  NRF_TIMER1->BITMODE = (TIMER_BITMODE_BITMODE_24Bit << TIMER_BITMODE_BITMODE_Pos);
  NRF_TIMER1->PRESCALER = 0b00001011;

  NRF_TIMER1->TASKS_CLEAR = 1;
  NRF_TIMER1->CC[0] = TIMEOUT * 1000;

  NRF_TIMER1->INTENSET = TIMER_INTENSET_COMPARE0_Enabled << TIMER_INTENSET_COMPARE0_Pos;

  NRF_TIMER1->SHORTS = (TIMER_SHORTS_COMPARE0_CLEAR_Enabled << TIMER_SHORTS_COMPARE0_CLEAR_Pos);
  NRF_TIMER1->TASKS_START = 1;
}
@SRGDamia1
Copy link
Contributor

I'm sorry, I'm not at all familiar with the timers on any of the Nordic processors. Unfortunately, I probably won't be able to look into it any time soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants