Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Mar 1997 17:51:01 -0700
From:      Steve Passe <smp@csn.net>
To:        Randall Hopper <rhh@ct.picker.com>
Cc:        multimedia@freebsd.org
Subject:   Re: bt848 video losing sync 
Message-ID:  <199703230051.RAA15028@Ilsa.StevesCafe.com>
In-Reply-To: Your message of "Sat, 22 Mar 1997 19:13:31 EST." <19970322191331.35902@ct.picker.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

> I don't know if anyone else sees this, but when starting and stopping the
> video on the tuner, every so often (very rarely) it'll sputter, lose
> vertical sync, slip down to 2 or 3 frames a second for a second or two, and
> then just freeze with the VBI band right in the middle of the window.
> 
> Starting/stopping the video doesn't seem to clear it up, but changing
> channels or changing the input device away from and back to tuner does.
> 
> This happens infrequently enough I haven't yet pinned down a complete
> producure for consistently reproducing it, but when it does happen, I've
> been changing channels and (un)zooming the tv window.

I was having a lot of trouble with my STB card loosing sync in the
UHF band only.  I eventually decided the board was bad and returned
it.  I now am using the hauppauge which has no such problems.

-------------------------------------------------------------------------------
While trying to determine the problem I create an ioctl to return
bt848 video input status. bits of interest in the bt848 status would include:

	bit 5: VPRES
	bit 4: HLOCK
	bit 3: OFLOW (bits 7:6 (DSTATUS 1:) tell which)

note that this call returns the accumulated status bits since the last call,
ie. it starts clear, then each interrupt bitwise ORs in the INT_STAT
value for that INTerrupt.  so the data is essentually a map of all INTs that
have occurred since the last read.

	/*
	 * this is the bt848 INT_STAT reg, with bits 1:0 of the
	 *  the bt848 DSTATUS reg (COF & LOF) overlayed onto bits
	 *  7:6 (unused in INT_STAT)
	 */
        if (ioctl(video, BT848_GSTATUS, &x) < 0)
		exit( 1 );
	else
		fprintf(stderr, "bt848 status: 0x%08x\n", x );

-------------------------------------------------------------------------------
when the tuner PLL is in lock bit 6 will be high, and the low 3
bits will be 010 (0x2), with each end of the range being 100 (0x4)
and 000 (0x0).
see the TSA5522 datasheet, p 8 for the table

this ioctl can be called at anytime to see the current PLL status.

	/*
	 * this is the tuner PLL status, good value is 0xfa or 0x7a
	 */
        if (ioctl(video, TVTUNER_GETSTATUS, &x) < 0)
		exit( 1 );
	else
		fprintf(stderr, "tuner status: 0x%02x\n", x );

-------------------------------------------------------------------------------
by comparing the bt848 HLOCK and the PLL lock bit you might gain insite.
remember that the bt848 sees loss of signal and lock when changing
channels, so read (clear) the status after each channel change.

here's my tool for exercising this:

#include <stdio.h>
#include <stdlib.h>
#include <sys/fcntl.h>
#include <unistd.h>
#include <errno.h>

#define TUNER
#include <machine/ioctl_meteor.h>
#include <machine/ioctl_bt848.h>

void
byebye( int fd )
{
	fprintf( stderr, "ioctl failed: %s\n", strerror(errno) );
	close( fd );
	exit( 1 );
}


main(int ac, char **av)
{
	int x, ch;
        char s[ 128 ];
	int video;

	if ((video = open("/dev/bktr0", O_RDONLY)) < 0) {
		byebye( video );
	}

	fputs( "\n > ", stdout );
	while ( fgets( s, 100, stdin ) )
	{
		switch ( s[0] )
                {
		/* clear colorbars */
		case 'b':
		        if (ioctl(video, BT848_CCBARS, &x) < 0)
				byebye( video );
			break;

		/* display colorbars */
		case 'B':
		        if (ioctl(video, BT848_SCBARS, &x) < 0)
				byebye( video );
			break;

		/* get current RAW freq & tuner status */
                case 'f':
		        if (ioctl(video, TVTUNER_GETFREQ, &x) < 0)
				byebye( video );
			else
				fprintf(stderr, "frequency: %d\n", x );

		        if (ioctl(video, TVTUNER_GETSTATUS, &x) < 0)
				byebye( video );
			else
				fprintf(stderr, "status: 0x%02x\n", x );
			break;

		/* set RAW frequency */
                case 'F':
			x = strtol( &s[ 2 ], NULL, 10 );
			fprintf( stderr, "freq: %d\n", x );
		        if (ioctl(video, TVTUNER_SETFREQ, &x) < 0)
				byebye( video );

			sleep( 1 );
		        if (ioctl(video, TVTUNER_GETSTATUS, &x) < 0)
				byebye( video );
			else
				fprintf(stderr, "status: 0x%02x\n", x );
			break;

		/* get bt848 & tuner status */
                case 's':
			x = 0;
		        if (ioctl(video, BT848_GSTATUS, &x) < 0)
				byebye( video );
			else
				fprintf(stderr, "bt848 status: 0x%08x\n", x );

		        if (ioctl(video, TVTUNER_GETSTATUS, &x) < 0)
				byebye( video );
			else
				fprintf(stderr, "tuner status: 0x%02x\n", x );
			break;

		/* set a channel */
                default:
			x = atoi( s );
		        if (ioctl(video, TVTUNER_SETCHNL, &x) < 0)
				byebye( video );
                }
		fputs( "\n > ", stdout );
        }

bybye:
	close(video);
	exit(0);
}

--
Steve Passe	| powered by
smp@csn.net	|            Symmetric MultiProcessor FreeBSD




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703230051.RAA15028>