Specific interrupt for one event

Hi everyone,

I’m using W5100 chip as a TCP client to send some data to a server (computer) over socket #0. I did this job and it works well. This is the main task.

Then, I want to send some commands from computer to W5100 using interrupt. I did this over the same socket #0 and it works fine. However, the code interrupts when W5100 connect, send, receive or do any other event on socket #0. This is expected as data sheet implies about “Sn_IR” register. So, My question is:

  • Can I just receive an interrupt for “RECV” event and block any other events like “SEND_OK”?

  • If it is not possible to do interrupt for one event while blocking others over the same socket, is there anyway to do RECV interrupt independently?

  • Can I open two sockets at the same time with the same computer and same port?

sorry if these are trivial questions, I’m still beginner in this field.

Hello,

No, it is not possible on the W5100. If you’re using the W5500, that’s possible.
The W5500 has a Socket n Interrupt Mask register.
image

If you need to use W5100, I think you should check Sn_IR every event.

It is possible that you open two sockets at the same time with the same computer, but it is not possible same port. In TCP communication, 1: 1 connection is the principle.
This is possible if the TCP server supports multiple connections.

Thank you @becky for fast clear response. I think I need to go to W5500.

one more question regarding interrupt.

when I want to clear the issued interrupt I useed: “wizchip_clrinterrupt(IntKind);” function from “ioLibrary_Driver”. However, the interrupt is not cleared.
When I dig into lib. I found that this function clears “IR” register [0x0015] not “Sn_IR” register and I think the data sheet states that you should clear “Sn_IR” register which will clear “IR” register automatically. Is this really a mistake in the library or I miss something?
I did a direct clear command to “Sn_IR” and it works, the interrupt cleared.

Hello,

This is a mistake in the library.
We will fix the bug and update ioLibrary.
Please refer to code. Thank you.
But if you use two or more interrupt, Do not use this function.
When two interrupts are asserted at the same time, only one interrupt be processed.

for(ir=0; ir<8; ir++){ 
   if(sir & (0x01 <<ir) ) setSn_IR(ir, 0xff); 
} 

Thank you.