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.

LAUNCHXL-F28379D: Setting ePWM Duty

Part Number: LAUNCHXL-F28379D

Hello, 

A customer needs help with up+down EPWM. She said she tried to change the duty cycle after the init and it is but stayed the same.

She mentioned that she used the function: EPWM_setCounterCompareValue and EPWM_COUNTER_MODE_UP_DOWN

Thank you

  • Hello again. Our customer has found a solution to the first question, but has additional inquiries. Please see details below:

    I found the problem. In my program I need CLA to run the inverter control loop – so I need the PWM for that. I also need the DMA to create reference voltage in the DAC.


    I added this function:
    SysCtl_selectSecMaster(SYSCTL_SEC_MASTER_DMA, SYSCTL_SEC_MASTER_DMA);

    So I can use the DMA to move value from global sinus table in ramgs0 to DAC.
    If I don’t use this function the DMA don’t work. But when I delete this function the CLA work and the duty cycle of the PWM change.

    What can I do if I need both functionalities, DMA that control DAC and CLA that control PWM?

    Thank you.

  • You have to switch between the two modes in this device.

    I had shown how to the DMA to access the EPWM registers in this example: http://dev.ti.com/tirex/explore/node?node=AAoYeccZq5uxp.i5REGk6Q__gYkahfz__LATEST

    In this device there is a mux that decides who is the secondary owner of the peripheral. It can be either DMA or CLA.

    For your need that requires both to access them registers of a peripheral you need to implement the software that signals the C28x core to switch the owner on the fly.

  • hi, thanks for your replay,

    if i understand you correctly i need to switch to register control from DMA to CLA in the software? but if i will change the master from DMA to CLA it will mean that the DMA will continue working without changing the register, is there any way that both of them can work together ? without switching masters all the time?

  • Hi Nima , 

    so some  news  plus  questions and confirmations :    

    1      Is really the C28x needed to execute  function SysCtl_selectSecMaster()  so to change secondary  master  ?    we did using C28x and OK working but if I use the CLA  I can compile  but it is not working in the system : are we wrong ? what is needed ?   I would like to execute from CLA so to keep PWM duty update totally inside the CLA routines . 

    2      How to keep the DMA running all time  to DAC   so to have continuos  data out  even if changing secondary master  ?  

    3-     How to have the two previous points working together

    thank you 

    best regards

    Carlo

  • 1. Yes, the C28x is the only one that can execute the selectSecMaster function. The CLA does not have access to SysCtl registers. There needs to be a communication mechanism (signaling) between CLA and C28x for changing the secondary master when requested by the CLA.

    2. IF the secondary master changes, the DMA cannot access the DAC registers. To have continuous stream between DMA and DAC the secondary master must remain as DMA.

    3. Is there a specific reason that the ePWM registers cant be controlled through C28x core ? maybe CPU2 if CPU1 bandwidth is of concern.

    If not, there needs to be a signaling mechanism setup between DMA, CLA and C28x core. You need to set up a CLA task that completed when a change in Secondary master is required. When the interrupt occurs on C28x the secondary master can change, and the CLA task can be executed again.

    Nima

  • Hi Nima , 
    ok  clear  

    we ll change SW as needed  

    thank you 

    best regards

    Carlo