STM32F1 ETHERNET

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

Previous topic - Next topic

tha

Error handling

ถ้า the Rx FIFO เต็มก่อนมันรับ the EOF data จาก the MAC, an overflow ถูกประกาศและ the whole frame ถูกดร็อป, และ the overflow counter ใน the (ETH_DMAMFBOCR register) ถูกเพิ่ม. The status แสดงให้เห็น a partial frame เนื่องจาก overflow. The Rx FIFO สามารถกรอง error และ frames ที่มีขนาดเล็ก, ถ้าเปิดการใช้งาน (โดยใช้ the FEF and FUGF bits ใน ETH_DMAOMR)

ถ้า the Receive FIFO ถูกกำหนดค่าให้ทำงานใน Store-and-forward mode, all error frames สามารถถูกกรองและดร็อป.

ใน Cut-through mode, ถ้า a frame's status และ length มีให้ใช้เมื่อ frame's SOF นั้นถูกอ่านจาก the Rx FIFO, จากนั้น the complete erroneous frame สามารถถูกดร็อป. The DMA สามารถล้าง the error frame ที่ถูกอ่านจาก the FIFO, โดยการเปิดการใช้งาน the receive frame flash bit. The data ส่งถ่ายไปยัง the application (DMA) จะถูกหยุดและส่วนที่เหลือของ the frame ถูกอ่านภายในและถูกดร็อป. The next frame transfer จะสามารถถูกสตาร์ท, ถ้ามีให้ใช้ประโยชน์.

tha

Receive status word

ที่ the end of the Ethernet frame reception, the MAC ส่งออก the receive status ไปยัง the application (DMA). รายละเอียดคำอธิบายของ the receive status เป็นอย่างเดียวกับสำหรับ bits[31:0] ใน RDES0, ถูกให้ไว้ใน RDES0: Receive descriptor Word0.

tha

Frame length interface

ในกรณีของ switch applications, data transmission และ reception ระหว่าง the application และ MAC เกิดขึ้นอย่าง complete frame transfers. The application layer ควรทราบถึงความยาวของ the frames ที่ได้รับจาก the ingress port เพื่อส่งถ่าย the frame ไปยัง the egress port. The MAC core จัดให้มี the frame length ของแต่ละ received frame ภายใน the status ที่จุดสิ้นสุดของแต่ละ frame reception.

Note: A frame length value เป็น 0 ถูกให้สำหรับ partial frames ที่เขียนลงใน the Rx FIFO เนื่องจาก overflow


tha

MII/RMII receive bit order

แต่ละ nibble(4 บิต) ถูกส่งไปยัง the MII จาก the dibit (2 บิต) ที่รับจาก the RMII ใน the nibble transmission order แสดงใน Figure 343. The lower-order bits (D0 and D1) ถูกรับก่อน, ตามด้วย the higher-order bits (D2 and D3).




tha

29.5.4 MAC interrupts

Interrupts สามารถถูกสร้างขึ้นจาก the MAC core อันเป็นผลมาจาก various events.

The ETH_MACSR register อธิบาย the events ที่สามารถเป็นเหตุให้เกิด an interrupt จาก the MAC core. คุณสามารถป้องกันแต่ละ event จากการถือสิทธิ์ the interrupt โดยการเซ็ต the corresponding mask bits ใน the Interrupt Mask register.

The interrupt register bits แสดงให้เห็นเฉพาะ the block จากที่ the event ถูกรายงาน. คุณต้องอ่าน the corresponding status registers และ registers อื่นๆเพื่อเคลียร์ the interrupt. ตัวอย่างเช่น, bit 3 ของ the Interrupt register, set high, แสดงให้เห็นว่า the Magic packet หรือ Wake-on-LAN frame ถูกรับใน Power-down mode. คุณต้องอ่าน the ETH_MACPMTCSR Register เพื่อเคลียร์ interrupt event นี้.


tha

29.5.5 MAC filtering

