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.

AM4379: EtherCAT Master packets not sent

Part Number: AM4379

Team,

Please provide some guidance for my customer's question:

I am currently working with your AM4379 IDK evm board to test implementations of an EtherCAT master. Previously I was working with the v04.02 SDK and it seemed to have some issues with the PRU chips for Ethernet so I was forced to use the Gigabit Ethernet port to test the master we use (EtherLabs IgH master) and it was working fine. I saw that the v04.03 SDK had been released a month or so ago so I’ve been working on porting our code to that version. I did some testing to make sure everything worked and it seemed like a big improvement overall and with this version, the PRU Ethernet ports work correctly. The last thing to test was running the EtherCAT master and try to communicate with our Elmo drives and unfortunately that failed. After debugging a bit I found that we weren’t receiving any packets from the drive and so I set up a Linux machine as a switch to use Wireshark and look at the communication between the master and the slave and I noticed that the drive wasn’t sending data back. I compared the packets sent between the v04.02 SDK and the v04.03 SDK and I noticed a single difference: The packet sizes were different.

If I understand correctly, the minimum packet size has to be 64 bytes. Wireshark doesn’t display the FCS so the minimum size I expect to see in Wireshark is 60 bytes. The packets that work fine show as 60 bytes, while the packets that are failing are 64 bytes, which would mean are 68 after the FCS. Is there a known issue in the new SDK where somewhere along the Ethernet stack, one of the drivers is padding incorrectly? The actual payload on the initial EtherCAT packet is tiny (14 bytes) so it always has to be padded. I assume if the slave is trying to parse the packet and it gets the wrong size based on its payload, it’ll also read the wrong FCS and discard the packet which would explain why there is no reply. I haven’t been able to get past that initial broadcast read packets to see if the problem goes away once the payload is above 46 bytes and there’s no padding needed.

