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.

TM4C1294 Quadrature Generation Variable Manipulation

I am developing a GUI Composer interface for my quadrature generation code and I am having issues with it. If I vary the frequency, the phase changes between the 2 channels. I want to know if you are able to figure out why this is happening. I have not attached my GUI Composer files to this message because you can still see my issue by varying any one of the following inputs by adding them to the "Expressions" tab in the Debug Window:

Quad1_frequency,

Quad1A_DutyCycle,

Quad1_phase,

Quad1B_DutyCycle

However, if you want to see my GUI Composer interface then let me know.

This is my Quadrature Generation code and snapshots of my issue below.

5086.TM4C1294_Quadrature_Generation.zip

Starting frequency of 10kHz

Changed frequency to 9kHz

Changed frequency to 11kHz

  • Hello Andrew,

    Can you explain the code logic a bit more since there are multiple generators being used and it would be nice what is the algorithm you have in mind, so that when the code is looked at we have a reference.

    Regards

    Amit

  • Amit,

    The actual final setup is something you figured out a few months ago so I don't if I'll be able to explain it very well but here goes. I believe you are syncing two generators together in order to phase shift the signals by using a General Purpose Timer. I have copied and pasted a quote from you explaining what you did to get it to work. 

    "It was tough using PWM alone so I had to insert a General Purpose Timer to be able to phase offset the two PWM generators. Also I had to forgo the Sync Mode Update on PWM."

    Please let me know if this helps. 

    Thank you,

    Andrew

  • Does my explanation help you understand what the code is doing at all?

  • Hello Andrew,

    Yes, it does. I will get back with a response on the code in a few days

    Regards

    Amit

  • Amit,

    Were you able to determine what I am doing wrong?

    Regards,
    Andrew

  • I am developing a GUI Composer interface for my quadrature generation code and I am having issues with it. If I vary the frequency, the phase changes between the 2 channels. I want to know if you are able to figure out why this is happening. I have not attached my GUI Composer files to this message because you can still see my issue by varying any one of the following inputs by adding them to the "Expressions" tab in the Debug Window:

    Quad1_frequency,

    Quad1A_DutyCycle,

    Quad1_phase,

    Quad1B_DutyCycle

    However, if you want to see my GUI Composer interface then let me know.

    This is my Quadrature Generation code and snapshots of my issue below.

    5086.TM4C1294_Quadrature_Generation.zip

    Starting frequency of 10kHz

    Changed frequency to 9kHz

    Changed frequency to 11kHz

  • Hello Andrew,

    Apologies for the delay. The issue was with the restart of the timer when the Frequency is updated. I made a change to the Quadature1_Update function by Reset of the PWM Generator counter to begin a fresh count. The following change has to be made in both if and else condition of the phase computation.

    PWMSyncTimeBase(PWM0_BASE,PWM_GEN_0_BIT|PWM_GEN_1_BIT);
    //
    // Enable Timer0B.
    //
    TimerEnable(TIMER0_BASE, TIMER_B);


    Regards
    Amit