Difference between revisions of "DESK-MX6-L/Pheripherals/Ethernet"

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "{{subst:Peripheral | nome-som=AXEL Lite | nome-peripheral = Ethernet}}")
 
Line 7: Line 7:
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
|-
 
|-
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|X.Y.Z
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|1.0.0
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Month Year
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Oct 2020
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|TBD
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|First DESK release
|-
 
|-
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|[TBD_link X.Y.Z]
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Month Year
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|TBD
 
|-
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|...
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|...
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|...
 
 
|-
 
|-
 
|}
 
|}
Line 26: Line 17:
 
==Peripheral Ethernet ==
 
==Peripheral Ethernet ==
  
''TBD: sostituire tutti i dump con le informazioni sull'uso della periferica''
+
The ethernet interface is made available through the i.MX6 '''fec''' interface which should be initialized on the device tree.
  
 
=== Device tree configuration ===
 
=== Device tree configuration ===
 
Here below an example of device tree configuration used on standard DAVE's kit for the AXEL Lite SOM:
 
Here below an example of device tree configuration used on standard DAVE's kit for the AXEL Lite SOM:
  
From <code>''carrier.dts''</code>:
+
From <code>imx6qdl-axelcommon.dtsi </code>:
  
 
<pre>
 
<pre>
&can1 {
+
&fec {
 
     pinctrl-names = "default";
 
     pinctrl-names = "default";
     pinctrl-0 = <&pinctrl_flexcan1_axel>;
+
     pinctrl-0 = <&pinctrl_enet_axel>;
 +
    phy-mode = "rgmii";
 +
    phy-handle = <&ethphy>;
 
     status = "okay";
 
     status = "okay";
 +
 +
    mdio {
 +
        #address-cells = <1>;
 +
        #size-cells = <0>;
 +
 +
        ethphy: ethernet-phy@7 {
 +
            compatible = "ethernet-phy-ieee802.3-c22";
 +
            reg = <7>;
 +
        };
 +
    };
 
};
 
};
</pre>
 
  
From <code>''carrier-common.dtsi''</code>:
+
&iomuxc {
 
+
...
<pre>
+
...
     can1 {
+
     enet {
         pinctrl_flexcan1_axel: flexcan1axelgrp-1 {
+
         pinctrl_enet_axel: enetgrp-1 {
 
             fsl,pins = <
 
             fsl,pins = <
                 MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x80000000
+
                 MX6QDL_PAD_ENET_MDIO__ENET_MDIO      0x1b0b0
                 MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x80000000
+
                 MX6QDL_PAD_ENET_MDC__ENET_MDC        0x1b0b0
 +
                MX6QDL_PAD_RGMII_TXC__RGMII_TXC      0x1b0b0
 +
                MX6QDL_PAD_RGMII_TD0__RGMII_TD0      0x1b0b0
 +
                MX6QDL_PAD_RGMII_TD1__RGMII_TD1      0x1b0b0
 +
                MX6QDL_PAD_RGMII_TD2__RGMII_TD2      0x1b0b0
 +
                MX6QDL_PAD_RGMII_TD3__RGMII_TD3      0x1b0b0
 +
                MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
 +
                MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK  0x1b0b0
 +
                MX6QDL_PAD_RGMII_RXC__RGMII_RXC      0x1b0b0
 +
                MX6QDL_PAD_RGMII_RD0__RGMII_RD0      0x1b0b0
 +
                MX6QDL_PAD_RGMII_RD1__RGMII_RD1      0x1b0b0
 +
                MX6QDL_PAD_RGMII_RD2__RGMII_RD2      0x1b0b0
 +
                MX6QDL_PAD_RGMII_RD3__RGMII_RD3      0x1b0b0
 +
                MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
 +
                MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28    0xb0b1
 +
                MX6QDL_PAD_SD4_DAT3__GPIO2_IO11        0xb0b1
 +
                MX6QDL_PAD_SD4_DAT2__GPIO2_IO10        0xb0b1
 
             >;
 
             >;
 
         };
 
         };
 
     };
 
     };
 +
...
 +
...
 +
};
 
</pre>
 
</pre>
  
 
===Accessing the peripheral===
 
===Accessing the peripheral===
 +
AXEL LITE SOM provides the network interface mapped at eth0.
 +
 
====Linux messages at boot time====
 
====Linux messages at boot time====
  
Line 60: Line 83:
 
...
 
...
 
...
 
...
[    1.807495] flexcan 2090000.flexcan: 2090000.flexcan supply xceiver not found, using dummy regulator
+
[    2.373438] fec 2188000.ethernet: 2188000.ethernet supply phy not found, using dummy regulator
[    1.817366] flexcan 2090000.flexcan: device registered (reg_base=c0a30000, irq=31)
+
[    2.393396] fec 2188000.ethernet eth0: registered PHC device 0
 
