Hi All,<br>I added support for Silicon Labs CP210x to my development board kernel.<br>On my development board CP210x chip is connected using USB bus.<br>And I am sending data to CP210x using one external device.<br><br>I write a program to read data on usb-serial (ttyUSB0) on development board.<br>
But I didn't get any data,<br><br> --------------- --------- ---------------------------<br> | external |-------> | CP210x | -------> | my developemnt |<br> | device | | | | device |<br>
<br><br>enable debug messages<br>-----------------------------------------------------------------------------------------------------------------------------------------<br># echo 1 > /sys/bus/usb-serial/drivers/generic/module/parameters/debug<br>
# cat /sys/bus/usb-serial/drivers/generic/module/parameters/debug<br>Y<br># echo 1 > /sys/bus/usb-serial/drivers/cp210x/module/parameters/debug<br># cat /sys/bus/usb-serial/drivers/cp210x/module/parameters/debug<br>Y<br>
<br>-----------------------------------------------------------------------------------------------------------------------------------------<br>debug messages<br>#demesg<br>....<br><br>ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver<br>
ar71xx-ohci ar71xx-ohci: Atheros AR71xx built-in OHCI controller<br>ar71xx-ohci ar71xx-ohci: new USB bus registered, assigned bus number 1<br>ar71xx-ohci ar71xx-ohci: irq 3, io mem 0x1b000000<br>usb usb1: configuration #1 chosen from 1 choice<br>
hub 1-0:1.0: USB hub found<br>hub 1-0:1.0: 1 port detected<br>usbcore: registered new interface driver usbserial<br>USB Serial support registered for generic<br>usbcore: registered new interface driver usbserial_generic<br>
usbserial: USB Serial Driver core<br>Initializing USB Mass Storage driver...<br>usbcore: registered new interface driver usb-storage<br>USB Mass Storage support registered.<br>usb 1-1: new full speed USB device using ar71xx-ohci and address 2<br>
USB Serial support registered for cp210x<br>usbcore: registered new interface driver cp210x<br>cp210x: v0.09:Silicon Labs CP210x RS232 serial adaptor driver<br>USB Serial support registered for pl2303<br>usbcore: registered new interface driver pl2303<br>
pl2303: Prolific PL2303 USB to serial adaptor driver<br>usb 1-1: configuration #1 chosen from 1 choice<br>cp210x 1-1:1.0: cp210x converter detected<br>usb 1-1: reset full speed USB device using ar71xx-ohci and address 2<br>
usb 1-1: cp210x converter now attached to ttyUSB0<br>......<br>-----------------------------------------------------------------------------------------------------------------------------------------<br><br>When I open ttyUSB0 for communication, debug messages are<br>
<br>-----------------------------------------------------------------------------------------------------------------------------------------<br>#dmesg<br>...<br>drivers/usb/serial/usb-serial.c: serial_install<br>drivers/usb/serial/usb-serial.c: serial_open - port 0<br>
drivers/usb/serial/cp210x.c: cp210x_open - port 0<br>drivers/usb/serial/cp210x.c: cp210x_get_termios_port - port 0<br>drivers/usb/serial/cp210x.c: cp210x_get_termios_port - baud rate = 115200<br>drivers/usb/serial/cp210x.c: cp210x_get_termios_port - data bits = 8<br>
drivers/usb/serial/cp210x.c: cp210x_get_termios_port - parity = NONE<br>drivers/usb/serial/cp210x.c: cp210x_get_termios_port - stop bits = 1<br>drivers/usb/serial/cp210x.c: cp210x_get_termios_port - flow control = NONE<br>
drivers/usb/serial/cp210x.c: cp210x_tiocmset_port - port 0<br>drivers/usb/serial/cp210x.c: cp210x_tiocmset_port - control = 0x0303<br>.....<br><br>-----------------------------------------------------------------------------------------------------------------------------------------<br>
<br>The debug messages I get when I send data from external device to developemnt board,<br><br>-----------------------------------------------------------------------------------------------------------------------------------------<br>
#demesg<br>....<br>drivers/usb/serial/usb-serial.c: serial_write_room - port 0<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]<br>
drivers/usb/serial/usb-serial.c: serial_write_room - port 0<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]<br>
drivers/usb/serial/usb-serial.c: serial_write_room - port 0<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]<br>
drivers/usb/serial/usb-serial.c: serial_write_room - port 0<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]<br>
drivers/usb/serial/usb-serial.c: serial_write_room - port 0<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]<br>
drivers/usb/serial/usb-serial.c: serial_write_room - port 0<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]<br>
drivers/usb/serial/usb-serial.c: serial_write_room - port 0<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]<br>
drivers/usb/serial/usb-serial.c: serial_write_room - port 0<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]<br>
drivers/usb/serial/usb-serial.c: usb_serial_port_work - port 0<br>drivers/usb/serial/usb-serial.c: usb_serial_port_work - port 0<br>drivers/usb/serial/usb-serial.c: serial_write_room - port 0<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]<br>
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]<br>drivers/usb/serial/usb-serial.c: serial_write_room - port 0<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]<br>
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]<br>drivers/usb/serial/usb-serial.c: serial_write_room - port 0<br>drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [5E]<br>
drivers/usb/serial/usb-serial.c: serial_write - port 0, 1 byte(s) data [40]<br>drivers/usb/serial/usb-serial.c: usb_serial_port_work - port 0<br>drivers/usb/serial/usb-serial.c: usb_serial_port_work - port 0<br>drivers/usb/serial/usb-serial.c: usb_serial_port_work - port 0<br>
-----------------------------------------------------------------------------------------------------------------------------------------<br><br><br>Program to read data from ttyUSB0, running on development board<br>-----------------------------------------------------------------------------------------------------------------------------------------<br>
int main(void)<br>{<br><br> int UartFd;<br> char ReadData[30];<br> int ReturnVal;<br><br> UartFd = open("/dev/ttyUSB0", O_RDONLY);<br> if ( UartFd < 0 )<br> {<br> perror("Open");<br>
}<br> else<br> {<br> printf("Uart_Fd: %d\r\n", UartFd);<br> }<br><br> memset(ReadData, 0, sizeof(ReadData));<br><br> ReturnVal = read(UartFd, ReadData, sizeof(ReadData));<br>
if ( ReturnVal < 0 )<br> {<br> perror("Read");<br> }<br> else<br> {<br> printf("ReturnVal: %d\r\n", ReturnVal);<br><br> int i;<br>
for(i = 0; i < ReturnVal; i++)<br> printf(" %2X ", ReadData[i]);<br> }<br><br> close(UartFd);<br><br> return 0;<br>}<br>-----------------------------------------------------------------------------------------------------------------------------------------<br>
<br>My program didn't print any data on terminal.<br>Is any body help me how to debug this issue, what is the problem.<br>Thanks in advance,<br><br><br>Thanks,<br>Paras<br><br>