-->
Page 1 of 1

Any Timer input capture available ?

PostPosted: Sun Jan 26, 2020 2:43 pm
by davidtaille
Hi all,
I'm trying to use a temperature sensor (SMT172 from Smartec) that uses the duty ratio of a PWM signal to give the temperature.
Hence my need to precisely measure rising/falling times of a pin.

If i was using another "normal" MCU, I'd go for using a timer's input capture to get the timing but I could not find anything on this for ESP8266...
Would anyone be able to confirm that there is no such feature on this chip ??

Note : I tried using an interrupt handler to capture the cycle count for every change, but it works only 95% of the time ; 5% I have abnormal readouts (due to other interrupts I guess).
Is there any way to raise the GPIO priority above all other interrupts ?

Thanks for your time.
David

Re: Any Timer input capture available ?

PostPosted: Fri Jan 31, 2020 6:44 am
by AcmeUK
Hi

How often are you sampling the SMT172?

How necessary is it that you have an uninterrupted series of measurements; e.g. for graphing?

Here are 3 approaches to your problem:-

1, If uninterrupted data is needed you could compare the current measurement with the previous, if it varies by more than say +/- 5 degrees bin it and send the previous measurement.

2, Wifi uses periodic interrupts. Turn off wifi when not sending data.

3, Use a slave processor such as a TinyAT85 to do the measurements, then use i2c to transfer the data to the ESP.

Good Luck in solving your problem.

Re: Any Timer input capture available ?

PostPosted: Sun Apr 12, 2020 5:26 am
by eriksl
I think #3 is the most conceptually sound solution. The ESP8266 can't ever guarantee timings due to it's nature of WLAN interfacing. A "normal" microcontroller is designed to do timing-specific stuff.

Another alternative, imho, is to use a sensor with a digital interface, i.e. I2C or SPI. They're not really sensitive about timing and always work.