cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting STM32F107 with DP83848 ??

antonius
Senior
Posted on July 25, 2015 at 13:11

Guys,

I tried to interface STM32F107 and DP838... The code is generated from STM32CubeMX

void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
{
GPIO_InitTypeDef GPIO_InitStruct;
if(heth->Instance==ETH)
{
/* USER CODE BEGIN ETH_MspInit 0 */
/* USER CODE END ETH_MspInit 0 */
/* Enable Peripheral clock */
__HAL_RCC_ETH_CLK_ENABLE();
/**ETH GPIO Configuration 
PC1 ------> ETH_MDC
PA1 ------> ETH_REF_CLK
PA2 ------> ETH_MDIO
PA7 ------> ETH_CRS_DV
PC4 ------> ETH_RXD0
PC5 ------> ETH_RXD1
PB11 ------> ETH_TX_EN
PB12 ------> ETH_TXD0
PB13 ------> ETH_TXD1 
*/
GPIO_InitStruct.Pin = GPIO_PIN_1;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* USER CODE BEGIN ETH_MspInit 1 */
HAL_UART_Transmit(&huart1, ''Finished ETH INIT \n'', 20, 1000);
/* USER CODE END ETH_MspInit 1 */
}
}

I connect

PA1 ------> ETH_REF_CLK

to OSCIN in DP83848 module ? Is it right ? Do I need a correct RCC to make it right ? I read from STM32F107 reference datasheet : RMII clock sources As described in the RMII clock sources section, the STM32F107xx could provide this 50 MHz clock signal on its MCO output pin and you then have to configure this output value through PLL configuration. I see a crystal on OSCIN pin at DP83848 module.....is it the clock I use ? Thanks
1 REPLY 1
Posted on July 25, 2015 at 19:35

How about providing a schematic of what you've actually wired?

Yes, where you have a 25 MHz oscillator PA1 connects to X1 as I recall. You also have to put a pull-up on the DP83848

(ETH_CRS_DV

) to put it in RMII mode. Carefully review the schematics, and jumper instructions for the STM3210C-EVAL board. Consider also using the SPL example for this board to test yours.

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/CD002124pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..