Hello.
I am just do one project with Zephyr and nrf52840 to control one step motor, the one task is to get pulse number of pwm pulse when motor is running , I think PPI May be userful and have write the below code ,
....
//pwm0 init and start
//time0(work as counter) init and start
.....
uint8_t ppi_ch;
int err;
uint32_t evt,task;
evt = nrf_pwm_event_address_get(NRF_PWM0,
NRF_PWM_EVENT_PWMPERIODEND);
task = nrfx_timer_task_address_get(NRF_TIMER0, NRF_TIMER_TASK_COUNT);
err = ppi_alloc(&ppi_ch, evt);
if (err != NRFX_SUCCESS) {
printk("Failed to allocate PPI channel.");
return NULL;
}
ppi_assign(ppi_ch, evt, task);
ppi_enable(ppi_ch);
.......
note : ppi functions are defined in ppi_trace.c, these functions can work well.
but it have not worked, it means the Time0 cannot trigger the interrupt of counter.
So, what wrong is the code? can you give me some suggestion?
Thanks.