LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   glcd + ftdi + usb (http://www.linuxquestions.org/questions/linux-hardware-18/glcd-ftdi-usb-364888/)

tooly 09-19-2005 11:19 AM

glcd + ftdi + usb
 
Hi,

i has the LCD from tilofranz.net/lcdshop

The Display has an ftdi232bm chip to communicate with USB and an S1D13305F for Display.

USB VendorID=0x403 and ProductID=0xe588

I added to ftdio_sio.h and ftdi_sio.c the product ID and recompile the ftdi_sio kernel modul.
Then i add :
BUS="usb", SYSFS{idProduct}="e588", NAME="lcd", SYMLINK="usb/lcd", MODE="0666"
to my udev rules.

Now when i connect the Display dmesg say:

drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI USB Serial Device
ftdi_sio 2-2:1.0: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT232BM
usb 2-2: FTDI USB Serial Device converter now attached to ttyUSB0
usbcore: registered new driver ftdi_sio
drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver

and i has an dev in /dev/usb/lcd


But how can i send some informations to Display?

First i thought that serdisplib can help, but at this time there is no rs232 support.
Then i asked the manufactur if there is any linux library for this display, but the answer was "Not now, maybe later".

Has anyone expirience with this Display in Linux?

My System:
AMD64 3200+, Kernel 2.6.13.1, LFS pure64.

Hope you can read my english ;)

mfg
tooly

tooly 09-25-2005 12:47 PM

Hi again,

i never unterstand how i can send data to the LCD via kernel.

So i conntect the LCD to an windows computer and record the data with usbsnoop (http://benoit.papillaut.free.ft/usbsnoop).

lsusb -v :
Code:

Bus 002 Device 002: ID 0403:e588 Future Technology Devices International, Ltd
Device Descriptor:
  bLength                18
  bDescriptorType        1
  bcdUSB              2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass        0
  bDeviceProtocol        0
  bMaxPacketSize0        8
  idVendor          0x0403 Future Technology Devices International, Ltd
  idProduct          0xe588
  bcdDevice            4.00
  iManufacturer          1 Wallbraun-Elect.
  iProduct                2 LCD-USB-Interface V1
  iSerial                3 WE3EFDQG
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                9
    bDescriptorType        2
    wTotalLength          32
    bNumInterfaces          1
    bConfigurationValue    1
    iConfiguration          0
    bmAttributes        0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                9
      bDescriptorType        4
      bInterfaceNumber        0
      bAlternateSetting      0
      bNumEndpoints          2
      bInterfaceClass      255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 LCD-USB-Interface V1
      Endpoint Descriptor:
        bLength                7
        bDescriptorType        5
        bEndpointAddress    0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type              None
          Usage Type              Data
        wMaxPacketSize    0x0040  1x 64 bytes
        bInterval              0
      Endpoint Descriptor:
        bLength                7
        bDescriptorType        5
        bEndpointAddress    0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type              None
          Usage Type              Data
        wMaxPacketSize    0x0040  1x 64 bytes
        bInterval              0

Next i write this small c program:
Code:

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdio.h>
#include <stdlib.h>

#include <usb.h>

#define USBLCD_VENDOR_ID  0x0403
#define USBLCD_PRODUCT_ID 0xe588

extern int usb_debug;

static usb_dev_handle *lcd;
static int interface;
static char *Buffer;
static char *BufPtr;

int drv_UL_open(void) {

  struct usb_bus *busses, *bus;
  struct usb_device *dev;

  lcd = NULL;

  usb_debug = 0;

  usb_init();
  usb_find_busses();
  usb_find_devices();
  busses = usb_get_busses();

  for (bus = busses; bus; bus = bus->next) {
    for (dev = bus->devices; dev; dev = dev->next) {
      if ((dev->descriptor.idVendor == USBLCD_VENDOR_ID) &&
          (dev->descriptor.idProduct == USBLCD_PRODUCT_ID)) {
        printf ("USB LCD gefunden\n");
        lcd = usb_open(dev);
        if (usb_claim_interface(lcd, interface) < 0) {
          printf ("FEHLER : usb_claim_interface\n");
          return -1;
          }
        else {
          printf ("usb_claim_interface erfolgreich\n");
         
        }
      }
    }
  }
  return -1;
}

int drv_UL_close(void) {
  usb_release_interface (lcd, interface);
  usb_close(lcd);
  printf (" LCD wieder freigegeben\n");
}

int drv_CMD(void) {
  char *cmdBuf, *cmdPtr, *inBuf, *inPtr;
  int rv, i, inrv;

  inBuf = (char *) malloc(1024);
  if (inBuf == NULL) {
    printf ("kann speicher nicht reservieren!\n");
    return -1;
  }
  inrv = usb_bulk_read(lcd, 0x81, inBuf, 1000, 1000);
  printf ("Ergebnis von usb_bulk_read: %d\n", inrv);

  cmdBuf = (char *) malloc(1024);
  if (cmdBuf == NULL) {
    printf ("Kann Speicher für cmd nicht reservieren!\n");
    return -1;
  }

  cmdPtr=cmdBuf;
  *cmdPtr++=0x04;
  *cmdPtr++=0x00;
  *cmdPtr++=0x03;
  *cmdPtr++=0x00;
  *cmdPtr++=0x00;
  *cmdPtr++=0x4c;
  rv=usb_bulk_write (lcd, 0x02, cmdBuf, 6, 1000);
  printf ("ergebnis von usb_bulk_write2 %d\n", rv);

  cmdPtr=cmdBuf;
  *cmdPtr++=0x08;
  *cmdPtr++=0x03;
  *cmdPtr++=0xFD;
  *cmdPtr++=0x54;
  *cmdPtr++=0x68;
  *cmdPtr++=0x65;
  *cmdPtr++=0x6f;
  *cmdPtr++=0x20;
  *cmdPtr++=0x53;
  *cmdPtr++=0x63;
  *cmdPtr++=0x68;
  *cmdPtr++=0x6e;
  *cmdPtr++=0x65;
  *cmdPtr++=0x69;
  *cmdPtr++=0x64;
  *cmdPtr++=0x65;
  *cmdPtr++=0x72;
  for (i=1; i <=1007; ++i) {
    *cmdPtr++=0x20;
  }
  rv=usb_bulk_write (lcd, 0x02, cmdBuf, 1024, 1000);
  printf ("ergebnis von usb_bulk_write3 %d\n", rv);

  inPtr=inBuf;
  for (i=1; i <= inrv; ++i) {
  printf ("Inhalt inBuf %x\n", *inPtr++);
  }

  free (inBuf);
  free (cmdBuf);
}

int main(int argc, char *argv[])
{
  drv_UL_open();
  drv_CMD();
  drv_UL_close();

  return EXIT_SUCCESS;
}

All the program to is, write my name to the LCD.

Take a look at // First DATA to LCD, the second and third byte are the lengt of data that follow, but dont know for what is 0x04 and 0x4f?

// Second DATA to LCD
First byte 0x08 ?
Second and third byte = 0x03FD = lengt of the follow data
rest is easy, my Name and some spaces.

Anyone know for what is 0x04, 0x4f and 0x08?

Hope you can read my english.

mfg
tooly


All times are GMT -5. The time now is 11:38 PM.