This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3352 RMII ethernet: no data sent or received

Other Parts Discussed in Thread: AM3352

Hi all,

We have an RMII ethernet interface connected to an AM3352 chip. We're aware of the clock errata, and have the PHY providing the clock. After some initial difficulties getting our MDIO working, we now have an ethernet device showing up in Linux.

When we use the route command, we see sensible output (see attached). 

When we try to send any data, whether via ping, netcat, or any other tool, we see no activity on our TX lines to the PHY, and no packets are sent. We've verified the pin-muxing of the TX lines by looking at the processor registers. Our RX lines do show traffic, but even when we specifically direct traffic to the board, we see no indication that the board has received it.

One interesting behavior is that when we attempt to send a packet, we do not see the TX or RX count increment on eth0. However, we do see the lo interface increment both TX and RX packets by 1 (see second attachment). However, when we try to send data to 'localhost' with a corresponding receive process, the connect fails, and it indicates 'no route to host' (see third attachment).

I've tried everything I can think of: instrumenting the TCP framework, double-checking our pin muxing, verifying that we have devices for the PHYs, MDIO, etc - what could be causing our board to not be able to use the Ethernet interface?

0363.ifconfig_route.txt
~ # ifconfig
eth0      Link encap:Ethernet  HWaddr 12:34:56:78:90:12
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::1034:56ff:fe78:9012/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:40

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

~ # route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

7851.pingtest.txt
~ # ifconfig
eth0      Link encap:Ethernet  HWaddr 12:34:56:78:90:12
          inet addr:192.168.0.20  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::1034:56ff:fe78:9012/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:40

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

~ # ping -4 -c 1 192.168.0.1
PING 192.168.0.1 (192.168.0.1): 56 data bytes

--- 192.168.0.1 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
~ # ifconfig
eth0      Link encap:Ethernet  HWaddr 12:34:56:78:90:12
          inet addr:192.168.0.20  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::1034:56ff:fe78:9012/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:40

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:112 (112.0 B)  TX bytes:112 (112.0 B)

~ # ifconfig
eth0      Link encap:Ethernet  HWaddr 12:34:56:78:90:12
          inet addr:192.168.0.20  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::1034:56ff:fe78:9012/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:40

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:112 (112.0 B)  TX bytes:112 (112.0 B)

~ # ping -4 -c 1 192.168.0.1
PING 192.168.0.1 (192.168.0.1): 56 data bytes

--- 192.168.0.1 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
~ # ifconfig
eth0      Link encap:Ethernet  HWaddr 12:34:56:78:90:12
          inet addr:192.168.0.20  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::1034:56ff:fe78:9012/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:40

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:224 (224.0 B)  TX bytes:224 (224.0 B)

~ # ifconfig
eth0      Link encap:Ethernet  HWaddr 12:34:56:78:90:12
          inet addr:192.168.0.20  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::1034:56ff:fe78:9012/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:40

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:224 (224.0 B)  TX bytes:224 (224.0 B)

5852.localhost.txt
~ # nc -l 12345 &
~ # echo "Hello World" | nc localhost 12345
nc: can't connect to remote host (127.0.0.1): Connection refused
~ # ps
  PID USER       VSZ STAT COMMAND
    1 root      2880 S    init
    2 root         0 SW   [kthreadd]
    3 root         0 SW   [ksoftirqd/0]
<snip>
 1166 root      2880 S    nc -l 12345

Thanks,

