w5500
w5500 copied to clipboard
Enable hardware interrupts
I noticed no hardware interrupts being triggered on pin INTn. Fixed by:
- fixing the mask construction for the sockets from a bitwise AND
&to bitwise OR|. - enabling hardware interrupts for all sockets.
I am unsure whether enabling the hardware interrupts in the device initialization is the best location to do so, or whether it is better to fetch the current mask when using a specific socket and enabling interrupts only for the new socket.
Hello @Wassasin, thank you for this fix. I was wondering if you could give a quick overview of how this interrupt could be used? I know it's Wake on LAN but is it setting the pin HIGH and how can I test if your fix actually works?
It has been a while since opening this PR, so please check anything I write here yourself.
This pull request only fixes the interrupt related to already opened sockets. WOL is a mechanism implemented by the W5500 separately as part of the Mode Register, and works without opening any socket for any WOL packet received on any UDP port. Check the datasheet for when the W5500 asserts the intn-pin. You would only have to create a new PR that:
- Sets the WOL symbol (bit 5) of the Mode Register (0x0000).
- Enable the Magic Packet Interrupt (bit 4) in the Interrupt Mask Register (0x0016).
- Check the interrupt pin yourself.
- Check the Magic Packet symbol (bit 4) in the Interrupt Register (0x0015).
- Write a
1to the Magic Packet symbol (bit 4) in the Interrupt Register (0x0015) to clear it.