Skip to contentSkip to conversation

stb0899 and tt s2-3200

linux-dvb Newsy Paper 6 participants 12 messages Oct 9, 2008 – Oct 10, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

I have Alex Betis' + Ales Jurik's patch running with liplianindvb, but still the same problem with those DVB-S2 8PSK transponders.

--- Alex Betis <[email protected]> schrieb am Do, 9.10.2008:

Quoted 87 lines

Von: Alex Betis <[email protected]>
Betreff: Re: [linux-dvb] [vdr] stb0899 and tt s2-3200
An: [email protected]
CC: [email protected]
Datum: Donnerstag, 9. Oktober 2008, 15:58
I will try that patch together with mine soon. Will update with results.

Quoted 2 lines · Ales Jurik
Quoted 1 line · On Thursday 09 of October 2008, Goga777 wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

it's not working with SR

30000 FEC 3/4 dvb-s2 8PSK, still the

Quoted 9 lines

same

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

problem.

kind regards

Newsy

It seems that patch from

http://www.linuxtv.org/pipermail/linux-dvb/2008-July/027264.htmlis

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

not applied. The internal PLL must

be disabled when setting new

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

frequency as is written in stb6100

documentation.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

has your July-patch any relation with

stb0899 patches from Alex Betis

Quoted 3 lines

?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

http://www.linuxtv.org/pipermail/linux-dvb/2008-October/029455.html

Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

http://www.linuxtv.org/pipermail/linux-dvb/2008-September/029361.html

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Goga

I don't think so as Alex's patches

are for demodulator (stb0899) but my

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

was for tuner (stb6100).

Regarding stb6100 doc the tuning procedure

should be:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

1. Disable PLL (LPEN_LPEN)
2. Set-up the tuner
3. Start PLL
4. Start VCO search
5. Wait for 5 ms
6. Disable VCO search, turn off VCO search

clock and disable LPF BW

Quoted 3 lines

clock

Quoted 2 lines
Quoted 2 lines

The steps 1-5 should be done in 5 steps (not

less) and as I remeber

Quoted 2 lines

I've

Quoted 1 line
Quoted 1 line

got better result when inserting small delay

between steps 1 and 2 and

Quoted 1 line
Quoted 1 line
Quoted 1 line

the delay from step 5 was set to 10ms. In

stb6100.c are steps 1 and 2

Quoted 1 line
Quoted 1 line
Quoted 1 line

done together within 1 write to stb6100

registers and this seems to be

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

not optimal for some modulations.

that's why TT3200 owners have to try both

patches together - from you and

Quoted 5 lines
Quoted 3 lines

from Alex Betis ? is it correct ?

Goga

Yes, I think so, but now I'm not able to test it

as I don't have the TT

Quoted 1 line

S2-3200 more in my PC. If nobody will be able to test

it I'll try to do it

Quoted 10 lines

this weekend.

Regards,

Ales

_______________________________________________
linux-dvb mailing list
[email protected]

Quoted 6 lines

http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

Quoted 1 line

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#1 lore raw
Quoted 4 lines · Newsy Paper

I have Alex Betis' + Ales Jurik's patch running with liplianindvb, but still the same problem with those DVB-S2 8PSK transponders.

Same here. Although I see improvements on signal lock. With Ales's tuner changes the signal is constantly found on all S2 transponders I've cheched, FEC is locked and dropped very fast (that gives the result of bad or no image).
Now we need someone with scope and logic on stb0899 chip :) This time I'll be happy to receive stb0899 documentation.

Thanks Ales, one step to the right direction!

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#2 lore raw

cheched = checked :)

Typing too fast...

Since tuner lock is more reliable, I'll try to remove some of my workarounds on DVB-S search algorithm.

Quoted 7 lines · Alex Betis
Quoted 4 lines · Newsy Paper

I have Alex Betis' + Ales Jurik's patch running with liplianindvb, but still the same problem with those DVB-S2 8PSK transponders.

Quoted 9 lines

Same here. Although I see improvements on signal lock. With Ales's tuner changes the signal is constantly found on all S2 transponders I've cheched, FEC is locked and dropped very fast (that gives the result of bad or no image).
Now we need someone with scope and logic on stb0899 chip :) This time I'll be happy to receive stb0899 documentation.

