I need to catch incoming TCP packets by interruption.
I have implemeneted following :
- In the loop, I invoke the register check procedure Sn_IR (Sn_IMR = 0x1F);
- If the RECV = 1 bit in the Sn_IR register, at the first I call a procedure for reading the packet and after the procedure for sending the response packet;
- After reading a packet and sending the response, the Sn_IR register automatically resets to 0x00;
That’s how it works.
Now, If I turn on the hardware interrupt, I have did following:
- Chip initialization procedure sets the register SIMR = 0xFF (although only one socket is used);
- Interrupt procedure check the RECV bit in the Sn_IR register. If bit RECV = 1 then set the flag FL_INT_RECV and leave the interrupt;
- In the loop:
A procedure of flag FL_INT_RECV verification invokes. If the flag is set, then a procedure calls for reading the packet, sending the response packet and reset flag
by resetting the interrupt bits:
- setSIR (0x00);
- setSn_IR (SOCK_TCP, 0x1F);
In doing so, I receive one packet and can send one response only. The INT line stays low (SIR != 0x00, Sn_IR != 0x00).
What I am doing wrong? Please, I will be thankful for any suggestions.