Re: [ivtv-devel] Data Sheet for Samsung TCPN2221P30A Tuner

2006-10-21 Thread Hans Verkuil
On Saturday 21 October 2006 00:40, Eric Paynter wrote:
> On Thu, October 19, 2006 2:35 pm, Eric Paynter said:
> > Right now, on channel 19 (151.25MHz) tuner 1 has loads of static -
> > picture is barely discernable, but on the same channel, tuner 2 is
> > near perfect. Nearby channels (17, 18, 20, 21), are all near
> > perfect on both tuners. On the channels in the 40's (above 300MHz),
> > tuner 1 has mild crosshatching and tuner 2 has strong
> > crosshatching, so in that range, I'd say tuner 1 is better.
> >
> > I'm going to play with various combinations of the "+4" in the
> > different frequency ranges to see what effect that has.
>
> OK, I did some poking around and have some questions:
>
> - Is there any way to detect the current signal strength and
> determine automatically if the Low Noise Amplifier needs to be
> enabled for a particular channel?

For PAL: yes, for NTSC: possibly (see below)

> - Is there any way to detect the current signal strength and vary the
> strength of the Low Noise Amplifier to achieve the optimum signal?

No.

>
> I bought an external amplifier and did some tests, which yielded some
> interesting results. I chose three channels that tend to give me
> trouble and I tested with no amp, with the internal amp, with the
> external amp, and with both amps. Results were:
>
> Channel 19: the external amp alone gave the best picture.
> Channel 45: the internal amp alone gave the best picture.
> Channel 9: using no amp gave the best picture on Tuner 2, but on
> Tuner 1, it was best with the internal amp.
>
> Both amps combined always yielded a very bad picture, which makes me
> think that too much amplification is overdriving the tuner. If it was
> possible to know when amplicification was needed per channel, perhaps
> the internal would be sufficient. If the internal could be varied,
> then even better.

90% of all tuners are similar to the Philips tuners (FM1236/FM1216 
series). Generally the only differences are the precise frequency 
boundaries between the three frequency bands and how to select the 
correct band. The Samsung TCPN2221P30A is no exception and the only 
special thing about the NTSC tuner is that bit 2 of the Band Switch 
Byte controls the Low Noise Amplifier.

Nothing else is mentioned about the LNA in the datasheet.

The datasheet for the Samsung TCPG6221P30A (the PAL version) is a bit 
more verbose. Again, it follows the standard tuner model, except for 
the LNA bit. However, in the appendix there is a LNA On/Off flow chart 
which shows when to turn the bit on or off. It uses the ADC value which 
are bits 0-2 of the tuner status byte.

The algorithm is as follows:

LNA=0
loop {
   read ADC
   if (ADC == 4) {
  LNA=1
   }
   else if (LNA == 1 && ADC <= 2) {
  LNA=0
   }
}

I've tested with this in the past, but with confusing results. However, 
those tests were done by by someone else who had this PAL tuner and not 
by me personally, so something may have gone wrong there. But it is 
something that you can try and see what happens.

I've no idea if it is valid for the NTSC tuner as well (I expect it is, 
but I'm not sure). And even if it does work for the NTSC tuner I've no 
idea how to implement it in the kernel: no other tuner needs such 
monitoring. 

BTW, I find the 'ADC == 4' test suspicious. I'd expect ADC >= 4 there. 
Something to test as well.

Anyway, that's all the Samsung-specific stuff from the datasheets. 
Everything else is standard tuner programming.

Hope this helps,

Hans

___
ivtv-devel mailing list
ivtv-devel@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-devel


Re: [ivtv-devel] Data Sheet for Samsung TCPN2221P30A Tuner

2006-10-20 Thread Eric Paynter
On Thu, October 19, 2006 2:35 pm, Eric Paynter said:
> Right now, on channel 19 (151.25MHz) tuner 1 has loads of static - picture
> is barely discernable, but on the same channel, tuner 2 is near perfect.
> Nearby channels (17, 18, 20, 21), are all near perfect on both tuners. On
> the channels in the 40's (above 300MHz), tuner 1 has mild crosshatching
> and tuner 2 has strong crosshatching, so in that range, I'd say tuner 1 is
> better.
>
> I'm going to play with various combinations of the "+4" in the different
> frequency ranges to see what effect that has.

OK, I did some poking around and have some questions:

- Is there any way to detect the current signal strength and determine
automatically if the Low Noise Amplifier needs to be enabled for a
particular channel?
- Is there any way to detect the current signal strength and vary the
strength of the Low Noise Amplifier to achieve the optimum signal?

I bought an external amplifier and did some tests, which yielded some
interesting results. I chose three channels that tend to give me trouble
and I tested with no amp, with the internal amp, with the external amp,
and with both amps. Results were:

Channel 19: the external amp alone gave the best picture.
Channel 45: the internal amp alone gave the best picture.
Channel 9: using no amp gave the best picture on Tuner 2, but on Tuner 1,
it was best with the internal amp.

