Copyright ©

Mongoose OS Forum

ATTENTION! This forum has moved to:

Do not post any new messages.

Interrupt performance

mjoldfieldmjoldfield Cambridge, UK

Is there any documentation or folk wisdom about the interrupt handling performance
of Mongoose on the ESP8266 ? I've been experimenting with this in init.js with limited
success, but it would be easy enough to move it to C if that would help.

Suppose I have handlers on a couple of GPIO lines, and I want to watch all the transitions.

  1. I can attach the handler, but when it gets invoked I don't know the sense of the transition so I have to call
    How much latency am I likely to see between the transition which causes the interrupt and the read ?

  2. If a couple of interrupts happen in close proximity, what happens ? What does close mean here: ms, us?

Thanks in advance.


  • rojerrojer Dublin, Ireland

    interrupt handler installed with mgos gpio API, hether C or JS, gets invoked in the main task context, so actual ISR only tells mos main task to execute a certain callback when it gets to run next.
    this is not suitable for very latency sensitive applications, delay can be in milliseconds. JS execution itself also adds to that.
    interrup on a particular pin remains disabled until handler executes and returns, so two consecutive interrupts will be coalesced.

    if you need low latency interrupt handling, you'll need to use particular platform-specific SDK functions.

  • jmpyjmpy Asuncion, Paraguay

    Hi, i'm also interested in this (trying to use a water flow meter),

    I tried the new mgos_gpio_set_int_handler_isr function, but that made mongooseos crash when the speed of the flow meter was not slow.

    The cb code is just a counter, and having looked at the hal code for the esp8266 I fail to see why would mos crash like that, so any help will be apreciated.

    volatile uint32_t pulses = 0;
    static void flowmeter_cb(int pin, void *arg){
          (void) pin;
          (void) arg;
  • tripflextripflex Orlando, FL

    @jmpy did you ever figure this out? I'm doing the same thing but can't run in ISR (at least from my tests so far)

Sign In or Register to comment.