Address filtering

Address filtering เช็ค the destination and source addresses บน all received frames และ the address filtering status ถูกรายงานสอดคล้องกัน. Address checking ขึ้นอยู่กับ different parameters (Frame filter register) ที่เลือกโดย the application. The filtered frame ยังสามารถถูกแยกแยะ : multicast หรือ broadcast frame.

Address filtering ใช้ the station's physical (MAC) address และ the Multicast Hash table สำหรับ address checking purposes.

tha

Unicast destination address filter

The MAC รองรับสูงถึง 4 MAC addresses สำหรับ unicast perfect filtering. ถ้า perfect filtering ถูกเลือก (HU bit ใน the Frame filter register ถูกรีเซ็ต), the MAC เปรียบเทียบ all 48 bits ของ the received unicast address กับ the programmed MAC address เพื่อความตรงกันใดๆ. Default MacAddr0 ถูกเปิดการใช้งานเสมอ, other addresses MacAddr1–MacAddr3 ถูกเลือกด้วย an individual enable bit. แต่ละ byte of these other addresses (MacAddr1–MacAddr3) สามารถถูกบังในระหว่าง comparison กับ the corresponding received DA byte โดยการเซ็ต the corresponding Mask Byte Control bit ใน the register. สิ่งนี้ช่วย group address filtering สำหรับ the DA. ใน Hash filtering mode (เมื่อ HU bit ถูกเซ็ต), the MAC ดำเนินการ imperfect filtering สำหรับ unicast addresses โดย a 64-bit Hash table. สำหรับ hash filtering, the MAC ใช้ the 6 upper CRC (ดู note 1 ข้างล่าง) bits ของ the received destination address เพื่อเป็นตัวชี้สิ่งที่อยู่ภายในของ the Hash table. ค่า 000000 เลือก bit 0 ใน the selected register, และค่า 111111 เลือก bit 63 ใน the Hash Table register. ถ้า the corresponding bit (ที่แสดงให้เห็นโดย the 6-bit CRC) ถูกเซ็ตเป็น 1, the unicast frame กล่าวได้ว่าผ่าน the Hash filter; มิฉะนั้น, the frame ล้มเหลว the Hash filter.

Note: CRC นี้คือ a 32-bit value เข้ารหัสโดยพหุนามต่อไปนี้ (สำหรับรายละเอียดเพิ่มเติมโปรดดูที่ Section 29.5.3):

             

tha

Multicast destination address filter

The MAC สามารถถูกโปรแกรมเพื่อผ่าน all multicast frames โดยการเซ็ต the PAM bit ใน the Frame filter register. ถ้า the PAM bit ถูกรีเซ็ต, the MAC ดำเนินการ the filtering สำหรับ multicast addresses ขึ้นอยู่กับ the HM bit ใน the Frame filter register. ใน Perfect filtering mode, the multicast address ถูกเปรียบเทียบกับ the programmed MAC destination address registers (1–3). Group address filtering ยังถูกรองรับอีกด้วย. ใน Hash filtering mode, the MAC ดำเนินการ imperfect filtering โดยใช้ a 64-bit Hash table. สำหรับ hash filtering, the MAC ใช้ the 6 upper CRC (ดู note 1 ข้างล่าง) bits ของ the received multicast address เพื่อเป็นตัวชี้สิ่งที่อยู่ภายในของ the Hash table. ค่า 000000 เลือก bit 0 ใน the selected register, และค่า 111111 เลือก bit 63 ใน the Hash Table register. ถ้า the corresponding bit ถูกเซ็ตเป็น 1, จากนั้น the multicast frame กล่าวได้ว่าผ่าน the Hash filter; มิฉะนั้น, the frame ล้มเหลว the Hash filter.

Note: CRC นี้คือ a 32-bit value เข้ารหัสโดยพหุนามต่อไปนี้ (สำหรับรายละเอียดเพิ่มเติมโปรดดูที่ Section 29.5.3):