Thanks Ales, one step to the right direction!

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#3 lore raw

the STB0899 (and STB6100) code in the Twinhan Linux drivers is different:

http://www.twinhan.com/files/AW/Linux/AZLinux_v1.4.2_CI_FC6.tar.gz

most of the files don't have copyright notice, but in one of the files there is "Copyright STMicroelectronics".

so, maybe Twinhan Linux drivers include the reference STB0899 and STB6100 code from STMicroelectronics.

2008/10/9 Alex Betis <[email protected]>:

Quoted 24 lines

cheched = checked :)

Typing too fast...

Since tuner lock is more reliable, I'll try to remove some of my workarounds on DVB-S search algorithm.

Quoted 15 lines · Alex Betis
Quoted 4 lines · Newsy Paper

I have Alex Betis' + Ales Jurik's patch running with liplianindvb, but still the same problem with those DVB-S2 8PSK transponders.

Same here. Although I see improvements on signal lock. With Ales's tuner changes the signal is constantly found on all S2 transponders I've cheched, FEC is locked and dropped very fast (that gives the result of bad or no image).
Now we need someone with scope and logic on stb0899 chip :) This time I'll be happy to receive stb0899 documentation.

Quoted 8 lines
Quoted 1 line

Thanks Ales, one step to the right direction!

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#4 lore raw

btw looking with hex editor in the TT S2-3200 Windows drivers (ttbudget2.sys) shows that the STB0899 function names are the same as in stb0899_chip.c from the Twinhan Linux drivers, which makes me convinced that the code in the Twinhan Linux drivers is really the reference Microelectronics code for STB0899 and STB6100ST on which the Technotrend Windows drivers are based.

Quoted 4 lines · Konstantin Dimitrov

the STB0899 (and STB6100) code in the Twinhan Linux drivers is different:

http://www.twinhan.com/files/AW/Linux/AZLinux_v1.4.2_CI_FC6.tar.gz

Quoted 40 lines

most of the files don't have copyright notice, but in one of the files there is "Copyright STMicroelectronics".

so, maybe Twinhan Linux drivers include the reference STB0899 and STB6100 code from STMicroelectronics.

2008/10/9 Alex Betis <[email protected]>:

Quoted 32 lines

cheched = checked :)

Typing too fast...

Since tuner lock is more reliable, I'll try to remove some of my workarounds on DVB-S search algorithm.

Quoted 8 lines · Alex Betis
Quoted 4 lines · Newsy Paper

I have Alex Betis' + Ales Jurik's patch running with liplianindvb, but still the same problem with those DVB-S2 8PSK transponders.

Quoted 8 lines

Same here. Although I see improvements on signal lock. With Ales's tuner changes the signal is constantly found on all S2 transponders I've cheched, FEC is locked and dropped very fast (that gives the result of bad or no image).
Now we need someone with scope and logic on stb0899 chip :) This time I'll be happy to receive stb0899 documentation.

Thanks Ales, one step to the right direction!

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#5 lore raw

Приветствую, Konstantin

Quoted 6 lines

btw looking with hex editor in the TT S2-3200 Windows drivers (ttbudget2.sys) shows that the STB0899 function names are the same as in stb0899_chip.c from the Twinhan Linux drivers, which makes me convinced that the code in the Twinhan Linux drivers is really the reference Microelectronics code for STB0899 and STB6100ST on which the Technotrend Windows drivers are based.

have you good results with 8psk SR=30 000 channels on windows drivers ?

Goga

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#6 lore raw
Quoted 9 lines · On Thu, Oct 9, 2008 at 7:53 PM, Goga777 <[email protected]> wrote:

Приветствую, Konstantin

Quoted 6 lines

btw looking with hex editor in the TT S2-3200 Windows drivers (ttbudget2.sys) shows that the STB0899 function names are the same as in stb0899_chip.c from the Twinhan Linux drivers, which makes me convinced that the code in the Twinhan Linux drivers is really the reference Microelectronics code for STB0899 and STB6100ST on which the Technotrend Windows drivers are based.

have you good results with 8psk SR=30 000 channels on windows drivers ?

can't test that, because i don't have S2-3200 anymore...

