cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Started With Ethernet.

gaurav  kumar
Associate II
Posted on June 20, 2017 at 13:48

Hello everyone,

I have recently switch from 8 bit to 32 bit ARM based MCUs. Currently i'm working on a project in which i want to create a LAN of some communicating devices and for this i have purchased STM32F4I-DISC1 (cortex M4 based) kit.

Actually Problem is, i know this is something that is related to the Ethernet but i'm not precisely know how to implement this. 

can anyone help me to sort out things for me like how to get started with it, what i need to read ( protocols like TCP, IP, UDP, HDLC etc) or there are some device specific libraries, which can be used.

I'm not saying you to implement it for me, anything that i want is just right approach to implement a Ethernet.     

thanks in advance...

#etherent #stm32 #lan
7 REPLIES 7
jp vergne
Associate
Posted on June 20, 2017 at 14:18

Hi,

The more efficient way is to use an Ethernet stack dedicated to the STM32F4.

Read the following ST note :

https://community.st.com/external-link.jspa?url=http%3A%2F%2Fwww.st.com%2Fcontent%2Fccc%2Fresource%2Ftechnical%2Fdocument%2Fapplication_note%2Ffd%2F5d%2F64%2Fcf%2F7c%2F38%2F4c%2F30%2FDM00036052.pdf%2Ffiles

/DM00036052.pdf/jcr:content/translations/en.DM00036052.pdf

Good luck ...

Zt Liu
Senior III
Posted on June 20, 2017 at 15:39

Another easy choice is WizNet's Internet offload engines, including modules or Chips.

http://www.wiznet.io/product/

 (hey, I don't work for them!)

Just a simple SPI interface, then you can have TCP, UDP, HTTP, DNCP, SNMP, DNS, NTP......so easy and so much fun.

Moreover, they offer libraries in 

https://github.com/Wiznet/ioLibrary_Driver

 

It's still updated few months ago. 

My First embedded ethernet development is through W5500 ethernet module. 

Once got 'launched' through this simple module,

sooner or later,  you may consider to run the lwIP (Adam Dunkels' great work!) in your mcu.

Good Luck!

Khouloud GARSI
Lead II
Posted on June 20, 2017 at 16:40

Hi

Kumar.Gaurav.004

‌,

I'd highly recommend you to refer to the LwIP applications under the

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef4.html

package.

Please refer to the path below:

STM32Cube_FW_F4_V1.0\Projects\STM324x9I_EVAL\Applications\LwIP

Khouloud.

gaurav  kumar
Associate II
Posted on June 21, 2017 at 06:48

thanks to all for quick replies. 

andy b
Senior
Posted on June 22, 2017 at 14:17

Hi 

If you are looking to do ethernet with the STM32 itself I'd recommend , like many others did, to use the LwIP stack.There are no examples for LwIP for the stm32f4 discovery but you can convert examples from the STM324xG eval pretty easily(same micro just a different package).Here is a post that describes the main changes that need to be done to the original file to make it work on the stm32f4 discovery. 

https://community.st.com/0D50X00009XkaAUSAZ

 .I started with the UDP echoclient example and I suggest that you do the same.Since it uses the raw api you dont need an RTOS to do ethernet , unlike the two other api of LwIP, and UDP is a simple protocol since there is no data acknowledge unlike TCP. Keep in mind that the stm32f4 doesnt have a PHY so you will need to buy a module either the LAN8720 or the DP83848 will work.(both sold by waveshare). The examples for LwIP can be found under C:/User/STM32Cube/Repository/STM32Cube_FW_F4_Vx.xx.x/Projects/STM324xG_EVAL/Applications/LwIP

Supported IDE are Keil ,IAR and Systeme workbench (a version of eclipse).But the .C and .H files are available if you want to use another IDE.

Good Luck

-Andy
Posted on June 27, 2017 at 08:40

thanks Andy b 

i have a doubt regarding this concept. Since everyone telling me to use standard library like LwIP stack, is it due to fact that TCP/IP is an ISO standard and to develop it my own i need to buy these from ISO or due to complexity of TCP/IP protocols it is very hard to implement ?

Posted on June 27, 2017 at 14:39

Hi gaurav

It is highly suggested to use an already fonctionnal tcp/ip stack , like Lw IP, because of the complexity and the time required to make a tcp/ip stack from scratch.There are many tcp/ip standards and the documentation is almost endless on the subject.Also ,exept for certain markets, most products dont need a custom tcp/ip stack ,taking a ready-to-go stack is totally fine.It's even better because you know that it works and usually they are well documented with mid to high level functions ready to use.

-Andy