cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7: Ethernet Wakeup from stop mode

CA_SUS
Associate II

Hi,

I want to wakeup my STM32F746 + FreeRTOS + LwIP system with a magic packet.

I started off with configuring the MAC to generate the interrupt when a Magic Packet is received, without entering the low power mode beforehand. This works perfectly fine (verified by toggling a LED each time the interrupt fires).

I just had to add the following lines to the CubeMX code at the end of the function "low_level_init" (Wakeup IRQ enabled in CubeMX):

__HAL_ETH_WAKEUP_FRAME_DETECTION_ENABLE(&heth);
 __HAL_ETH_MAGIC_PACKET_DETECTION_ENABLE(&heth);
 __HAL_ETH_WAKEUP_EXTI_ENABLE_RISING_EDGE_TRIGGER();
 __HAL_ETH_WAKEUP_EXTI_CLEAR_FLAG();
 __HAL_ETH_WAKEUP_EXTI_ENABLE_IT();
 __HAL_ETH_MAC_ENABLE_IT(&heth, ETH_MAC_IT_PMT);

As a next step, I wanted to keep the MAC as is (not following the whole procedure in the Reference Manual chapter 38.5.8) and just enter the STOP mode. As a first step, I just wanted to see the controller wake up, to verify that I configured the MAC correctly (not caring if FreeRTOS is messed up, because I want to reset the whole system after wakeup anyway).

As soon as I add

__HAL_ETH_POWER_DOWN_ENABLE(&heth);
    HAL_SuspendTick();
    HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFI);

somewhere in my code (in any FreeRTOS thread), the interrupt isn't received anymore (LED doesn't toggle). The current consumption also doesn't change, so I assume the MCU simply doesn't wake up. It doesn't change if I use the default interrupt priority 5 or if I increase it to e.g. 0.

I expected to maybe get an early wakeup interrupt due to any other interrupt or whatever, but not that it sleeps forever. Can anybody please open my eyes and tell me what's my mistake?

EDIT: When I'm actively debugging it seems to work (seems to take the MCU out of deep sleep regularly --> IRQ gets through somehow), but on a cold restart (power cycle) the MCU sleeps forever

Thanks

CA

0 REPLIES 0