• 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 » S2E data split issue
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
  • S2E data split issue

    S2E data split issue

    This question is not answered
    nestor lee
    Posted by nestor lee
    on Jul 25 2012 04:14 AM
    Prodigy100 points

    Hi, My customer is using LM3S6432 working as a Serial-to-Ethernet adapter. Using source code revision 8555 of the RDK-S2E Firmware Package. The S2E adapter is used to connect a local device which have only serial port, to a remote server via Ethernet.

    During testing, we found the S2E adapter canot work properly. So we test the S2E adapter alone as descripted below:

    1. The S2E IP address is 192.168.52.169, we login and configured the S2E module by:

    2. We have a USB-to-Serial adapter ( COM3 port ) conneced to the S2E UART0 port. using only TDX and RDX pins. as following

    3. test using a windows gui socket tool to send and receive data through the Network interface card, and windows hyper terminal through the COM3 port.

    We find that when we send data from the soket tool to hyper terminal(Ethernet to COM), the hyper terminal receives OK, but when we send data back from hyper terminal(COM to Ethernet), the received window  shows splited data, normally the first 8 characters comes togerther as the first group, and the rest comes togerther as a group.that is when we send "123456789abcdefg1234" from COM to Ethernet, The received characters are  "12345678 (here pause a little bit)9abcd1234".

    When using lower baudrate, the senario becomes more obvious, for example, when we set the baudrate to 1200, the received data would be "12345678(pause)9abcdefg(pause)1234" that is to say, not only the first 8 characters, but all characters are received grouped in 8.

    When using higher baudrate (115200), the senario may sometimes not present. when it appears, still the first 8 characters gouped together, and the rest (may be larger than 8 characters, can be up to 60 or more characters grouped as the last group).

    I found in the E2E community, and found a web page quite alike:

     http://e2e.ti.com/support/microcontrollers/stellaris_arm_cortex-m3_microcontroller/f/471/t/147002.aspx 

    but the suggested methods have no effect, I added #define TCP_TMR_INTERVAL 20 and #define TCP_WND_UPDATE_THRESHOLD 1 in the  "lwipopts.h" file, but problem remains.

    Please  give me some advice.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • nestor lee
      Posted by nestor lee
      on Jul 30 2012 22:51 PM
      Prodigy100 points

      Can somone help, please?

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Moses Isang
      Posted by Moses Isang
      on Jul 31 2012 12:05 PM
      Prodigy280 points

      My apologies for the late response

      This is a problem that doesn't have any straight-forward solution yet. The S2E adapter in Serial to Ethernet transfers is designed to send out data a byte at a time to an Ethernet buffer and when a timeout value expires, it sends out whatever's in the buffer. So if the buffer is half full and timeout expires, the incomplete data will still be sent out as an individual packet. Increasing the baud rate reduces the possibility of the timeout expiring happening in the middle of a data transfer but it will still happen. 

      A proposed fix the customer can implement on the serial-side is to have a temporary/intermediate buffer to ensure that the entire data is collected first and then quickly written to the ethernet buffer. Or another approach from the Ethernet-side can be to increase the timeout value to ensure that data is not split up into separate packets. Unfortunately, presently now the RDK doesn't handle this scenario. Try these approaches and lets see if it helps

      Regards,

      Moses

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • slandrum
      Posted by slandrum
      on Aug 01 2012 21:23 PM
      Mastermind9510 points

      An approach I've taken in my own applications when they needed to do serial->ethernet was to collect serial data that was coming in, and use a timeout on the serial data.  If 2msec go by w/o receiving a character, then I consider the message complete and send it out (I was typically receiving data at 115200 or higher baud rate).  I also sent the serial data if my buffer where the data accumulated got full.  My code didn't use periodic timers to send the ethernet data, the ethernet data was always sent immediately on demand.  This required some under the hood tinkering with the ethernet code (I used uIP in my projects).

      In my applications I ran SysTick at 1kHz, rather than the typical 100Hz so that I could track time in msec increments, as was required by other parts of my application.  This made short timeouts convenient for responsiveness.

      The main reason you see things happen in about 8 byte increments is because a typical setting for the UART FIFO is to trigger when 1/2 full (or 8 characters have been received), and then the interrupt code will fire receiving the 8 bytes.  My code needed to be more responsive to potential incoming commands, so I used 1/8 full as the trigger level (2 characters).

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • nestor lee
      Posted by nestor lee
      on Aug 01 2012 23:26 PM
      Prodigy100 points

      Thank you, Moses Isang and slandrum.

      After studying the code, i seem to find the reason. Just as Moses Isang mentioned, the RDK is "designed to send out data a byte at a time to an Ethernet buffer and when a timeout value expires, it sends out whatever's in the buffer. So if the buffer is half full and timeout expires, the incomplete data will still be sent out as an individual packet."

      So the reason is the FIFO. For this serial->ethernet applicaion, one effective way is to determine where is the start and the end of a data-train based on the time gap of received data. And when send it via the ethernet, sent it all at one time. 

      When the SYSTICKHZ is set to 100 by default, because of the use of FIFO and timeout, the MCU send 8 charactrs (1/2 FIFO )first because its fast reaponding. That is to say, it does not finish receiving all the data into the FIFO from the serial port, and now the SYSTICK interrupt happens, and the MCU checks the FIFO, it has data in it, so it sends them out. After that, the next time SYSTICK interrupt happens,  the left data-train was found in the FIFO, so the MCU sends them as the second part. I  tried to modify the SYSTICKHZ to 1 from 100, and find that the data-train can be send to the ethernet at one time. The spit issue was greatly improved.

      But that is not a good way to solve this problem, what slandrum suggest is a much better way, so i will try to modify the code, and use time gap to determine the start and end of a complete data-train. and i can also try not using the FIFO, see if disable the FIFO will make it better.

      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