STM32F1 ETHERNET

Started by tha, February 11, 2021, 08:40:30 AM

Previous topic - Next topic

tha

29.4.3 Reduced media-independent interface: RMII

The reduced media-independent interface (RMII) specification ลด the pin count ระหว่าง the microcontroller Ethernet peripheral และ the external Ethernet ใน 10/100 Mbit/s. สอดคล้องกับ the IEEE 802.3u standard, an MII ประกอบด้วย 16 pins สำหรับ data and control. The RMII specification ถูกทุ่มเทเพื่อลด the pin count มาเป็น 7 pins (a 62.5% ลดลงใน pin count).

The RMII ถูก instantiated ระหว่าง the MAC and the PHY. นี้ช่วยการแปลของ the MAC's MII ลงใน the RMII. The RMII block มีคุณสมบัติดังต่อไปนี้:
•    มันรองรับ 10-Mbit/s และ 100-Mbit/s operating rates
•    The clock reference ต้องถูกสองเท่าเป็น 50 MHz
•    The same clock reference ต้องถูกจ่ายจากภายนอกไปยังทั้ง MAC และ external Ethernet PHY
•    มันจัดให้มี independent 2-bit wide (dibit) transmit and receive data เส้นทาง


tha

RMII clock sources

ตามที่อธิบายใน the RMII clock sources section, the STM32F10xxxSTM32F107xx ควรจัดให้มี 50 MHz clock signal นี้บน MCO output pin ของมันและคุณจากนั้นต้องกำหนดค่า output value นี้ผ่านทาง PLL configuration.


tha

29.4.4 MII/RMII selection

The mode, MII or RMII, ถูกเลือกโดยใช้ the configuration bit 23, MII_RMII_SEL, in the AFIO_MAPR register. The application ต้องเซ็ต the MII/RMII mode ในขณะที่ the Ethernet controller อยู่ภายใต้ reset หรือก่อนการเปิดการใช้งาน the clocks.

MII/RMII internal clock scheme

The clock scheme ที่ต้องการเพื่อรองรับทั้ง the MII and RMII, เช่นเดียวกันกับ 10 and 100 Mbit/s operations ถูกอธิบายใน Figure 335.



เพื่อประหยัด a pin, the two input clock signals, RMII_REF_CK and MII_RX_CLK, ถูก multiplexed บน the same GPIO pin.


tha

29.5 Ethernet functional description: MAC 802.3

The IEEE 802.3 International Standard สำหรับ local area networks (LANs) ใช้ the CSMA/CD (carrier sense multiple access with collision detection) เป็น the access method

The Ethernet peripheral ประกอบด้วย a MAC 802.3 (media access control) controller พร้อมด้วย media independent interface (MII) และ a dedicated DMA controller.

The MAC block จัดให้มีใช้ the LAN CSMA/CD sublayer สำหรับตระกูลต่อไปนี้ของระบบ: 10 Mbit/s and 100 Mbit/s of data rates สำหรับ baseband and broadband systems. Half and full-duplex operation modes ถูกรองรับ. The collision detection access method มีให้ใช้เฉพาะกับ the half-duplex operation mode. The MAC control frame sublayer ถูกรองรับ.

The MAC sublayer ดำเนินการหน้าที่ต่อไปนี้ที่เกี่ยวข้องกับ a data link control procedure:
•    Data encapsulation(ห่อหุ้ม) (transmit and receive)
      –    Framing (frame boundary delimitation, frame synchronization)
      –    Addressing (การรรับมือของต้นทางและปลายทาง addresses)
      –    Error detection
•    Media access management
      –    Medium allocation (collision avoidance)
      –    Contention resolution (collision handling)

โดยทั่วไปมี two operating modes of the MAC sublayer:
•    Half-duplex mode: the stations ต่อสู้เพื่อใช้ the physical medium, โดยใช้ the CSMA/CD algorithms.
•    Full duplex mode: การส่งและการรับพร้อมกันโดยไม่มี contention resolution (CSMA/CD algorithm ไม่มีความจำเป็น) เมื่อ
      เงื่อนไขต่อไปนี้ทั้งหมดถูกตรงตาม
      –    physical medium capability เพื่อรองรับ simultaneous transmission and reception
      –    มี 2 stations จริงๆที่ต่อถึง the LAN
      –    ทั้งสอง stations ถูกกำหนดค่าสำหรับ full-duplex operation

tha

29.5.1 MAC 802.3 frame format

The MAC block จัดให้มีใช้ the MAC sublayer และ the optional MAC control sublayer (10/100 Mbit/s) ตามที่ระบุโดย the IEEE 802.3-2002 standard.

Two frame formats ถูกระบุเพื่อ data communication systems โดยใช้ the CSMA/CD MAC:
•    Basic MAC frame format
•    Tagged MAC frame format (ส่วนขยายของ the basic MAC frame format)

Figure 337 and Figure 338 อธิบาย the frame structure (untagged and tagged) ที่ประกอบด้วยฟิลด์ต่อไปนี้:
•    Preamble: 7-byte field ถูกใช้สำหรับวัตถุประสงค์การซิงโครไนส์ (PLS circuitry) Hexadecimal value: 55-55-55-55-55-
      55-55
      Bit pattern: 01010101 01010101 01010101 01010101 01010101 01010101 01010101 (right-to-left bit
      transmission)
