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.

Stellaris® LM4F120 LaunchPad to trigger external devices using sequential PWM signals

Hello,

I would like to have some informations about the Stellaris® LM4F120 LaunchPad. Basically I have an application where I would like to use a microcontroler based solution to send pulses (0-5V) to trigger 6 LED and 1 camera based on an external trigger that is asynchronous, but nearly periodical. The LED signals would have to be sent every 8 rising edges of the input clock, and this sequentially on each output ports while the camera signals will be sent every rising edges of the clock. I would like the possibility to have pulse width modulated signals and would like to output the different pulses on different physical ports (see drawing attached) that will be wired to the different LED (digital output 2 to 8) and camera (digital output 1). The frequency of the clock is between 3 Hz and 20 Hz. I would like to have the possibility to chose pulses with ON duration ranging from 10 us to several ms. I wanted to know if that was possible with the Stellaris® LM4F120 LaunchPad? If not what other TI solution should be prefered?

Thanks in advance,

Grégory

  • Hey Gregory,

    From what I understand, this should be pretty simple to do using a Stellaris Launchpad.  I don't quite follow what you're saying about the PWM signals though.  Take a look at the datasheet for the lm4f120h5qr, specifically the input edge-count mode section of the general-purpose timers section.  Basically, this functionality allows you to set up a timer peripheral to count the number of edges on an input signal (which in your case would be the nearly periodic asynchronous input you mentioned).  You can set it up so that the peripheral counts the number of edges (positive, negative, or both) from the input signal, and enters an interrupt handler once that number crosses a given threshold (interrupt after X edges), which sounds useful for this application.

    You can also use the timer peripheral for generating PWM output.  For information on that, check out the PWM Mode section of the General-Purpose Timers section.

    The only tricky part would be the 5V output.  The Stellaris Launchpad does have access to a 5 volt rail from the USB connection, but the GPIO can only drive 3.3V output.  You could achieve a 5V output if you set the GPIO to open drain output, and used a pull-up resistor to tie the GPIO to 5 volts.  When you need the GPIO low, Stellaris would drive it low.  When you need it at 5V, Stellaris will set the GPIO to open drain, and the pull-up will bring the signal up to 5 volts.

    Hope this helps, and have fun!

  • Hey,

    OK! Thank you for the help I looked at the info you indicates.

    Regards,

    Gregory

     

  • Stellaris Jordan said:
    set the GPIO to open drain, and the pull-up will bring the signal up to 5 volts.

    You must use some consideration in the value of such pull-up R.  Stellaris GPIO usually default into 2mA sink (pull to ground) capability.  Thus a 2K7 pull-up will be w/in the default capability of the GPIO - and realize well-shaped waveforms should "reasonable" capacitance be encountered.  (too small a pull-up may be damaging to your MCU's GPIO!)

    You have a wealth of GPIO on the board suggested.  Programming effort greatly simplifies should you route your driving signal to "multiple" timer input pins - in parallel.  In this means - you create a unique interrupt handler (per timer) which can more easily manage the differing count requirements - eliminating any possible conflicts created by the necessarily more complex - single interrupt handler.  (be sure that you properly label each/every of these timer IRQs w/in your, "Start-Up" file...)