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.

Implementing "missing pulse detector" with MSP430

Other Parts Discussed in Thread: NE555

Hi all,

just want to ask whether somebody has experience implementing "missing pulse detector" with MSP430.

The only thing crossed my mind just now is by utilizing a Timer_A/Timer_B with watchdog timer. The pulse generator is connected as input of Timer_A/Timer_B clock source (Timer module set in "up mode" and CCR0 set to 1),  and Watchdog timer interrupt is set with interval time slightly greater than the pulse period to be detected.

Depending on which interrupt occur first, the following shall occur:

- if Timer_A or Timer_B interrupt occurs before the Watchdog timer expires, the Timer_A/Timer_B interrupt shall set an output pin as TRUE (pulse detected) reset/clear the watchdog counter.

- if Watchdog timer expires before Timer_A/Timer_B occurs (due to a "missing pulse"), the watchdog timer will set the output pin as FALSE(missing pulse detected).

But i think this is not the mose elegant way to do it because basically it uses the whole Timer_A/Timer_B resources and wastes the other functionality of the CCR registers.

Any opinion how this can be done simpler and nicer?

Thanks for any input.

  • Here's another idea.

    Use just one timer and two capture/compare channels.  Timer in continuous mode.

    CCR0 - Capture mode. ISR calculates difference between current capture and most recent capture (stored during last ISR).  ISR then determines the time by which the next pulse must arrive (maximum allowed timespan to next pulse could be say 1.5x or 2x the inter-pulse duration just calculated).  ISR puts this time into CCR1 (maximum timespan plus captured CCR0 value).  ISR sets output pin TRUE (pulse detected).  ISR stores current capture value in static variable in preparation for next ISR.

    CCR1 - Compare mode.  If this interrupt occurs, a missing pulse has been detected.  ISR sets output pin to FALSE (pulse missed).

    Choose timer clocking frequency carefully to support required pulse rates.  Very high pulse rates limited by MSP430 MCLK speed.  Range of supported pulse rates limited by timer width (16 bits).

    Jeff

  • Hi Jeff,

    thanks for the input. it sounds like a more efficient solution to me!

  • lhend said:
    just want to ask whether somebody has experience implementing "missing pulse detector" with MSP430.

    Yes, but rather the other way: detecting a missing pulse from the MSP, so the hardware will detect a device failure and switch to a safe condition (laser output off). We used an external retriggerable monoflop 74HCT4538D. Basically the same as the NE555, but with only an external resistor and capacitor.

    lhend said:
    Any opinion how this can be done simpler and nicer

    You can set one timer to count up and trigger a CCR interrupt when it reaches a certain limit (pulse missed). Then you set up a DMA channel that writes a 'reset timer' on external DMA event (the input pulse to watch).

    So the reset happens in plain hardware and only the 'pulse fail' condition requires an ISR. Also, you don't need two timers.

    I'm sure there are even more ways.

     

  • Jens-Michael Gross said:

    You can set one timer to count up and trigger a CCR interrupt when it reaches a certain limit (pulse missed). Then you set up a DMA channel that writes a 'reset timer' on external DMA event (the input pulse to watch).

    Do you mean that we set the following DMA configuration?:

    - DMA trigge: DMAE0 -> where the pulse will be fed in

    - DMA addressing mode: Fixed address to fixed address

    - DMA transfer mode: single transfer

    - DMA Source address is for example the address of a constant variable with the value of 0

    - DMA Destination address is the address of TAxR or TBxR?

    This would be a great idea, eventough on one side you will use a whole timer for this puspose. And another thing that, i think you would still need to set a small ISR to set the output to TRUE, if a missing pulse had been detected previously and the output was set to FALSE. CMIIW.

  • lhend said:
    Do you mean that we set the following DMA configuration?:

    yes.

    lhend said:
    eventough on one side you will use a whole timer for this puspose.

    If you can configure the WDT timer interval properly, the WDT will do fine (you can reset it as you can reset the otehr timers, and the momentary count value is unimportant).

    lhend said:
    i think you would still need to set a small ISR to set the output to TRUE

    Not really. The expired timer will trigger the alarm ISR, but the next incoming pulse will still reset the timer and therefore re-enter the cycle. Except if you need to know when the pulses start coming in again. However, I think if there are no more pulses coming, you'll get another interrupt for the timer timeout, and another... You can, however, enable the DMA interrupt in the timeout ISR. If the DMA runs in repeated sequence mode (even if the sequence is only one transfer), you'll get an interrupt as soon as the next pulse arrives and the timer is reset. In the DMA ISR you'll disable the DMA interrupt again, so you aren't bothered.every pulse.

**Attention** This is a public forum