This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

eCAP functionality

Other Parts Discussed in Thread: CONTROLSUITE

I have the sine and cosine signal of a speed sensor connected to GPIO-32 and 34 of the F28069M MCU. The signals consist of 16 pulses each (8 rising, 8 falling), and I need to get the speed from these pulses. When I built my custom hardware I didn't consider the fact that the eCAP module would be perfect to use for this, so the signals are now connected to pins that don't have the eCAP functionality.

So, is there a way to manually retrieve the time between two consecutive pulses? If not, the only option would be to modify the hardware so I can attach the signal to GPIO's that do support eCAP.

  • Hi Thomas,

    Unfortunately, I think it will be best to modify your hardware.  As you mention, the eCAP will likely be the best way to measure the distance between rising/falling edges.

    Another option might involve external interrupts and in those interrupts looking at the value of a free-running timer (or something like this).  This has the negative of requiring some CPU bandwidth and introducing error/latency because you'll be using an interrupt.


    Thank you,
    Brett

  • Hi Brett,

    Thanks for the advice. Luckily, I had some pins available on my modified board that do support eCAP. So following your advice, I just wired my sensor to those pins. Thanks.

    Do you have any further remarks/tips regarding speed calculation with the eCAP module?

  • Thomas,

    Not really.  I think the eCAP documentation does a decent job of explaining the peripheral.  After you do a little bit of researching, I think you'll figure out the way you want to use the peripheral based on your knowledge of the sensor's output (and what you're trying to do).

    There's also a few examples in controlSUITE which you can use to start exploring.

    I will note that you will find there will be a natural tradeoff between the accuracy of your measurement versus the ability to measure long periods of time between pulses (often this means the ability to measure slow speed).  You should make sure that you use the eCAP prescalar to purposefully choose how you wish to make this 'tradeoff'.  If needed, I'd also recommend using the overflow flag to detect the just-in-case situation where an overflow occurs - you can then create software to figure out a way to overcome this condition.

    Good luck in your project!


    Thank you,
    Brett