[V4L] Imagenation PXC200 initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Help,

I am having problems grabbing from an Imagenation PXC200 
frame grabber using the bttv driver. The version I am
using is 0.6.4h under a vanilla linux 2.2.14.

After loading I can open the driver and talk to it - more on
this later, but grabbing invariably yields an all-black 
frame.

This is what I find in /var/log/messages upon module loading.


Dec  3 23:05:07 linux kernel: Linux video capture interface: v0.01 ALPHA
Dec  3 23:05:07 linux kernel: i2c: initialized
Dec  3 23:05:07 linux kernel: bttv0: Brooktree Bt848 (rev 18) bus: 0,
devfn: 80, irq: 11, memory: 0xf78ff000.
Dec  3 23:05:07 linux kernel: PCI: Enabling bus mastering for device
00:50
Dec  3 23:05:07 linux kernel: bttv: 1 Bt8xx card(s) found.
Dec  3 23:05:07 linux kernel: Setting DAC reference voltage level ...
Dec  3 23:05:07 linux kernel: Initialising 12C508 PIC chip ...
Dec  3 23:05:07 linux kernel: I2C Write(0x08) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: I2C Write(0x09) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: I2C Write(0x0a) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: I2C Write(0x0b) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: I2C Write(0x0c) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: I2C Write(0x0d) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: I2C Write(0x01) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: I2C Write(0x02) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: I2C Write(0x03) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: I2C Write(0x04) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: I2C Write(0x05) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: I2C Write(0x06) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: I2C Write(0x00) = 0
Dec  3 23:05:07 linux kernel: I2C Read () = 0
Dec  3 23:05:07 linux kernel: 
Dec  3 23:05:07 linux kernel: PXC200 Initialised.
Dec  3 23:05:07 linux kernel: bttv0: audio chip: TDA9840
Dec  3 23:05:07 linux kernel: bttv0: audio chip: TDA9850
Dec  3 23:05:07 linux kernel: bttv0: audio chip: TDA8425
Dec  3 23:05:07 linux kernel: bttv0: model: BT848A(Imagenation PXC200)


Which is a little strange: shouldn't I2CRead return different
values? Is the board actually initialized corectly here?

I don't have the fb device installed: I am just trying to
grab into memory, not on the screen. The program I use
to talk to the card is as attached at the end. Essentially
it opens the device, checks the capability, sets the channel
and tries to grab via the mmap interface. 

One thing I noticed is that I cannot change the palette from
the default one (RGB565): calling ioctl VIDIOCSPICT with a 
different palette, followed by VIDIOCGPICT, reveals that
nothing has changed.

The camera I use is a cheap NTSC one attached to the
composite input. It all works correctly from windoze (yuck).

This is the lil (C++) prog I use to grab:

int
main(int argc, char * argv[])
{
  int fd = open("/dev/video", O_RDWR);
  if (fd < 0) syserror("open");
 

  int ch = 0;
  rv = ioctl(fd, VIDIOCSCHAN, &ch);
  if (rv < 0) syserror("ioctl VIDIOCSCHAN");
 
  void * start = mmap(0, vm.size / vm.frames, PROT_READ, MAP_SHARED, fd,
0);
  if (start == MAP_FAILED) syserror("mmap");
  
  printf("mapped at 0x%x\n", start);

  struct video_mmap vmm;
  vmm.frame = 0;
  vmm.height = 480;
  vmm.width = 640;
  vmm.format = 3; // RGB565

  // grab the frame and save it as a ppm

  rv = ioctl(fd, VIDIOCMCAPTURE, &vmm);
  if (rv < 0) syserror("ioctl VIDIOCMAPTURE");

  unsigned short * p = (unsigned short *)start;
  unsigned char buf[640*3];

  FILE * fp = fopen("img.ppm", "w");
  if (! fp) { perror("img.ppm"); exit(1); }

  fprintf(fp, "P6\n640 480\n255\n");

  for (int i = 0; i < 480; i++) {
    unsigned char * b = buf;
    for (int j = 0; j < 640; j++) {
      unsigned short pix = *p++;
      *b++ = (unsigned char)(pix & 0x1f);
      *b++ = (unsigned char)((pix >> 5) & 0x3f);
      *b++ = (unsigned char)((pix >> 11) & 0x1f);
    }
    fwrite(buf, 640*3, sizeof(unsigned char), fp);
  }
  fclose(fp);
  
  int fn = 0;
  rv = ioctl(fd, VIDIOCSYNC, &fn);
  if (rv < 0) syserror("ioctl VIDIOCSYNC");
  
  munmap(start, vm.size);
  return 0;
}





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux