Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of MAC Controller in STM32 Network

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about the use of MAC controllers in STM32 networks. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The MAC controller for STM32, that is, area 2 below.

01. Overview of MAC of STM32

The full name of STM32's MAC controller is MediaAccess Control.

Modes supported by STM32F207's MAC controller

Compliant with IEEE 802.3 MAC

10/100Mbps network

Full duplex and half duplex communication

MII interface and RMII interface with external PHY

Support preamble and frame start data (SFD) insertion or deletion

Header checksum checksum check supported by IPv4

Support for Wake up over Ethernet

Payload check

In fact, ST in the design of MAC controller, designed other functions, PTP (IEEE1588) precise time protocol, MMC network statistics function, these functions are not commonly used, I have no contact, so I will no longer explain.

For the above mentioned: preamble and frame start data (SFD) insertion or deletion is supported.

The preamble and frame start data (SFD) were not mentioned in the previous tweet "Ethernet data header". An Ethernet data structure is as follows:

Most network devices support preamble and frame start data (SFD) insertion or deletion. So it can be said that this is the data packaged by the network hardware device in front of the Ethernet frame. Personally, I don't think it belongs to the TCP/IP protocol suite.

02. MAC address filtering

STM32's MAC controller supports MAC address filtering.

Destination address filtering:

Unicast filtering

Multicast filtering

Broadcast filtering

Note: broadcast filtering will cause ARP broadcasts to be missed. For more information, please see "ARP Protocol in TCP/IP Protocol Cluster".

Source address filtering:

Unicast filtering

STM32's MAC controller also supports rule flipping, for example, only unicast filtering is allowed to receive, and after flipping, only unicast is not received.

In the actual STM32 project development, you only need to call the library file of ST.

ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Enable;// allows all broadcast frames to be received

For information about MAC addresses, what is broadcasting and how to represent MAC addresses, please see the previous tweet "Ethernet data header".

03. Payload check

In fact, the payload check is that the length of the IP protocol must be greater than 46 bytes, and fill in pad bytes when it is insufficient. For details, please see "5000 words" of this IP protocol.

When the number of bytes received from the application is less than 60 (DA+SA+LT+Data), zeros are appended to the sending frame so that the data length is exactly 46 bytes to meet the IEEE802.3 requirements of the minimum data field.

04. Checksum checksum

First of all, it is clear that the MAC controller of STM32 cannot automatically check all the Checksum in the TCP/IP protocol. STM32 implements the Checksum checksum of IPv4,ICMP,TCP and UDP protocols.

When sending, STM32 automatically calculates the Checksum checksum and automatically inserts it.

When received, STM32 automatically verifies that the Checksum checksum is correct.

The above functions can be enabled by:

Enable the receive checksum offload by setting the IPCO bit in the ETH_MACCR register.

Checksum calculation and insertion are enabled during transmission by setting the CIC bit in the TDES1 register.

However, in actual code development, there is no need to operate registers. The library interface that uses ST is as follows

ETH_InitStructure.ETH_ChecksumOffload = ETH_ChecksumOffload_Enable; / / enable frame checksum unloading for ipv4 and TCP/UDP/ICMP. Thank you for reading! This is the end of this article on "what is the use of MAC controllers in STM32 networks?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report