Serial communication buffering

서지훈의 이미지

현재 rs232c 통신을 하고 있습니다.
근데 이상하게 시리얼이 buffering이 되는듯 합니다.
제가 시리얼 통신은 별다른 경험이 없어서 그러는데 이런게 정상적인 것인지 ?
제가 아는분 말로는 device단에서 16byte 정도는 buffering을 한다고 하는데요.
그리고 시스템(OS)에 딸라서 100K 정도 buffering하는 것도 있다고 하는데 ...

그리고 아마도 서로 통신하는 모듈에서 주고 받는 갭이 크서 자동으로 buffering이 되는것 같은데 이런 작용을 최소화 했으면 합니다.

그리고 최종적으로 둘중 하나의 머신은 ucLinux가 될텐데 이럴때 겪으신 문제점들 같은 좋은 정보도 감사하겠습니다.

현재 테스트 중인 머신은 아래와 같습이다.

Linux bebop 2.6.15-26-server #1 SMP Thu Aug 3 04:09:15 UTC 2006 i686 GNU/Linux (by Vmware)
Linux surenote1 2.6.9-22.EL #1 Mon Sep 19 18:20:28 EDT 2005 i686 i686 i386 GNU/Linux

그리고 시리얼 생성 옵션은..
    850         bzero(&my_termios, sizeof(my_termios));
    851         //my_termios.c_cflag = B9600 | CS8 |CREAD | CLOCAL | HUPCL;
    852         //my_termios.c_cflag = B9600 | CRTSCTS | CS8 | CLOCAL | CREAD;
    853         my_termios.c_cflag = B9600 | CS8 | CLOCAL | CREAD;
    854         my_termios.c_cc[VTIME]    = 0;
    855         my_termios.c_cc[VMIN]     = 0;
    856         //my_termios.c_iflag = IGNPAR | ICRNL;
    857         my_termios.c_iflag = IGNPAR;
    858         my_termios.c_oflag = 0;
    859         //my_termios.c_lflag = my_termios.c_lflag & ~(ICANON);
    860         my_termios.c_lflag = 0;
    861
    862         cfsetospeed(&my_termios, B9600);
    863         tcsetattr(pThis->m_handler, TCSANOW, &my_termios);

현재 blocking mode로 각 서버마다 여러 쓰레드가 실행 되고 통신 채널은 시리얼하나뿐입니다.

좋은 답변 기다리겠습니다. ^^

<어떠한 역경에도 굴하지 않는 '하양 지훈'>

lovemyin의 이미지

시리얼 통신중에 데이터가 버퍼링 되는것은 맞습니다. 시리얼 통신의 경우 네트워크(TCP/IP) 통신같이 신뢰성을 보장하지 않기 때문에 버퍼의 용량보다 많은 데이터가 버퍼링되려고 할 경우 데이터가 손실되게 됩니다. 이렇게 버퍼링 되는건 어느정도 데이터의 손실을 막아주기 때문에 필요한 기능이라고 생각됩니다. 데이터를 빨리 READ 해서 처리하면 버퍼링이 그렇게 심하지 않을거라 생각되는데...

버퍼링 보다는 개발하신 로직을 좀더 성능을 향상시켜서 버퍼가 넘치는 일이 없도록 해댜 될 것 같습니다.

/***************************************************
* 가장 심플한 것이 가장 아름다운 것이다.
***************************************************/

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.