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.

Frequency and duty cycle measurements on TMS570

Hello,

We plan to use the HET timers to measure several PWM duty cycles and periods. Let say we have 16 PWMs, what would be an optimal way of implementing this using HET?

I guess I can use PCNT instructions right away? Something like this..

A0   PCNT { hr_lr=LOW,type=RISE2RISE,pin=18};   Freq
A1   PCNT { hr_lr=LOW,type=RISE2FALL,pin=18};   Duty Cycle
A2   PCNT { hr_lr=LOW,type=RISE2RISE,pin=19};   Freq
A3   PCNT { hr_lr=LOW,type=RISE2FALL,pin=19};   Duty Cycle

... etc.

From an application point of view, is it a bad idea to read the values directly from HET RAM? I wonder if HTU would be possible to use here? There are quite many signals...

I´m also thinking about how to measure 0% and 100% duty cycles. I guess I need to implement some sort of time out interrupt in the application in order to catch these situations? Or is it possible to do this in some other way?

Im not very experienced of using these HET timers so all advices and hints are welcome.


Jeru

  • Jeru,

    I would like to suggest using HTU for this measurement. After the completion of the required data transfer, HTU can generate an interrupt and CPU can process the data in the receive buffer.

    NHET cannot do measurement on 0% and 100 % duty cycle. Please read NHET errata #53,#54, and #55 for limitations. You can set up a time out condition to check those scenarios.

    Thanks and regards,

    Zhaohong
  • Thanks for advice :) When you suggest HTU, what trigger do you recommend for data transfer? Is it possible to set up a timer triggered HTU transfer that bursts data at a pre defined tick? I guess setting up edge triggered HTU transfers will casue a lot of CPU interrupts, especially since we are also planning to add some high frequency inputs as well. I need to study HTU more, quite a lot to get into. Maybe you have some good points here that you can share?
  • You do not need to generate interrupt for each HTU transfer. You can set HTU to generate interrupt after a lock of data has been transferred. From system level, you need to know how often you have to check the frequencies.

    Thanks and regards,

    Zhaohong