Hi Everyone
I have been measuring the frequency of some square waves around 40KHz on a Teensy 4.1. The code is a variation of freqMeasureMulti and uses flexPWM to measure the time between rising edges on pins 0, 1, 2 and 3. It works great - most of the time anyway.
At random times and on random pins, there is a dropped reading. Some serial monitor readout:
3823 3618 3715 3629
3824 3619 3716 3628
3822 3617 3715 3628
3821 3616 3714 3626
3824 3619 3716 3629
3822 3617 3714 3627
3822 3617 3715 3627
3824 3619 2 3628
3824 3618 3717 3630
3823 3618 3714 3630
3822 3616 3714 3626
3823 3620 3716 3638
3817 3618 3714 3626
3821 3618 3714 3630
The signals are being put through an SN74AHC to shift the level from 5v on the sensor side down to 3.3v on the Teensy. I thought this might be the cause. However, placing various sized bypass capacitors on the VCC pin and power supply, using a range of pull down resistors on the input pins of 1K through 1M and the shortest connections I can get away with doesn't help. Even so, the nice folks at TI are looking into it.
Could it be the Teensy doing it? Seeing the same rising edge twice perhaps? My scope shows a nice clean wave with vertical rising and falling edges and square corners. If anyone has any suggestions they would be most welcome.
Thanks for your help.
Dean
I have been measuring the frequency of some square waves around 40KHz on a Teensy 4.1. The code is a variation of freqMeasureMulti and uses flexPWM to measure the time between rising edges on pins 0, 1, 2 and 3. It works great - most of the time anyway.
At random times and on random pins, there is a dropped reading. Some serial monitor readout:
3823 3618 3715 3629
3824 3619 3716 3628
3822 3617 3715 3628
3821 3616 3714 3626
3824 3619 3716 3629
3822 3617 3714 3627
3822 3617 3715 3627
3824 3619 2 3628
3824 3618 3717 3630
3823 3618 3714 3630
3822 3616 3714 3626
3823 3620 3716 3638
3817 3618 3714 3626
3821 3618 3714 3630
The signals are being put through an SN74AHC to shift the level from 5v on the sensor side down to 3.3v on the Teensy. I thought this might be the cause. However, placing various sized bypass capacitors on the VCC pin and power supply, using a range of pull down resistors on the input pins of 1K through 1M and the shortest connections I can get away with doesn't help. Even so, the nice folks at TI are looking into it.
Could it be the Teensy doing it? Seeing the same rising edge twice perhaps? My scope shows a nice clean wave with vertical rising and falling edges and square corners. If anyone has any suggestions they would be most welcome.
Thanks for your help.
Dean