I am also looking into the master stack we are using to see if it’s doing the padding instead.

  • The software team have been notified. They will respond here.
  • I have since ran more tests and I found that only the Gigabit port pads incorrectly. I also tested removing any padding from the EtherCAT master and allowing the drivers pad themselves and saw the same behavior. If I manually modify the packets sent to be more than 64 bytes (I am testing with 66), the slave replies correctly. Unfortunately because of the way I am hacking the packets, the master is rejecting the responses so I can't check to see if any other problem arises after the initial setup.

    I also found another problem that only affects the PRU ports. Initially I thought that they were also padding incorrectly because I wasn't getting replies from the slave but it turns out that the slave is replying but the PRU is rejecting the reply. According to Wireshark's capture, whenever the slave replies in the Gigabit port, the source MAC address is slightly different on the response. When I send packets using the PRU ports, the source stays the same on the reply and I am guessing that is causing the PRU to reject the packet. It may be thinking it's the packet it initially sent that was broadcasted back. I have no idea why the MAC stays the same in this case but I have noticed that the PRU MAC addresses have some problems since I get a different address every time I boot up. I tried changing the packets manually to have a different source MAC but when I do that, nothing is sent out so there must be a check that prevents sending if it's the wrong source.

    I have found a workaround for the MAC issue by using both ports in redundancy mode and I get much further in the init process. Since the packets arrive in the other port, they have different MAC addresses and the response reaches the master. I get other problems with topology in the master side but that may not be related to any of these problems and could be my configuration since I have never used that mode before. I still need to investigate the topology error and I can't test it in the old SDK since the PRU ports don't work.
  • Hi,

    I would like to summarize the issues you are seeing since you are reporting issues with both the cpsw and the PRU and because of that this post may need to be split into two threads or more threads.

    The first topic is that you are seeing the cpsw pad Ethercat Master packets incorrectly. For us to help on this issue it will need to be isolated into a small application independent of the EtherCAT stack that sends the packet incorrectly along with the Wireshark capture.

    The next issue is the getting different MAC addresses, could you please attach (not paste) the boot log and the ifconfig results for the PRU ports?

    Could you attach the pcap file showing the MAC address change on the PRU?

    Could you describe the redundancy mode or method that you using?

    Also please attach the results of ethtool -S eth0, I would like to look at the statistics reported by the HW block.

    Best Regards,
    Schuyler
  • Hello,

    I apologize for the delay on my response. For the first issue that is correct. The master I use creates the packets manually and uses ndo_start_xmit() to talk to the device. It always brings the packet size to 64 (not including crc) rather than 60 regardless of whether or not I let the master pad itself. Manually padding in the master to a much larger size prevents that additional padding done later and the slave then can process the data correctly.

    For the second issue I did more tests and I think I fully understand the issue so I was able to find a better work around. The original issue I saw was that the Elmo EtherCAT slaves we have always respond with the sender's MAC address. After looking at the wireshark data, I saw that the working counter was being changed, showing that those were packets from a slave, but my driver wasn't being notified of any data arriving. I made the conclusion that the PRU's may be rejecting packets (maybe broadcast only) that share the same MAC address probably on the assumption that it was the original data sent and not meant for them. I used the redundancy mode in this master to use both PRU ports connected in a ring with the slave so both send data and then receive the other's data with the other port's MAC.

    When I mentioned the changing address on wireshark I meant that on the previous SDK (4.02) the data captured showed that the slave was modifying the source MAC. I'm not sure why it did but that was testing using the regular gigabit port.

    The issue with the changing MAC addresses on boot up may be unrelated but I just happened to notice it from having to power the board often for testing. The master I was using finds the interfaces by MAC address so I had to constantly change it in the configuration. I attached the boot log (I hope it worked) and near the end you can see the issues with the prueth using random MAC addr.

    [    0.000000] Booting Linux on physical CPU 0x0
    [    0.000000] Linux version 4.9.65-rt23-g7069a470d5 (marcojimenez@f21-build) (gcc version 6.2.1 20161016 (Linaro GCC 6.2-2016.11) ) #1 PREEMPT RT Fri May 25 12:26:55 CDT 2018
    [    0.000000] CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
    [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [    0.000000] OF: fdt:Machine model: TI AM437x Industrial Development Kit
    [    0.000000] efi: Getting EFI parameters from FDT:
    [    0.000000] efi: UEFI not found.
    [    0.000000] cma: Reserved 48 MiB at 0xbd000000
    [    0.000000] Memory policy: Data cache writeback
    [    0.000000] On node 0 totalpages: 262144
    [    0.000000] free_area_init_node: node 0, pgdat c0c49aa8, node_mem_map ef6f9000
    [    0.000000]   Normal zone: 1728 pages used for memmap
    [    0.000000]   Normal zone: 0 pages reserved
    [    0.000000]   Normal zone: 196608 pages, LIFO batch:31
    [    0.000000]   HighMem zone: 65536 pages, LIFO batch:15
    [    0.000000] CPU: All CPU(s) started in SVC mode.
    [    0.000000] AM437x ES1.2 (sgx neon)
    [    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
    [    0.000000] pcpu-alloc: [0] 0 
    [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260416
    [    0.000000] Kernel command line: console=ttyO0,115200n8 video=HDMI-A-1:800x600 root=PARTUUID=9ded6cd4-02 rw rootfstype=ext4 rootwait
    [    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
    [    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
    [    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
    [    0.000000] Memory: 977248K/1048576K available (7168K kernel code, 301K rwdata, 2364K rodata, 1024K init, 325K bss, 22176K reserved, 49152K cma-reserved, 212992K highmem)
    [    0.000000] Virtual kernel memory layout:
                       vector  : 0xffff0000 - 0xffff1000   (   4 kB)
                       fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
                       vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
                       lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
                       pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
                       modules : 0xbf000000 - 0xbfe00000   (  14 MB)
                         .text : 0xc0008000 - 0xc0800000   (8160 kB)
                         .init : 0xc0b00000 - 0xc0c00000   (1024 kB)
                         .data : 0xc0c00000 - 0xc0c4b460   ( 302 kB)
                          .bss : 0xc0c4b460 - 0xc0c9c9a0   ( 326 kB)
    [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [    0.000000] Preemptible hierarchical RCU implementation.
    [    0.000000] 	RCU kthread priority: 1.
    [    0.000000] NR_IRQS:16 nr_irqs:16 16
    [    0.000000] L2C: platform modifies aux control register: 0x0e030000 -> 0x3e430000
    [    0.000000] L2C: DT/platform modifies aux control register: 0x0e030000 -> 0x3e430000
    [    0.000000] L2C-310 enabling early BRESP for Cortex-A9
    [    0.000000] OMAP L2C310: ROM does not support power control setting
    [    0.000000] L2C-310 dynamic clock gating disabled, standby mode disabled
    [    0.000000] L2C-310 cache controller enabled, 16 ways, 256 kB
    [    0.000000] L2C-310: CACHE_ID 0x410000c9, AUX_CTRL 0x4e430000
    [    0.000000] OMAP clockevent source: timer2 at 24000000 Hz
    [    0.000011] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    [    0.000022] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
    [    0.000027] OMAP clocksource: timer1 at 24000000 Hz
    [    0.000143] sched_clock: 64 bits at 500MHz, resolution 2ns, wraps every 4398046511103ns
    [    0.000151] clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0xe6a171a037, max_idle_ns: 881590485102 ns
    [    0.000166] Switching to timer-based delay loop, resolution 2ns
    [    0.000523] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 58327039986419 ns
    [    0.000525] OMAP clocksource: 32k_counter at 32768 Hz
    [    0.000912] Console: colour dummy device 80x30
    [    0.001048] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
    [    0.001050] This ensures that you still see kernel messages. Please
    [    0.001051] update your kernel commandline.
    [    0.001072] Calibrating delay loop (skipped), value calculated using timer frequency.. 1000.00 BogoMIPS (lpj=5000000)
    [    0.001076] pid_max: default: 32768 minimum: 301
    [    0.001201] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.001206] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.002059] CPU: Testing write buffer coherency: ok
    [    0.002375] Setting up static identity map for 0x80100000 - 0x80100060
    [    0.003397] EFI services will not be available.
    [    0.004198] devtmpfs: initialized
    [    0.015867] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
    [    0.016182] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [    0.016209] futex hash table entries: 256 (order: 1, 8192 bytes)
    [    0.019515] pinctrl core: initialized pinctrl subsystem
    [    0.020899] NET: Registered protocol family 16
    [    0.022380] DMA: preallocated 256 KiB pool for atomic coherent allocations
    [    0.097397] omap_l3_noc 44000000.ocp: L3 debug error: target 8 mod:0 (unclearable)
    [    0.097594] omap_l3_noc 44000000.ocp: L3 application error: target 8 mod:0 (unclearable)
    [    0.101752] gpio gpiochip0: (gpio): added GPIO chardev (254:0)
    [    0.102057] gpiochip_setup_dev: registered GPIOs 0 to 31 on device: gpiochip0 (gpio)
    [    0.103399] OMAP GPIO hardware version 0.1
    [    0.104079] gpio gpiochip1: (gpio): added GPIO chardev (254:1)
    [    0.104387] gpiochip_setup_dev: registered GPIOs 32 to 63 on device: gpiochip1 (gpio)
    [    0.106157] gpio gpiochip2: (gpio): added GPIO chardev (254:2)
    [    0.106436] gpiochip_setup_dev: registered GPIOs 64 to 95 on device: gpiochip2 (gpio)
    [    0.108246] gpio gpiochip3: (gpio): added GPIO chardev (254:3)
    [    0.108563] gpiochip_setup_dev: registered GPIOs 96 to 127 on device: gpiochip3 (gpio)
    [    0.110398] gpio gpiochip4: (gpio): added GPIO chardev (254:4)
    [    0.110677] gpiochip_setup_dev: registered GPIOs 128 to 159 on device: gpiochip4 (gpio)
    [    0.118499] No ATAGs?
    [    0.118526] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
    [    0.118537] hw-breakpoint: maximum watchpoint size is 4 bytes.
    [    0.132683] edma 49000000.edma: TI EDMA DMA engine driver
    [    0.133063] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixed-regulator-v24_0d[0]'
    [    0.133344] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixed-regulator-v3_3d[0]'
    [    0.133448] V3_3D: supplied by V24_0D
    [    0.133724] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixed-regulator-vdd_corereg[0]'
    [    0.133777] VDD_COREREG: supplied by V24_0D
    [    0.134024] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixed-regulator-vdd_core[0]'
    [    0.134070] VDD_CORE: supplied by VDD_COREREG
    [    0.134326] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixed-regulator-v1_8dreg[0]'
    [    0.134387] V1_8DREG: supplied by V24_0D
    [    0.134626] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixed-regulator-v1_8d[0]'
    [    0.134670] V1_8D: supplied by V1_8DREG
    [    0.134931] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixed-regulator-v1_5dreg[0]'
    [    0.134978] V1_5DREG: supplied by V24_0D
    [    0.135216] of_get_named_gpiod_flags: can't parse 'gpio' property of node '/fixed-regulator-v1_5d[0]'
    [    0.135261] V1_5D: supplied by V1_5DREG
    [    0.138332] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp@44000000/l4_wkup@44c00000/scm@210000/pinmux@800/i2c0_pins_default, deferring probe
    [    0.138386] omap_i2c 4819c000.i2c: could not find pctldev for node /ocp@44000000/l4_wkup@44c00000/scm@210000/pinmux@800/i2c2_pins_default, deferring probe
    [    0.138497] media: Linux media interface: v0.10
    [    0.138541] Linux video capture interface: v2.00
    [    0.138581] pps_core: LinuxPPS API ver. 1 registered
    [    0.138588] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
    [    0.138629] PTP clock support registered
    [    0.138672] EDAC MC: Ver: 3.0.0
    [    0.139570] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
    [    0.139907] Advanced Linux Sound Architecture Driver Initialized.
    [    0.141118] clocksource: Switched to clocksource arm_global_timer
    [    0.149932] NET: Registered protocol family 2
    [    0.150793] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
    [    0.150880] TCP bind hash table entries: 8192 (order: 5, 196608 bytes)
    [    0.151448] TCP: Hash tables configured (established 8192 bind 8192)
    [    0.151632] UDP hash table entries: 512 (order: 3, 32768 bytes)
    [    0.151751] UDP-Lite hash table entries: 512 (order: 3, 32768 bytes)
    [    0.152173] NET: Registered protocol family 1
    [    0.152682] RPC: Registered named UNIX socket transport module.
    [    0.152697] RPC: Registered udp transport module.
    [    0.152702] RPC: Registered tcp transport module.
    [    0.152707] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [    0.152720] PCI: CLS 0 bytes, default 64
    [    0.155129] workingset: timestamp_bits=14 max_order=18 bucket_order=4
    [    0.160867] squashfs: version 4.0 (2009/01/31) Phillip Lougher
    [    0.161902] NFS: Registering the id_resolver key type
    [    0.161939] Key type id_resolver registered
    [    0.161947] Key type id_legacy registered
    [    0.161989] ntfs: driver 2.1.32 [Flags: R/O].
    [    0.163538] bounce: pool size: 64 pages
    [    0.163739] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
    [    0.163754] io scheduler noop registered
    [    0.163760] io scheduler deadline registered
    [    0.163887] io scheduler cfq registered (default)
    [    0.165405] pinctrl-single 44e10800.pinmux: 199 pins at pa f9e10800 size 796
    [    0.219218] Serial: 8250/16550 driver, 10 ports, IRQ sharing disabled
    [    0.221596] omap8250 44e09000.serial: No clock speed specified: using default: 48000000
    [    0.222351] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 30, base_baud = 3000000) is a 8250
    [    0.940308] console [ttyS0] enabled
    [    0.945670] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
    [    0.952523] [drm] Initialized
    [    0.969639] brd: module loaded
    [    0.979016] loop: module loaded
    [    0.984406] spi spi1.0: not using DMA for McSPI (-19)
    [    0.989757] spidev spi1.0: buggy DT: spidev listed directly in DT
    [    0.995884] ------------[ cut here ]------------
    [    1.000542] WARNING: CPU: 0 PID: 1 at drivers/spi/spidev.c:757 spidev_probe+0x1e4/0x204
    [    1.008578] Modules linked in:
    [    1.011657] CPU: 0 PID: 1 Comm: swapper Not tainted 4.9.65-rt23-g7069a470d5 #1
    [    1.018907] Hardware name: Generic AM43 (Flattened Device Tree)
    [    1.024849] Backtrace: 
    [    1.027332] [<c010b77c>] (dump_backtrace) from [<c010ba38>] (show_stack+0x18/0x1c)
    [    1.034937]  r7:00000009 r6:00000000 r5:c09df480 r4:00000000
    [    1.040632] [<c010ba20>] (show_stack) from [<c03b2d9c>] (dump_stack+0x24/0x28)
    [    1.047906] [<c03b2d78>] (dump_stack) from [<c012d060>] (__warn+0xe8/0x100)
    [    1.054903] [<c012cf78>] (__warn) from [<c012d130>] (warn_slowpath_null+0x28/0x30)
    [    1.062508]  r9:00000000 r8:c0c38760 r7:00000000 r6:ee983800 r5:c0c38750 r4:ee983800
    [    1.070289] [<c012d108>] (warn_slowpath_null) from [<c0566a24>] (spidev_probe+0x1e4/0x204)
    [    1.078606] [<c0566840>] (spidev_probe) from [<c056302c>] (spi_drv_probe+0x84/0xb4)
    [    1.086298]  r8:c0c38760 r7:00000000 r6:00000000 r5:c0c38750 r4:ee983800
    [    1.093041] [<c0562fa8>] (spi_drv_probe) from [<c05096dc>] (driver_probe_device+0x20c/0x2d4)
    [    1.101516]  r7:00000000 r6:c0c88dc4 r5:c0c88db4 r4:ee983800
    [    1.107204] [<c05094d0>] (driver_probe_device) from [<c0509908>] (__device_attach_driver+0xa0/0xd4)
    [    1.116290]  r10:00000000 r9:00000000 r8:c0c88d60 r7:00000001 r6:ee983800 r5:ef065c28
    [    1.124152]  r4:c0c38760 r3:00000000
    [    1.127745] [<c0509868>] (__device_attach_driver) from [<c0507a94>] (bus_for_each_drv+0x68/0x9c)
    [    1.136568]  r7:00000001 r6:c0509868 r5:ef065c28 r4:00000000
    [    1.142254] [<c0507a2c>] (bus_for_each_drv) from [<c05093ac>] (__device_attach+0xb8/0x11c)
    [    1.150552]  r6:c0c38204 r5:ee983834 r4:ee983800
    [    1.155191] [<c05092f4>] (__device_attach) from [<c0509988>] (device_initial_probe+0x14/0x18)
    [    1.163752]  r7:00000000 r6:c0c38204 r5:ee983800 r4:ee983808
    [    1.169437] [<c0509974>] (device_initial_probe) from [<c05089cc>] (bus_probe_device+0x8c/0x94)
    [    1.178088] [<c0508940>] (bus_probe_device) from [<c0506b1c>] (device_add+0x3e4/0x570)
    [    1.186039]  r7:00000000 r6:ee983800 r5:ee983400 r4:ee983808
    [    1.191724] [<c0506738>] (device_add) from [<c0563f80>] (spi_add_device+0xa8/0x140)
    [    1.199414]  r10:ee9835b2 r9:ef171a10 r8:00000000 r7:ef171a10 r6:00000000 r5:ee983400
    [    1.207274]  r4:ee983800
    [    1.209818] [<c0563ed8>] (spi_add_device) from [<c05643e0>] (of_register_spi_device+0x220/0x320)
    [    1.218640]  r7:ee983400 r6:00000001 r5:ef6eb8ac r4:ee983800
    [    1.224326] [<c05641c0>] (of_register_spi_device) from [<c05649d8>] (spi_register_master+0x320/0x51c)
    [    1.233587]  r8:ef6eb590 r7:c09defac r6:00000000 r5:ef6eb8ac r4:ee983400
    [    1.240317] [<c05646b8>] (spi_register_master) from [<c0564c14>] (devm_spi_register_master+0x40/0x78)
    [    1.249578]  r10:ee9835b2 r9:c09df5b8 r8:ee983400 r7:ef171a10 r6:ee983400 r5:ee983400
    [    1.257439]  r4:ee932c90
    [    1.259987] [<c0564bd4>] (devm_spi_register_master) from [<c0569530>] (omap2_mcspi_probe+0x2e0/0x36c)
    [    1.269247]  r7:ef171a10 r6:ee983400 r5:ee983770 r4:00000000
    [    1.274938] [<c0569250>] (omap2_mcspi_probe) from [<c050b01c>] (platform_drv_probe+0x58/0xb8)
    [    1.283502]  r10:00000000 r9:00000000 r8:c0c387b4 r7:fffffdfb r6:c0c387b4 r5:ffffffed
    [    1.291363]  r4:ef171a10
    [    1.293910] [<c050afc4>] (platform_drv_probe) from [<c05096dc>] (driver_probe_device+0x20c/0x2d4)
    [    1.302821]  r7:00000000 r6:c0c88dc4 r5:c0c88db4 r4:ef171a10
    [    1.308505] [<c05094d0>] (driver_probe_device) from [<c0509864>] (__driver_attach+0xc0/0xc4)
    [    1.316980]  r10:00000000 r9:c0b0061c r8:000000b9 r7:00000000 r6:ef171a44 r5:c0c387b4
    [    1.324841]  r4:ef171a10 r3:00000000
    [    1.328433] [<c05097a4>] (__driver_attach) from [<c05079d4>] (bus_for_each_dev+0x70/0xa4)
    [    1.336647]  r7:00000000 r6:c05097a4 r5:c0c387b4 r4:00000000
    [    1.342334] [<c0507964>] (bus_for_each_dev) from [<c05090a8>] (driver_attach+0x24/0x28)
    [    1.350369]  r6:c0c34b38 r5:ee933d80 r4:c0c387b4
    [    1.355008] [<c0509084>] (driver_attach) from [<c0508be8>] (bus_add_driver+0x108/0x214)
    [    1.363051] [<c0508ae0>] (bus_add_driver) from [<c0509f64>] (driver_register+0x80/0xfc)
    [    1.371089]  r7:c0b3b830 r6:c0b4852c r5:ffffe000 r4:c0c387b4
    [    1.376776] [<c0509ee4>] (driver_register) from [<c050af78>] (__platform_driver_register+0x48/0x50)
    [    1.385859]  r5:ffffe000 r4:c0c34b38
    [    1.389461] [<c050af30>] (__platform_driver_register) from [<c0b2a7d4>] (omap2_mcspi_driver_init+0x1c/0x20)
    [    1.399241]  r5:ffffe000 r4:c0b2a7b8
    [    1.402838] [<c0b2a7b8>] (omap2_mcspi_driver_init) from [<c01017b4>] (do_one_initcall+0x4c/0x178)
    [    1.411761] [<c0101768>] (do_one_initcall) from [<c0b00e94>] (kernel_init_freeable+0x13c/0x1cc)
    [    1.420500]  r10:00000007 r9:c0b0061c r8:000000b9 r7:c0b3b830 r6:c0b4852c r5:c0c4b480
    [    1.428360]  r4:c0c4b480
    [    1.430908] [<c0b00d58>] (kernel_init_freeable) from [<c0794ad4>] (kernel_init+0x10/0x110)
    [    1.439210]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c0794ac4
    [    1.447070]  r4:00000000
    [    1.449617] [<c0794ac4>] (kernel_init) from [<c0107d40>] (ret_from_fork+0x14/0x34)
    [    1.457217]  r5:c0794ac4 r4:00000000
    [    1.460803] ---[ end trace 0000000000000001 ]---
    [    1.466346] spi spi2.0: not using DMA for McSPI (-19)
    [    1.473317] m25p80 spi0.0: mx66l51235l (65536 Kbytes)
    [    1.478453] 7 ofpart partitions found on MTD device spi0.0
    [    1.483966] Creating 7 MTD partitions on "spi0.0":
    [    1.488785] 0x000000000000-0x000000080000 : "QSPI.U_BOOT"
    [    1.495373] 0x000000080000-0x000000100000 : "QSPI.U_BOOT.backup"
    [    1.502405] 0x000000100000-0x000000110000 : "QSPI.U-BOOT-SPL_OS"
    [    1.509401] 0x000000110000-0x000000120000 : "QSPI.U_BOOT_ENV"
    [    1.516145] 0x000000120000-0x000000130000 : "QSPI.U-BOOT-ENV.backup"
    [    1.523552] 0x000000130000-0x000000930000 : "QSPI.KERNEL"
    [    1.529997] 0x000000930000-0x000004000000 : "QSPI.FILESYSTEM"
    [    1.537557] libphy: Fixed MDIO Bus: probed
    [    1.611192] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
    [    1.617327] davinci_mdio 4a101000.mdio: detected phy mask fffffffe
    [    1.624438] libphy: 4a101000.mdio: probed
    [    1.628482] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver Micrel KSZ9031 Gigabit PHY
    [    1.638931] cpsw 4a100000.ethernet: Detected MACID = 68:9e:19:ba:da:39
    [    1.645616] cpsw 4a100000.ethernet: device node lookup for pps timer failed
    [    1.652647] cpsw 4a100000.ethernet: cpts: overflow check period 500 (jiffies)
    [    1.661612] mousedev: PS/2 mouse device common for all mice
    [    1.667606] i2c /dev entries driver
    [    1.672919] omap_hsmmc 48060000.mmc: GPIO lookup for consumer cd
    [    1.672928] omap_hsmmc 48060000.mmc: using device tree for GPIO lookup
    [    1.672972] of_get_named_gpiod_flags: parsed 'cd-gpios' property of node '/ocp@44000000/mmc@48060000[0]' - status (0)
    [    1.673038] omap_hsmmc 48060000.mmc: Got CD GPIO
    [    1.677689] omap_hsmmc 48060000.mmc: GPIO lookup for consumer wp
    [    1.677693] omap_hsmmc 48060000.mmc: using device tree for GPIO lookup
    [    1.677699] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/ocp@44000000/mmc@48060000[0]'
    [    1.677704] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/ocp@44000000/mmc@48060000[0]'
    [    1.677709] omap_hsmmc 48060000.mmc: using lookup tables for GPIO lookup
    [    1.677715] omap_hsmmc 48060000.mmc: lookup for GPIO wp failed
    [    1.737339] NET: Registered protocol family 10
    [    1.744534] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
    [    1.753252] NET: Registered protocol family 17
    [    1.758000] Key type dns_resolver registered
    [    1.762548] omap_voltage_late_init: Voltage driver support not added
    [    1.786814] mmc0: host does not support reading read-only switch, assuming write-enable
    [    1.794946] mmc0: new SDHC card at address 0001
    [    1.800142] mmcblk0: mmc0:0001 SD8GB 7.28 GiB 
    [    1.801501] at24 0-0050: 32768 byte 24c256 EEPROM, writable, 64 bytes/write
    [    1.801735] of_get_named_gpiod_flags: can't parse 'vsel0-gpio' property of node '/ocp@44000000/i2c@44e0b000/tps62362@60[0]'
    [    1.801739] of_get_named_gpiod_flags: can't parse 'vsel1-gpio' property of node '/ocp@44000000/i2c@44e0b000/tps62362@60[0]'
    [    1.802541] omap_i2c 44e0b000.i2c: bus 0 rev0.12 at 400 kHz
    [    1.811869] omap_i2c 4819c000.i2c: bus 2 rev0.12 at 100 kHz
    [    1.812590] of_get_named_gpiod_flags: parsed 'gpios' property of node '/gpio_keys/switch0[0]' - status (0)
    [    1.813119] input: gpio_keys as /devices/platform/gpio_keys/input/input0
    [    1.813416] hctosys: unable to open rtc device (rtc0)
    [    1.814046] ALSA device list:
    [    1.814050]   No soundcards found.
    [    1.847709]  mmcblk0: p1 p2
    [    2.107488] random: fast init done
    [    2.973498] EXT4-fs (mmcblk0p2): recovery complete
    [    2.980887] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    [    2.989088] VFS: Mounted root (ext4 filesystem) on device 179:2.
    [    2.999982] devtmpfs: mounted
    [    3.004831] Freeing unused kernel memory: 1024K
    [    3.486040] systemd[1]: System time before build time, advancing clock.
    [    3.543416] systemd[1]: systemd 230 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN)
    [    3.562083] systemd[1]: Detected architecture arm.
    [    3.602939] systemd[1]: Set hostname to <am437x-evm>.
    [    4.278070] systemd[1]: Listening on Process Core Dump Socket.
    [    4.312232] systemd[1]: Listening on Network Service Netlink Socket.
    [    4.435250] systemd[1]: Listening on Journal Socket.
    [    4.471649] systemd[1]: Listening on Syslog Socket.
    [    4.501384] systemd[1]: Reached target Remote File Systems.
    [    4.531646] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
    [    4.571673] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
    [    4.709571] cmemk: loading out-of-tree module taints kernel.
    [    4.718887] CMEMK module: reference Linux version 4.9.65
    [    4.728295] no physical memory specified
    [    4.732262] cmemk initialized
    [    4.748679] cryptodev: driver 1.8 loaded.
    [    4.818063] usbcore: registered new interface driver usbfs
    [    4.848145] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    [    4.890133] usbcore: registered new interface driver hub
    [    4.899063] usbcore: registered new device driver usb
    [    4.914730] usbcore: registered new interface driver usbserial
    [    4.946776] usbcore: registered new interface driver ftdi_sio
    [    4.957168] usbserial: USB Serial support registered for FTDI USB Serial Device
    [    6.384130] systemd-journald[127]: Received request to flush runtime journal from PID 1
    [    7.561839] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
    [    7.589811] remoteproc remoteproc0: wkup_m3 is available
    [    7.644004] rtc rtc0: 44e3e000.rtc: dev (253:0)
    [    7.644040] omap_rtc 44e3e000.rtc: rtc core: registered 44e3e000.rtc as rtc0
    [    7.900122] remoteproc remoteproc0: powering up wkup_m3
    [    8.040498] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 224268
    [    8.093963] remoteproc remoteproc0: remote processor wkup_m3 is now up
    [    8.094080] wkup_m3_ipc 44e11324.wkup_m3_ipc: CM3 Firmware Version = 0x192
    [    8.455483] gpiochip_find_base: found new base at 504
    [    8.455517] gpio gpiochip5: (tpic2810): added GPIO chardev (254:5)
    [    8.455899] gpiochip_setup_dev: registered GPIOs 504 to 511 on device: gpiochip5 (tpic2810)
    [    8.528338] pisosr-gpio spi2.0: GPIO lookup for consumer load
    [    8.528351] pisosr-gpio spi2.0: using device tree for GPIO lookup
    [    8.528432] of_get_named_gpiod_flags: parsed 'load-gpios' property of node '/ocp@44000000/spi@481a0000/sn65hvs882@0[0]' - status (0)
    [    8.542053] gpiochip_find_base: found new base at 496
    [    8.542097] gpio gpiochip6: (pisosr-gpio): added GPIO chardev (254:6)
    [    8.542475] gpiochip_setup_dev: registered GPIOs 496 to 503 on device: gpiochip6 (pisosr-gpio)
    [   10.214236] omap-sham 53100000.sham: hw accel on OMAP rev 0.0
    [   10.380518] omap-aes 53501000.aes: OMAP AES hw accel rev: 0.1
    [   10.438706] omap-aes 53501000.aes: will run requests pump with realtime priority
    [   10.597148] omap-des 53701000.des: OMAP DES hw accel rev: 0.33
    [   10.640585] omap-des 53701000.des: will run requests pump with realtime priority
    [   10.820804] [drm] Initialized pvr 1.14.3699939 20110701 on minor 0
    [   11.239105] PM: bootloader does not support rtc-only!
    [   11.325489] ti-pruss 54400000.pruss: creating PRU cores and other child platform devices
    [   11.511836] davinci_mdio 54432400.mdio: GPIO lookup for consumer reset
    [   11.511850] davinci_mdio 54432400.mdio: using device tree for GPIO lookup
    [   11.511877] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/ocp@44000000/pruss_soc_bus@54426000/pruss@54400000/mdio@54432400[0]' - status (0)
    [   11.571360] davinci_mdio 54432400.mdio: davinci mdio revision 1.6
    [   11.571367] libphy: 54432400.mdio: probed
    [   11.696930] net eth0: initializing cpsw version 1.15 (0)
    [   11.696941] cpsw 4a100000.ethernet: initialized cpsw ale version 1.4
    [   11.696945] cpsw 4a100000.ethernet: ALE Table size 1024
    [   11.803869] Micrel KSZ9031 Gigabit PHY 4a101000.mdio:00: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=4a101000.mdio:00, irq=-1)
    [   11.840120] Bluetooth: Core ver 2.22
    [   11.840201] NET: Registered protocol family 31
    [   11.840205] Bluetooth: HCI device and connection manager initialized
    [   11.840224] Bluetooth: HCI socket layer initialized
    [   11.840234] Bluetooth: L2CAP socket layer initialized
    [   11.840263] Bluetooth: SCO socket layer initialized
    [   11.862344] cpts ptp bc clkid 0
    [   11.865922] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    [   11.882161] davinci_mdio 54432400.mdio: phy[0]: device 54432400.mdio:00, driver TI TLK10X 10/100 Mbps PHY
    [   11.882168] davinci_mdio 54432400.mdio: phy[1]: device 54432400.mdio:01, driver TI TLK10X 10/100 Mbps PHY
    [   11.882356] ti-pruss 54440000.pruss: creating PRU cores and other child platform devices
    [   11.918704] remoteproc remoteproc1: 54434000.pru0 is available
    [   11.918779] pru-rproc 54434000.pru0: PRU rproc node /ocp@44000000/pruss_soc_bus@54426000/pruss@54400000/pru@54434000 probed successfully
    [   11.936382] remoteproc remoteproc2: 54438000.pru1 is available
    [   11.936472] pru-rproc 54438000.pru1: PRU rproc node /ocp@44000000/pruss_soc_bus@54426000/pruss@54400000/pru@54438000 probed successfully
    [   11.960205] remoteproc remoteproc3: 54474000.pru0 is available
    [   11.960311] pru-rproc 54474000.pru0: PRU rproc node /ocp@44000000/pruss_soc_bus@54426000/pruss@54440000/pru@54474000 probed successfully
    [   11.960784] remoteproc remoteproc4: 54478000.pru1 is available
    [   11.960835] pru-rproc 54478000.pru1: PRU rproc node /ocp@44000000/pruss_soc_bus@54426000/pruss@54440000/pru@54478000 probed successfully
    [   12.082375] prueth pruss1_eth: pruss MC Mask 0:0:0:0:0:0
    [   12.082655] prueth pruss1_eth: could not get ptp tx irq
    [   12.082675] prueth pruss1_eth: port 1: using random MAC addr: 42:f3:e1:ce:83:75
    [   12.182232] prueth pruss1_eth: could not get ptp tx irq
    [   12.182253] prueth pruss1_eth: port 2: using random MAC addr: 5a:0b:87:34:fa:e5
    [   12.286725] prueth pruss1_eth: TI PRU ethernet (type 0) driver initialized
    [   13.856270] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
    [   17.484815] NET: Registered protocol family 15
    [   18.548238] Initializing XFRM netlink socket
    [   18.912341] PVR_K: UM DDK-(3699939) and KM DDK-(3699939) match. [ OK ]
    [   20.382978] random: crng init done
    [   21.202425] cpsw 4a100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
    [   21.303533] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    [   21.821955] remoteproc remoteproc1: powering up 54434000.pru0
    [   21.871497] remoteproc remoteproc1: Booting fw image ti-pruss/am437x-pru0-prueth-fw.elf, size 5432
    [   21.902065] ti-pruss 54400000.pruss: configured system_events = 0x0000060000500000 intr_channels = 0x00000095 host_intr = 0x00000115
    [   21.940979] remoteproc remoteproc1: remote processor 54434000.pru0 is now up
    [   22.001974] net eth1: started
    [   22.024480] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
    [   22.123888] remoteproc remoteproc2: powering up 54438000.pru1
    [   22.156027] remoteproc remoteproc2: Booting fw image ti-pruss/am437x-pru1-prueth-fw.elf, size 5508
    [   22.194585] ti-pruss 54400000.pruss: configured system_events = 0x0060000000a00000 intr_channels = 0x0000012a host_intr = 0x0000022a
    [   22.248878] remoteproc remoteproc2: remote processor 54438000.pru1 is now up
    [   22.290916] net eth2: started
    [   22.316385] IPv6: ADDRCONF(NETDEV_UP): eth2: link is not ready
    [   23.041992] prueth pruss1_eth eth1: Link is Up - 100Mbps/Full - flow control rx/tx
    [   23.049644] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
    

    I also attached the ipconfig results.

    eth1      Link encap:Ethernet  HWaddr 42:F3:E1:CE:83:75
              inet6 addr: fe80::40f3:e1ff:fece:8375%763860/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (0.0 B)  TX bytes:13224 (12.9 KiB)
    
    eth2      Link encap:Ethernet  HWaddr 5A:0B:87:34:FA:E5
              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)
    

    Since then I have tried using a different master and found more information on the PRU problems. After running it and logging to see that it was trying to communication I found that no packets were being sent according to wireshark. I saw that the source MAC for the packets was set to 10:10:10:10:10:10 in the code and there was a comment saying MAC does not matter in EtherCAT. I assumed that it was again an issue with matching MAC addresses so I tried matching the MAC address to the one from the interface used. I noticed that as long as I just match the first byte, the packet is transmitted. The rest of the bytes in the MAC address did not seem to matter. However I also noticed that if ALL the bytes match, while packets get sent, it will ignore them when receiving them. This was the same issue I saw with the old master. When I had tried testing this on the old master, I was only modifying the first byte to test and it didn't work (in the same way where nothing was sent but I had assumed that I broke something that time). I retested once more on the old master by instead changing the second byte and everything worked.

    My current workaround is modifying the old master and having the second byte changed to 0 and all my previous code that I was using in 4.02 works correctly. I am no longer using redundancy because of it.

    So in summary I think the issues are:

    -Gigabit port padding incorrectly.

    -PRU ports refuse to transmit if MAC address on Ethernet II header doesn't match the first byte of its MAC address.

    -PRU ports reject any packet received that matches their MAC address.

    -PRU ports fail to read correct MAC address on boot up and so they use random ones.

    I also attached the ethtool statistics on eth0 but I have it set up for regular Ethernet and not for EtherCAT. I can re-run it with EtherCAT communication.

    root@am437x-evm:~# ethtool -S eth0
    NIC statistics:
         Good Rx Frames: 54352
         Broadcast Rx Frames: 40604
         Multicast Rx Frames: 12790
         Pause Rx Frames: 0
         Rx CRC Errors: 0
         Rx Align/Code Errors: 0
         Oversize Rx Frames: 0
         Rx Jabbers: 0
         Undersize (Short) Rx Frames: 0
         Rx Fragments: 0
         Rx Octets: 5487912
         Good Tx Frames: 1099
         Broadcast Tx Frames: 394
         Multicast Tx Frames: 165
         Pause Tx Frames: 0
         Deferred Tx Frames: 0
         Collisions: 0
         Single Collision Tx Frames: 0
         Multiple Collision Tx Frames: 0
         Excessive Collisions: 0
         Late Collisions: 0
         Tx Underrun: 0
         Carrier Sense Errors: 0
         Tx Octets: 209492
         Rx + Tx 64 Octet Frames: 29946
         Rx + Tx 65-127 Octet Frames: 13732
         Rx + Tx 128-255 Octet Frames: 8005
         Rx + Tx 256-511 Octet Frames: 3495
         Rx + Tx 512-1023 Octet Frames: 255
         Rx + Tx 1024-Up Octet Frames: 18
         Net Octets: 5697404
         Rx Start of Frame Overruns: 0
         Rx Middle of Frame Overruns: 0
         Rx DMA Overruns: 0
         Rx DMA chan 0: head_enqueue: 1
         Rx DMA chan 0: tail_enqueue: 43935
         Rx DMA chan 0: pad_enqueue: 0
         Rx DMA chan 0: misqueued: 0
         Rx DMA chan 0: desc_alloc_fail: 0
         Rx DMA chan 0: pad_alloc_fail: 0
         Rx DMA chan 0: runt_receive_buf: 0
         Rx DMA chan 0: runt_transmit_bu: 0
         Rx DMA chan 0: empty_dequeue: 0
         Rx DMA chan 0: busy_dequeue: 42939
         Rx DMA chan 0: good_dequeue: 43808
         Rx DMA chan 0: requeue: 0
         Rx DMA chan 0: teardown_dequeue: 0
         Tx DMA chan 0: head_enqueue: 1093
         Tx DMA chan 0: tail_enqueue: 6
         Tx DMA chan 0: pad_enqueue: 0
         Tx DMA chan 0: misqueued: 6
         Tx DMA chan 0: desc_alloc_fail: 0
         Tx DMA chan 0: pad_alloc_fail: 0
         Tx DMA chan 0: runt_receive_buf: 0
         Tx DMA chan 0: runt_transmit_bu: 407
         Tx DMA chan 0: empty_dequeue: 1093
         Tx DMA chan 0: busy_dequeue: 0
         Tx DMA chan 0: good_dequeue: 1099
         Tx DMA chan 0: requeue: 0
         Tx DMA chan 0: teardown_dequeue: 0
    

  • Hi,
    The people who would be able to answer the questions concerning the PRU ports are out of the office this week. I will consult with them next week and work on getting a response to you then.
    Best Regards,
    Schuyler
  • Hi,

    When you say that the cpsw gig port is padding incorrectly I would like to ask a few questions. Are you using the 4.03 SDK ? The SDK prebuilt images or did you build the kernel? Do you have a code example that is output the frames?

    Best Regards,
    Schuyler