2025-12-18 4:16 PM
Hi all,
I have been trying to set up an ethernet connection to stream camera output for my own project (using the STM32N6 Discovery Kit with a different IMX image sensor). Before working on this, I uploaded and ran the VENC RTSP Server application, and it was working correctly. I then returned back to my own firmware implementation for a day or two and I could not get the ethernet to work.
Then, when reuploading the VENC RTSP Server application, I found that it was no longer working. The issue is essentially the same as what occurs in these posts, the difference being this is not custom hardware:
https://community.st.com/t5/stm32-mcus-products/ethernet-sw-reset-timeout/td-p/703469
https://community.st.com/t5/stm32-mcus-products/ethernet-sw-reset-timeout/td-p/703469
What's happening is that the code continuously fails in stm32n6xx_hal_eth.c in HAL_ETH_Init while waiting for the SW reset to complete after setting the SR bit in the DMABMR register.
I have noticed within void HAL_ETH_MspInit(ETH_HandleTypeDef *heth) that the example application has:
__HAL_RCC_ETH1MAC_CLK_ENABLE();
__HAL_RCC_ETH1TX_CLK_ENABLE();
__HAL_RCC_ETH1RX_CLK_ENABLE();Whereas within my project, the ETH MSP Init has this instead (autogenerated by STM32CubeMX).
__HAL_RCC_ETH1_CLK_ENABLE();When I replace the CLK enables within the example application with the one above (from my project), the ETH can initialize properly, but the network cannot connect later on (debug message "The network cable is not connected").
This has left me with several questions:
Firstly, is it possible my custom firmware left the Ethernet PHY in a bad state which persists across MCU resets? I can read in this manual that the reset button (B1) is connected to the Ethernet reset, which should disprove this...
Also, why does the working demo need the three separate clock enables, whilst CubeMX only generates ETH1 CLK Enable.
I have power cycled the board and experimented with the CLK Enables, but I don't want to modify this application too much as it should work out of the box and worked before.
Thanks!