Quoted 7 lines

Goga

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#7 lore raw
In reply to Goga777

I have two channels with 8psk SR 30000 and it is working well on windows WDM drivers.

Regards,

Quoted 8 lines · On Thu, Oct 9, 2008 at 8:23 PM, Goga777 <[email protected]> wrote:

Приветствую, Konstantin

Quoted 6 lines

btw looking with hex editor in the TT S2-3200 Windows drivers (ttbudget2.sys) shows that the STB0899 function names are the same as in stb0899_chip.c from the Twinhan Linux drivers, which makes me convinced that the code in the Twinhan Linux drivers is really the reference Microelectronics code for STB0899 and STB6100ST on which the Technotrend Windows drivers are based.

Quoted 9 lines

have you good results with 8psk SR=30 000 channels on windows drivers ?

Goga

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#9 lore raw

2008/10/10 Igor M. Liplianin <[email protected]>:

Quoted 4 lines

В сообщении от 9 October 2008 19:26:51 Konstantin Dimitrov написал(а):

Quoted 1 line

http://www.twinhan.com/files/AW/Linux/AZLinux_v1.4.2_CI_FC6.tar.gz

Really amazing link!

i heard that there is another stb0899 code from the following email, all credits about that goes to its author:

http://www.linuxtv.org/pipermail/linux-dvb/2008-September/028584.html

Quoted 4 lines

--
Igor M. Liplianin

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#10 lore raw
In reply to Igor M. Liplianin

Did anyone was able to compile that Azurewave driver?

I've used it for Twinhan 1027 card, but I had to merge everything manually into recent kernel files. Don't have time to do the same in order to test it with 1041 card (stb0899).

I've tried to perform the same operations in mantis code for S2 search as its written in Azureware driver code, but was unable to lock on any channels at all. I'll try to revise the code again, maybe I've missed something...

2008/10/10 Igor M. Liplianin <[email protected]>

Quoted 5 lines

В сообщении от 9 October 2008 19:26:51 Konstantin Dimitrov написал(а):

Quoted 1 line

http://www.twinhan.com/files/AW/Linux/AZLinux_v1.4.2_CI_FC6.tar.gz

Really amazing link!

Quoted 8 lines

--
Igor M. Liplianin

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#11 lore raw
In reply to Alex Betis

Attached are my changes with removed workaround to perform several attempts on the same frequency since Ales's tuner changes solved the real problem. This should provide faster lock (don't think it will be noticeable). The diffs are from clean tree.

Please check.

Quoted 29 lines · Alex Betis

cheched = checked :)

Typing too fast...

Since tuner lock is more reliable, I'll try to remove some of my workarounds on DVB-S search algorithm.

Quoted 16 lines · Alex Betis
Quoted 4 lines · Newsy Paper

I have Alex Betis' + Ales Jurik's patch running with liplianindvb, but still the same problem with those DVB-S2 8PSK transponders.

Same here. Although I see improvements on signal lock. With Ales's tuner changes the signal is constantly found on all S2 transponders I've cheched, FEC is locked and dropped very fast (that gives the result of bad or no image).
Now we need someone with scope and logic on stb0899 chip :) This time I'll be happy to receive stb0899 documentation.

Thanks Ales, one step to the right direction!

stb0899_algo.c renamed from media/storage/Download/dvb/mantis-303b1d29d735/linux/drivers/media/dvb/frontends/stb0899_algo.c +137 -17
@@ -203,8 +203,6 @@
 static enum stb0899_status stb0899_search_tmg(struct stb0899_state *state)
 {
 	struct stb0899_internal *internal = &state->internal;
-	struct stb0899_params *params = &state->params;
-
 	short int derot_step, derot_freq = 0, derot_limit, next_loop = 3;
 	int index = 0;
 	u8 cfr[2];
@@ -213,12 +211,18 @@
 
 	/* timing loop computation & symbol rate optimisation	*/
 	derot_limit = (internal->sub_range / 2L) / internal->mclk;
-	derot_step = (params->srate / 2L) / internal->mclk;
+	derot_step = internal->derot_step * 4;
+
+	dprintk(state->verbose, FE_DEBUG, 1, "limit = %d, step = %d, mclk = %d", 
+		derot_limit, derot_step, internal->mclk);
 
 	while ((stb0899_check_tmg(state) != TIMINGOK) && next_loop) {
-		index++;
+
 		derot_freq += index * internal->direction * derot_step;	/* next derot zig zag position	*/
 
+		dprintk(state->verbose, FE_DEBUG, 1, "index = %d, derot_freq = %d, limit = %d, direction = %d, step = %d", 
+		index, derot_freq, derot_limit, internal->direction, derot_step);
+	
 		if (ABS(derot_freq) > derot_limit)
 			next_loop--;
 
@@ -227,6 +231,8 @@
 			STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq));
 			stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency		*/
 		}
