Hi,everyone I want to make out 4 channel PWM with PPI and two timers , PPI configuration like this,
/* Configure PPI channel 0 to toggle PWM_OUTPUT_PIN on every Timer 2 COMPARE[0] match. */
NRF_PPI->CH[0].EEP = (uint32_t)&NRF_TIMER1->EVENTS_COMPARE[0];
NRF_PPI->CH[0].TEP = (uint32_t)&NRF_GPIOTE->TASKS_OUT[0];
/* Configure PPI channel 1 to toggle PWM_OUTPUT_PIN on every Timer 2 COMPARE[1] match. */
NRF_PPI->CH[1].EEP = (uint32_t)&NRF_TIMER1->EVENTS_COMPARE[1];
NRF_PPI->CH[1].TEP = (uint32_t)&NRF_GPIOTE->TASKS_OUT[0];
/* Configure PPI channel 2 to toggle PWM_OUTPUT_PIN on every Timer 2 COMPARE[0] match. */
NRF_PPI->CH[2].EEP = (uint32_t)&NRF_TIMER1->EVENTS_COMPARE[0];
NRF_PPI->CH[2].TEP = (uint32_t)&NRF_GPIOTE->TASKS_OUT[1];
/* Configure PPI channel 3 to toggle PWM_OUTPUT_PIN on every Timer 2 COMPARE[2] match. */
NRF_PPI->CH[3].EEP = (uint32_t)&NRF_TIMER1->EVENTS_COMPARE[2];
NRF_PPI->CH[3].TEP = (uint32_t)&NRF_GPIOTE->TASKS_OUT[1];
is this right?
another queston is when I use sd_nvic_EnableIRQ , timer_handler function can not be called, but when I use NVIC_EnableIRQ, the EK board's blue tooth function stop working;
here is the code:
sd_nvic_SetPriority(TIMER1_IRQn,3);
sd_nvic_SetPriority(TIMER2_IRQn,3);
// Enable interrupt on Timer
//NVIC_EnableIRQ(TIMER1_IRQn);
//NVIC_EnableIRQ(TIMER2_IRQn);
sd_nvic_EnableIRQ(TIMER1_IRQn);
sd_nvic_EnableIRQ(TIMER2_IRQn);
__enable_irq();