W5500 - Example code of using the INTn interrupt
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: W5500 - Example code of using the INTn interrupt
by Eugeny ·
Being several years here on the forum I would I saw maybe 2 projects trying using INT pin. I tried using it back in days when I was learning W5100, but decided to go polling for several reasons.
Even if you had information and sources of several projects, there no guarantee they will help you in implementation in your environment. Thus please explain your environment If it is just about code which already uses the interrupts (and nothing else), then you can map interrupt sources and conditions between your current project and W5500 and see if you can just port your current code into environment with W5500.
RE: W5500 - Example code of using the INTn interrupt
by acpie360 ·
Thanks for the reply. After some careful looking into the W5500 socket APIs, I think the polling method is much easier to adapt.
RE: W5500 - Example code of using the INTn interrupt
by Candela12 ·
We work with the INT interrupt. It works fine, as long as you make sure you keep polling for changes as long as the INT pin is high.
This is because the INT pin seem to be a level interrupt (remains high as long as the condition is high) rather than the edge interrupt (high when something happens, and then reset in the interrupt handler).
So the interrupt routine looks like this (schematic only, I use Microchip Dspic)
volatile unsigned int socketinterrupt = 0;
int _w5500pininterrupt()
{
socketinterrupt++; // run service routine
pininterrupt=0; // clear end of interrupt
}
and the main loop checks the service routine:
int main()
{int rcvsiz;
// lots of initialization
while (1) do
{
if (socketinterrupt)
{ socketinterrupt–; // declare interrupt as “handled”.
res=check_for_read_data(&rcvsiz); // writes SN_IR_RECV to SN_IR and reads Sn_RX_RSR0 twice till first read=second read.
} // while
}// main
RE: W5500 - Example code of using the INTn interrupt
by acpie360 ·
Thanks for the sharing. However, I don’t see a significant advantage of using the interrupt. In your case, I suppose you could simply check the return value from check_for_read_data(). If it is zero, then there is nothing to do. Correct?
RE: RE: W5500 - Example code of using the INTn interrupt
by Candela12 ·
The advantage is that I only poll RSR when the interrupt comes instead of continuesly
The workaround is that you poll extra if the interrupt line stays high (which it usually doesn’t)