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.

Add time delay to ehrPWM on OMAP L138 LCDK

Other Parts Discussed in Thread: OMAPL138

Dear All,

We would like to generate a wave form similar to the following image. This is a pulse signal with a delay between each pulse packages. The application is to generate a pulse sonar system. The best way to generate this wave form is to use the ehrPWM (enhanced high resolution Pulse Width Module) of our OMAP L138 LCDK.

  (Figure 1)

As you can see above, we would like to make a pulse signal with a rectangular shape. The Starterware 01.10.01.01  ehrPWM example demonstrates the process to generate rectangular waves which is very close to our desired wave form. An example of Starterware 01.10.01.01  ehrPWM example is shown bellow (Figure 2):

  (Figure 2)

Now we would like to modify the this example to get our desired wave form (which is shown in Figure 1). I guess we should create a delay every 0.1 second and this delay should last for 1.9 seconds. I know two possible methods to achieve this delay. The first method is to just waste the processor resource by using a "while" or "for" loop. This method does not generate accurate delay time and is not recommended. The second method is to use time interrupts. However, could not figure out how to use the time interrupt properly to achieve this delay.

Any advice on how to create this 1.9 sec delay (whether using time interrupts or other methods) is appreciated. Do you know any other method to achieve this wave form? Please share your thoughts with us. 

Detail information about our project:

  • Board: OMAP L138 LCDK
  • Emulator: Spectrum Digital XDS 220 ISO

Thank you :)

  • Hi,

    Thanks for your post.

    May be, I would suggest you to use the time-base sub module of ePWM through which you could control the events how often to occur via configuring the ePWM time base counter (TBCNT) of the module. For more details to calculate PWM period and frequency to control events through time-base period (TBPRD) register, kindly refer section 17.2.3 from the TRM below:

    http://www.ti.com/lit/ug/spruh77b/spruh77b.pdf

    I think, you could generate the following events:

    CTR = PRD: Time-base counter equal to the specified period (TBCNT = TBPRD) . (May be, you can generate a required delay to a specified time period and accordingly configure the same through TBCNT)

    CTR = 0: Time-base counter equal to zero (TBCNT = 0000h).

    As well, you do have privilege to configure the rate of the time-base clock; a prescaled version of the CPU system clock (SYSCLKOUT) which would  allow the time-base counter to increment/decrement at a desired rate.

    Table 17-3 from the above doc. shows the time-base submodule registers which are used to control and monitor the module events.

    Also, one other option of configuring the "Dead-Band Falling Edge Delay Count Register" of dead band sub-module to add a programmable delay to falling edge (FED) of the PWM pulse. May be, you could introduce a 1.9s programmable delay after falling edge of fourth pulse as mentioned by you in Figure 1. For more details, kindly refer section 17.2.6.2, Table 17-25 from the doc. above, to control and monitor dead band submodule registers.

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    -------------------------------------------------------------------------------------------------------

  • Please make use of the following timer related code which generate the delay in ms using HW timers.

    Sysdelay(1000)//1 sec delay
    C:\ti\OMAPL138_StarterWare_1_10_04_01\platform\lcdkOMAPL138\sysdelay.c
    C:\ti\OMAPL138_StarterWare_1_10_04_01\utils\delay.c
  • Thank you. I used your method and it works perfectly.

  • Sounds good.
    Thanks for the update.