Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2a6bcb24ea4cd427b247f78e5016142d50f4647b
Ticket: 08872796bc8e58be82094bdfe6cc54207afe3580
win: serial port read works only once
User & Date: fenugrec on 2015-01-28 15:47:39
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
     I'm having a strange problem reading a serial port on winXP. In short, I can only perform one "read", all the following attempts fail. Here's an example, with TX and RX shorted to echo everything back :
    > *****
    > (tuner-ctl) 306 % catch {set curchan [open $curport r+ ]}
    > 0
    > (tuner-ctl) 307 % chan configure $curchan -buffering none -translation binary -mode 9600,n,8,1 -handshake none -timeout 100
    > (tuner-ctl) 308 % puts -nonewline $curchan \x55
    > (tuner-ctl) 309 % read $curchan
    > U
    > (tuner-ctl) 310 % puts -nonewline $curchan \x55
    > (tuner-ctl) 311 % read $curchan
    > (tuner-ctl) 312 % close $curchan
     > *****
     If I close+open the same port right after, I will get the same result : first read works regardless, second read gives nothing!
    
     Here's what I tried :
     - different serial ports (USB->FTDI adapter, com0com software virtual port); either configured/wired as simple loopback devices or connected with a known-good, responding device. (I see the responses come in on the RXD line with a scope)
     - various combinations of blocking = 1, =0, buffering = full (and calling "flush $curchan" when required)
     - sending a longer string with puts : if I do, the first read will correctly give back the entire string echo. Second read still fails.
     - [eof $curchan] ==1, and [chan pending input $curchan] ==0 before the second read. So the data is getting lost somewhere before the second read is called ?
    - "set errorInfo" after every command shows nothing (no errors)
    
    Other terminal software (realterm, etc) works fine of course.
    
    I can run ollydbg for simple debugging if needed.
    
  5. foundin changed to: "8.6.3.1"
  6. is_private changed to: "0"
  7. login: "fenugrec"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "5aa950fce2ca1705453aec59adc8d0c3c9186502"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "fenugrec"
  14. subsystem changed to: "24. Channel Commands"
  15. title changed to: "win: serial port read works only once"
  16. type changed to: "Bug"