06-24-2014 04:50 AM
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.
06-24-2014 07:42 AM
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?
06-25-2014 12:48 PM
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
06-26-2014 03:26 AM - edited 06-26-2014 03:30 AM
i have it initialized as
int oldNumRecoverdBitStream = 0;
Thanks
06-26-2014 10:22 AM
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.
06-27-2014 05:17 AM - edited 06-27-2014 05:19 AM
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.
06-30-2014 11:09 AM
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?
07-01-2014 06:23 AM
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.
07-02-2014 12:42 PM
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
07-03-2014 03:50 AM
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.