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

What is the maximum and minimum frequency of the PWM signal which can be measured?

What is the maximum and minimum frequency of the PWM signal/square wave that can be measured on the NRF 52DK board I'm using NRF 52832.

Also, what is the max and min "pulse width" of PWM/Square wave that can be measured on the NRF board? I'm a student so can you also help me on how to implement it. Till now I have used mbed compiler and wrote a simple code with an interrupt. But I wanted to use the SDK as it would provide me with more options, at least that's what I think.

Parents
  • Creating a PWM signal is a little more straight forward than reading it back, unfortunately. However, it is possible.

    Have you looked into the RTC on the nRF.  Combining this with PPI and GPIOs is what you want to do.

    Set up the RTC, then look for changes in on the GPIO with the pulse width signal, and check the counter (number of ticks) on the timer. 

    A more thorough explanation is given in this post.

    It is a bit hard to say something general on the ranges. A shorter range will give a lower accuracy, but you can use the prescaler on the timer to suit it to your need.

    What kind of ranges are you looking at?

  • Hey Edvin,

    Thanks for the help. By range, I meant calculating the pulse duration of the duty cycle (time escaped during the on time of the PWM). Correct me if I'm wrong so I can enable a pin as GPIOTE which will make it interrupt enabled and start a timer when an interrupt occurs and stop the timer when another interrupt occurs. I wanted high accuracy so I will use HFCLK (16Mhz and in 32 bit mode) which gives me a min of 62.5ns and max of ~268 secs for measuring the duration. 

    Few doubts I have are:

    • Are events and interrupts same? Is there any kind of latency associated with these events (interrupts)? Let's say I wanted to measure a pulse with duty cycle duration of 100ns. Will the events able to react that quick enough?

    • I have read the Application timer tutorial to get an understanding of timers, so far I only understood how to start a timer and do something in an event function when it times out. How can I read the values (measure the time passed) between the timer start and timer stop event?
Reply
  • Hey Edvin,

    Thanks for the help. By range, I meant calculating the pulse duration of the duty cycle (time escaped during the on time of the PWM). Correct me if I'm wrong so I can enable a pin as GPIOTE which will make it interrupt enabled and start a timer when an interrupt occurs and stop the timer when another interrupt occurs. I wanted high accuracy so I will use HFCLK (16Mhz and in 32 bit mode) which gives me a min of 62.5ns and max of ~268 secs for measuring the duration. 

    Few doubts I have are:

    • Are events and interrupts same? Is there any kind of latency associated with these events (interrupts)? Let's say I wanted to measure a pulse with duty cycle duration of 100ns. Will the events able to react that quick enough?

    • I have read the Application timer tutorial to get an understanding of timers, so far I only understood how to start a timer and do something in an event function when it times out. How can I read the values (measure the time passed) between the timer start and timer stop event?
Children
No Data
Related