+
+		index++;
 		internal->direction = -internal->direction;	/* Change zigzag direction		*/
 	}
 
@@ -275,14 +281,21 @@
 {
 	struct stb0899_internal *internal = &state->internal;
 
-	short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 3;
+	short int derot_freq = 0, last_derot_freq = 0, derot_limit, derot_step, next_loop = 3;
 	int index = 0;
+	int base_freq;
 	u8 cfr[2];
 	u8 reg;
 
 	internal->status = NOCARRIER;
 	derot_limit = (internal->sub_range / 2L) / internal->mclk;
 	derot_freq = internal->derot_freq;
+	derot_step = internal->derot_step * 2;
+	last_derot_freq = internal->derot_freq;
+	base_freq = internal->derot_freq;
+
+	dprintk(state->verbose, FE_DEBUG, 1, "freq = %d, limit = %d, step = %d, mclk = %d", 
+		derot_freq, derot_limit, derot_step, internal->mclk);
 
 	reg = stb0899_read_reg(state, STB0899_CFD);
 	STB0899_SETFIELD_VAL(CFD_ON, reg, 1);
@@ -291,11 +304,16 @@
 	do {
 		dprintk(state->verbose, FE_DEBUG, 1, "Derot Freq=%d, mclk=%d", derot_freq, internal->mclk);
 		if (stb0899_check_carrier(state) == NOCARRIER) {
-			index++;
+
 			last_derot_freq = derot_freq;
-			derot_freq += index * internal->direction * internal->derot_step; /* next zig zag derotator position	*/
+			derot_freq += index * internal->direction * derot_step; /* next zig zag derotator position	*/
 
-			if(ABS(derot_freq) > derot_limit)
+
+			dprintk(state->verbose, FE_DEBUG, 1, "index = %d, derot_freq = %d, limit = %d, step = %d", 
+		index, derot_freq, derot_limit, derot_step);
+
+			// Alex: should limit based on initial base freq
+			if(derot_freq > base_freq + derot_limit || derot_freq < base_freq - derot_limit)
 				next_loop--;
 
 			if (next_loop) {
@@ -307,9 +325,10 @@
 				STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq));
 				stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency	*/
 			}
-		}
 
+			index++;
 		internal->direction = -internal->direction; /* Change zigzag direction	*/
