cancel
Showing results for 
Search instead for 
Did you mean: 

Strange bug with STM32F407's MAC

huangtuchen
Associate II
Posted on March 21, 2014 at 12:22

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?
3 REPLIES 3
Posted on March 21, 2014 at 13:26

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);

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
huangtuchen
Associate II
Posted on March 21, 2014 at 13:44

Thank you for your suggestion. I will try this and tell you the result tomorrow. 

huangtuchen
Associate II
Posted on March 24, 2014 at 15:05

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.