2014-03-21 04:22 AM
I'm developing a system using STM32F407ZGT with a PHY DP83848 using RMII interface. A 50MHz oscillator was used for the RMII_REF_CLK. I ran the FreeRTOS+LWIP demo application from ST's websize and encountered a strange problem:
1) Firstly, because external 50MHz oscillator was used so I comment the configuration code for PA8 (MCO1). But the initialization failed and the program was stuck in 'while(ETH_GetSoftwareResetStatus()==SET)' line. I measured the 50MHz clock and found that after PA7 was configured as RMII_CLK the amplitude of the 50MHz clock drop to a half !2) When I added the configuration code for PA8 in the ETH_GPIO configuration function before PA7 was configured, everything is OK !!! I just added the following lines for PA8, but didn't output the clock to PA8!! /* Configure MCO (PA8) */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; GPIO_Init(GPIOA, &GPIO_InitStructure);------------------------------------------------------This is really strange! PA8 was not used in my system. It should have nothing to do with the system. I found many posts in BBS talking about the 'while(ETH_GetSoftwareResetStatus()==SET)' problem. Is it a bug for STM32?2014-03-21 05:26 AM
What happens if you just comment out the GPIO_Init() line?
/* Configure MCO (PA8) */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
// ## GPIO_Init(GPIOA, &GPIO_InitStructure);
2014-03-21 05:44 AM
Thank you for your suggestion. I will try this and tell you the result tomorrow.
2014-03-24 07:05 AM
I had made a stupid mistake! The following GPIO initialization code only change the GPIO_Pin of
GPIO_InitStructure. So when I comment out the code for PA8, the corresponding members of GPIO_InitStructure were not configured.