WIZnet Developer Forum

When I enable WOL (Wake up On LAN) I cant receive UDP packages any more

When I enable WOL (Wake up On LAN) I cant receive UDP packages any more.

Is there a limitation in the chip?

I enable WOL as this:

    (void)socket( 0, Sn_MR_UDP, 7, 0x00 );

	//  Enable WOL mode
	setMR( getMR( ) | MR_WOL );


    // Enable WOL interrupt
    //
    // Each bit of SIMR corresponds to each bit of SIR. When a bit of SIMR is ‘1’ and the
    // corresponding bit of SIR is ‘1’, Interrupt will be issued. In other words, if a bit of
    // SIMR is ‘0’, an interrupt will be not issued even if the corresponding bit of SIR is ‘1’.
    //
    // IM_IR4 = Magic Packet Interrupt Mask
    setIMR( getIMR( ) | IM_IR4 );

    // Enable interrupt for socket 0
    setSIMR( 1 << 0);

I receive UDP packages as this:

static void poll_signal_scope_rx( void )
{
    uint16_t rx_length;

    switch ( getSn_SR( 1) )
    {
    case SOCK_UDP: // This indicates that the socket is open in UDP mode
        if ( (rx_length = getSn_RX_RSR( 1)) > 0 )
        {
            if ( rx_length > sizeof(udp_package.data) ) rx_length = sizeof(udp_package.data);
            udp_package.data_length = recvfrom( 1, udp_package.data, rx_length, udp_package.ip_address, &udp_package.port );
            (void)xQueueSend( signal_rx_queue, &udp_package, 0 );
        }
        break;
    case SOCK_CLOSED: // This indicates that the socket is released
        //(void)close( 1);
        (void)socket( 1, Sn_MR_UDP, port_number_for_signal_scope, 0x00 );
        break;
    default:
        break;
    }
}

I’ve never tried it but …
from as written in the manual after setting the WOL in MR must read IR bit 4 (MP) which becomes high after remotely you sent in UDP to W5500 on any port six times 0xFFFFFFFFFFFF and sixteen times the mac address of W5500.
This is the condition of waking up from standby and not think you have do something else.

The WOL works, no problem.

The problem is that UDP on the other socket does not work if I enable WOL.

Could someone post an example that includes WOL and UDP (send and receive)?

My UDP code stops working as soon as I add to following to my code:

setMR( getMR( ) | MR_WOL );

Any help on this?

After setting WOL check the reception of packets awakening reading IR_MP and upon arrival should put the W5500 in normal operation by resetting the MR_WOL bit.
One thing I’ve tried and I can confirm is that the WOL packet does not go out the chip from the power down mode state losing the advantages of the waste of current.

So the W5500 is not in normal operation when I set the WOL bit in the Mode Register?

Does the W5500 inhibit reception of UDP packages when the WOL bit is set in the Mode Register? The data sheet does not tell this. Or is there a chip bug in the W5500 that inhibits reception of UDP packages when the WOL bit is set?

When I set the WOL bit in the Mode Register I can still send and receive TCP packages. But I can’t receive any UDP packages. This is strange!

In my application I want the INTn pin to go low when the W5500 receives a magic package (WOL). The INTn is connected to the board reset line. I want my board to reset when the W5500 receives a magic package. This works, I have tested it. But I would also like to be able to receive normal UDP packages.

I think it’s a firmware problem because I find very strange that the chip can not even start from power down when in WOL … normally this is expected, restart the circuit when it is in low power.
To solve your problem you may not use the WOL but open an UDP standard channel and write the protocol from scratch.

I peeked in web and there are some WOL client examples already written …
are for W5100 but take them for W5500 is not difficult.

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.