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.

gpio pwm pulses

Other Parts Discussed in Thread: CONTROLSUITE

GPIOctrl regs.GPAmux1.BIT.gpio0=1;

GPIO dATAREGS.GPADAT.bit.GPIO0=G1;

WITH THESE CODES CAN I CONFIGURE GPIO 0 AS PWM AND CAN I USE GPIO0=G1 FOR 1 AND 0 AS PER MY NEED.FOR  DIFF CONDITIONS ...

FOR EG: IF VECTOR =1,G1=1 G2=0 G3=0

                       VECTOR =0 G1=0 G2=0 G3=0

SO G1 TAKE 2 VALUES 1 AND 0 FOR 2 DIFF CONDITIONS

  • Hi Joseph,

    You can use GPIO to generate ePWM like pulses but these have some limitations.

    Regards,
    Gautam
  • Hi Joseph,

    No, if you configure a GPIO for PWM operation - it cannot be used as GPIO anymore.

    Since you configured GPIO0 as EPWM output

    GPIOctrl regs.GPAmux1.BIT.gpio0=1;

    The write to GPIO data register (GPADAT.bit.GPIO0=G1; ) will not have any effect.

    -Bharathi.

  • hi

     Thanks for your response...

    so can i configure GPIOctrl regs.GPAmux1.BIT.gpio0=0;so that i can use the zero pin as gpio...and can perform the above mentioned operations..

    or it would be greatful if u can suggest me some codes or documents i could refer for configuring gpio pins as input output so that i can perform my switching logics

    regards

     Joseph

  • Hi Joseph,

    If you're looking for GPIO for switching operations then you can refer : For F2802x devices
    C:\ti\controlSUITE\device_support\f2802x\v230\f2802x_examples_structs\gpio_setup
    C:\ti\controlSUITE\device_support\f2802x\v230\f2802x_examples_structs\gpio_toggle

    Regards,
    Gautam
  • Hi Joseph,

    Yes. You need to set GPAMUX to Zero for the corresponding GPIO.
    But note that the PWM output will not come out in this case.
    It's one function at a time. You can switch between the 2 modes in software - but signal switching will be impacted by s/w latency and will become difficult to maintain exact timing of the signal transition. 
    I would suggest you try to achieve the behavior through EPWM - via forcing the o/ps from withing EPWM module as and when needed.
    Unless you describe the complete requirement/usecase it's difficult to suggest an alternative.

    -Bharathi.

  • Hi Bharati

             i am doing my project related to vector control of induction motor drives..in that i am using space vector pwm...i am doing it with processor tms32028335 dsp processor in c coding...for generating pwm pulses the logic i need is to switch the correspondiung vectors in differentr times...for eg:

    if my Ts=1s..T1=.3s T2=.5s T0=.2S

    I need to have the sequence 01277210 for SECTOR 1.

    SO I Am using the conditionms

    1) create a ramp of Ts

    2)give the conditions if r>0 and r<to/4 vector =0

                                            if r>to/4 and r< t1/2 +to/4vector=1

                                            if r>t1/2 +to/4 and r< t1/2 +to/4+t2/2 vector=2

                                            if r>t1/2 +to/4+t2/2 and r<ts/2 vector=7 and so on........

    so each time when i input a vector say o,1,2,7 n..i need to output the states 0=000 1=110 2=110 7=111 etc...for these states i am planning to use gpio pins...so please do the needful

    Thanks and regards

    Joseph

  • Hi Joseph,

    Please refer to the motor control libraries and related project in ControlSuite.
    There are several examples of Space Vector PWM Modulation.
    Are you trying some different modulation technique?
    Even then - you could start referring to the examples in controlSuite and start from there.

    -Bharathi. 

  • hi

    i am planing to write codes using  gpio pins instead of epwm module for space vector PWM in vector control o0f induction mtoro drives ...so while implementing foc algorithm can i use

    interrupt void epwm1_isr(void)

    {.....

    }

    for writing the control algorithm ?

  • Yes - you can still use EPWM ISR, though you are not using EPWM outputs on GPIO.
    ISR would function as it should. You can write your GPIO toggle code within the ISR.

    -Bharathi.