Skip to content

Spurious Interrupts #1250

@stickbreaker

Description

@stickbreaker

Hardware:

Board: ?WeMos BlueTooth with Battery?
Core Installation/update date: ?09MAR2018
IDE name: ?Arduino IDE 1.8.5
Flash Frequency: ?80Mhz?
Upload Speed: ?921600?

Description:

I am working on SLAVE mode I2C, my interrupt service routine (ISR) is receiving interrupts without any interrupt cause.

The following is a dump of a capture buffer that lists all arriving interrupts, the CCOUNT (cycle Count) when they were dispatched, and the pending hardware interrupt state.
The interesting columns are:

  • INTR: current value of i2c->dev->int_status.val
  • CCOUNT: current processor cycle count.
  • count: 0x8000 + number of consecutive interrupts
  • TX:RX Current value of i2c->dev->status_reg.val
[E][esp32-hal-i2c.c:999] i2cDumpInts(): 0 row  count   INTR    TX     RX    CCOUNT
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [01] 0x8001 0x0010 0x0014 0x0111 0xd268e314
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [02] 0x8001 0x0000 0x0014 0x0111 0xd268e3ce
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [03] 0x8001 0x0080 0x0014 0x0400 0xd269f950
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [04] 0x8001 0x0000 0x0014 0x0400 0xd269fa3b
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [05] 0x8001 0x0400 0x0014 0x0412 0xd26a8b15
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [06] 0x8001 0x0000 0x0014 0x0412 0xd26a8c00
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [07] 0x8001 0x0080 0x0014 0x0402 0xd26a9174
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [08] 0x8001 0x0000 0x0014 0x0402 0xd26a924f
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [09] 0x8001 0x0010 0x0010 0x0413 0xd26b7e10
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [10] 0x8001 0x0000 0x0010 0x0413 0xd26b7eca
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [11] 0x8001 0x0400 0x0008 0x0412 0xd26c2c10
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [12] 0x8001 0x0000 0x0008 0x0412 0xd26c2cca
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [13] 0x8001 0x0080 0x0008 0x0402 0xd26c3e23
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [14] 0x8001 0x0000 0x0008 0x0402 0xd26c3f0f
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [15] 0x8001 0x0400 0x0008 0x0410 0xd26ce189
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [16] 0x8001 0x0000 0x0008 0x0410 0xd26ce274
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [17] 0x8001 0x0080 0x0008 0x0400 0xd26ce829
[E][esp32-hal-i2c.c:1002] i2cDumpInts(): [18] 0x8001 0x0000 0x0008 0x0400 0xd26ce917
// code attaching interrupt

ret = esp_intr_alloc(ETS_I2C_EXT0_INTR_SOURCE, 0, &i2c_isr_handler_default, i2c, &i2c->intr_handle);
      
i2c->dev->int_ena.val = 0x1FFF; // int 0 .. int 12

As you can see each interrupt is processed, and the ISR exits, immediately the ISR is re-entered without any interrupt source. I have coded around it by if(i2c->dev->int_status.val==0) return;, but there is something I am not understanding, or doing wrong. What is generating this wasted interrupt cycle?

There are multiple open issues around interrupts. #1111, #1229 I am wondering all of these have the same basis?

Am I not clearing the interrupt correctly? I use i2c->dev->int_clr.val = activeInterrupt;, to clear the interrupt status flag after I have responded to the underlying interrupt cause, so I only clear the interrupts I receive. I am not 'ignoring' any interrupt by just clearing the flag.

Chuck

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions