CP210x module didn't receive data

पारस beparas at gmail.com
Fri Apr 13 09:05:40 EDT 2012


Hi All,
I added support for Silicon Labs CP210x to my development board kernel.
On my development board CP210x chip is connected using USB bus.
And I am sending data to CP210x using one external device.

I write a program to read data on usb-serial (ttyUSB0) on development board.
But I didn't get any data,

  ---------------               ---------
---------------------------
  | external    |------->  | CP210x | ------->   | my developemnt |
  |  device     |           |             |              |
device               |


enable debug messages
-----------------------------------------------------------------------------------------------------------------------------------------
# echo 1 > /sys/bus/usb-serial/drivers/generic/module/parameters/debug
# cat /sys/bus/usb-serial/drivers/generic/module/parameters/debug
Y
# echo 1 > /sys/bus/usb-serial/drivers/cp210x/module/parameters/debug
# cat /sys/bus/usb-serial/drivers/cp210x/module/parameters/debug
Y

-----------------------------------------------------------------------------------------------------------------------------------------
debug messages
#demesg
....

ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ar71xx-ohci ar71xx-ohci: Atheros AR71xx built-in OHCI controller
ar71xx-ohci ar71xx-ohci: new USB bus registered, assigned bus number 1
ar71xx-ohci ar71xx-ohci: irq 3, io mem 0x1b000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usb 1-1: new full speed USB device using ar71xx-ohci and address 2
USB Serial support registered for cp210x
usbcore: registered new interface driver cp210x
cp210x: v0.09:Silicon Labs CP210x RS232 serial adaptor driver
USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
usb 1-1: configuration #1 chosen from 1 choice
cp210x 1-1:1.0: cp210x converter detected
usb 1-1: reset full speed USB device using ar71xx-ohci and address 2
usb 1-1: cp210x converter now attached to ttyUSB0
......
-----------------------------------------------------------------------------------------------------------------------------------------

When I open ttyUSB0 for communication, debug messages are

-----------------------------------------------------------------------------------------------------------------------------------------
#dmesg
...
drivers/usb/serial/usb-serial.c: serial_install
drivers/usb/serial/usb-serial.c: serial_open - port 0
drivers/usb/serial/cp210x.c: cp210x_open - port 0
drivers/usb/serial/cp210x.c: cp210x_get_termios_port - port 0
drivers/usb/serial/cp210x.c: cp210x_get_termios_port - baud rate = 115200
drivers/usb/serial/cp210x.c: cp210x_get_termios_port - data bits = 8
drivers/usb/serial/cp210x.c: cp210x_get_termios_port - parity = NONE
drivers/usb/serial/cp210x.c: cp210x_get_termios_port - stop bits = 1
drivers/usb/serial/cp210x.c: cp210x_get_termios_port - flow control = NONE
drivers/usb/serial/cp210x.c: cp210x_tiocmset_port - port 0
drivers/usb/serial/cp210x.c: cp210x_tiocmset_port - control = 0x0303
.....

-----------------------------------------------------------------------------------------------------------------------------------------

The debug messages I get when I send data from external device to
developemnt board,

-----------------------------------------------------------------------------------------------------------------------------------------
#demesg
....
drivers/usb/serial/usb-serial.c: serial_write_room - port 0
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]
drivers/usb/serial/usb-serial.c: serial_write_room - port 0
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]
drivers/usb/serial/usb-serial.c: serial_write_room - port 0
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]
drivers/usb/serial/usb-serial.c: serial_write_room - port 0
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]
drivers/usb/serial/usb-serial.c: serial_write_room - port 0
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]
drivers/usb/serial/usb-serial.c: serial_write_room - port 0
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]
drivers/usb/serial/usb-serial.c: serial_write_room - port 0
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]
drivers/usb/serial/usb-serial.c: serial_write_room - port 0
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]
drivers/usb/serial/usb-serial.c: usb_serial_port_work - port 0
drivers/usb/serial/usb-serial.c: usb_serial_port_work - port 0
drivers/usb/serial/usb-serial.c: serial_write_room - port 0
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]
drivers/usb/serial/usb-serial.c: serial_write_room - port 0
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]
drivers/usb/serial/usb-serial.c: serial_write_room - port 0
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]
drivers/usb/serial/usb-serial.c: usb_serial_port_work - port 0
drivers/usb/serial/usb-serial.c: usb_serial_port_work - port 0
drivers/usb/serial/usb-serial.c: usb_serial_port_work - port 0
-----------------------------------------------------------------------------------------------------------------------------------------


Program to read data from ttyUSB0, running on development board
-----------------------------------------------------------------------------------------------------------------------------------------
int main(void)
{

        int UartFd;
        char ReadData[30];
        int ReturnVal;

         UartFd = open("/dev/ttyUSB0", O_RDONLY);
        if ( UartFd < 0 )
        {
                perror("Open");
        }
        else
        {
                printf("Uart_Fd: %d\r\n", UartFd);
        }

        memset(ReadData, 0, sizeof(ReadData));

        ReturnVal = read(UartFd, ReadData, sizeof(ReadData));
        if ( ReturnVal < 0 )
        {
                perror("Read");
        }
        else
        {
                printf("ReturnVal: %d\r\n", ReturnVal);

                int i;
                for(i = 0; i < ReturnVal; i++)
                        printf(" %2X ", ReadData[i]);
        }

        close(UartFd);

        return 0;
}
-----------------------------------------------------------------------------------------------------------------------------------------

My program didn't print any data on terminal.
Is any body help me how to debug this issue, what is the problem.
Thanks in advance,


Thanks,
Paras
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120413/98c632be/attachment-0001.html 


More information about the Kernelnewbies mailing list