enet_qos_txrx_ptp1588_transfer#
Overview#
The example shows the way to use ENET driver to receive and transmit frame in the 1588 feature required cases.
This example shows how to initialize the ENET.
How to get the time stamp of the PTP 1588 timer.
How to use Get the ENET transmit and receive frame time stamp.
The example transmits 20 number PTP event frame, shows the timestamp of the transmitted frame. The length, source MAC address and destination MAC address of the received frame will be print. The time stamp of the received timestamp will be print when the PTP message frame is received(the outside loopback cable can be used to see the right rx time-stamping log since we send the ptp message).
Supported Boards#
MIMXRT1170-EVKB
Hardware requirements
Mini/micro USB cable
Loopback network cable RJ45 standard
MIMXRT1170-EVKB board
Personal Computer
Board settings
If Rx frame CRC error occurs, try to populate a suitable C66. The REV C/C1 boards populate 22pF which is high and may result in CRC errors on some of boards, if this is the case C66 may be removed or replaced by a smaller capacitor.
Prepare the Demo
Connect a USB cable between the host PC and the OpenSDA USB port on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Insert loopback network cable to Ethernet RJ45 port(J4).
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Make loopback cable: 568B standard Unknowed standard J1 orange+white green+white J2 orange green J3 green+white orange+white J4 blue brown+white J5 blue+white brown J6 green orange J7 brown+white blue J8 brown blue+white
Connect J1 => J3, J2 => J6, J4 => J7, J5 => J8. 10/100M transfer only requires J1, J2, J3, J6, and 1G transfer requires all 8 pins. Check your net cable color order and refer to 568B standard or the other standard. If your cable’s color order is not showed in the list, please connect J1~J8 based on your situation.
Running the demo
When the demo runs, the log would be seen on the terminal like:
ENET example start. Get the 1-th time 0 second, 1864 nanosecond Get the 2-th time 0 second, 7275192 nanosecond Get the 3-th time 0 second, 14804820 nanosecond Get the 4-th time 0 second, 22420658 nanosecond Get the 5-th time 0 second, 30036030 nanosecond Get the 6-th time 0 second, 37651402 nanosecond Get the 7-th time 0 second, 45267240 nanosecond Get the 8-th time 0 second, 52882612 nanosecond Get the 9-th time 0 second, 60498450 nanosecond Get the 10-th time 0 second, 68113822 nanosecond
Transmission start now! The 1 frame transmitted success! the timestamp is 0 second, 167770756 nanosecond One frame received. the length 1014 the timestamp is 0 second, 167973396 nanosecond The 2 frame transmitted success! the timestamp is 0 second, 200548167 nanosecond One frame received. the length 1014 the timestamp is 0 second, 200750756 nanosecond The 3 frame transmitted success! the timestamp is 0 second, 233324728 nanosecond One frame received. the length 1014 the timestamp is 0 second, 233527436 nanosecond The 4 frame transmitted success! the timestamp is 0 second, 266102139 nanosecond One frame received. the length 1014 the timestamp is 0 second, 266305136 nanosecond The 5 frame transmitted success! the timestamp is 0 second, 298878785 nanosecond
…… The 20 frame transmitted success! the timestamp is 0 second, 792377480 nanosecond One frame received. the length 1014 the timestamp is 0 second, 792580698 nanosecond
FRDM-IMXRT1152
Hardware requirements
Type-C USB cable
Loopback network cable RJ45 standard
FRDM-IMXRT1152 board
Personal Computer
Board settings
Use the 10/100 Ethernet RJ45 port (J112).
Set J134 to position 1-2 for the shared
ENET_MDIOrouting.Set J136 to position 1-2 for the
ENET_QOS_REF_CLK1routing.
Prepare the Demo
Connect a USB cable between the host PC and the OpenSDA USB port on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Insert loopback network cable to the 10/100 Ethernet RJ45 port (J112).
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Make loopback cable: 568B standard Unknowed standard J1 orange+white green+white J2 orange green J3 green+white orange+white J4 blue brown+white J5 blue+white brown J6 green orange J7 brown+white blue J8 brown blue+white
Connect J1 => J3, J2 => J6. 10/100M transfer only requires J1, J2, J3, and J6. Check your net cable color order and refer to 568B standard or the other standard. If your cable’s color order is not showed in the list, please connect J1~J8 based on your situation.
Running the demo
When the demo runs, the log would be seen on the terminal like:
ENET example start. Get the 1-th time 0 second, 1864 nanosecond Get the 2-th time 0 second, 7275192 nanosecond Get the 3-th time 0 second, 14804820 nanosecond Get the 4-th time 0 second, 22420658 nanosecond Get the 5-th time 0 second, 30036030 nanosecond Get the 6-th time 0 second, 37651402 nanosecond Get the 7-th time 0 second, 45267240 nanosecond Get the 8-th time 0 second, 52882612 nanosecond Get the 9-th time 0 second, 60498450 nanosecond Get the 10-th time 0 second, 68113822 nanosecond
Transmission start now! The 1 frame transmitted success! the timestamp is 0 second, 167770756 nanosecond One frame received. the length 1014 the timestamp is 0 second, 167973396 nanosecond The 2 frame transmitted success! the timestamp is 0 second, 200548167 nanosecond One frame received. the length 1014 the timestamp is 0 second, 200750756 nanosecond The 3 frame transmitted success! the timestamp is 0 second, 233324728 nanosecond One frame received. the length 1014 the timestamp is 0 second, 233527436 nanosecond The 4 frame transmitted success! the timestamp is 0 second, 266102139 nanosecond One frame received. the length 1014 the timestamp is 0 second, 266305136 nanosecond The 5 frame transmitted success! the timestamp is 0 second, 298878785 nanosecond
…… The 20 frame transmitted success! the timestamp is 0 second, 792377480 nanosecond One frame received. the length 1014 the timestamp is 0 second, 792580698 nanosecond
EVK-MIMX8MP
Hardware requirements
Micro USB cable
EVK-MIMX8M Plus board
J-Link Debug Probe
12V power supply
Personal Computer
Board settings
Example uses phy looback. No need to connect any network cable on port.
Please note this application can’t support running with Linux BSP! This example aims to show the basic usage of the IP’s function, some of the used Pads/Resources are also used by Cortex-A core.
Prepare the Demo
Connect 12V power supply and J-Link Debug Probe to the board.
Connect a micro USB cable between the host PC and the J19 USB Debug Port on the CPU board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Launch the debugger in your IDE to begin running the example.
Running the demo
When the demo runs, the log would be seen on the terminal like:
ENET example start. Get the 1-th time 0 second, 1864 nanosecond Get the 2-th time 0 second, 7275192 nanosecond Get the 3-th time 0 second, 14804820 nanosecond Get the 4-th time 0 second, 22420658 nanosecond Get the 5-th time 0 second, 30036030 nanosecond Get the 6-th time 0 second, 37651402 nanosecond Get the 7-th time 0 second, 45267240 nanosecond Get the 8-th time 0 second, 52882612 nanosecond Get the 9-th time 0 second, 60498450 nanosecond Get the 10-th time 0 second, 68113822 nanosecond
Transmission start now! The 1 frame transmitted success! the timestamp is 0 second, 167770756 nanosecond One frame received. the length 1014 the timestamp is 0 second, 167973396 nanosecond The 2 frame transmitted success! the timestamp is 0 second, 200548167 nanosecond One frame received. the length 1014 the timestamp is 0 second, 200750756 nanosecond The 3 frame transmitted success! the timestamp is 0 second, 233324728 nanosecond One frame received. the length 1014 the timestamp is 0 second, 233527436 nanosecond The 4 frame transmitted success! the timestamp is 0 second, 266102139 nanosecond One frame received. the length 1014 the timestamp is 0 second, 266305136 nanosecond The 5 frame transmitted success! the timestamp is 0 second, 298878785 nanosecond
…… The 20 frame transmitted success! the timestamp is 0 second, 792377480 nanosecond One frame received. the length 1014 the timestamp is 0 second, 792580698 nanosecond
MCIMX93-EVK
Hardware requirements
USB Type-C cable
Loopback network cable RJ45 standard
MCIMX93-EVK board
Personal Computer
Board settings
No special settings are required.
Note
Please run the application in Low Power boot mode (without Linux BSP). The IP module resource of the application is also used by Linux BSP. Or, run with Single Boot mode by changing Linux BSP to avoid resource conflict.
Prepare the Demo
Connect a USB cable between the host PC and the OpenSDA USB port on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Insert loopback network cable to Ethernet RJ45 port(J501).
Download the program to the target board.
Either re-power up your board or launch the debugger in your IDE to begin running the demo.
Make loopback cable: 568B standard Unknowed standard J1 orange+white green+white J2 orange green J3 green+white orange+white J4 blue brown+white J5 blue+white brown J6 green orange J7 brown+white blue J8 brown blue+white
Connect J1 => J3, J2 => J6, J4 => J7, J5 => J8. 10/100M transfer only requires J1, J2, J3, J6, and 1G transfer requires all 8 pins. Check your net cable color order and refer to 568B standard or the other standard. If your cable’s color order is not showed in the list, please connect J1~J8 based on your situation.
Running the demo
When the demo runs, the log would be seen on the terminal like:
ENET example start. Get the 1-th time 0 second, 1864 nanosecond Get the 2-th time 0 second, 7275192 nanosecond Get the 3-th time 0 second, 14804820 nanosecond Get the 4-th time 0 second, 22420658 nanosecond Get the 5-th time 0 second, 30036030 nanosecond Get the 6-th time 0 second, 37651402 nanosecond Get the 7-th time 0 second, 45267240 nanosecond Get the 8-th time 0 second, 52882612 nanosecond Get the 9-th time 0 second, 60498450 nanosecond Get the 10-th time 0 second, 68113822 nanosecond
Transmission start now! The 1 frame transmitted success! the timestamp is 0 second, 167770756 nanosecond One frame received. the length 1014 the timestamp is 0 second, 167973396 nanosecond The 2 frame transmitted success! the timestamp is 0 second, 200548167 nanosecond One frame received. the length 1014 the timestamp is 0 second, 200750756 nanosecond The 3 frame transmitted success! the timestamp is 0 second, 233324728 nanosecond One frame received. the length 1014 the timestamp is 0 second, 233527436 nanosecond The 4 frame transmitted success! the timestamp is 0 second, 266102139 nanosecond One frame received. the length 1014 the timestamp is 0 second, 266305136 nanosecond The 5 frame transmitted success! the timestamp is 0 second, 298878785 nanosecond
…… The 20 frame transmitted success! the timestamp is 0 second, 792377480 nanosecond One frame received. the length 1014 the timestamp is 0 second, 792580698 nanosecond
MCIMX93W-EVK
Hardware requirements
USB Type-C cable
Loopback network cable RJ45 standard
MCIMX93W-EVK board
Personal Computer
Board settings
No special settings are required.
Note
Please run the application in Low Power boot mode (without Linux BSP). The IP module resource of the application is also used by Linux BSP. Or, run with Single Boot mode by changing Linux BSP to avoid resource conflict.
Prepare the Demo
Connect a USB cable between the host PC and the OpenSDA USB port on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Insert loopback network cable to Ethernet RJ45 port(J501).
Download the program to the target board.
Either re-power up your board or launch the debugger in your IDE to begin running the demo.
Make loopback cable: 568B standard Unknowed standard J1 orange+white green+white J2 orange green J3 green+white orange+white J4 blue brown+white J5 blue+white brown J6 green orange J7 brown+white blue J8 brown blue+white
Connect J1 => J3, J2 => J6, J4 => J7, J5 => J8. 10/100M transfer only requires J1, J2, J3, J6, and 1G transfer requires all 8 pins. Check your net cable color order and refer to 568B standard or the other standard. If your cable’s color order is not showed in the list, please connect J1~J8 based on your situation.
Running the demo
When the demo runs, the log would be seen on the terminal like:
ENET example start. Get the 1-th time 0 second, 1864 nanosecond Get the 2-th time 0 second, 7275192 nanosecond Get the 3-th time 0 second, 14804820 nanosecond Get the 4-th time 0 second, 22420658 nanosecond Get the 5-th time 0 second, 30036030 nanosecond Get the 6-th time 0 second, 37651402 nanosecond Get the 7-th time 0 second, 45267240 nanosecond Get the 8-th time 0 second, 52882612 nanosecond Get the 9-th time 0 second, 60498450 nanosecond Get the 10-th time 0 second, 68113822 nanosecond
Transmission start now! The 1 frame transmitted success! the timestamp is 0 second, 167770756 nanosecond One frame received. the length 1014 the timestamp is 0 second, 167973396 nanosecond The 2 frame transmitted success! the timestamp is 0 second, 200548167 nanosecond One frame received. the length 1014 the timestamp is 0 second, 200750756 nanosecond The 3 frame transmitted success! the timestamp is 0 second, 233324728 nanosecond One frame received. the length 1014 the timestamp is 0 second, 233527436 nanosecond The 4 frame transmitted success! the timestamp is 0 second, 266102139 nanosecond One frame received. the length 1014 the timestamp is 0 second, 266305136 nanosecond The 5 frame transmitted success! the timestamp is 0 second, 298878785 nanosecond
…… The 20 frame transmitted success! the timestamp is 0 second, 792377480 nanosecond One frame received. the length 1014 the timestamp is 0 second, 792580698 nanosecond
MCIMX93-QSB
Hardware requirements
USB Type-C cable
Loopback network cable RJ45 standard
MCIMX93-QSB board
Personal Computer
Board settings
No special settings are required.
Note
Please run the application in Low Power boot mode (without Linux BSP). The IP module resource of the application is also used by Linux BSP. Or, run with Single Boot mode by changing Linux BSP to avoid resource conflict.
Prepare the Demo
Connect a USB cable between the host PC and the OpenSDA USB port on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Insert loopback network cable to Ethernet RJ45 port(J501).
Download the program to the target board.
Either re-power up your board or launch the debugger in your IDE to begin running the demo.
Make loopback cable: 568B standard Unknowed standard J1 orange+white green+white J2 orange green J3 green+white orange+white J4 blue brown+white J5 blue+white brown J6 green orange J7 brown+white blue J8 brown blue+white
Connect J1 => J3, J2 => J6, J4 => J7, J5 => J8. 10/100M transfer only requires J1, J2, J3, J6, and 1G transfer requires all 8 pins. Check your net cable color order and refer to 568B standard or the other standard. If your cable’s color order is not showed in the list, please connect J1~J8 based on your situation.
Running the demo
When the demo runs, the log would be seen on the terminal like:
ENET example start. Get the 1-th time 0 second, 1864 nanosecond Get the 2-th time 0 second, 7275192 nanosecond Get the 3-th time 0 second, 14804820 nanosecond Get the 4-th time 0 second, 22420658 nanosecond Get the 5-th time 0 second, 30036030 nanosecond Get the 6-th time 0 second, 37651402 nanosecond Get the 7-th time 0 second, 45267240 nanosecond Get the 8-th time 0 second, 52882612 nanosecond Get the 9-th time 0 second, 60498450 nanosecond Get the 10-th time 0 second, 68113822 nanosecond
Transmission start now! The 1 frame transmitted success! the timestamp is 0 second, 167770756 nanosecond One frame received. the length 1014 the timestamp is 0 second, 167973396 nanosecond The 2 frame transmitted success! the timestamp is 0 second, 200548167 nanosecond One frame received. the length 1014 the timestamp is 0 second, 200750756 nanosecond The 3 frame transmitted success! the timestamp is 0 second, 233324728 nanosecond One frame received. the length 1014 the timestamp is 0 second, 233527436 nanosecond The 4 frame transmitted success! the timestamp is 0 second, 266102139 nanosecond One frame received. the length 1014 the timestamp is 0 second, 266305136 nanosecond The 5 frame transmitted success! the timestamp is 0 second, 298878785 nanosecond
…… The 20 frame transmitted success! the timestamp is 0 second, 792377480 nanosecond One frame received. the length 1014 the timestamp is 0 second, 792580698 nanosecond
FRDM-MCXE31B
Hardware requirements
Type-C USB cable
Loopback network cable RJ45 standard
FRDM-MCXE31B board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a USB cable between the host PC and the OpenSDA USB port on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Insert loopback network cable to Ethernet RJ45 port (J16).
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Make loopback cable:
568B standard Unknowed standard
J1 orange+white green+white
J2 orange green
J3 green+white orange+white
J4 blue brown+white
J5 blue+white brown
J6 green orange
J7 brown+white blue
J8 brown blue+white
Connect J1 => J3, J2 => J6, J4 => J7, J5 => J8. 10/100M transfer only requires J1, J2, J3, J6, and 1G transfer requires all 8 pins. Check your net cable color order and refer to 568B standard or the other standard. If your cable’s color order is not showed in the list, please connect J1~J8 based on your situation.
Running the demo
When the demo runs, the log would be seen on the terminal like:
ENET example start.
Wait for PHY init...
Wait for PHY link up...
Get the 1-th time 0 second, 20040 nanosecond
Get the 2-th time 0 second, 204715800 nanosecond
Get the 3-th time 0 second, 409797960 nanosecond
Get the 4-th time 0 second, 614871720 nanosecond
Get the 5-th time 0 second, 819945360 nanosecond
Get the 6-th time 1 second, 25019120 nanosecond
Get the 7-th time 1 second, 229997240 nanosecond
Get the 8-th time 1 second, 435071120 nanosecond
Get the 9-th time 1 second, 640144760 nanosecond
Get the 10-th time 1 second, 845218640 nanosecond
Transmission start now!
PHY link changed, link status = 1
The 1 frame transmitted success!
the timestamp is 2 second, 56362360 nanosecond
One frame received. the length 1014
the timestamp is 2 second, 56363600 nanosecond
The 2 frame transmitted success!
the timestamp is 2 second, 73146400 nanosecond
One frame received. the length 1014
the timestamp is 2 second, 73147640 nanosecond
The 3 frame transmitted success!
the timestamp is 2 second, 89926760 nanosecond
One frame received. the length 1014
the timestamp is 2 second, 89928000 nanosecond
The 4 frame transmitted success!
the timestamp is 2 second, 106712080 nanosecond
One frame received. the length 1014
the timestamp is 2 second, 106713320 nanosecond
The 5 frame transmitted success!
the timestamp is 2 second, 123683360 nanosecond
One frame received. the length 1014
the timestamp is 2 second, 123684600 nanosecond
......
The 20 frame transmitted success!
the timestamp is 2 second, 379255240 nanosecond
One frame received. the length 1014
the timestamp is 2 second, 379256480 nanosecond
FRDM-MCXE32B
Hardware requirements
Type-C USB cable
Loopback network cable RJ45 standard
FRDM-MCXE32B board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a USB cable between the host PC and the OpenSDA USB port on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Insert loopback network cable to Ethernet RJ45 port (J16).
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Make loopback cable:
568B standard Unknowed standard
J1 orange+white green+white
J2 orange green
J3 green+white orange+white
J4 blue brown+white
J5 blue+white brown
J6 green orange
J7 brown+white blue
J8 brown blue+white
Connect J1 => J3, J2 => J6, J4 => J7, J5 => J8. 10/100M transfer only requires J1, J2, J3, J6, and 1G transfer requires all 8 pins. Check your net cable color order and refer to 568B standard or the other standard. If your cable’s color order is not showed in the list, please connect J1~J8 based on your situation.
Running the demo
When the demo runs, the log would be seen on the terminal like:
ENET example start.
Wait for PHY init...
Wait for PHY link up...
Get the 1-th time 0 second, 20040 nanosecond
Get the 2-th time 0 second, 204715800 nanosecond
Get the 3-th time 0 second, 409797960 nanosecond
Get the 4-th time 0 second, 614871720 nanosecond
Get the 5-th time 0 second, 819945360 nanosecond
Get the 6-th time 1 second, 25019120 nanosecond
Get the 7-th time 1 second, 229997240 nanosecond
Get the 8-th time 1 second, 435071120 nanosecond
Get the 9-th time 1 second, 640144760 nanosecond
Get the 10-th time 1 second, 845218640 nanosecond
Transmission start now!
PHY link changed, link status = 1
The 1 frame transmitted success!
the timestamp is 2 second, 56362360 nanosecond
One frame received. the length 1014
the timestamp is 2 second, 56363600 nanosecond
The 2 frame transmitted success!
the timestamp is 2 second, 73146400 nanosecond
One frame received. the length 1014
the timestamp is 2 second, 73147640 nanosecond
The 3 frame transmitted success!
the timestamp is 2 second, 89926760 nanosecond
One frame received. the length 1014
the timestamp is 2 second, 89928000 nanosecond
The 4 frame transmitted success!
the timestamp is 2 second, 106712080 nanosecond
One frame received. the length 1014
the timestamp is 2 second, 106713320 nanosecond
The 5 frame transmitted success!
the timestamp is 2 second, 123683360 nanosecond
One frame received. the length 1014
the timestamp is 2 second, 123684600 nanosecond
......
The 20 frame transmitted success!
the timestamp is 2 second, 379255240 nanosecond
One frame received. the length 1014
the timestamp is 2 second, 379256480 nanosecond