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.

Setting up the ePWM module

Other Parts Discussed in Thread: MOTORWARE

I am trying out some simple programs on the Instaspin card so that I have a better understanding of the programming involved.

I tried to set the parameters for the ePWM module. I started with the existing example projects and changed the code to mine. When I run this program the changes in the ePWM registers only occur during the PWM enable command. When the commands that I have written in the program are executed, the registers remain unchanged.

This is what I'm trying to do,

PWM_setPeriod(pwmHandle,period);

PWM_setCounterMode(pwmHandle,PWM_CounterMode_Up);

PWM_setRunMode(pwmHandle,PWM_RunMode_FreeRun);

PWM_setSyncMode(pwmHandle,PWM_SyncMode_Disable);

PWM_setClkDiv(pwmHandle,PWM_ClkDiv_by_128);

PWM_setLoadMode_CmpA(pwmHandle,PWM_LoadMode_Zero);

PWM_setActionQual_Zero_PwmA(pwmHandle,PWM_ActionQual_Set);

PWM_setActionQual_CntUp_CmpA_PwmA(pwmHandle,PWM_ActionQual_Clear);

PWM_setLoadMode_CmpB(pwmHandle,PWM_LoadMode_Zero);

PWM_setActionQual_Zero_PwmB(pwmHandle,PWM_ActionQual_Clear);

PWM_setActionQual_CntUp_CmpB_PwmB(pwmHandle,PWM_ActionQual_Set);

PWM_Obj *pwm1 = (PWM_Obj *)pwmHandle;
pwm1->CMPA=300;
pwm1->CMPB=300;

Can someone tell me where I am going wrong?

  • Udai,

    How are you calling these functions?  It needs to be done inside of a controller structure as you need to initialize the handles, globals, etc  It's very important to understand how the entire control system is constructed.  You can make changes to almost anything you want inside, but you still need to use the framework for InstaSPIN.

    Have you worked through the Lab Projects?  Lab01 explains the concept of the control system and how to set-up all of the handles and structures for passing information. 

    in the InstaSPIN_FOC source folder:
    C:\ti\motorware\MotorWare_1_01_00_09\sw\solutions\instaspin_foc\src

    the key files are: ctrl.c/.h, main.h, and proj_lab##.c, there is also user.c which is related to the board/device specific user.h located further down the directory structure

    The next key files (drv.c/.h/_obj.h)  are related to interfacing from the software control system to on-chip peripherals and external interfaces (including the inverter). These are board/device specific, ex:
    C:\ti\motorware\MotorWare_1_01_00_09\sw\drivers\drv\boards\drv8312kit_revD\f28x\f2806x\src