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

TIMER+PPI+ADC on nrf52

Hi,

I am looking for some assistance to choose the best way using the nrf52832 processor in a correct way.

The main task is to generate a 1KHz PWM Signal with changeable Duty-Ciclye during the runtime. On every cycle (Signal change high/low - low/high), or better after the signal changed, i need to measure with the integrated saadc. I also need control about the Signal to set the PWM pin to low, or to high.

What is the best way to use the nrf52 chip? Should i use the integrated hardware PWM module and can i trigger the saadc on a signal cycle? Or should i use a Timer to generate the PWM Signal, reload the CC registers with different values for Duty-Cycle and trigger saadc measurements on every timeout?

I am thankful for every help, best regards, Nils :)

Parents
  • You want to measure with saadc twice every pwm cycle, i.e. when the pwm signal goes low and when it goes high? With the pwm peripheral you can only get a signal at the end of the pwm period (EVENTS_PERIODEND). You can start a timer at this signal with a timeout equal to the duty cycle to get an additional event at the duty cycle.

    If you use timer + ppi + gpiote you should use set and clr tasks. You need to update the duty cycle at the timer clear event to avoid some periods to be constant (for example if duty cycle is updated to a lower value before the last duty cycle was reached), this can be done with ppi group enable/disable tasks. I can explain better if you chose this method.

Reply
  • You want to measure with saadc twice every pwm cycle, i.e. when the pwm signal goes low and when it goes high? With the pwm peripheral you can only get a signal at the end of the pwm period (EVENTS_PERIODEND). You can start a timer at this signal with a timeout equal to the duty cycle to get an additional event at the duty cycle.

    If you use timer + ppi + gpiote you should use set and clr tasks. You need to update the duty cycle at the timer clear event to avoid some periods to be constant (for example if duty cycle is updated to a lower value before the last duty cycle was reached), this can be done with ppi group enable/disable tasks. I can explain better if you chose this method.

Children
No Data
Related