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

Timer1 Only Firing at 250Hz

Not sure why but my time is only firing at 250Hz with the prescaler set to 0. Not sure why. Shouldn't it be going at 16Mhz at these settings? (Running on the PCA10028 Board)

namespace drv {

void Timer::Init() {
	// Start 16 MHz crystal oscillator.
	NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
	NRF_CLOCK->TASKS_HFCLKSTART    = 1;

	// Wait for the external oscillator to start up.
	while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0){}

	NRF_TIMER1->MODE = TIMER_MODE_MODE_Timer;

	NRF_TIMER1->PRESCALER   = 0;
	NRF_TIMER1->BITMODE = TIMER_BITMODE_BITMODE_16Bit;
	NVIC_EnableIRQ(TIMER1_IRQn);
	NRF_TIMER1->INTENSET = TIMER_INTENSET_COMPARE0_Enabled << TIMER_INTENSET_COMPARE0_Pos;

	NRF_TIMER1->CC[0] = 100;
	NRF_TIMER1->TASKS_START = 1;



}

extern "C" {
	void TIMER1_IRQHandler() {
		NRF_TIMER1->EVENTS_COMPARE[0] = 0; // Clear INT
		uint32_t cc;
		cc = NRF_TIMER1->CC[0]++;
		nrf_gpio_pin_toggle(21);
		svc::TimerManager::IncrementTime();

	}
}

} /* namespace drv */
Parents Reply Children
No Data
Related