Arduino-SDI-12 icon indicating copy to clipboard operation
Arduino-SDI-12 copied to clipboard

NRF52 Support

Open KevinUrrutia opened this issue 3 years ago • 1 comments

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;
}

KevinUrrutia avatar Jun 28 '21 17:06 KevinUrrutia

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.

SRGDamia1 avatar Jul 06 '21 15:07 SRGDamia1