ESP8266 microsecond timer missing, what can I do?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
mark
Posts: 2
Joined: Thu Mar 26, 2020 4:32 pm

ESP8266 microsecond timer missing, what can I do?

Post by mark » Thu Mar 26, 2020 4:46 pm

I am new to micropython and I noticed that the ESP8266 port sadly does not provide timer interrupts with microsecond precision.
As I workaround I tried to use sleep_us inside the zero_cross isr but it did not work (obviously using sleeps in isr is not a good idea).
What would be the best strategy for me? Implementing in C and adding the C function to micropython.

I am working on a dimmer based on BTA16. This would be the Arduiono code for this:
https://github.com/RobotDynOfficial/RBD ... SP8266.cpp

Not sure if this is relevant but I am using a wemos d1 mini board and I am hesitant to move to another board.

User avatar
jimmo
Posts: 1837
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: ESP8266 microsecond timer missing, what can I do?

Post by jimmo » Thu Mar 26, 2020 11:43 pm

Could you use PWM instead?

mark
Posts: 2
Joined: Thu Mar 26, 2020 4:32 pm

Re: ESP8266 microsecond timer missing, what can I do?

Post by mark » Fri Mar 27, 2020 12:38 am

jimmo wrote:
Thu Mar 26, 2020 11:43 pm
Could you use PWM instead?
what I am trying to do actually is pwm (even the dimmer module pin is called that). I am guessing you are refering to the PWM module and as far as I know this one does not support zero cross detection. Please expand a bit what you mean. Thanks

User avatar
jimmo
Posts: 1837
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: ESP8266 microsecond timer missing, what can I do?

Post by jimmo » Tue Apr 14, 2020 5:24 am

mark wrote:
Thu Mar 26, 2020 4:46 pm
What would be the best strategy for me? Implementing in C and adding the C function to micropython.
I think what you suggested about implementing it in C (i.e. custom firmware) is probably your best bet.

Post Reply