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.

TMS320F28377D: Generate a single pulse?

Part Number: TMS320F28377D

Hi,

I'm using the controlCard F2837x.

I need to generate a SINGLE pulse of 4.25µs (Negative or positive pulse, I think it is not a problem..) when software need (by software triggering in writing a specific value in a register...)

I think the ePWM module can do it without any other intervention than Initialize and Trig it when we want the pulse, but it is a very complexe module!

I had not found any exemple for my case.

Is somebody can help me or show me an existing exemple which help me to configure the ePWM?

Thank you.

  • Hi,

    For single pulse, toggling a GPIO in an interrupt would be better. Do correct me if that is what you don't want.

    Regards,
    Gautam
  • Hello

    I had thought of this solution, but I will already trig this pulse under a PWM interruption (Brushless motor control). Then I do not want interrupt this interruption only for toggle a GPIO pulse!

    Especially as I am persuaded that the hardware with the help of the module ePWM can do it. Right?

    Note: If I take your idea, I will have to generate the interrupt with a timer (ePWM module).
    From there, I think that generating an interrupt or toggle the state of an output will be practically the same configuration of the ePWM module?

    Thank you.

  • A GIR said:
    Especially as I am persuaded that the hardware with the help of the module ePWM can do it. Right?

    Offcourse for the train of pulses ePWM is the most convenient peripheral. But you'd mentioned above that you require a SINGLE *** and not a train right?  

  • Yes, I only need a sigle pulse. We can't program it in this ePwm? there is no a sibgle counter mode which toggle a pin when counter reach a programmed value? Off course, in this case we can't call this a "Pwm", but is some "SubModule" of the "ePmw" can do it?
  • A GIR said:
    We can't program it in this ePwm? there is no a sibgle counter mode which toggle a pin when counter reach a programmed value? Off course, in this case we can't call this a "Pwm", but is some "SubModule" of the "ePmw" can do it?

    As far as I know... You Can't :) Hence asked you to toggle GPIO in CPU_timer/ePWM interrupt.

  • Ok.

    In fact, follow is my use case.

    i have a Motor absolute position captor which work on "Serial link".

    Then I must make a "request" which consist to send a byte on the SCI, then I will receive after 13 Bytes to know the current position.

    But, the physical link is type of RS-485. (Half duplex mode)

    So I must generate a Signal which enable the Tx way during I send my request and then release it to "listen" the response.

    I think I will make following:

    =>In PWM interrupt which manage Brushless motor:

    - Set GPIO to pass in "transmit mode" on RS-485

    - Send a byte on the SCI

    - On SCI Tx complete interrupt (which I set as "high" interrupt priority) I will clear the GPIO to pass in "listen mode" on RS-485.

    So My Pwm interrupt will be preempted by the SCI Tx end interrupt, So I will accept this knowing in it I only clear a GPIO then the interrupt time is very low.

    I will test that.

    Thank for your help.

    Note: Is SCI module can manage RTE/CTE RS-232 signal. According datasheet, I think no. I'm right?

  • You could make it work with the PWM, but it would probably take more cycles than doing it another way because you would have to take another interrupt to shut the PWM down.

    The only exception to this was if you had another signal on the board that you could use a trip zone input for the PWM before the next cycle came around. You could also kick off the pulse in your interrupt, and then configure a trip zone to trip the PWM when the signal is low. The PWM would then trip itself and effectively generate a single pulse. If you pre-configured it in your initialization, your interrupt would probably look something like this:

    Start timebase counter
    Delay a few cycles to make sure the PWM is high
    Enable tripzone on low

    This would prevent you from having to take a second interrupt for a GPIO. In the end, I agree with Guatum. A GPIO is the simplest method.

    Another thing to look at may be to use a serial comm such as SCI or SPI. At the correct baud rate this should work pretty well.  You would just use the TX pin only and in the interrupt you would just be sending whatever data corresponded to the correct pulse width, 0x0001 for example or 0x0003 for a longer pulse.

    Regards,
    Kris

  • After thinking on this for a while, you want to be cautious if using a GPIO to do this, or any method which involves taking a second action to terminate the pulse. Depending on your system load, the second interrupt could be delayed due to other interrupts being serviced. This would cause a larger pulse. You will need to evaluate is acceptable for your application.

    My order of recommendations would be:

    1) Serial Communication Peripheral
    2) PWM with setting up a tripzone as I described in the previous post
    3) GPIO
  • Hello

    Ok I understand tour Idea with another SCI module.

    Thank

  • Hello

    For me the easier solution was GPIO.
    -> I set GPIO before send data
    -> I clear GPIO when Data was transmitted via the SCI interruption....

    But they are not interruption on "TX empty" flag.. So I can't know when data are physically transmitted.... :-(

    Then I will test the second way: Use another SCI controller to generate a pulse...

    Is the "Inv" Gpio work when Mux is for SCI? : I need positive pulse, SCI character "0" will transmit a negative pulse...

  • Hi,

    I implemented the following solution:
    Use LoopBack mode to have an interrupt when all Bytes of the Request are transmitted then when these byte are received and in the RxFifo(With Rx Fifo level)