AM6442: AM6442 EPWM Configuration as timer to read back the frequency and duty cycle

Part Number: AM6442

Tool/software:

Hello TI,

We have 6x PWM lines, we want to validate PWM in loopback i-e 3x PWM lines act as PWM output and other 3x PWM as input will be configured as a counter to identify the frequency and duty cycle.

Is this possible to configure counters/timers available in the main CPU domain in kernel and validate PWM in loopback?

Thank you,

Prathibha

  • Hello TI,

    Can you please provide your updates on this query,

    Thank you,

    Prathibha

  • Prathibha

     this looks like a PRU functionality need than on the A53 cores or the R5 cores. AM64x has only one PWM available from those cores. You should ask as a PRU core question.

    btw, a number of TI Dallas folks just getting back from the US holidays,

    Jim (ex-TIer)

  • Hi Jim, thanks for jumping to help!. 

    Prathibha, sorry for the delay, I was OOO during holidays. 

    Probably there is more than one way to achieve what you are trying to do. Some options below:

    1) One option is to use EPWM -  ECAP to get a loopback. There is an OOB example on our MCU+SDK that you can use as a reference AM64x MCU+ SDK: ECAP EPWM Loopback 

    2) You could also use timers. For more information about MCU domain and Main domain timers please refers to TRM (AM64x/AM243x Technical Reference Manual (Rev. H)) chapter 12. 

    From  "12.5.3.1 Timers Overview": 

    In the MCU domain the device provides 4 timer pins, one for each instance, to be used as MCU Timer Capture inputs or as MCU Timer PWM outputs. In the MAIN domain the device provides 11 timer pins, one for each instance, to be used as Timer Capture inputs or as Timer PWM outputs.

    If you want to use timers as PWM outputs you can check example code and some guidance from this FAQ: (+) [FAQ] PROCESSOR-SDK-AM64X: How to create a PWM  using a timer - Processors forum - Processors - TI E2E support forums

    3) You can also explore PRU's PWM. Please refers to TRM "6.4.10 PRU_ICSSG PWM Module" for more details.

    thank you,

    Paula

  • Hello TI,

    Thanks for your input,

    Also, can we test timers on AM64x EVM?

    Can you please share some example configuration to test timers to calculate Duty-cycle and freq of PWM output lines in A53 core,

    Example, we have PWM output lines, and one timer capture input pin

     

    Thank you,

    Prathibha

  • Hello TI,

    Thank you for the information provided, our requirement is to receive external PWM signal by AM64x and calculate/figure out the duty cycle and frequency of the external PWM signal (from another module).

    Can we configure the available timer module of AM64x to receive external PWM signal and calculate its parameters like duty cycle and frequency of received PWM signal from external module. Can you please guide us on this requirement.

    Thank you,

    Prathibha 

  • Hi Prathibha,

    As far as I know we don't have an example for a Timer Capture. I would suggest referring to AM64x TRM (AM64x/AM243x Technical Reference Manual (Rev. H) for details. Below some suggested sections

    12.5.3.2.1 Timer External System Interface

    12.5.3.4.6 Timer Capture Mode Functionality

    12.5.3.5.2.3 Timer Capture Mode

    12.5.3.5.2.3.1 Main Sequence – Timer Capture Mode Configuration

    High level steps:

    1. Configure the timer in input capture mode (module input pin PIEVENTCAPT). 
    2. Set the capture mode to capture on both rising and falling edges of the PWM signal (TIMER_TCLR Register[9-8] TCM bit field).
    3. Enable the capture interrupt. The interrupt will be triggered each time a capture event occurs (TIMER_IRQSTATUS_SET[2] TCAR_EN_FLAG).
    4. In the interrupt service routine (detect and clear TIMER_IRQSTATUS[2] TCAR_IT_FLAG), read the captured value from the capture register (TIMER_TCAR1 or TIMER_TCAR2). The difference between two consecutive captured values will give the period or frequency of the PWM signal. The difference between the captured values at the rising and falling edges will give the duty cycle.

    thank you,

    Paula

  • Also, another option is to use ECAP module (3xECAP supported on main domain) as there is a ECAP - EPWM loopback example in our MCU + SDK (AM64x MCU+ SDK: ECAP EPWM Loopback that you can use as a reference  

    thank you,

    Paula

  • Hello TI,

    1. How can we test Timer IOs from A53 Linux end, as there are timer IOs part of main domain also

    2. If not timer capture mode, can you please provide us working example of timers from A53 Linux end, maybe as PWM also

    Thank you,

    Prathibha

  • Hi Prathibha, let me check with some colleagues and come back to you

    thank you

    Paula