2015-07-25 04:11 AM
Guys,
I tried to interface STM32F107 and DP838... The code is generated from STM32CubeMXvoid 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
2015-07-25 10:35 AM
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