rt1061 cannot wakeup by magic packet

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

rt1061 cannot wakeup by magic packet

跳至解决方案
1,938 次查看
zrx
Contributor II

rt1061 mac enter sleep mode,but it cannot wakeup by magic paket,the ECR[MAGICEN] can not set

SDK_2_5_0_EVKB_IMXRT1061\boards\evkmimxrt1060\lwip_examples\lwip_httpsrv\bm\mdk
int main(void)
{
    struct netif fsl_netif0;
    ip4_addr_t fsl_netif0_ipaddr, fsl_netif0_netmask, fsl_netif0_gw;
    ethernetif_config_t fsl_enet_config0 = {
        .phyAddress = EXAMPLE_PHY_ADDRESS,
        .clockName = EXAMPLE_CLOCK_NAME,
        .macAddress = configMAC_ADDR,
    };

    gpio_pin_config_t gpio_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};

    BOARD_ConfigMPU();
    BOARD_InitPins();
    BOARD_BootClockRUN();
    BOARD_InitDebugConsole();
    BOARD_InitModuleClock();

    IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1TxClkOutputDir, true);

//    GPIO_PinInit(GPIO1, 9, &gpio_config);
//    GPIO_PinInit(GPIO1, 10, &gpio_config);
//    /* pull up the ENET_INT before RESET. */
//    GPIO_WritePinOutput(GPIO1, 10, 1);r
//    GPIO_WritePinOutput(GPIO1, 9, 0);
//    delay();
//    GPIO_WritePinOutput(GPIO1, 9, 1);
        GPIO_PinInit(GPIO1, 2, &gpio_config);
    GPIO_PinInit(GPIO1, 10, &gpio_config);
    /* pull up the ENET_INT before RESET. */
    GPIO_WritePinOutput(GPIO1, 10, 1);
    GPIO_WritePinOutput(GPIO1, 2, 0);
    delay();
    GPIO_WritePinOutput(GPIO1, 2, 1);

    time_init();

    IP4_ADDR(&fsl_netif0_ipaddr, configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3);
    IP4_ADDR(&fsl_netif0_netmask, configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3);
    IP4_ADDR(&fsl_netif0_gw, configGW_ADDR0, configGW_ADDR1, configGW_ADDR2, configGW_ADDR3);

    lwip_init();

    netif_add(&fsl_netif0, &fsl_netif0_ipaddr, &fsl_netif0_netmask, &fsl_netif0_gw,
              &fsl_enet_config0, ethernetif0_init, ethernet_input);
    netif_set_default(&fsl_netif0);
    netif_set_up(&fsl_netif0);

    httpd_init();

    PRINTF("\r\n************************************************\r\n");
    PRINTF(" HTTP Server example\r\n");
    PRINTF("************************************************\r\n");
    PRINTF(" IPv4 Address     : %u.%u.%u.%u\r\n", ((u8_t *)&fsl_netif0_ipaddr)[0], ((u8_t *)&fsl_netif0_ipaddr)[1],
           ((u8_t *)&fsl_netif0_ipaddr)[2], ((u8_t *)&fsl_netif0_ipaddr)[3]);
    PRINTF(" IPv4 Subnet mask : %u.%u.%u.%u\r\n", ((u8_t *)&fsl_netif0_netmask)[0], ((u8_t *)&fsl_netif0_netmask)[1],
           ((u8_t *)&fsl_netif0_netmask)[2], ((u8_t *)&fsl_netif0_netmask)[3]);
    PRINTF(" IPv4 Gateway     : %u.%u.%u.%u\r\n", ((u8_t *)&fsl_netif0_gw)[0], ((u8_t *)&fsl_netif0_gw)[1],
           ((u8_t *)&fsl_netif0_gw)[2], ((u8_t *)&fsl_netif0_gw)[3]);
    PRINTF("************************************************\r\n");

        PRINTF("MAC_add:%02x %02x %02x %02x %02x %02x \n",fsl_netif0.hwaddr[0],fsl_netif0.hwaddr[1],fsl_netif0.hwaddr[2],fsl_netif0.hwaddr[3], fsl_netif0.hwaddr[4],fsl_netif0.hwaddr[5]);
        
ENET_EnableSleepMode(ENET,1);  //使MAC进入休眠

    while (1)
    {
        ethernetif_input(&fsl_netif0);
        sys_check_timeouts(); 
    }
}

0 项奖励
回复
1 解答
1,864 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi,

 

1. You need to enable the magic packet detection and enable the sleep in ENETX_ECR.

for example:

ENET1_ECR |= 0XC;

 2. Implement an ISR handler to process kENET_WakeupInterrupt. 

 

Regards

Daniel

 

 

 

 

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,865 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi,

 

1. You need to enable the magic packet detection and enable the sleep in ENETX_ECR.

for example:

ENET1_ECR |= 0XC;

 2. Implement an ISR handler to process kENET_WakeupInterrupt. 

 

Regards

Daniel

 

 

 

 

0 项奖励
回复