• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » Stellaris® ARM® Microcontrollers » Stellaris® ARM® LM3S Microcontrollers Forum » Ethernet packet truncated
Share
Stellaris® ARM® Microcontrollers
  • Forum
Options
  • Subscribe via RSS
Helpful Stellaris® LM4F Series Links
  • LM4F Series
  • Stellaris PinMux Utility
  • Stellaris® LM4F120 LaunchPad
  • LM4F MCU Applications
  • LM4F MCU Video
  • ARM Cortex-M4F Whitepaper
  • Stellaris MCU Brochure
  • LM4F232 Eval Kit
  • Forums

    Ethernet packet truncated

    This question is not answered
    Maurizio Ferraris
    Posted by Maurizio Ferraris
    on May 03 2012 06:21 AM
    Intellectual475 points

    I am using the Stellarisware library to receive some raw ethernet frames.
    From a PC application I am sending Ethernet frames all of the same size og 1300 bytes including the header.
    Six bytes destination, 6 bytes source, 2 bytes type, 1286 bytes payload.

    For the records, I am using driver lib version 7611, CCS V5.1, on a designed board based upon LM3S8970.
    The circuit related to the Ethernet part is the same as the EK-LM3S8962.

    The Ethernet controller interrupt routine contains the following code:

     unsigned long status; // Read status and clear pending interrupts status = EthernetIntStatus(ETH_BASE, false); EthernetIntClear(e->ulPeripheral, status); // Manage packet reception if(status & ETH_INT_RX) { // Retrieve the packet long len = EthernetPacketGetNonBlocking(e->ulPeripheral, (unsigned char *)&p->header, (sizeof(TEthMsg) - sizeof(long))); if(len != 1300) Error++; } else ...

    Sometimes I receive a shorter packet, sometimes much shorter ... like 78 bytes
    I have seen that the data sheet mention the possibility to receive a shorter packet, and suggests to use the driverlib, which I have done.

    The initializtion code is:

      SysCtlPeripheralEnable(SYSCTL_PERIPH_ETH);       // Enable peripheral
      SysCtlPeripheralReset(SYSCTL_PERIPH_ETH);        // Reset to a known status

      EthernetInitExpClk(ETH_BASE, SysCtlClockGet());
      EthernetConfigSet(ETH_BASE, (ETH_CFG_TX_DPLXEN | ETH_CFG_TX_CRCEN |
                                       ETH_CFG_TX_PADEN));
      EthernetIntDisable(ETH_BASE, (ETH_INT_PHY | ETH_INT_MDIO | ETH_INT_RXER |
                         ETH_INT_RXOF | ETH_INT_TX | ETH_INT_TXER | ETH_INT_RX));
      ulTemp = EthernetIntStatus(ETH_BASE, false);
      EthernetIntClear(ETH_BASE, ulTemp);

      EthernetMACAddrSet(ETH_BASE, e->our_mac);
      EthernetIntEnable(ETH_BASE, (ETH_INT_RXER | ETH_INT_RXOF | ETH_INT_TX | ETH_INT_TXER | ETH_INT_RX));
      EthernetEnable(ETH_BASE);
      IntEnable(INT_ETH);                              // Enable peripheral interrupt

    Any suggestion?
    Thanks.


    Ethernet LM3S9070
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • slandrum
      Posted by slandrum
      on May 03 2012 07:25 AM
      Mastermind9510 points

      I can't read most of your post, it comes out badly mangled in my browser, starting at where you've included the code section.

      Your computer will probably send a lot of packets over the ethernet other than what you are explicitly asking it to.  You may be seeing these other packets as your computer is trying to discover details about the network and devices connected to it.  I would monitor the traffic with WireShark or some similar tool to see what your computer is actually sending out as opposed to what you are asking it to send out.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Maurizio Ferraris
      Posted by Maurizio Ferraris
      on May 03 2012 08:22 AM
      Intellectual475 points

      Sorry,
      I tryed to post some code, setting different color and font in the online editor, but something went wrong.

      First, thank you for your quick answer.
      But I am quite sure no other packet is running out of that particular PC interface.
      That interface is not seen by the operating system, but instead a special Real Time driver, running below the OS is sending the packets.
      So no ARP, BROWSER, NBLOOKUP and other type of packers are sent there without my knowledge.
      We already checked this with WireShark.

      Additionally, I am quite sure that the truncated packets is one of mine, since the initial portion of the packer that is avaliable, looks like one of my packets.
      Actually, making all packets of same size, is already a test to seek for this problem.
      Initially the packets were of variable size, normally much shorter that 1300 bytes, but still some of them looked like shorter than they should.
      So we decided to make all packets fixed size and added this specific test to check for the validity of the packet.

      We already tryed to tweak some code to find the problem, like disabling duplex mode, like making all packet's size equal as I mentioned, and other changes that did not change the behavior.

      The only thing that seemed to "solve" the problem is that if we place a switch in between (for examplet to connect wireshark too), everyting works fine.
      This seems a good indication of where the problem might be, but we coudn't get hold of it.
      The switch may introduce three kind of changes, I am aware of:
      - Change in timing since the switch receives the complete message before retransmit it
      - Change in quality of signal, since it is regenerated
      - Change in crossing, since a stringt point-to-point cable causes the two ethernet endpoints to agree on wich are the Tx and Rx  pair.

      To exclude the last possibility, we also tryed a cross cable without changes.
      To eclude the first possibility the traffic is actually half duplex. The PC send a packet, and after reception, the board sends a packet back.
      No other traffic runs on the cable until the next time slot which is after 1mS. So all FIFOs should be empty when a new cycle begins.

      I am starting to consider the second case, but I don't know how to check.
      I expect that If a garbled packet arrives at the controller, it is silently discarded, or at least some error bit is set (which I don't see).
      Is this the normal behavior?

      Thanks for any hint.
      Regards.

      For completeness I try again to put the relevant code here:

      The interrupt routine:

      unsigned long status;

      // Read status and clear pending interrupts
      status = EthernetIntStatus(ETH_BASE, false);
      EthernetIntClear(e->ulPeripheral, status);

      // Manage packet reception
      if(status & ETH_INT_RX)
      {
        // Retrieve the packet
        long len = EthernetPacketGetNonBlocking(e->ulPeripheral, (unsigned char *)&p->header, (sizeof(TEthMsg) - sizeof(long)));
        if(len != 1300)
        Error++;
      }
      else
       ...

      The initialization code:

      SysCtlPeripheralEnable(SYSCTL_PERIPH_ETH);       // Enable peripheral
      SysCtlPeripheralReset(SYSCTL_PERIPH_ETH);        // Reset to a known status
      EthernetInitExpClk(ETH_BASE, SysCtlClockGet());
      EthernetConfigSet(ETH_BASE, (ETH_CFG_TX_DPLXEN | ETH_CFG_TX_CRCEN | ETH_CFG_TX_PADEN));
      EthernetIntDisable(ETH_BASE, (ETH_INT_PHY | ETH_INT_MDIO | ETH_INT_RXER | ETH_INT_RXOF | ETH_INT_TX | ETH_INT_TXER | ETH_INT_RX));
      ulTemp = EthernetIntStatus(ETH_BASE, false);
      EthernetIntClear(ETH_BASE, ulTemp);
      EthernetMACAddrSet(ETH_BASE, e->our_mac);
      EthernetIntEnable(ETH_BASE, (ETH_INT_RXER | ETH_INT_RXOF | ETH_INT_TX | ETH_INT_TXER | ETH_INT_RX));
      EthernetEnable(ETH_BASE);
      IntEnable(INT_ETH);                              // Enable peripheral interrupt

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use