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

GPIOTE one input pin to few channels

Hello!

I want meashure pulse time via input capture.

I configured  NRF_P0, NRF_GPIOTE, NRF_PPI and NRF_TIMER1.

	NRF_P0->PIN_CNF[4] = 0x0000000C;
	
	NRF_GPIOTE->CONFIG[0] = 0x00010401;
	NRF_GPIOTE->CONFIG[1] = 0x00020401;
	
	NRF_GPIOTE->INTENSET = 3;
	
	NRF_GPIOTE->EVENTS_IN[0] = 1;
	NRF_GPIOTE->EVENTS_IN[1] = 1;
	
	NRF_PPI->CH[0].EEP = (uint32_t)&NRF_GPIOTE->EVENTS_IN[0];
	NRF_PPI->CH[0].TEP = (uint32_t)&NRF_TIMER1->TASKS_CAPTURE[0];
	
	NRF_PPI->CH[1].EEP = (uint32_t)&NRF_GPIOTE->EVENTS_IN[1];
	NRF_PPI->CH[1].TEP = (uint32_t)&NRF_TIMER1->TASKS_CAPTURE[1];
	
	NRF_PPI->CHENSET = 3;
	
	uint32_t err_code;
	NRF_TIMER1->TASKS_STOP = 1;
	
	NRF_TIMER1->MODE = 0;
	
	NRF_TIMER1->BITMODE = 3;
	
	NRF_TIMER1->PRESCALER = 0;
	
	NRF_TIMER1->TASKS_CLEAR = 1;

	NRF_TIMER1->SHORTS = 3;
	
	NRF_TIMER1->CC[0] = 0;
	
	NRF_TIMER1->INTENSET = 0x10000;	

It work fine, but in datasheet I found next text:

Only one GPIOTE channel can be assigned to one physical pin. Failing to do so may result in unpredictable
behavior.

If using two GPIOTE channels with one pin is prohibited, then how should I measure the pulse duration without constantly reconfiguring the input capture?

And is it really impossible to use two GPIOTE lines with one pin?

Parents Reply Children
No Data
Related