Both amps combined always yielded a very bad picture, which makes me think
that too much amplification is overdriving the tuner. If it was possible
to know when amplicification was needed per channel, perhaps the internal
would be sufficient. If the internal could be varied, then even better.

-Eric


___
ivtv-devel mailing list
ivtv-devel@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-devel


Re: [ivtv-devel] Data Sheet for Samsung TCPN2221P30A Tuner

2006-10-19 Thread Eric Paynter
On Thu, October 19, 2006 12:33 pm, Hans Verkuil said:
> What sort of problems do you have? If it is noisy, then it is the signal
> quality and I suggest you try an amplifier. I have also seen reports of
> a 'herringbone' pattern that disappears when the '+4' is removed. The
> PAL datasheet has a flowchart that shows when to set the bit (although
> I had very confusing test results and it is not implemented at the
> moment). No such chart is present in the NTSC datasheet, but perhaps a
> similar thing is needed. However, the test for that is easy: remove
> the '+4' and if that doesn't improve things, then you can be sure that
> the tuner code is correct.

Hmmm... I added the "+4" because without it one of the tuners barely
worked at all - just  static. I think it was tuner 1. I had the
herringbone/crosshatching in the upper channels before I added the +4 and
it's still there.

Right now, on channel 19 (151.25MHz) tuner 1 has loads of static - picture
is barely discernable, but on the same channel, tuner 2 is near perfect.
Nearby channels (17, 18, 20, 21), are all near perfect on both tuners. On
the channels in the 40's (above 300MHz), tuner 1 has mild crosshatching
and tuner 2 has strong crosshatching, so in that range, I'd say tuner 1 is
better.

I'm going to play with various combinations of the "+4" in the different
frequency ranges to see what effect that has.

-Eric


___
ivtv-devel mailing list
ivtv-devel@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-devel


Re: [ivtv-devel] Data Sheet for Samsung TCPN2221P30A Tuner

2006-10-19 Thread Hans Verkuil
On Thursday 19 October 2006 18:38, Eric Paynter wrote:
> On Wed, October 18, 2006 2:41 pm, Hans Verkuil said:
> > Kernel 2.6.18 contains full support for the tuner based on the
> > datasheets (a bit called the 'Low Noise Amplifier' had to be set).
> > Older kernels did not set that bit and so have poor quality.
>
> Is this the same bit that I posted a patch for 2.6.17 kernels a few
> months ago? Looked something like this:

Yes, it is.

>
>
> --- tuner-types.c   2006-08-27 10:52:28.0 -0700
> +++ tuner-types.c.patched   2006-08-27 10:53:05.0 -0700
> @@ -995,9 +995,9 @@
>  /*  TUNER_SAMSUNG_TCPN_2121P30A - Samsung NTSC
>  */
>
>  static struct tuner_range tuner_samsung_tcpn_2121p30a_ntsc_ranges[]
> = { -   { 16 * 130.00 /*MHz*/, 0xce, 0x01, },
> -   { 16 * 364.50 /*MHz*/, 0xce, 0x02, },
> -   { 16 * 999.99, 0xce, 0x08, },
> +   { 16 * 130.00 /*MHz*/, 0xce, 0x01+4, },
> +   { 16 * 364.50 /*MHz*/, 0xce, 0x02+4, },
> +   { 16 * 999.99, 0xce, 0x08+4, },
>  };
>
>
>
> Anyhow, just to be sure I wasn't missing anything, I upgraded to
> 2.6.18 and ivtv 0.8.0. It didn't seem to change anything.

What sort of problems do you have? If it is noisy, then it is the signal 
quality and I suggest you try an amplifier. I have also seen reports of 
a 'herringbone' pattern that disappears when the '+4' is removed. The 
PAL datasheet has a flowchart that shows when to set the bit (although 
I had very confusing test results and it is not implemented at the 
moment). No such chart is present in the NTSC datasheet, but perhaps a 
similar thing is needed. However, the test for that is easy: remove 
the '+4' and if that doesn't improve things, then you can be sure that 
the tuner code is correct.

>
> > better than what's offered by the 2.6.18 kernel is unlikely to
> > happen. It should be equivalent to what the Windows driver does.
>
> You never know what a different set of eyes might discover. Isn't the
> whole philosophy of open source software that we all work together to
> achieve a better result?

I was asked not to redistribute the datasheet, so I won't. The code is 
open source, but the datasheet isn't.

Regards,

Hans

>
> Thanks,
>
> -Eric
>
>
> ___
> ivtv-devel mailing list
> ivtv-devel@ivtvdriver.org
> http://ivtvdriver.org/mailman/listinfo/ivtv-devel

___
ivtv-devel mailing list
ivtv-devel@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-devel


Re: [ivtv-devel] Data Sheet for Samsung TCPN2221P30A Tuner

2006-10-19 Thread Eric Paynter
On Wed, October 18, 2006 2:41 pm, Hans Verkuil said:
> Kernel 2.6.18 contains full support for the tuner based on the
> datasheets (a bit called the 'Low Noise Amplifier' had to be set).
> Older kernels did not set that bit and so have poor quality.

