When Ethernet is initialized in QNEthernet, the Ethernet clock in the the clock gating register CCM_CCGR1 (CG5) is enabled. I know that when a feature on an ARM processor is used without first having its clock enabled, things can freeze.
The issue I'm having is that when I disable Ethernet by turning off the appropriate bits in CCM_CCGR1, the system freezes. Are there specific steps I need to follow so that I can safely disable the clock? Maybe it's something as simple as undoing some of the configuration steps? I'm already disabling the PLL before shutting down the clock, but no luck.
Here's what I'm doing:
The issue I'm having is that when I disable Ethernet by turning off the appropriate bits in CCM_CCGR1, the system freezes. Are there specific steps I need to follow so that I can safely disable the clock? Maybe it's something as simple as undoing some of the configuration steps? I'm already disabling the PLL before shutting down the clock, but no luck.
Here's what I'm doing:
Code:
// Stop the PLL
CCM_ANALOG_PLL_ENET_SET = CCM_ANALOG_PLL_ENET_BYPASS;
CCM_ANALOG_PLL_ENET_CLR = CCM_ANALOG_PLL_ENET_ENABLE;
CCM_ANALOG_PLL_ENET_SET = CCM_ANALOG_PLL_ENET_POWERDOWN;
// Disable the clock for ENET
CCM_CCGR1 &= ~CCM_CCGR1_ENET(CCM_CCGR_ON);