cancel
Showing results for 
Search instead for 
Did you mean: 

How to use LwIP + LAN8720 +STM32F4

Murad
Visitor

Originally a reply to https://community.st.com/t5/stm32cubemx-mcus/lwip-lan8720/m-p/690602 but needs a new thread


How do i manually add file C and file H ??

9 REPLIES 9

You haven't said what IDE you're using but, for STM32CubeIDE:

  1. copy the .c file into a folder in your project which already has source files;
  2. copy the .h file into a folder in your project which already has header files.

(depending on how your project is set up, those could be the same folder)

Murad
Visitor

I am using STM32CubeIDE. need to add in Core>Inc and Core> Src  ???

Lwip Should be enabled or disabled??

 

 

Безымянный.png

Murad
Visitor

Sorry for so many questions, as I am just starting to work with stm32 controllers and practicing

Ethernet is really not a beginner's project - you should probably start with some more basic projects to get familiar with the tools...

https://www.youtube.com/watch?v=gL8OoS9E1rw&list=PLnMKNibPkDnFCosVVv98U5dCulE6T3Iy8

 

EDIT:

You also haven't said what STM32 you're using, what hardware, etc.

Again, please see the Posting Tips:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

 

PS:

Try a search in the Knowledge Base; eg,

https://community.st.com/t5/stm32-mcus/how-to-use-the-lwip-ethernet-middleware-on-the-stm32h5-series/ta-p/691100?search-action-id=38526787183&search-result-uid=691100

 

Also, as previously noted, LwIP is a widely-used independent 3rd-party project - so a general web search should find a lot...

https://savannah.nongnu.org/projects/lwip/ 

Murad
Visitor

I am using STM32F407VGT6.   ETH mode: RMII. 

PA1ETH_REF_CLKn/aAlternate Function Push PullNo pull-up and no pull-downVery High false
PA2ETH_MDIOn/aAlternate Function Push PullPull-upVery High true
PA7ETH_CRS_DVn/aAlternate Function Push PullNo pull-up and no pull-downVery High false
PB11ETH_TX_ENn/aAlternate Function Push PullNo pull-up and no pull-downVery High false
PB12ETH_TXD0n/aAlternate Function Push PullNo pull-up and no pull-downVery High false
PB13ETH_TXD1n/aAlternate Function Push PullNo pull-up and no pull-downVery High false
PC1ETH_MDCn/aAlternate Function Push PullPull-upVery High true
PC4ETH_RXD0n/aAlternate Function Push PullNo pull-up and no pull-downVery High false
PC5ETH_RXD1n/aAlternate Function Push PullNo pull-up and no pull-downVery High false

Also I activate RCC_MCO_1  -- 25Mhz.

Is that a commercial board, or your own custom design?

Murad
Visitor

My custom design

Pavel A.
Evangelist III

Hi Murad,

The CubeMX and the libraries offered in the "Software pack" have evolved since I've last time dealt with ETH and LwIP. Maybe there's a new straight method now to change the PHY. I'd still do this in the old way, simply because this is easier for me. The changes for the PHY will be in LwIP/Target/ethernetif.c and the original files for the PHY are under Drivers/BSP.  Basically you just find all calls to the PHY module in ethernetif.c and replace by similar calls in the actual C file (lan8720_driver.c or whatever) and replace the PHY .h file to the corresponding new .h. Then remove the c,h files for the old PHY and copy the new PHY files in your project. Just copy both .c and .h files in the same directory with your ethernetif.c and add to the project. Only ethernetif.c will use it, so no reason to be fancy. 

Compile and fix errors. That will be the easy part.

The hard part is to debug and verify that the new PHY routines are actually called and do what they should.

Good luck.

 

Thank you a lot. I will try use this method, and feedback later:folded_hands: