2012-11-01 12:17 PM
Hello,
I am trying to attach external PHY chip to my STM32F4Discovery board. I am using the 'stm32f4x7_eth_lwip' example from the ST site. I think for people that have the bigger evaluation board with already soldered PHY chip is just a question of loading the code. If you are trying to add different chip like me(DM9161AEP) then maybe this info would be useful(i hope). The PHY address is very important to be able to talk to the chip, it is defined like this: #define DP83848_PHY_ADDRESS 0x01 /* Relative to STM324xG-EVAL Board */ in the stm32f4x7_eth_bsp.h file. It helps to add this code to stm32f4x7_eth_bsp.c file: // Search for PHY uint32_t Eth_Link_FindPhy(void) { int i; uint32_t tmpreg = 0; // Try all possible addresses for(i = 0; i < 32; i++) { // Read ID1 reg tmpreg = ETH_ReadPHYRegister(i, 0x02); printf(''PHYID1 = %04x\n\r'',tmpreg); // PHY product id, from manufacturer pdf // check and replace with correct one! // DM9161AEP = 0x0181 if(tmpreg == 0x0181) { printf(''PHY addr = %04x\n\r'',i); return ETH_SUCCESS; } } printf(''PHY - not found!\n\r''); return ETH_ERROR; } and then call it somewhere after init, maybe in ETH_BSP_Config(), after the ETH_MACDMA_Config(); call. It will allow to test if there is valid communication with the chip, and stall on error. So next step is to see the debug print and look for alternative address (this one is based on start up GPIO condition) and replace the definition. Or if not that, search for HW problem. BR, Chris