UM1713 User manual Developing applications on STM32Cube with LwIP TCP/IP stack

  • 55 Replies
  • 1197 Views
*

Offline tha

  • *****
  • 4992
    • View Profile
UM1713

User manual

Developing applications on STM32Cube with LwIP TCP/IP stack

Introduction

STMCube™ เป็นความคิดริเริ่มของ STMicroelectronics ที่ช่วยให้ชีวิตนักพัฒนาง่ายขึ้นโดยลดความพยายาม เวลา และต้นทุนในการพัฒนา. STM32Cube ครอบคลุมผลงานของ STM32.

STM32Cube Version 1.x ประกอบด้วย:
•   The STM32CubeMX, a graphical software configuration tool ที่ช่วยให้สร้าง C initialization code โดยใช้ graphical
     wizards.
•   A comprehensive embedded software platform, ที่ส่งมอบต่อซีรีส์ (อย่างเช่น STM32CubeF4 สำหรับ STM32F4 series)
     –   The STM32Cube HAL, an STM32 abstraction layer embedded software, เพื่อให้มั่นใจว่าสามารถถือได้สูงสุดพาดผ่าน
          STM32 portfolio
     –   ชุดที่ตรงกันของ middleware components อย่างเช่น RTOS, USB, TCP/IP, Graphics
     –   ทุก embedded software utilities มาพร้อมกับชุดเต็มของตัวอย่าง.

*

Offline tha

  • *****
  • 4992
    • View Profile
บาง STM32 microcontrollers มีคุณลักษณะ a high-quality 10/100 Mbit/s Ethernet peripheral ที่รองรับทั้ง Media Independent Interface (MII) และ Reduced Media Independent Interface (RMII) เพื่ออินเตอร์เฟสกับ the Physical Layer (PHY).

เมื่อทำงานกับ an Ethernet communication interface, ส่วนใหญ่ a TCP/IP stack จะถูกใช้สื่อสารผ่าน a local หรือ a wide area network.

คู่มือผู้ใช้นี้มีไว้สำหรับนักพัฒนาที่ใช้ STM32Cube firmware บน STM32 microcontrollers. มันจัดให้มีคำอธิบายแบบเต็มเกี่ยวกับวิธีการรวม a free middleware TCP/IP stack โดยใช้ STM32Cube HAL drivers ลงใน an embedded application บนฐานของ STM32 microcontroller

The middleware TCP/IP stack คือ the LwIP (Lightweight IP) ซึ่งเป็น an open source stack ที่มุ่งหมายสำหรับ embedded devices.

A dedicated STM32Cube firmware package ถูกจัดให้มีสำหรับแต่ละ series. มันประกอบด้วย Ethernet HAL driver, LwIP middleware และ application examples ที่มีและที่ไม่มี RTOS รันบน ST evaluation boards.

Note: เอกสารนี้ใช้ได้กับซีรีส์ STM32 ทั้งหมดที่มี an Ethernet peripheral. อย่างไรก็ตาม, หรือเหตุผลง่ายๆ, STM32F4xx and
          STM32CubeF4 ถูกใช้เป็นแพลตฟอร์มอ้างอิง. คำอธิบาย ชื่อไฟล์ และภาพหน้าจอเดียวกันนี้ใช้ได้กับซีรีส์อื่นๆ ที่มี Ethernet
          connectivity, อย่างเช่น STM32F107xx, STM32F2x7xx and STM32F7xx. หากต้องการทราบข้อมูลเพิ่มเติมเกี่ยวกับ the
          Ethernet examples implementation บน STM32 series ของคุณ, โปรดดูเอกสารที่จัดให้ไว้ภายใน the associated
          STM32Cube firmware package.

*

Offline tha

  • *****
  • 4992
    • View Profile

*

Offline tha

  • *****
  • 4992
    • View Profile
1 LwIP TCP/IP stack description

1.1 Stack features

LwIP เป็น a free TCP/IP stack ที่พัฒนาโดย Adam Dunkels ที่ the Swedish Institute of Computer Science (SICS) และได้รับอนุญาตภายใต้ใบอนุญาต BSD ที่แก้ไขแล้ว.

จุดเน้นของการจัดให้มีใช้ LwIP TCP/IP คือเพื่อลดการใช้ RAM ในขณะที่คงไว้ a full scale TCP/IP stack. สิ่งนี้ทำให้ LwIP เหมาะสำหรับใช้ในระบบฝังตัว.

LwIP มาพร้อมกับโปรโตคอลต่อไปนี้:
•   IPv4 and IPv6 (Internet Protocol v4 and v6)
•   ICMP (Internet Control Message Protocol) for network maintenance and debugging
•   IGMP (Internet Group Management Protocol) for multicast traffic management
•   UDP (User Datagram Protocol)
•   TCP (Transmission Control Protocol)
•   DNS (Domain Name Server)
•   SNMP (Simple Network Management Protocol)
•   DHCP (Dynamic Host Configuration Protocol)
•   PPP (Point to Point Protocol)
•   ARP (Address Resolution Protocol)

*

Offline tha

  • *****
  • 4992
    • View Profile
LwIP มีสาม application programming interfaces (APIs):
•   Raw API คือ the native LwIP API. มันช่วยให้สามารถพัฒนาแอปพลิเคชันโดยใช้ event callbacks. API นี้จัดให้มี the best
     performance และปรับให้ code size ดีขึ้น, แต่จะเพิ่มความซับซ้อนบางประการให้กับ application development.
•   Netconn API คือ a high-level sequential API ที่ต้องการ a real-time operating system (RTOS). The Netconn API เปิดใช้
     งาน multithreaded operations.
•   BSD Socket API: Berkeley-like Socket API (พัฒนาต่อยอดจาก the Netconn API)

The source code สำหรับ the LwIP stack สามารถดาวน์โหลดได้จาก http://savannah.nongnu.org.

*

Offline tha

  • *****
  • 4992
    • View Profile
1.2 License

LwIP ได้รับใบอนุญาตภายใต้ the BSD license. ด้านล่างนี้คือสำเนาของ the LwIP license document ที่ถูกรวมอยู่ใน the source codes:



*

Offline tha

  • *****
  • 4992
    • View Profile
1.3 LwIP architecture

LwIP เป็นไปตาม the TCP/IP model architecture ซึ่งระบุวิธีการที่ data ถูกจัดรูปแบบ, ส่ง, กำหนดเส้นทาง และรับเพื่อจัดให้มี end-to-end communications.

โมเดลนี้มีสี่ abstraction layers ซึ่งถูกใช้เพื่อจัดเรียงโปรโตคอลที่เกี่ยวข้องทั้งหมดตามขอบเขตของเครือข่ายที่เกี่ยวข้อง (ดูรูปที่ 1) จากต่ำสุดไปสูงสุด, the layers คือ:
•   The link layer บรรจุ communication technologies สำหรับ a single network segment (เชื่อมโยง) ของ a local area
     network.
•   The internet layer (IP) เชื่อมต่อ independent networks, จึงสร้าง internetworking.
•   The transport layer จัดการ host-to-host communications.
•   The application layer บรรจุทุก protocols สำหรับ specific data communications services ในระดับ a process-to-
     process level.


*

Offline tha

  • *****
  • 4992
    • View Profile
1.4 LwIP stack folder organization of the

เมื่อ unzipped, the LwIP stack files สามารถถูกพบภายใต้ \Middlewares\Third_Party\LwIP.