+		}
 	} while ((internal->status != CARRIEROK) && next_loop);
 
 	if (internal->status == CARRIEROK) {
@@ -335,16 +354,22 @@
 	int lock = 0, index = 0, dataTime = 500, loop;
 	u8 reg;
 
+	// Alex: added sleep 5 mSec
+	msleep(5);
+
 	internal->status = NODATA;
 
 	/* RESET FEC	*/
 	reg = stb0899_read_reg(state, STB0899_TSTRES);
 	STB0899_SETFIELD_VAL(FRESACS, reg, 1);
 	stb0899_write_reg(state, STB0899_TSTRES, reg);
-	msleep(1);
+	// Alex: changed from 1 to 5 mSec
+	msleep(5);
 	reg = stb0899_read_reg(state, STB0899_TSTRES);
 	STB0899_SETFIELD_VAL(FRESACS, reg, 0);
 	stb0899_write_reg(state, STB0899_TSTRES, reg);
+	// Alex: added 5 mSec
+	msleep(5);
 
 	if (params->srate <= 2000000)
 		dataTime = 2000;
@@ -357,6 +382,9 @@
 
 	stb0899_write_reg(state, STB0899_DSTATUS2, 0x00); /* force search loop	*/
 	while (1) {
+		// Alex: added 1 mSec
+		msleep(1);
+
 		/* WARNING! VIT LOCKED has to be tested before VIT_END_LOOOP	*/
 		reg = stb0899_read_reg(state, STB0899_VSTATUS);
 		lock = STB0899_GETFIELD(VSTATUS_LOCKEDVIT, reg);
@@ -384,20 +412,29 @@
 	short int derot_freq, derot_step, derot_limit, next_loop = 3;
 	u8 cfr[2];
 	u8 reg;
-	int index = 1;
+	int index = 0;
+	int base_freq;
 
 	struct stb0899_internal *internal = &state->internal;
-	struct stb0899_params *params = &state->params;
 
-	derot_step = (params->srate / 4L) / internal->mclk;
+	derot_step = internal->derot_step;
 	derot_limit = (internal->sub_range / 2L) / internal->mclk;
 	derot_freq = internal->derot_freq;
+	base_freq = internal->derot_freq;
+
+	dprintk(state->verbose, FE_DEBUG, 1, "limit = %d, step = %d, mclk = %d", 
+		derot_limit, derot_step, internal->mclk);
 
 	do {
 		if ((internal->status != CARRIEROK) || (stb0899_check_data(state) != DATAOK)) {
 
 			derot_freq += index * internal->direction * derot_step;	/* next zig zag derotator position	*/
-			if (ABS(derot_freq) > derot_limit)
+
+			dprintk(state->verbose, FE_DEBUG, 1, "index = %d, derot_freq = %d, limit = %d, direction = %d, step = %d", 
+			index, derot_freq, derot_limit, internal->direction, derot_step);
+
+			// Alex: should limit based on initial base freq
+			if(derot_freq > base_freq + derot_limit || derot_freq < base_freq - derot_limit)
 				next_loop--;
 
 			if (next_loop) {
@@ -411,9 +448,10 @@
 				stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency	*/
 
 				stb0899_check_carrier(state);
-				index++;
 			}
 		}
+
+		index++;
 		internal->direction = -internal->direction; /* change zig zag direction		*/
 	} while ((internal->status != DATAOK) && next_loop);
 
@@ -551,6 +589,10 @@
 
 	/* Initial calculations	*/
 	internal->derot_step = internal->derot_percent * (params->srate / 1000L) / internal->mclk; /* DerotStep/1000 * Fsymbol	*/
+
+	dprintk(state->verbose, FE_DEBUG, 1, "Derot step=%d",
+		internal->derot_step);
+
 	internal->t_derot = stb0899_calc_derot_time(params->srate);
 	internal->t_data = 500;
 
@@ -748,6 +790,17 @@
 	reg = STB0899_READ_S2REG(STB0899_S2DEMOD, SOF_SRCH_TO);
 	STB0899_SETFIELD_VAL(SOF_SEARCH_TIMEOUT, reg, config->sof_search_timeout);
 	stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_SOF_SRCH_TO, STB0899_OFF0_SOF_SRCH_TO, reg);
+
+	dprintk(state->verbose, FE_DEBUG, 1, "esno_ave = %d", config->esno_ave);
+	dprintk(state->verbose, FE_DEBUG, 1, "esno_quant = %d", config->esno_quant);
+	dprintk(state->verbose, FE_DEBUG, 1, "uwp_threshold_sof = %d", config->uwp_threshold_sof);
+	dprintk(state->verbose, FE_DEBUG, 1, "av_frame_coarse = %d", internal->av_frame_coarse);
+	dprintk(state->verbose, FE_DEBUG, 1, "av_frame_fine = %d", internal->av_frame_fine);
+	dprintk(state->verbose, FE_DEBUG, 1, "miss_threshold = %d", config->miss_threshold);
+	dprintk(state->verbose, FE_DEBUG, 1, "uwp_threshold_acq = %d", config->uwp_threshold_acq);
+	dprintk(state->verbose, FE_DEBUG, 1, "uwp_threshold_track = %d", config->uwp_threshold_track);
+	dprintk(state->verbose, FE_DEBUG, 1, "sof_search_timeout = %d", config->sof_search_timeout);
+
 }
 
 /*
@@ -844,6 +897,8 @@
 	dec_ratio = (dec_ratio == 0) ? 1 : dec_ratio;
 	dec_rate = Log2Int(dec_ratio);
 
+	dprintk(state->verbose, FE_DEBUG, 1, "dec_ratio %d, dec_rate %d", dec_ratio, dec_rate);
+
 	win_sel = 0;
 	if (dec_rate >= 5)
 		win_sel = dec_rate - 4;
@@ -857,6 +912,8 @@
 	else
 		band_lim = 0;	/* band limit signal going into btr block*/
 