...
 
...
 
...
 
...
[    3.952659] can: controller area network core (rev 20170425 abi 9)
+
[    5.235075] Micrel KSZ9031 Gigabit PHY 2188000.ethernet-1:07: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=2188000.ethernet-1:07, irq=POLL)
[   3.963413] can: raw protocol (rev 20170425)
+
[    5.249686] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    3.967717] can: broadcast manager protocol (rev 20170425 t)
 
[    3.973397] can: netlink gateway (rev 20170425) max_hops=1
 
 
</pre>
 
</pre>
  
====Enable the interface and check status====
+
Cable connection:
 +
 
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
root@imx6qxelk:~# ip link set can0 type can bitrate 500000
+
...
root@imx6qxelk:~# ifconfig can0 up
+
...
root@imx6qxelk:~# ifconfig can0
+
[    7.364256] fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
+
[    7.383799] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
          UP RUNNING NOARP  MTU:16  Metric:1
+
[    7.417007]      device=eth0, hwaddr=fa:2a:07:88:45:42, ipaddr=192.168.0.90, mask=255.255.255.0, gw=255.255.255.255
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
+
</pre>
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
 
          collisions:0 txqueuelen:10
 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 
          Interrupt:31
 
  
root@imx6qxelk:~#
+
==== Check the interface with ifconfig ====
 +
 
 +
<pre class="workstation-terminal">
 +
root@imx6qdlxelk:~# ifconfig eth0
 +
eth0      Link encap:Ethernet  HWaddr fa:2a:07:88:45:42
 +
          inet addr:192.168.0.90  Bcast:192.168.0.255  Mask:255.255.255.0
 +
          inet6 addr: fe80::f82a:7ff:fe88:4542/64 Scope:Link
 +
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 +
          RX packets:126363 errors:0 dropped:0 overruns:0 frame:0
 +
          TX packets:64259 errors:0 dropped:0 overruns:0 carrier:0
 +
          collisions:0 txqueuelen:1000
 +
          RX bytes:103276957 (98.4 MiB)  TX bytes:19090409 (18.2 MiB)
 +
 
 +
root@imx6qdlxelk:~#
 
</pre>
 
</pre>
  
