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

nRF51822 Bit-Width and BITMODE

Hello,

Firstly, the nRF5122 Product Specification v1.3 Section 4.2 says that TIMER0 is 32 bits wide. However, other product specs seem to mention 16/24 bit timers, and it seems to be 24 bits.

Secondly, changing the BITMODE register does not seem to change the frequency of a compare interrupt.

NRF_TIMER0->BITMODE = TIMER_BITMODE_BITMODE_08Bit;

Paul.

(for the code below, interrupt still happens once per second)

NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK->TASKS_HFCLKSTART = 1;

while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
	
NRF_TIMER0->MODE = TIMER_MODE_MODE_Timer;
NRF_TIMER0->PRESCALER = 0;
NRF_TIMER0->BITMODE = TIMER_BITMODE_BITMODE_08Bit;

NRF_TIMER0->TASKS_CLEAR = 1;

NRF_TIMER0->CC[0] = 10;	

NRF_TIMER0->INTENSET =
	(TIMER_INTENSET_COMPARE0_Enabled << TIMER_INTENSET_COMPARE0_Pos);

NVIC_EnableIRQ(TIMER0_IRQn);
	
__enable_irq();

NRF_TIMER0->TASKS_START = 1;
Related