+	dprintk(state->verbose, FE_DEBUG, 1, "decim %d, f_sym %d, master_clk %d, srate %d, band_lim %d", decim, f_sym, internal->master_clk, internal->srate, band_lim);
+
 	decim_cntrl = ((win_sel << 3) & 0x18) + ((band_lim << 5) & 0x20) + (dec_rate & 0x7);
 	stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_DECIM_CNTRL, STB0899_OFF0_DECIM_CNTRL, decim_cntrl);
 
@@ -867,6 +924,8 @@
 	else
 		anti_alias = 2;
 
+	dprintk(state->verbose, FE_DEBUG, 1, "anti_alias %d", anti_alias);
+
 	stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_ANTI_ALIAS_SEL, STB0899_OFF0_ANTI_ALIAS_SEL, anti_alias);
 	btr_nom_freq = stb0899_dvbs2_calc_srate(state);
 	stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_BTR_NOM_FREQ, STB0899_OFF0_BTR_NOM_FREQ, btr_nom_freq);
@@ -879,6 +938,9 @@
 	/* scale UWP+CSM frequency to sample rate*/
 	freq_adj =  internal->srate / (internal->master_clk / 4096);
 	stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_FREQ_ADJ_SCALE, STB0899_OFF0_FREQ_ADJ_SCALE, freq_adj);
+
+	dprintk(state->verbose, FE_DEBUG, 1, "btr_nom_freq %d, correction %d, freq_adj %d", btr_nom_freq, correction, freq_adj);
+
 }
 
 /*
@@ -951,8 +1013,13 @@
 	s32 crl_nom_freq;
 	u32 reg;
 
+	dprintk(state->verbose, FE_DEBUG, 1, "carr_freq = %d, master_clk = %d", carr_freq, master_clk);
+
 	crl_nom_freq = (1 << config->crl_nco_bits) / master_clk;
 	crl_nom_freq *= carr_freq;
+
+	dprintk(state->verbose, FE_DEBUG, 1, "crl_nom_freq = %d", crl_nom_freq);
+
 	reg = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_NOM_FREQ);
 	STB0899_SETFIELD_VAL(CRL_NOM_FREQ, reg, crl_nom_freq);
 	stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_NOM_FREQ, STB0899_OFF0_CRL_NOM_FREQ, reg);
@@ -985,7 +1052,12 @@
 	else
 		step_size = (1 << 17) / 4;
 
-	range = internal->srch_range / 1000000;
+	// Alex: make smaller steps
+	step_size = 100;
+
+	dprintk(state->verbose, FE_DEBUG, 1, "step size %d", step_size);
+
+	range = 10;//Alex: return to: internal->srch_range / 1000000;
 	steps = (10 * range * (1 << 17)) / (step_size * (internal->srate / 1000000));
 	steps = (steps + 6) / 10;
 	steps = (steps == 0) ? 1 : steps;
@@ -996,6 +1068,8 @@
 	else
 		stb0899_dvbs2_set_carr_freq(state, internal->center_freq, (internal->master_clk) / 1000000);
 
+	dprintk(state->verbose, FE_DEBUG, 1, "range %d, steps %d", range, steps);
+
 	/*Set Carrier Search params (zigzag, num steps and freq step size*/
 	reg = STB0899_READ_S2REG(STB0899_S2DEMOD, ACQ_CNTRL2);
 	STB0899_SETFIELD_VAL(ZIGZAG, reg, 1);
@@ -1084,6 +1158,8 @@
 	int time = -10, lock = 0, uwp, csm;
 	u32 reg;
 