==== Usage with [https://github.com/linux-can/can-utils can-utils] ====
+
==== Test with [https://iperf.fr/ iperf] ====
  
''TBD: reference verso eventuali informazioni sul web''
+
<pre class="workstation-terminal">
 +
root@imx6qdlxelk:~#  iperf3 -t 5 -c 192.168.0.125
 +
Connecting to host 192.168.0.125, port 5201
 +
[  5] local 192.168.0.90 port 45808 connected to 192.168.0.125 port 5201
 +
[ ID] Interval          Transfer    Bitrate        Retr  Cwnd
 +
[  5]  0.00-1.00  sec  11.5 MBytes  96.4 Mbits/sec    0    156 KBytes
 +
[  5]  1.00-2.00  sec  11.2 MBytes  93.8 Mbits/sec    0    191 KBytes
 +
[  5]  2.00-3.00  sec  11.2 MBytes  93.8 Mbits/sec    0    212 KBytes
 +
[  5]  3.00-4.00  sec  11.2 MBytes  93.8 Mbits/sec    0    212 KBytes
 +
[  5]  4.00-5.00  sec  11.3 MBytes  94.9 Mbits/sec    0    242 KBytes
 +
- - - - - - - - - - - - - - - - - - - - - - - - -
 +
[ ID] Interval          Transfer    Bitrate        Retr
 +
[  5]  0.00-5.00  sec  56.4 MBytes  94.6 Mbits/sec    0            sender
 +
[  5]  0.00-5.00  sec  55.7 MBytes  93.5 Mbits/sec                  receiver
  
<pre class="workstation-terminal">
+
iperf Done.
root@imx6qxelk:~# ip link set can0 type can bitrate 500000 triple-sampling on
+
root@imx6qdlxelk:~#
root@imx6qxelk:~# ifconfig can0 up
 
root@imx6qxelk:~# cansend can0 128#1122334455667788
 
root@imx6qxelk:~# candump can0
 
  can0  128  [8]  11 22 33 44 55 66 77 88
 
root@imx6qxelk:~#  
 
 
</pre>
 
</pre>
  
=== Additional information ===
 
Each CAN port appears like a networking interface in the form <code>canX</code> where <b><i>X</i></b> is the port number.
 
 
Information about programming the CAN socket interface is given in the kernel tree under ''Documentation/networking/can.txt''
 
 
<section end=Body/>
 
<section end=Body/>
  

Revision as of 15:51, 9 October 2020

History
Version Issue Date Notes
1.0.0 Oct 2020 First DESK release


Peripheral Ethernet[edit | edit source]

The ethernet interface is made available through the i.MX6 fec interface which should be initialized on the device tree.

Device tree configuration[edit | edit source]

Here below an example of device tree configuration used on standard DAVE's kit for the AXEL Lite SOM:

From imx6qdl-axelcommon.dtsi :

&fec {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_enet_axel>;
    phy-mode = "rgmii";
    phy-handle = <&ethphy>;
    status = "okay";

    mdio {
        #address-cells = <1>;
        #size-cells = <0>;

        ethphy: ethernet-phy@7 {
            compatible = "ethernet-phy-ieee802.3-c22";
            reg = <7>;
        };
    };
};

&iomuxc {
...
...
    enet {
        pinctrl_enet_axel: enetgrp-1 {
            fsl,pins = <
                MX6QDL_PAD_ENET_MDIO__ENET_MDIO       0x1b0b0
                MX6QDL_PAD_ENET_MDC__ENET_MDC         0x1b0b0
                MX6QDL_PAD_RGMII_TXC__RGMII_TXC       0x1b0b0
                MX6QDL_PAD_RGMII_TD0__RGMII_TD0       0x1b0b0
                MX6QDL_PAD_RGMII_TD1__RGMII_TD1       0x1b0b0
                MX6QDL_PAD_RGMII_TD2__RGMII_TD2       0x1b0b0
                MX6QDL_PAD_RGMII_TD3__RGMII_TD3       0x1b0b0
                MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
                MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK  0x1b0b0
                MX6QDL_PAD_RGMII_RXC__RGMII_RXC       0x1b0b0
                MX6QDL_PAD_RGMII_RD0__RGMII_RD0       0x1b0b0
                MX6QDL_PAD_RGMII_RD1__RGMII_RD1       0x1b0b0
                MX6QDL_PAD_RGMII_RD2__RGMII_RD2       0x1b0b0
                MX6QDL_PAD_RGMII_RD3__RGMII_RD3       0x1b0b0
                MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
                MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28     0xb0b1
                MX6QDL_PAD_SD4_DAT3__GPIO2_IO11        0xb0b1
                MX6QDL_PAD_SD4_DAT2__GPIO2_IO10        0xb0b1
            >;
        };
    };
...
...
};

Accessing the peripheral[edit | edit source]

AXEL LITE SOM provides the network interface mapped at eth0.

Linux messages at boot time[edit | edit source]

...
...
[    2.373438] fec 2188000.ethernet: 2188000.ethernet supply phy not found, using dummy regulator
[    2.393396] fec 2188000.ethernet eth0: registered PHC device 0
...
...
[    5.235075] Micrel KSZ9031 Gigabit PHY 2188000.ethernet-1:07: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=2188000.ethernet-1:07, irq=POLL)
[    5.249686] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

Cable connection:

...
...
[    7.364256] fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[    7.383799] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    7.417007]      device=eth0, hwaddr=fa:2a:07:88:45:42, ipaddr=192.168.0.90, mask=255.255.255.0, gw=255.255.255.255

Check the interface with ifconfig[edit | edit source]

root@imx6qdlxelk:~# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr fa:2a:07:88:45:42
          inet addr:192.168.0.90  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::f82a:7ff:fe88:4542/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:126363 errors:0 dropped:0 overruns:0 frame:0
          TX packets:64259 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:103276957 (98.4 MiB)  TX bytes:19090409 (18.2 MiB)

root@imx6qdlxelk:~#

Test with iperf[edit | edit source]

root@imx6qdlxelk:~#  iperf3 -t 5 -c 192.168.0.125
Connecting to host 192.168.0.125, port 5201
[  5] local 192.168.0.90 port 45808 connected to 192.168.0.125 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  11.5 MBytes  96.4 Mbits/sec    0    156 KBytes
[  5]   1.00-2.00   sec  11.2 MBytes  93.8 Mbits/sec    0    191 KBytes
[  5]   2.00-3.00   sec  11.2 MBytes  93.8 Mbits/sec    0    212 KBytes
[  5]   3.00-4.00   sec  11.2 MBytes  93.8 Mbits/sec    0    212 KBytes
[  5]   4.00-5.00   sec  11.3 MBytes  94.9 Mbits/sec    0    242 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-5.00   sec  56.4 MBytes  94.6 Mbits/sec    0             sender
[  5]   0.00-5.00   sec  55.7 MBytes  93.5 Mbits/sec                  receiver

iperf Done.
root@imx6qdlxelk:~#