Background: I’m working on a STM32F7 based device that uses ethernet and FreeRTOS+TCP lib for communication with PC. For a significant amount of time, the device will be powered from the backup battery and PC it’s connected turned OFF. So I’m on a quest to reduce power consumption as much as possible/reasonable during those periods, so logical action would be to shut down everything related to the ethernet connection.
At the moment, I’m trying to turn OFF the PHY IC and ETH peripheral so that interface could be turned ON again without restarting the MCU (requirement).
I’m using Network management code from the samples provided with the library with almost no modification and added functions to shut down the interface:
- Delete EMAC task,
- Send PHY to power-down mode,
- deinit ETH
…and to turn it back ON:
- Wakeup PHY
- Send Network down event (via FreeRTOS_NetworkDown() ) to reinit ETH and create EMAC task again
But achieved only crashes and watchdog resets after a cycle or two.
Is there a recommended way how to gracefully turn the interface OFF and reinit it again? List of things to take care of? Is it even a good idea in the context of FreeRTOS+TCP?
I would appreciate any pointers in the right direction.