+	dprintk(state->verbose, FE_DEBUG, 1, "timeout = %d mSec", timeout);
+
 	do {
 		reg = STB0899_READ_S2REG(STB0899_S2DEMOD, DMD_STATUS);
 		dprintk(state->verbose, FE_DEBUG, 1, "DMD_STATUS=[0x%02x]", reg);
@@ -1102,7 +1177,7 @@
 	} while ((!lock) && (time <= timeout));
 
 	if (lock) {
-		dprintk(state->verbose, FE_DEBUG, 1, "----------------> DVB-S2 LOCK !");
+		dprintk(state->verbose, FE_DEBUG, 1, "----------------> DVB-S2 LOCK ! after %d mSec", time);
 		return DVBS2_DEMOD_LOCK;
 	} else {
 		return DVBS2_DEMOD_NOLOCK;
@@ -1136,6 +1211,8 @@
 {
 	int time = 0, Locked;
 
+	dprintk(state->verbose, FE_DEBUG, 1, "timeout = %d", timeout);
+
 	do {
 		Locked = stb0899_dvbs2_get_data_lock(state, 1);
 		time++;
@@ -1342,6 +1418,11 @@
 		FecLockTime	= 20;	/* 20 ms max time to lock FEC, 20Mbs< SYMB <= 25Mbs		*/
 	}
 
+	searchTime = 5000;
+	FecLockTime = 500;
+
+	dprintk(state->verbose, FE_DEBUG, 1, "srate = %d, searchTime = %d, FecLockTime = %d", internal->srate, searchTime, FecLockTime);
+
 	/* Maintain Stream Merger in reset during acquisition	*/
 	reg = stb0899_read_reg(state, STB0899_TSTRES);
 	STB0899_SETFIELD_VAL(FRESRS, reg, 1);
@@ -1401,12 +1482,18 @@
 			/*	Read the frequency offset*/
 			offsetfreq = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_FREQ);
 
+			dprintk(state->verbose, FE_DEBUG, 1, "1: i = %d, offsetfreq = %d", i, offsetfreq);
+
 			/* Set the Nominal frequency to the found frequency offset for the next reacquire*/
 			reg = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_NOM_FREQ);
 			STB0899_SETFIELD_VAL(CRL_NOM_FREQ, reg, offsetfreq);
 			stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_NOM_FREQ, STB0899_OFF0_CRL_NOM_FREQ, reg);
 			stb0899_dvbs2_reacquire(state);
+
+			msleep(10);
+
 			internal->status = stb0899_dvbs2_get_fec_status(state, searchTime);
+
 			i++;
 		}
 	}
@@ -1412,12 +1499,19 @@
 	}
 
 	if (internal->status != DVBS2_FEC_LOCK) {
+		dprintk(state->verbose, FE_DEBUG, 1, "still no lock, inversion = %d", internal->inversion);
+
 		if (internal->inversion == IQ_SWAP_AUTO) {
+			dprintk(state->verbose, FE_DEBUG, 1, "inversion = IQ_SWAP_AUTO");
+
 			reg = STB0899_READ_S2REG(STB0899_S2DEMOD, DMD_CNTRL2);
 			iqSpectrum = STB0899_GETFIELD(SPECTRUM_INVERT, reg);
 			/* IQ Spectrum Inversion	*/
 			STB0899_SETFIELD_VAL(SPECTRUM_INVERT, reg, !iqSpectrum);
 			stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_DMD_CNTRL2, STB0899_OFF0_DMD_CNTRL2, reg);
+
+			msleep(10);
+
 			/* start acquistion process	*/
 			stb0899_dvbs2_reacquire(state);
 
@@ -1432,13 +1527,19 @@
 					/*	Read the frequency offset*/
 					offsetfreq = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_FREQ);
 
+					dprintk(state->verbose, FE_DEBUG, 1, "2: i = %d, offsetfreq = %d", i, offsetfreq);
+
 					/* Set the Nominal frequency to the found frequency offset for the next reacquire*/
 					reg = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_NOM_FREQ);
 					STB0899_SETFIELD_VAL(CRL_NOM_FREQ, reg, offsetfreq);
 					stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CRL_NOM_FREQ, STB0899_OFF0_CRL_NOM_FREQ, reg);
 
+					msleep(10);
+
 					stb0899_dvbs2_reacquire(state);
