Arduino-SDI-12
Arduino-SDI-12 copied to clipboard
NRF52 Support
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;
}
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.