没有合适的资源?快使用搜索试试~ 我知道了~
首页stm32f107上实现lwIP TCPIP协议栈
资源详情
资源评论
资源推荐

November 2009 Doc ID 16620 Rev 1 1/18
AN3102
Application note
lwIP TCP/IP stack demonstration
for STM32F107xx connectivity line microcontrollers
Introduction
STM32F107xx connectivity line microcontrollers feature a high-quality 10/100 Ethernet
peripheral that supports both MII and RMII to interface the PHY.
One of the advanced features of the STM32F107xx's Ethernet controller is the capability of
generating, inserting and verifying the checksums of the IP, UDP, TCP and ICMP protocols
by hardware. In this application note, you can find a real application that uses this feature.
The objective of this application note is to present a demonstration package built on top of a
free TCP/IP stack: the lwIP (lightweight IP). This package contains:
● A DHCP client, for IP address setting
● A Hello example based on the Telnet protocol
● A TFTP server, which transfers files from and to the microSD™ card located on the
STM3210C-EVAL board
● A web server
● A Server/Clients example, which uses multiple boards and allows clients to control the
server's LEDs.
www.st.com

Contents AN3102
2/18 Doc ID 16620 Rev 1
Contents
1 Porting lwIP to the STM32F107xx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1 lwIP stack overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 How to port lwIP to the STM32F107xx . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.1 Ethernet controller interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.2 Periodic lwIP tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.3 lwIP configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.4 STM32F107xx hardware checksum . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 Description of the demonstration package . . . . . . . . . . . . . . . . . . . . . . 8
2.1 Package directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Demonstration settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.1 PHY interface configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.2 MAC address settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.3 IP address settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.4 STM3210C-EVAL settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 How to use the demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.1 Demonstration overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.2 Hello example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.3 Web server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.4 TFTP server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.5 UDP/TCP server/client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4 Demonstration footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

AN3102 List of tables
Doc ID 16620 Rev 1 3/18
List of tables
Table 1. STM3210C-EVAL jumpers configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Table 2. STM32F107xx lwIP demonstration footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 3. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

List of figures AN3102
4/18 Doc ID 16620 Rev 1
List of figures
Figure 1. Demonstration package structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 2. How applications handle a packet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 3. UDP communication to establish the connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 4. Telnet demonstration example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 5. Web server browsing: here the static IP address is set . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 6. tftpd32 tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 7. lwIP structure in the raw API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
剩余17页未读,继续阅读

















安全验证
文档复制为VIP权益,开通VIP直接复制

评论4