+
 					internal->status = stb0899_dvbs2_get_fec_status(state, searchTime);
+
 					i++;
 				}
 			}
@@ -1464,13 +1565,21 @@
 
 			i = 0;
 			while ((internal->status != DVBS2_FEC_LOCK) && (i < 3)) {
+
+				dprintk(state->verbose, FE_DEBUG, 1, "3: i = %d", i);
+
 				csm1 = STB0899_READ_S2REG(STB0899_S2DEMOD, CSM_CNTRL1);
 				STB0899_SETFIELD_VAL(CSM_TWO_PASS, csm1, 1);
 				stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CSM_CNTRL1, STB0899_OFF0_CSM_CNTRL1, csm1);
+
+				msleep(10);
+
 				csm1 = STB0899_READ_S2REG(STB0899_S2DEMOD, CSM_CNTRL1);
 				STB0899_SETFIELD_VAL(CSM_TWO_PASS, csm1, 0);
 				stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CSM_CNTRL1, STB0899_OFF0_CSM_CNTRL1, csm1);
 
+				msleep(10);
+
 				internal->status = stb0899_dvbs2_get_fec_status(state, FecLockTime);
 				i++;
 			}
@@ -1480,6 +1589,8 @@
 		      (INRANGE(STB0899_QPSK_12, modcod, STB0899_QPSK_35)) &&
 		      (pilots == 1)) {
 
+  			dprintk(state->verbose, FE_DEBUG, 1, "Equalizer disable update");
+
 			/* Equalizer Disable update	 */
 			reg = STB0899_READ_S2REG(STB0899_S2DEMOD, EQ_CNTRL);
 			STB0899_SETFIELD_VAL(EQ_DISABLE_UPDATE, reg, 1);
@@ -1491,18 +1602,26 @@
 		STB0899_SETFIELD_VAL(EQ_SHIFT, reg, 0x02);
 		stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_EQ_CNTRL, STB0899_OFF0_EQ_CNTRL, reg);
 
+		msleep(10);
+
 		/* Store signal parameters	*/
 		offsetfreq = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_FREQ);
 
+		dprintk(state->verbose, FE_DEBUG, 1, "offsetfreq from reg = %d", offsetfreq);
+
 		offsetfreq = offsetfreq / ((1 << 30) / 1000);
 		offsetfreq *= (internal->master_clk / 1000000);
 		reg = STB0899_READ_S2REG(STB0899_S2DEMOD, DMD_CNTRL2);
 		if (STB0899_GETFIELD(SPECTRUM_INVERT, reg))
 			offsetfreq *= -1;
 
+		dprintk(state->verbose, FE_DEBUG, 1, "offsetfreq after calc = %d", offsetfreq);
+
 		internal->freq = internal->freq - offsetfreq;
 		internal->srate = stb0899_dvbs2_get_srate(state);
 
+		dprintk(state->verbose, FE_DEBUG, 1, "freq = %d, srate = %d", internal->freq, internal->srate);
+
 		reg = STB0899_READ_S2REG(STB0899_S2DEMOD, UWP_STAT2);
 		internal->modcod = STB0899_GETFIELD(UWP_DECODE_MOD, reg) >> 2;
 		internal->pilots = STB0899_GETFIELD(UWP_DECODE_MOD, reg) & 0x01;
stb0899_drv.c renamed from media/storage/Download/dvb/mantis-303b1d29d735/linux/drivers/media/dvb/frontends/stb0899_drv.c +3 -2
@@ -31,7 +31,7 @@
 #include "stb0899_priv.h"
 #include "stb0899_reg.h"
 
-static unsigned int verbose = 0;//1;
+static unsigned int verbose = 4; // change back to 0
 module_param(verbose, int, 0644);
 
 /* C/N in dB/10, NIRM/NIRL */
@@ -1630,7 +1630,8 @@
 			 *	    10% of the symbol rate
 			 */
 			internal->srch_range	= SearchRange + 1500000 + (i_params->srate / 5);
-			internal->derot_percent	= 30;
+			// Alex: changed from 30
+			internal->derot_percent	= 20;
 
 			/* What to do for tuners having no bandwidth setup ?	*/
 			/* enable tuner I/O */

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb