LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

msk demodulation

Iam trying to do MSK demodulation on GSM signals like

checkWarn (ModtMSKDemodulate (
                mtSession,  resampledT0,resampledDt,  resampledWavefrom, numResampledWaveform,  enableDifferentialEncoding, samplesPerSymbol,  NULL, matchedFilterCoefficents,
                numMatchedFilterCoefficients, PulseShapingFilterCoefficients,  numPulseShapingFilterCoefficients,  reset, &mskRecoveredDataLength, &mskDemodulatedDataLength,&mskMeasurements));

 Then trying to recover the demodulated bit stream with this function

 if(mskDemodulatedDataLength > oldNumRecoverdBitStream)
	{
		free(recoverdBitStream);
		recoverdBitStream = malloc(mskDemodulatedDataLength * sizeof(unsigned char));
		oldNumRecoverdBitStream = mskDemodulatedDataLength;
	}    
 
    checkWarn (ModtGetRecoveredBitStream ( mtSession,mskDemodulatedDataLength,recoverdBitStream));

 This returns an error message of " Null pointer argument to library function" and surely recoverdBitStream is been returned as NULL. But i try to check where the error is i cant find it since its sister function

	
	if(mskRecoveredDataLength > oldNumRecoveredWaveform)
	{
		free(recoverdWaveform);	
		recoverdWaveform = malloc(mskRecoveredDataLength * sizeof(niComplexNum));
	oldNumRecoveredWaveform = mskRecoveredDataLength;
	}
	
    checkWarn (ModtGetRecoveredComplexWaveform (
         mtSession,&recoverdWaveformT0,&recoverdWaveformDt,mskRecoveredDataLength,recoverdWaveform));

 is giving the likely results.

0 Kudos
Message 1 of 17
(6,032 Views)

To add on something to my question.the following variables are returning this values.

mskDemodulatedDataLength=495

oldNumRecoverdBitStream=1048238066

 

I think there is a problem here as "mskDemodulatedDataLength > oldNumRecoverdBitStream" is not realistic here.

Why could thisbe returning obnoxious oldNumRecoverdBitStream value?

0 Kudos
Message 2 of 17
(6,006 Views)

Greetings,

 

Where is oldNumRecoveredBitStream initialized? In your function, you make your comparison and write to the variable, but where is it getting its initial value from?

 

Regards,

 

Brandon V.

Applications Engineer

National Instruments 

0 Kudos
Message 3 of 17
(5,983 Views)

i have it initialized as

 

int  oldNumRecoverdBitStream = 0;

 

Thanks

0 Kudos
Message 4 of 17
(5,962 Views)

Can you find anywhere in your code other than what you've shared where that variable is written to? I don't see it in any of the code you've provided.

0 Kudos
Message 5 of 17
(5,946 Views)

I have not used it anywhere else apart from initialization and what i have shared so far in my code.

Funnily if i reverse the operator to less than "<" as below, it gives me an output for recoverdBitStream while mskDemodulatedDataLength =495 and oldNumRecoverdBitStream=495 at breakpoint. This is not correct as oldNumRecoverdBitStream gets values from mskDemodulatedDataLength thus operator should be ">". Am stuck as to why this variables behaves this way.

if(mskDemodulatedDataLength < oldNumRecoverdBitStream)
	{
		free(recoverdBitStream);
		recoverdBitStream = malloc(mskDemodulatedDataLength * sizeof(unsigned char));
		oldNumRecoverdBitStream = mskDemodulatedDataLength;
	}

 Secondly the function " ModtGetRecoveredBitStream()" as per the modulation toolkit is supposed to return char of 1's & 0's, How do you cast unsigned char (recoverdBitStream) to char possiby to achieve this?

 

Thanks.

0 Kudos
Message 6 of 17
(5,925 Views)

Have you tried the ModAcc example in the GSM toolkit? This should exemplify the way these functions work. In regards to your last post, switching the operator to < instead of > yields expected behavior as the if statement will execute and reassign the value of oldNumRecoverdBitStream. As for your second question:

 

"is supposed to return char of 1's & 0's, How do you cast unsigned char (recoverdBitStream) to char"

 

I'm not sure I understand what you're asking. Do you mean it's supposed to return a char array? And do ou mean unsigned int to char?

0 Kudos
Message 7 of 17
(5,891 Views)

The ModAcc example in the GSM toolkit gives me the following error "-311398:Failed to detect TSC in ModAcc measurement", why could this be while examples like niGSMMeasureORFS just return values ok although what am trying to do is demodulating the captured signals.

 

Secondly in the modulation manual, the function "int ModtGetRecoveredBitStream (ModtHandle handle, int numRecoveredBitStreamElements, unsigned char recoveredBitStream[]);" is supposed to return a char array of bits (1's & 0's), my output variable is  unsigned char recoveredBitStream[]. How do i cast this to return the char array?

 

Thanks.

0 Kudos
Message 8 of 17
(5,870 Views)

Hi waciuri,

 

I did a bit of research on the error you're receiving when running the ModAcc example, it looks like this error can occur if TSC is specified wrong or if TSC Detection Enabled is set to False.  In regards to your second question, would you mind posting a screenshot of the help page you're looking at?  I'm having some trouble getting the documentation to show up.

 

I should also mention that you may want to post this question to the RF page as well. I can help you with CVI-related issues, but I am not as well versed with this toolkit.

 

Thanks,

 

Myriam D.

Applications Engineer

National Instruments

0 Kudos
Message 9 of 17
(5,850 Views)

Hi Myriam,

I have tried with all TSC from TSC0.... and TSC detection enabled been true but i still get the same error.

 

Also i have attached the screenshot of the manual page.

 

Thanks.

0 Kudos
Message 10 of 17
(5,837 Views)