Correct way to HW shutdown the ethernet port when using FreeRTOS tcp

I’m working on a stm32f4 device that sends data to the server once in an hour.
I want to shut down the Ethernet off between sends. Just turning the ethernet off with the GPIO ports sometimes cause the network to not work correctly when turning back on.
I need it to work with both DHCP and static IP.

Hello @NoamYu,

I prefer and suggest keeping the Ethernet turned on - since IP task will only run periodically based on the value of ipconfigMAX_IP_TASK_SLEEP_TIME (~10 seconds) to check for normal housekeeping tasks.

But in case you want extremely low power consumption I see your point in switching off the Ethernet. When you turn the ethernet ON again, it needs to be re-initialized along with contacting the DHCP server to get an IP-address etc. I would suggest that once you switch the Ethernet back on again, try calling FreeRTOS_NetworkDown function. It will send an event to the IP task which in-turn would do everything necessary to bring the network back up.

Let me know if that works for you.

It’s working. Thanks for the help

Thanks for letting the forum know that it works now.
Can you indicate how you solved it? Even if it was a mistake on your side, it might help others who’ve got stuck at the same point, and look for a solution in this post.