2011-11-17 04:13 AM
hello friends
Can any body guide me on how can i use the ethernet module of stm32f407 on discovery kit? do i need something extra? #stm32f4-discovery #ethernet #lwip2011-11-17 06:46 AM
Well I suspect it's non-trivial, perhaps reviewing some F4 development board schematics will be enlightening.
http://www.st.com/internet/evalboard/product/252216.jsp http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/USER_MANUAL/DM00036746.pdf http://www.keil.com/mcbstm32f400/ http://www.keil.com/mcbstm32f400/mcbstm32f400-schematics.pdf2012-01-12 07:58 AM
Hello,
I am also trying to connect stm32f4 discovery board with an ethernet phy. I am using DP83848 conected on a separate board using RMII interface. For physical connection I refered to description of ''STM3240G-EVAL evaluation board'', that can be found under link: http://www.ebv.com/fileadmin/products/Products/STM/STM32F4_Series/User_Manual_STM3240G-EVAL.pdf Still there is a conflict using pin PA7, which is used as SDA/SDI/SDO for LIS302DL on discovery board and is also part of RMII interface as RMII_CRS_DV signal. My assumption is that if I do not use accelerometer and do not configure microcontroller interface for it, then I can configure PA7 signal for RMII function. As base I am using code downloaded from: http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/stm32f4x7_eth_lwip.zip I modified the GPIO initialization part in order to match discovery board and RMII interface. This results in following code:/* Configure PA1, PA2 and PA7 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_7; GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_ETH); GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_ETH); GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_ETH); /* Configure PB11, PB12 and PB13 */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13; GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_PinAFConfig(GPIOB, GPIO_PinSource11, GPIO_AF_ETH); GPIO_PinAFConfig(GPIOB, GPIO_PinSource12, GPIO_AF_ETH); GPIO_PinAFConfig(GPIOB, GPIO_PinSource13, GPIO_AF_ETH); /* Configure PC1, PC4 and PC5 */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_PinAFConfig(GPIOC, GPIO_PinSource1, GPIO_AF_ETH); GPIO_PinAFConfig(GPIOC, GPIO_PinSource4, GPIO_AF_ETH); GPIO_PinAFConfig(GPIOC, GPIO_PinSource5, GPIO_AF_ETH); Following instructions on some other posts I moved ehternet clock enabling after ethernet reset:/* Software reset */
ETH_SoftwareReset(); /* Wait for software reset */ while (ETH_GetSoftwareResetStatus() == SET); /* Enable ETHERNET clock */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx | RCC_AHB1Periph_ETH_MAC_Rx, ENABLE); I configured the code such that CPU runs on 168 MHz. According to this, insideETH_Init()
the ETHERNET CSR Clock Range should be adapted. Here I run into problem not knowing what prescaler to use: - inside the source code ETH_MACMIIAR_CR_Div102 is indicated as proper for 168 MHz clock - in st32f4 user manual prescalers 62 is stated for HCLK 100-168 MHz! Is there a mistake in user manual document? http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/REFERENCE_MANUAL/DM00031020.pdf Comming to conclusion, my code now stucks insideETH_Init()
, when trying to get the link status:/* We wait for linked status... */
do { timeout++; } while (!(ETH_ReadPHYRegister(PHYAddress, PHY_BSR) & PHY_Linked_Status) && (timeout < PHY_READ_TO)); MACMIIDR never gets value other than 0. Has anybody succeeded connecting stm32f4 discovery board to and ethernet phy using RMII interface? Can anybody give a suggestion what to check?2012-01-12 08:08 AM
Still there is a conflict using pin PA7, which is used as SDA/SDI/SDO for LIS302DL on discovery board and is also part of RMII interface as RMII_CRS_DV signal.
Why wouldn't you just remove the LIS302DL from the board.
2012-01-12 11:17 PM
Hello,
I finally can confirm that there is no problem with connecting RMII ethernet PHY even if PA7 is connected to accelerometer placed on discovery board. The only thing important is that you dont actually use accelerometer, which means that PA7 is configured for ethernet function not SPI. You dont have to unsolder accelerometer from the board. My problem was with GPIO configuration inside ETH_GPIO_Config(). Because of using RMII mode I have put MCO pin initialization under conditional compilation for MII mode. Unfortunately I also removed GPIO_InitStructure initialization. This eventually resulted in all pins used for ethernet not being properly initialized. Now the code looks something like:/* MII/RMII Media interface selection --------------------------------------*/
/* 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 ; #ifdef MII_MODE /* Mode MII with STM324xG-EVAL */ #ifdef PHY_CLOCK_MCO GPIO_Init(GPIOA, &GPIO_InitStructure); /* Output HSE clock (25MHz) on MCO pin (PA8) to clock the PHY */ RCC_MCO1Config(RCC_MCO1Source_HSE, RCC_MCO1Div_1); #endif /* PHY_CLOCK_MCO */ And stm32f4 discovery board is alive on ethernet!2012-01-16 03:35 AM
Hi andrej,
I'm trying to make my first steps with the Ethernet interface for the STM32F1. I have already make some projects with the stm32F1 so I know the structures of the standard Library and so. But for my Ethernet project I have some problems:There are 3 types of free TCP/IP stacks that you can use:
LwIP
uIP
Nichelite
Would you share your quell-code?
Regards
From: zupanc.andrej
Posted: Friday, January 13, 2012 8:17 AMSubject: STM32F4 Discovery EthernetHello,
I finally can confirm that there is no problem with connecting RMII ethernet PHY even if PA7 is connected to accelerometer placed on discovery board. The only thing important is that you dont actually use accelerometer, which means that PA7 is configured for ethernet function not SPI. You dont have to unsolder accelerometer from the board. My problem was with GPIO configuration inside ETH_GPIO_Config(). Because of using RMII mode I have put MCO pin initialization under conditional compilation for MII mode. Unfortunately I also removed GPIO_InitStructure initialization. This eventually resulted in all pins used for ethernet not being properly initialized. Now the code looks something like:/* MII/RMII Media interface selection --------------------------------------*/
/* 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 ; #ifdef MII_MODE /* Mode MII with STM324xG-EVAL */ #ifdef PHY_CLOCK_MCO GPIO_Init(GPIOA, &GPIO_InitStructure); /* Output HSE clock (25MHz) on MCO pin (PA8) to clock the PHY */ RCC_MCO1Config(RCC_MCO1Source_HSE, RCC_MCO1Div_1); #endif /* PHY_CLOCK_MCO */ And stm32f4 discovery board is alive on ethernet!2012-02-15 10:42 AM
Hi I have also the same problems can I ask you some help ??thanks
2012-02-19 10:37 PM
New Ethernet demonstrations on STM32F4x7
2012-12-29 02:38 AM
Hi,
I'm new in STM microcontrollers and I would like to ask if someone had similar problem with ethernet and LwIP stack: I simply took first example in LwIP (httpserver) and got problem->after some code corrections as mentioned above, when I compile and start debugging, everything works fine, I can open my own made page (made by using fsdata) on browser and etc., but after microcontroller reset ETH_CheckFrameReceived() never returns 1 and packets are not handled...Any ideas? Thx.2012-12-29 06:57 AM
Oh, it was my mistake, I didn't imagine how long could take DP83848 startup... the main problem was that stm32f407 starts mush faster and tries to initialize DP83848 while it's not ready...small delay helped.