Fu@#ki&% Linux AGAIN!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dunker
    DK Veteran
    • Oct 2009
    • 1130

    #1

    Fu@#ki&% Linux AGAIN!

    Just having a bit of a rant. I have a USB to serial adapter (ID 1a86:7523), it gets picked up as a CH341 (to everyone else this is a HL-340 / CH340 but thats by the by). When inserted the ch341 and usbserial kernel modules are loaded as you would expect. I am writing a small perl prog to send a series of 5 characters to the USB serial port (bloody PC hasnt got a 9 pin). Heres a snippet:

    Code:
    #!/usr/bin/perl -w
    use strict;
    
    use Device::SerialPort;
    
    my $port = Device::SerialPort->new("/dev/ttyUSB0");
    
    $port->baudrate(300); <<< aaarghhh!!!
    $port->parity("1");
    $port->handshake("none");
    $port->databits(7);
    $port->stopbits(1);
    $port->read_char_time(0);
    $port->read_const_time(1);
    
    # send data out
    $port->write("/?!\r\n");
    sleep(1);
    The problem is that the baudrate will not change to anything lower than 2400. I thought I was cracking up at first but I have monitored the output with a digital storage scope and I can plainly see that settings of 2400, 4800, 9600 etc. work ok (the trace of the data sent reduces in horizontal size as the baudrate goes up as you would expect). Unfortunately setting the baudrate to anything less than 2400 does nothing - it leaves the rate at 2400.

    Any ideas which driver is at fault here? Maybe a fresh look tomorrow minus the beer might help.

    </rant>
    V Series TMS470 / EEPROM data - encryption / decryption, totally pwned.

    IEC 62056-21 - new discussion: sonsivri.to/forum/index.php?topic=60412.0

  • Dunker
    DK Veteran
    • Oct 2009
    • 1130

    #2
    Sussed it in case anyone else has a similar problem... Crap ch341 driver. I've cobbled together a FDTI USB to serial interface and the FDTI drivers work ok and I can change the baudrate.
    Last edited by Dunker; 31 August, 2010, 01:46. Reason: Typo
    V Series TMS470 / EEPROM data - encryption / decryption, totally pwned.

    IEC 62056-21 - new discussion: sonsivri.to/forum/index.php?topic=60412.0

    Comment

    • radu_gostian
      Member
      • Jan 2010
      • 58

      #3
      Probably the USB - > Serial device doesn't support all boudrates. Try searching for different kernel module (it also can be a hardware limitation so better try with an other device)

      Comment

      • jeff114
        Junior Member
        • Jan 2010
        • 25

        #4
        Hello
        you can try to set your ttyUSB0 with this scritp:
        Code:
        #!/bin/sh
        (
        stty 300
        stty cs8
        stty -parenb
        stty -parodd
        stty -clocal
        stty crtscts
        stty -echo
        ) < /dev/ttyUSB0 > /dev/ttyUSB0
        in this sample:
        300 = speed
        cs8 = 8 bits data
        -parenb
        -parodd
        = no parity
        -clocal = not local (modem DCD, DTR)
        crtscts = hardware flow control
        -echo = no local echo

        Regards,
        jeff

        Comment

        Working...