Is this the same bit that I posted a patch for 2.6.17 kernels a few months
ago? Looked something like this:


--- tuner-types.c   2006-08-27 10:52:28.0 -0700
+++ tuner-types.c.patched   2006-08-27 10:53:05.0 -0700
@@ -995,9 +995,9 @@
 /*  TUNER_SAMSUNG_TCPN_2121P30A - Samsung NTSC  */

 static struct tuner_range tuner_samsung_tcpn_2121p30a_ntsc_ranges[] = {
-   { 16 * 130.00 /*MHz*/, 0xce, 0x01, },
-   { 16 * 364.50 /*MHz*/, 0xce, 0x02, },
-   { 16 * 999.99, 0xce, 0x08, },
+   { 16 * 130.00 /*MHz*/, 0xce, 0x01+4, },
+   { 16 * 364.50 /*MHz*/, 0xce, 0x02+4, },
+   { 16 * 999.99, 0xce, 0x08+4, },
 };



Anyhow, just to be sure I wasn't missing anything, I upgraded to 2.6.18
and ivtv 0.8.0. It didn't seem to change anything.


> better than what's offered by the 2.6.18 kernel is unlikely to
> happen. It should be equivalent to what the Windows driver does.

You never know what a different set of eyes might discover. Isn't the
whole philosophy of open source software that we all work together to
achieve a better result?

Thanks,

-Eric


___
ivtv-devel mailing list
ivtv-devel@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-devel


Re: [ivtv-devel] Data Sheet for Samsung TCPN2221P30A Tuner

2006-10-18 Thread Hans Verkuil
On Wednesday 18 October 2006 23:06, Eric Paynter wrote:
> On Wed, October 18, 2006 1:26 pm, Hans Verkuil said:
> > On Wednesday 18 October 2006 20:25, Eric Paynter wrote:
> >> Several months ago, Ryan P ([EMAIL PROTECTED]) posted to this
> >> list that he had the data sheet for the Samsung TCPN2221P30A Tuner
> >> and if anybody wanted it, let him know. Well, I did. No response.
> >> Does anybody else have it?
> >
> > I have it (given to me by someone else), but I was asked not to
> > give it to others. Is there anything specific that you want to
> > know?
>
> Well, I'm entirely unhappy with the amount of static and other
> interference in the image that my PVR-500 is producing. At the same
> time, the image my TV produces using its own tuner is near perfect.
> There is no reason why the PVR-500 can't do as well (unless the
> TCPN2221P30A is just a crappy tuner). So,  I'm looking to see if I
> can find any way to tweak the tuner to improve its reception.

Kernel 2.6.18 contains full support for the tuner based on the 
datasheets (a bit called the 'Low Noise Amplifier' had to be set). 
Older kernels did not set that bit and so have poor quality. But even 
with that bit set you have to realize that the signal is split over two 
tuners, so that in itself reduces the signal quality. You may need an 
antenna amplifier. Also in my experience the quality of the PVR500 is 
less than a PVR350/250/150, even with amplifier. Your mileage may vary, 
though.

Anyway, better than what's offered by the 2.6.18 kernel is unlikely to 
happen. It should be equivalent to what the Windows driver does.

Regards,

Hans

___
ivtv-devel mailing list
ivtv-devel@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-devel


Re: [ivtv-devel] Data Sheet for Samsung TCPN2221P30A Tuner

2006-10-18 Thread Eric Paynter
On Wed, October 18, 2006 1:26 pm, Hans Verkuil said:
> On Wednesday 18 October 2006 20:25, Eric Paynter wrote:
>> Several months ago, Ryan P ([EMAIL PROTECTED]) posted to this list
>> that he had the data sheet for the Samsung TCPN2221P30A Tuner and if
>> anybody wanted it, let him know. Well, I did. No response. Does
>> anybody else have it?
>
> I have it (given to me by someone else), but I was asked not to give it
> to others. Is there anything specific that you want to know?

Well, I'm entirely unhappy with the amount of static and other
interference in the image that my PVR-500 is producing. At the same time,
the image my TV produces using its own tuner is near perfect. There is no
reason why the PVR-500 can't do as well (unless the TCPN2221P30A is just a
crappy tuner). So,  I'm looking to see if I can find any way to tweak the
tuner to improve its reception.

-Eric


___
ivtv-devel mailing list
ivtv-devel@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-devel


Re: [ivtv-devel] Data Sheet for Samsung TCPN2221P30A Tuner

2006-10-18 Thread Hans Verkuil
On Wednesday 18 October 2006 20:25, Eric Paynter wrote:
> Several months ago, Ryan P ([EMAIL PROTECTED]) posted to this list
> that he had the data sheet for the Samsung TCPN2221P30A Tuner and if
> anybody wanted it, let him know. Well, I did. No response. Does
> anybody else have it?

I have it (given to me by someone else), but I was asked not to give it 
to others. Is there anything specific that you want to know?

Hans

___
ivtv-devel mailing list
ivtv-devel@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-devel