Ben

  • Do you seen different behavior in uBoot vs Linux?

    Please ensure that the PAD configuration for RMII_REFCLK is set for RECEIVER_ENABLED.

    Please ensure that RMII(n)_IO_CLK_EN is set.

    Please ensure that GMII(n)_SEL is set for RMII (0x01)

    If all these are found to be correct, please capture and post a RMII_REFCLK waveform.

  • Hi DK,

    Yes, we do see different behavior in U-boot. The Ethernet interface does work in U-boot.

    The pad configuration is set for receiver enabled, here are the lines for RMII1 and RMII2:

    { "rmii1_refclk.rmii1_refclk", OMAP_MUX_MODE0 | AM33XX_INPUT_EN },

    and

    { "mii1_col.rmii2_refclk", OMAP_MUX_MODE1 | AM33XX_INPUT_EN },

    The IO_CLK_EN is set, and GMII_SEL is set to RMII:

    Register 0x44e10650 is set to 0xC5.

    Attached is the RMII_REFCLK waveform.

  • Did you read the 0xC5 from u-boot or when the kernel was booted?

    Steve K.

  • Hi Steve,

    I read the 0xC5 after the kernel was booted, using 'devmem'. We modified the code in arch/arm/mach-omap2/device.c to set the 0xC0 in addition to the 0x05 that it put in when we set RMII mode operation, as we couldn't find a function/API to set up the clocks where the RMII mode was an input. All of the EVM modes seem to use the phy clock as an output, despite the errata. Or at least, board-am335x.c doesn't seem to have any code which sets up the clocks as inputs.

    Thanks,

    Ben

  • Hi Ben,

    That's what I was looking for - to make sure you modified devices.c in the kernel source.

    Steve K.

  • Ben,

    What frequency is your master oscillator running at?

  • Hi DK,

    I wasn't sure whether you meant the main clock for the board, or the main clock for the RMII interface, so here's the information for both. For the main clock for the board, we are using the same setup as the EVM, a 24MHz crystal.

    For the RMII clock, we are using a 25Mhz crystal attached to a Micrel PHY (p/n KSZ8081RNAIA) which by default outputs a 50Mhz clock on a REFCLK output pin from the PHY. This is connected via a 22.1 ohm series resistor to the AM3352 RMII-REFCLK1 pin. 

    Thanks,

    Ben

  • OK...can you dump MACCONTROL in both CPSW_SL registers? (14.5.7 in the TRM) and post the values here?

  • Hi DK,

    The MACCONTROL register at CPSW_SL1 (0x4a10_0D84) is 0x0.

    The MACCONTROL register at CPSW_SL2 (0x4a10_0DC4) is also 0x0.

    In u-Boot these registers also seem to be 0x0 and 0x0. 

    Looking at the TRM definitions for MACCONTROL, those values seem not entirely correct (half-duplex and 10 Mbit on our full-duplex 100Mbit link), but not like anything that would prevent data transfer. The fact that data transfer works in u-boot despite the same MACCONTROL values seems to corroborate this.

    Thanks,

    Ben

  • One interesting note - after pinging a destination in u-boot, both registers change to 0x8021. This is interesting because the 0x20 seems to imply GMII is released from reset, which then would be different from the Linux version.

  • Yes, that's what I was looking for.

    Bit 5 must be set or the interface is held in reset. I tried this on my board and uBoot and Linux both have MACCONTROL set to 0x8021, which is the expected value for a full-duplex 100mbps connection.

    Something in your Linux distro is either not setting MACCONTROL correctly, or it is, and something comes along later and clears it.

  • Hi DK,

    Setting this register to 0x8021 and then pinging another destination, I see no effect. The ping still does not send data, ifconfig still shows 0 packets transmitted, and the packet count for the loopback interface goes up by 1. Is there some other action I'd need to take other than setting the register to 0x8021 after I'm booted into Linux?

    Thanks,

    Ben

  • Additional info: we've found that upon bringing the interface up, this register is cleared. If things are set up correctly at any point, this seems to be when those settings are overwritten. I'm not entirely sure why this register would be cleared on an up, but I'm going to see if I can find the code related to that, it might have some other hints about things that might be going wrong.

  • Hi Ben,

    I remember from a different thread on MDIO that you were posting to that mentioned you had your own linux distro that is different from the distro provided with the SDK for the AM335x. From what you are describing the cpsw interface is not being  initialized.

    There is a function called am33xx_cpsw_init in the file devices.c that was mentioned in an earlier post in this thread. Is this function being called? Or perhaps just this function below?

     pdev = omap_device_build("cpsw", -1, oh, &am33xx_cpsw_pdata,
                            sizeof(am33xx_cpsw_pdata), NULL, 0, 0);

  • Hi Schuyler,

    Your recollection is correct. I've actually been working on a second build derived from TI's base code to try and get around any issues related to the custom distribution we're working with, but so far this build is also not working, and in a very similar fashion. I looked at the code in our custom version first, and found that this code:

    pdev = omap_device_build("davinci_mdio", 0, oh, &am33xx_cpsw_mdiopdata, sizeof(am33xx_cpsw_mdiopdata), NULL, 0, 0);

    <...>

    pdev = omap_device_build("cpsw", -1, oh, &am33xx_cpsw_pdata, sizeof(am33xx_cpsw_pdata), NULL, 0, 0);

    seems to have been replaced with this code:

    platform_device_register(&am33xx_cpsw_mdiodevice);

    platform_device_register(&am33xx_cpsw_device);

    clk_add_alias(NULL, dev_name(&am33xx_cpsw_mdiodevice.dev), NULL, &am33xx_cpsw_device.dev);

    This replacement appears to be intentional. Here is the content of am33xx_cpsw_mdiodevice:

    static struct platform_device am33xx_cpsw_mdiodevice = {

    .name = "davinci_mdio",

    .id = 0,

    .num_resources = ARRAY_SIZE(am33xx_cpsw_mdioresources)

    .resource = am33xx_cpsw_mdioresources

    .dev.platform_data = &am33xx_cpsw_mdiopdata,

    };

    I had a look at am33xx_cpsw_mdiopdata, and the content is the same as it is on the EVM. This looks like it might just be a difference between the 3.2.0 kernel used in the EVM and the 3.2.2 kernel used in our custom version.

    In the interest of science, I recompiled our custom version with the calls to build the omap device in before the calls to platform_device_register. What I found was that the call:

    oh = omap_hwmod_lookup("mdio")

    fails. This causes the whole thing to exit without registering the devices.

    I'm hoping to follow both debugging tracks, seeing if I can get my SDK-derived kernel up and running today. At this point, I've got it booting and it's showing Ethernet interfaces, but I believe it's not registering the PHYs correctly. I'm also going to make sure to check on the GMII enable which someone suggested above, to see that that's not causing the problem.

    My thought here is that if I can get it working in an SDK-derived kernel, I can probably puzzle out the differences between that and the custom kernel, and if I can't get it working in an SDK-derived kernel, you all will probably be a lot more comfortable helping with that.

  • Re-reading this, I realized I'd been unclear. When I said that the omap_hwmod_lookup caused the whole thing to exit without registering the devices, that is NEW behavior that only happens after changing to code to try and register the devices the old way.

    Previously, the platform_device_register calls were happening and did not appear to fail, so it seemed to be registering the CPSW.

  • Hi all,

    Just an update here. I've not made any progress on the custom kernel side, but I've got my TI-SDK build up and booted onto the board. On the SDK, I see that the "davinci_mdio" probe checks the PHY_ALIVE register, finds 0 results, and bails out. Our PHY driver then doesn't init because it doesn't see any PHYs to latch onto.

    This is similar to what I originally saw on the custom kernel when I had a Fixed MDIO enabled, but I've checked and that's not enabled in the SDK build. I've also checked the registers, and everything that you had me check for the custom kernel is in the same state as it was there... including the CPSW MDIOCONTROL registers being 0x0 instead of 0x8021. This may be because the MDIO is not working correctly here, instead of the CPSW not working properly in the custom build.

    I'm going to see if I can capture data on the MDIO lines to verify that MDIO/MDC are both operating correctly, but our hardware engineer is gone for the week, so it may take me some time. However, the pin muxing should be the same as it was using the custom build.

  • One last update on this:

    There was an issue with our PHY where both of the PHYs were responding to packets set to PHY address 0. This is apparently known as "broadcast mode" and on these PHYs you have to turn it off. The CPSW switch wasn't active because the PHYs were returning a link state of 1 and 0, which apparently coalesced to a 0, making the switch think they were off.

    I'm not sure why eth0 was reporting as "up" despite this.

    After turning the broadcast mode off, the PHYs reported their proper status, the ethernet interface got an IP address, and ping began working. Thanks for all the help.

  • Hi all.

    We are trying to configure RMII2 interface at our custom board based on am335x.
    We use a LAN8710 PHY.
    Now we have achieved eth1 in target OS up and running, but it allows only outbound traffic and static IP's.
    Tcpdump on host OS shows incoming ping-requests when we ping the host from target. Also we can see a DHCP-requests.

    18:13:40.377533 ARP, Request who-has 192.168.1.100 tell 192.168.1.200, length 46
    18:13:41.376254 ARP, Request who-has 192.168.1.100 tell 192.168.1.200, length 46
    18:13:41.948205 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from d0:ff:50:b3:ab:69 (oui Unknown), length 548
    18:13:42.376301 ARP, Request who-has 192.168.1.100 tell 192.168.1.200, length 46
    18:13:43.378479 ARP, Request who-has 192.168.1.100 tell 192.168.1.200, length 46
    18:13:44.376326 ARP, Request who-has 192.168.1.100 tell 192.168.1.200, length 46
    18:13:44.951714 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from d0:ff:50:b3:ab:69 (oui Unknown), length 548



    We can also see the data on the RXD0 and RXD1 lines of the PHY (at the input of microcontroller), but 'RX packets' counter in target OS is not increased.

    Additional info:
    GMII_SEL = 0xF5 (both interfaces are configured as RMII with EXT_CLK enabled)
    MACCONTROL_0 = 0x8021
    MACCONTROL_1 = 0x8021

    dmesg output:

    [ 35.643525] net eth1: CPSW phy found : id is : 0x7c0f1
    eth1 no wireless extensions.

    udhcpc (v1.13.2) started
    Sending discover...
    [ 38.640435] PHY: 0:00 - Link is Up - 100/Full
    Sending discover...
    Sending discover...
    No lease, forking to background




    ifconfig output:

    root@am335x-evm:~# ifconfig eth1
    eth1 Link encap:Ethernet HWaddr D0:FF:50:B3:AB:69
    inet addr:192.168.1.200 Bcast:192.168.1.255 Mask:255.255.255.0
    UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:533 errors:3 dropped:10 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:7030 (6.8 KiB)



    I hope for your help.
  • Hi Ivan,

    In the future, you might get a better response by posting this as a new question - my original question is a year and a half old at this point. Personally, I would like to be able to help you, but I've moved on from working with this system and don't remember enough of how the internals worked to help anymore.

    Thanks,
    Ben
  • Hi Ben,

    Thank you for your advice.
    I think I'll follow it.