Hello all,
I've connected the device to a power supply, but it seems to do nothing: no
leds light up until I plug the USB cable in, and the behaviour is the same as
with no power attached.

To check deeper for USB drivers issues, I've reflashed my Fox with a 2.4.31
kernel (with USB serial debug turned on) and compiled the CP2101 driver as a
module; it loads without apparent problems:

------------------------------------------------------------------------------
usbserial.c: USB Serial support registered for CP2101/CP2102/CP2103  
USB to UART Bridge
cp2101.c: Silicon Labs CP2101/CP2102/CP2103 RS232 serial adaptor driver v0.11
------------------------------------------------------------------------------

When I plug in the device, the output is promising:
------------------------------------------------------------------------------
hub.c: port 1, portstatus 1, change 1, 12 Mb/s
hub.c: port 1 connection change
hub.c: port 1, portstatus 1, change 1, 12 Mb/s
hub.c: port 1, portstatus 1, change 0, 12 Mb/s
hub.c: port 1, portstatus 1, change 0, 12 Mb/s
hub.c: port 1, portstatus 1, change 0, 12 Mb/s
hub.c: port 1, portstatus 1, change 0, 12 Mb/s
usb-host.c: USB controller running.
hub.c: port 1, portstatus 3, change 10, 12 Mb/s
hub.c: new USB device ETRAX 100LX-1, assigned address 2
usb.c: kmalloc IF c0df6e00, numif 1
usb.c: new device strings: Mfr=1, Product=2, SerialNumber=3
usb.c: USB device number 2 default language ID 0x409
Manufacturer: Silicon Labs
Product: CP2101 USB to UART Bridge Controller
SerialNumber: 0001
usbserial.c: descriptor matches
usbserial.c: found bulk out
usbserial.c: found bulk in
usbserial.c: CP2101/CP2102/CP2103 USB to UART Bridge converter detected
usbserial.c: get_free_serial 1
usbserial.c: get_free_serial - minor base = 0
usbserial.c: usb_serial_probe - setting up 1 port structures for this device
usbserial.c: CP2101/CP2102/CP2103 USB to UART Bridge converter now  
attached to ttyUSB0 (or usb/tts/0 for devfs)
usb.c: serial driver claimed interface c0df6e00
hub.c: port 2, portstatus 0, change 0, 12 Mb/s
------------------------------------------------------------------------------

So, I can now start my program: it opens the interface correctly, but hangs
when reading. Here's the functions I use for driving the UART:

------------------------------------------------------------------------------
int tty_open(char* tty_dev) {
   struct termios new_attributes;
   tty_fd = open(tty_dev,O_RDWR| O_NOCTTY);
   if (tty_fd<0) { return -1; }
   tcgetattr(tty_fd,&tty_saved_attributes);
   bzero(&new_attributes, sizeof(new_attributes));
   new_attributes.c_cflag = CREAD | B19200 | CS8 | CLOCAL;
   new_attributes.c_iflag = IGNPAR;
   new_attributes.c_oflag = 0;
   new_attributes.c_lflag = ~(ICANON) & ~(ECHO) & ~(ECHOE) & ~(ISIG);
   new_attributes.c_cc[VMIN]=1;
   new_attributes.c_cc[VTIME]=0;
   tcflush(tty_fd, TCIFLUSH);
   tcsetattr(tty_fd, TCSANOW, &new_attributes);
   return tty_fd;
}
int tty_write(char *buffer, int len){ return write(tty_fd,buffer,len); }
char tty_getc(){ char c; read(tty_fd,&c,1); return c; }
void tty_close(){
  if (tty_fd>0) tcsetattr(tty_fd,TCSANOW,&tty_saved_attributes);
  close(tty_fd);
}
------------------------------------------------------------------------------

The output from dmesg is the following:
------------------------------------------------------------------------------
usbserial.c: serial_open
cp2101.c: cp2101_open - port 0
cp2101.c: cp2101_get_termios - port 0
cp2101.c: cp2101_get_termios - baud rate = 115200
cp2101.c: cp2101_get_termios - data bits = 8
cp2101.c: cp2101_get_termios - parity = NONE
cp2101.c: cp2101_get_termios - stop bits = 1
cp2101.c: cp2101_get_termios - flow control = NONE
cp2101.c: cp2101_tiocmset - port 0
cp2101.c: cp2101_tiocmset - control = 0x0303
usbserial.c: serial_ioctl - port 0, cmd 0x5401
cp2101.c: cp2101_ioctl (0) cmd = 0x5401
cp2101.c: cp2101_ioctl not supported = 0x5401
usbserial.c: serial_ioctl - port 0, cmd 0x540b
cp2101.c: cp2101_ioctl (0) cmd = 0x540b
cp2101.c: cp2101_ioctl not supported = 0x540b
usbserial.c: serial_ioctl - port 0, cmd 0x5402
cp2101.c: cp2101_ioctl (0) cmd = 0x5402
cp2101.c: cp2101_ioctl not supported = 0x5402
usbserial.c: serial_set_termios - port 0
cp2101.c: cp2101_set_termios - port 0
cp2101.c: cp2101_set_termios - Setting baud rate to 19200 baud
usbserial.c: serial_ioctl - port 0, cmd 0x5401
cp2101.c: cp2101_ioctl (0) cmd = 0x5401
cp2101.c: cp2101_ioctl not supported = 0x5401
usbserial.c: __serial_write - port 0, 4 byte(s)
usbserial.c: generic_write - port 0 [4]
usbserial.c: generic_write_bulk_callback - port 0
usbserial.c: port_softint - port 0
------------------------------------------------------------------------------

and my program just hangs on a tty_getc().

Is there anything obvious that I'm missing?

Thanks in advance for your help,

Ant9000

Reply via email to