Search found 3667 matches

by Roberthh
Sat Oct 06, 2018 6:25 am
Forum: ESP8266 boards
Topic: improve speed
Replies: 13
Views: 7206

Re: improve speed

Looking at you code sample, the strobe pulse of 7 ms alone limits the speed to 140 events/second. Maybe that can be improved. Besides that, if you want to write directly to the GPIO registers, you can do so with direct memory writes. below is a short piece of code which writes directly to the GPIO P...
by Roberthh
Fri Oct 05, 2018 11:17 am
Forum: General Discussion and Questions
Topic: disable_irq not effective
Replies: 25
Views: 12865

Re: disable_irq not effective

Is hard a extension on ESP8266 ?
Yes and no. It is not supported in the ESP32 port, but in the ESP8266 and STM32 port.
I have no clue why it is missing in the ESP32 port. Maybe a simple omission.
by Roberthh
Fri Oct 05, 2018 10:39 am
Forum: General Discussion and Questions
Topic: disable_irq not effective
Replies: 25
Views: 12865

Re: disable_irq not effective

Your questions are about generic OS or formware design. And yes, there is a system timer interrupt, which stops executing of you main code in regular intervals and looks for other tasks to be scheduled. The timer interrupt is like the Pin interrupt a hard one, relying on hardware mechanisms of the C...
by Roberthh
Thu Oct 04, 2018 7:37 am
Forum: General Discussion and Questions
Topic: disable_irq not effective
Replies: 25
Views: 12865

Re: disable_irq not effective

what kind of trouble? In that case: strange error messages like: "cannot find module xxy", where xxy is the name of the actual script. That could be cause by a second interrupt occuring before the handler finished the first one. Still strange, because interrupt should be blocked until the handler h...
by Roberthh
Thu Oct 04, 2018 5:36 am
Forum: General Discussion and Questions
Topic: disable_irq not effective
Replies: 25
Views: 12865

Re: disable_irq not effective

@pythoncoder: I think it was documented in the past. I remember the discussion around it. To collect some aspects: hard=True: faster response; interrupt context, meaning e.g. no memory allocation# hard=False: slower response; normal code execution context; no limitation on what can be done, e.g. mem...
by Roberthh
Wed Oct 03, 2018 5:11 pm
Forum: General Discussion and Questions
Topic: disable_irq not effective
Replies: 25
Views: 12865

Re: disable_irq not effective

As far as I know, Python, at least MicroPython, does not reorder statements. And even in other languages I have doubts, whether a function call and an assignment following it would be swapped, simply because the side effects of that call may not be known.
by Roberthh
Wed Oct 03, 2018 9:47 am
Forum: General Discussion and Questions
Topic: disable_irq not effective
Replies: 25
Views: 12865

Re: disable_irq not effective

Setting the trigger to a single slope only just about halves the "locked" count. BUT: A look into the code improves knowledge: Changing this line of the code by adding hard=True: p14.irq(trigger=Pin.IRQ_FALLING, handler=callback, hard=True) the phenomenon also disappears. It seems that the parameter...
by Roberthh
Wed Oct 03, 2018 7:50 am
Forum: General Discussion and Questions
Topic: disable_irq not effective
Replies: 25
Views: 12865

Re: disable_irq not effective

Adding a small sleep between urq_disable and setting of the "locked" flag brings the locked count to zero: irq_state = machine.disable_irq() # Start of critical section time.sleep_us(50) locked = True I faintly recall that call sleep allows other scheduled tasks to execute, at least for sleep_us lar...
by Roberthh
Wed Oct 03, 2018 7:41 am
Forum: General Discussion and Questions
Topic: disable_irq not effective
Replies: 25
Views: 12865

Re: disable_irq not effective

Actually i did not use a square wave, but a pulse of 10µs duration at a ferqency of 1 kHz. Changing that frequency affects the probability in which such a "error" condition occurs. A simple once-only series gives: Frequency Locked-count 2000 90 1000 42 500 26 250 12 100 4
by Roberthh
Tue Oct 02, 2018 6:59 pm
Forum: General Discussion and Questions
Topic: disable_irq not effective
Replies: 25
Views: 12865

Re: disable_irq not effective

I do not fully recall how it is implemented on the ESP8266, but as far as I recall, registering an event and calling the handler are two separate actions. When an IRQ occurs, a handler request is scheduled, and the handler is executed at a later time. In that scenario, at the time of the IRQ 'locked...