Interrupts don't fire if reading status register

If I repeatedly read a socket’s status register in a loop, it seems interrupts don’t fire.

/* psuedo code: interrupts don't fire */ while(1) { uint8_t status = socket_get_status(); switch(status) { /* ... */ } }

If I don’t read the status, the interrupts fire as expected:

/* psuedo code: interrupts fire as expected */ while(1) { /* uint8_t status = socket_get_status(); */ switch(status) { /* ... */ } }

I’m using the SPI interface with an STM32F4 MCU.

Is anyone aware of a problem like this? 부탁 드림니다.

Mike

If I add a 20us delay in the loop, it works fine.

[code]/* psuedo code: this works /
while(1)
{
uint8_t status = socket_get_status();
switch(status)
{
/
… */
}

delay_us(20);

} [/code]

Anyone have an idea why?

Hi,
Check the mask value of IMR regsiter.
When the mask value set as ‘1’ ans the coresponding bit also set as ‘1’ , Interrupt oucurrs.
Others, no interrupt oucurrs.

And, check the hardwire connection to MCU’s intterupt input pin with W5100’s /INT pin.
And, Check your MCU’s interrupt control as sensitivity and polarity.

Thank you.

[quote]Check the mask value of IMR regsiter.
When the mask value set as ‘1’ ans the coresponding bit also set as ‘1’ , Interrupt oucurrs.
Others, no interrupt oucurrs.[/quote]

Since the interrupts do occur when not reading the status register, or after adding a delay to the loop, the mask is set correctly. If it wasn’t I wouldn’t receive interrupts under any condition.

Again, since I am getting interrupts under certain conditions, it is obvious that the hardware is wired correctly.

And again, since I am getting interrupts under certain conditions, it is obvious this is set correctly.

The only difference is a 20us delay added in the loop, and it makes all the difference. Is the W5100 unable to pull the interrupt pin if it’s register are being read?

Hi,
According to what you said, The related Interrupt configuration & hardware is all ok.

I wonder how to process Sn_IR register and what is your ISR routine.
Sn_IR represents the interrupt of socket such as CONNECT,DISCON,RECV,SENDOK and TIMEOUT.
if Sn_IR is not zero and Sn_IR mask bit is set, n bit of IR become set and Interrupt pin hold low until IR is not zero.
Although IR is not zero, another interrupt can be occurred without changing the interrupt pin.
So, Once interrupt is detected, you should process all IR bit and clear all Sn_IR.

For more detail, refer to datasheet.

Thank you.

[quote]I wonder how to process Sn_IR register and what is your ISR routine.
Sn_IR represents the interrupt of socket such as CONNECT,DISCON,RECV,SENDOK and TIMEOUT.
if Sn_IR is not zero and Sn_IR mask bit is set, n bit of IR become set and Interrupt pin hold low until IR is not zero.
Although IR is not zero, another interrupt can be occurred without changing the interrupt pin.
So, Once interrupt is detected, you should process all IR bit and clear all Sn_IR.[/quote]

This is exactly what I’m doing. I modeled it after the examples and the information in the datasheet.

I ask that you please take the time to test yourself. Create a simple loop to repeatedly read the status register, and see if it prevents the interrupts from firing. Knowing if you experience the same problem will be very helpful.

Thanks.

Hi,

I am trying to test your condition.

After test I will post ASAP.

Best regards.

Hi,

I tested done.

But interrupt is always fine.

So, I think reading status register has nothing to do with interrupt.

Let’s try to find problem.

Best regards.

Thank you for taking the time to test. Were you using the SPI interface? I suspect that is critical to reproducing the problem.

Hi,

I tested interrupt in SPI interface.

And post your schematics and I/O function code.

Then we will check and reply.

Best regards.

Let’s start with the schematic. Here it is. Do you see any potential problems?


I made a few comments about the schematic.

  1. To use system bus interface mode, pull down the SEN pin.
  2. You can’t use both MCU system bus I/F mode and SPI I/F mode simultaneously.
    Thanks.

[quote]1. To use system bus interface mode, pull down the SEN pin.
2. You can’t use both MCU system bus I/F mode and SPI I/F mode simultaneously.[/quote]

Yes, we are aware of this. The “DNI” (Do Not Insert) is only there in case we change our minds, so we don’t have to refabricate a PCB.

Hi,
Is there your problem still ?

If yes, check the the MCU interrupt to be enabled or be disabled.
W5100 basic SPI IO operation as IINCHIP_READ, IINCHIP_WRITE, IINCHIP_READ_BUF, and IINCHIP_WRTIE_BUF in wiznet driver code diable the MCU interrupt until A register read/written is completed. Refer to IINCHIP_ENABLE() and IINCHIP_DISABLE().

I think MCU can’t recognize the intrerrupt of 5100 generated during MCU interrupt is disabled by the code as IINCHIP_DISABLE() & IINCHIP_ENABLE().

Thank you.