•    Start frame delimiter (SFD): 1-byte field ถูกใช้เพื่อแสดงให้เห็น the start of a frame.
      Hexadecimal value: D5
      Bit pattern: 11010101 (right-to-left bit transmission)
•    Destination and Source Address fields: 6-byte fields เพื่อแสดงให้เห็นปลายทางและต้นทาง station addresses ดังต่อไปนี้
      (ดู Figure 336):
      –    แต่ละ address คือ 48 bits ในความยาว
      –    The first LSB bit (I/G) ใน the destination address field ถูกใช้เพื่อแสดงให้เห็น an individual(เฉพาะราย) (I/G = 0)
            หรือ a group address (I/G = 1). A group address สามารถระบุ ไม่มี, หนึ่งหรือมากกว่า, หรือทุก the stations ที่เชื่อมต่อ
            ถึง the LAN. ใน the source address the first bit ถูกสงวนไว้และรีเซ็ตเป็น 0.
      –    The second bit (U/L) แยกความแตกต่างระหว่าง locally (U/L = 1) หรือ globally (U/L = 0) ที่บริหาร addresses.
            สำหรับ broadcast addresses บิตนี้เป็น 1 ด้วย.
      –    แต่ละ byte ของแต่ละ address field ต้องถูกส่ง least significant bit เป็นอันดับแรก

The address designation อยู่บนฐานของประเภทต่อไปนี้:
•    Individual address: นี้คือ the physical address ที่เกี่ยวข้องกับสถานีใดสถานีหนึ่งบนโดยเฉพาะบน the network.
•    Group address. A multidestination address ที่เกี่ยวข้องกับหนึ่งหรือมากกว่าหนึ่ง stations บน a given network. มีสองชนิด
      ของ multicast address:
      –    Multicast-group address: an address ที่เกี่ยวข้องกับกลุ่มของ logically related stations.
      –    Broadcast address: ความเด่น, predefined multicast address ( 1's ทั้งหมดใน the destination address field) ที่ใช้
            แสดงทุก the stations เสมอบน a given LAN.


tha

•    QTag Prefix: 4-byte field ที่แทรกระหว่าง the Source address field และ the MAC Client Length/Type field. field นี้เป็น
      ส่วนขยายของ the basic frame (untagged) เพื่อให้ได้มา the tagged MAC frame. The untagged MAC frames จะไม่รวม
      field นี้. ส่วนขยายสำหรับการติดแท็กมีดังต่อไปนี้:
      –    2-byte constant Length/Type field value ที่สอดคล้องกับ the Type interpretation (มากกว่า 0x0600) เท่ากับค่าของ
            the 802.1Q Tag Protocol Type (0x8100 hexadecimal). ฟิลด์คงที่นี้ถูกใช้เพื่อแยกความแตกต่าง tagged and
            untagged MAC frames.
      –    2-byte field บรรจุ the Tag control information field แบ่งย่อยดังต่อไปนี้ : a 3-bit user priority, a canonical
            format indicator (CFI) bit และ a 12-bit VLAN Identifier. ความยาวของ the tagged MAC frame ถูกยืดขยายเป็น 4
            bytes โดย the QTag Prefix

tha

•    MAC client length/type: 2-byte field ที่มีวามหมายแตกต่างกัน (เฉพาะตัวอย่างสัมพันธ์กัน), ขึ้นอยู่กับค่าของมัน:
      –    ถ้าค่านี้น้อยกว่าหรือเท่ากับ maxValidFrame (0d1500) ดังนั้น field นี้แสดงให้เห็นจำนวนของ MAC client data bytes ที่
            บรรจุใน the subsequent data field ของ the 802.3 frame (length interpretation).
      –    ถ้าค่านี้มากกว่าหรือเท่ากับ MinTypeValue (0d1536 decimal, 0x0600) ดังนั้น field นี้แสดงให้เห็นลักษณะของ the MAC
            client protocol (Type interpretation) ที่เกี่ยวข้องกับ the Ethernet frame

โดยไม่คำนึงถึงการตีความของ the length/type field, ถ้าความยาวของ the data field น้อยกว่าค่าต่ำสุดที่จำเป็นสำหรับการทำงานอย่างเหมาะสมของ the protocol, a PAD field ถูกเพิ่มเข้ามาหลังจาก the data field แต่ก่อนถึง the FCS (frame check sequence) field. The length/type field ถูกส่งและรับด้วย the higher-order byte ก่อน.

สำหรับ length/type field values ในย่านระหว่าง maxValidLength และ minTypeValue (ไม่รวมขอบเขต), พฤติการณ์ของ the MAC sublayer ไม่ถูกระบุ: มันอาจหรืออาจไม่ถูกผ่านโดย the MAC sublayer.

tha

•    Data and PAD fields: n-byte data field. Full data transparency ถูกจัดให้มี, มันหมายความว่า arbitrary sequence ใดๆของ
      byte values อาจปรากฎใน the data field. ขนาดของ the PAD, ถ้ามี, ถูกกำหนดโดยขนาดของ the data field. Max and min
      length ของ the data and PAD field คือ:
      –    Maximum length = 1500 bytes
      –    Minimum length for untagged MAC frames = 46 bytes
      –    Minimum length for tagged MAC frames = 42 bytes

เมื่อ the data field length น้อยกว่าค่าต่ำสุดที่จำเป็น, the PAD field ถูกเพิ่มเข้ามาเพื่อให้เท่ากับ the minimum length (42 bytes for tagged frames, 46 bytes for untagged frames).