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.

TMS570LS1227: ECAP PWM capturing does not work for low frequency signals

Part Number: TMS570LS1224PGE

Hi,

we currently have exactly the same problem as described in this thread:

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/660516/tms570ls1227-configuring-ecap-module-to-capture-lower-frequencies

Unfortunately no solution was provided there except "it should work this way". 

We successfully set up ECAP reading with the example "example_etpwm_ecap". It works perfectly, even when duty cycle or period are changed slightly. 

However, we want to capture a 67Hz, 3.3V PWM with a duty cycle of approx. 10-20%, which is very slow in comparison to the generated PWM from the example. In theory, it should be possible to capture signals of up to 53 sec period length before the counter overflows.

When trying to read our slow signal, all ECAP counters show the same values and thus we only get zeros as duty and period values. It seems like all capture events happen at the same time and a rising & falling edge are triggered at the same time.

We already generated our desired signal (and similiar ones) with different sources to be sure our signal source isn't the issue. The signals look fine in a scope.

Why doesn't the example work with low frequency signals? What needs to be done to read a relatively slow signal?

Best regards

Christian

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/** @example example_etpwm_ecap.c
* This is an example which describes the steps to configure ETPWM for generating PWM signal
* and ECAP to capture the same and calculate its frequency and duty cycle,Here ETPWM1A pin is configured
* to generate a PWM wave and is fed to ECAP1 pin.
*
*
* @b Step @b 1:
*
* Create a new project.
*
* Navigate: -> File -> New -> Project
*
* @image html example_createProject.jpg "Figure: Create a new Project"
*
* @b Step @b 2:
*
* Configure driver code generation:
* - Enable ETPWM and ECAP drivers
* - Disable others
*
* Navigate: -> TMS570LS12x/RM46 -> Enable Drivers
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Christian,

    Can you please reverify by reducing the VCLK3 clock frequency to 10Mhz?

    Because the time base counter in the eCAP module will be run from VCLK3 only, so if we reduce this frequency then we can measure low frequencies.

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish, 

    thanks for your reply. 

    We are using board TMS570LS1224PGE, not...1227. 

    I just changed VCLK4, which is used for calculation, and also VCLK3 to 10MHz. 

    It did not change the result.

    We always get equal values for the different cap variables and thus no calculation of duty cycle or period is possible - see also attachment.

    If we generate a faster signal, it works fine again.

  • Hi ,

    I understood the root cause for the issue you are getting. 

    Actually this issue is not due to the eCAP module actually it was due to the ETPWM module. I mean did you check whether you are getting 67Mhz output from

    ETPWM module with oscilloscope?

    Actually, ETPWM will not generate such low frequencies from 75Mhz Actual TB clock frequency. I tested in practical and find this issue.

    To generate such low frequencies from ETPWM module we should adjust the pre-scalers as shown below:

    After adjusting pre-scalers as shown above then i got the 67Hz output waveform from ETPWM as shown below:

    And as you can see now i got the capture register values for 67Hz input waveform:

    Here is my tested project for your reference:

    ECAP_TEST_LC4357.zip

    Note: As i don't have TMS570LS12x board with me, so i did this testing with my TMS570LC43x Launchpad board.

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    thanks again for your reply. 

    We are not using the ETPWM module to generate the slow signal. We have tried the actual signal source (RC receiver) and also a signal generator and the capturing does not work with either of them. So the issue lies in the ECAP module. If we generate a fast signal above approx. 200 kHz, capturing works fine. If the signal becomes slower, below approx. 100 kHz, capturing does not work anymore.

  • Thanks for sharing the details.

    I will try to check with other board and will provide you, my update.

  • Hi ,

    I tested with RM46 board as well and this controller have same as the TMS570LS12x, and here also i didn't see any issues with 100Hz frequency output from ETPWM.

    So, my suggestion would be this, please try to test with ETPWM signal once before testing with functional generators because it is a external oscilllators right there might be a grounding issues. So, please test with my code once and let me know the result of it, I am attaching my RM46 code for your reference.

    ECAP_TEST_RM46.zip

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish, 

    thanks for your support. It is now working. First I tried to read a slow (100 Hz) signal generated by ETPWM pin, which worked fine. 

    Then we tried different signal sources and it did not work, exactly as before. 

    When we removed all printf commands and breakpoints and wrote the duty cycle and period to global variables, it started to work. So there seems to be some kind of timing problem caused by interruptions from printf and/or breakpoints causing this issue.  

    However, the issue is now solved, so thanks again.

    Best regards

    Christian