Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

NI-6250 stops acquisition in RTX 64bit

Hello,

 

I am using DDK Samples for analog measurement with NI-6232 and NI-6250 PCI cards in a Windows 7 / RTX environment.

 

Recently we upgraded to RTX64-bit and compiled our driver for 64bit environment. We now have a problem with the 6250 card ... for some time (from 3 seconds up to 140 seconds in various tests) data acquisition works fine, but then it seems like the card suddenly stops measurement. Debugging suggests that there might be some problem with DMA data transfer, since I can see that the buffer is no longer filled (in function _getBytesInBuffer() /  _writeIdx is no longer changed). Other than that, I currently  have no idea what might cause a problem like this.

 

The 6232 card however works just fine in 64-bit, with the exact same driver / system setup.

 

Both cards work fine with the same driver in a 32-bit environment.

 

Any idea what might cause this problem?

 

0 Kudos
Message 1 of 15
(6,306 Views)

Hi reini1981,

 

Are you trying to run an example or custom code? If you are running an example, which one are you trying? If you have custom code, would you be able to post it here?

Steven K.
National Instruments
DAQ Software Engineer
0 Kudos
Message 2 of 15
(6,246 Views)
		Analog_DebugInfo("vInitAdcUnit \n");

		tDMAError status = kNoError;
		tBoolean continuous = kTrue; // continous data-aquisition
		unsigned int i = 0;		// temp variable
		unsigned int uiGain = 0;		// Analog-Input range
		unsigned int uiDmaSizeInBytes = 0;
		unsigned int uiSamplePeriodDivisor = 100;  // 20 MHz / divisor = Wandlungsrate
		const unsigned int kEepromSize = 1024;
		u8 eepromMemory[kEepromSize];//  read eeprom for calibration information

		// EEPROM read should be done before initializing analog input
		eepromReadMSeries(s_NIPCIBoards[CardNumber].bus, eepromMemory, kEepromSize);

		// Reset board and set Card-Specific parameters
		aiReset(s_NIPCIBoards[CardNumber].board);
		if (s_NIPCIBoards[CardNumber].deviceType == NIPCI6250_DEVICE_ID)
		{
			aiPersonalize(s_NIPCIBoards[CardNumber].board, tMSeries::tAI_Output_Control::kAI_CONVERT_Output_SelectActive_Low);
			uiGain = 1;	// See gain-range map in file "ai.h"
		}
		else if (s_NIPCIBoards[CardNumber].deviceType == NIPCI6232_DEVICE_ID)
		{
			aiPersonalize(s_NIPCIBoards[CardNumber].board, tMSeries::tAI_Output_Control::kAI_CONVERT_Output_SelectActive_High);
			uiGain = 0; // See gain-range map in file "ai.h"
		}
		aiClearFifo(s_NIPCIBoards[CardNumber].board);


		// ADC reset only applies to 625x boards
		if (s_NIPCIBoards[CardNumber].deviceType == NIPCI6250_DEVICE_ID)
		{
			adcReset(s_NIPCIBoards[CardNumber].board);
		}

		// ---- Start AI task ----

		aiDisarm(s_NIPCIBoards[CardNumber].board);
		aiClearConfigurationMemory(s_NIPCIBoards[CardNumber].board);

		s_NIPCIBoards[CardNumber].NumberOfUsedAnalogChannels = 0;

		// Loop over all analog channels
		for (i = 0; i < s_NIPCIBoards[CardNumber].analogChannels; i++)
		{
			if (fGetMessGroupAktiv(Index, i + (CardNumber * NIPCI62XX_MAX_ANALOG_CHANNELS)))
			{
				s_NIPCIBoards[CardNumber].usedChannelList[i] = 1;
			}
			else
			{
				s_NIPCIBoards[CardNumber].usedChannelList[i] = 0;
			}

			if (fGetPrintDebugInfo())
				RtPrintf("Set Channel %d - %d to gain %d \n", i, i + (CardNumber * NIPCI62XX_MAX_ANALOG_CHANNELS), uiGain);

			// Set Analog Channel
			aiConfigureChannel(s_NIPCIBoards[CardNumber].board,
				i,  // channel number
				uiGain,  // gain -- check ai.h for allowed values
				tMSeries::tAI_Config_FIFO_Data&colon;:kAI_Config_PolarityBipolar, // Bipolar -> signed values
				tMSeries::tAI_Config_FIFO_Data&colon;:kAI_Config_Channel_TypeRSE,  // Differential
				(i == s_NIPCIBoards[CardNumber].lastChannel) ? kTrue : kFalse); // last channel must be terminated specifically

			s_NIPCIBoards[CardNumber].NumberOfUsedAnalogChannels++;
			/*
			}
			*/
		}

		for (i = 0; i < s_NIPCIBoards[CardNumber].analogChannels; i++)
		{
			if (fGetPrintDebugInfo())
			{
				if (s_NIPCIBoards[CardNumber].usedChannelList[i] == 1)
					RtPrintf("Channel %d used \n", i);
				else
					RtPrintf("Channel %d not used \n", i);
			}
		}

		aiGetRawScalingCoefficients(eepromMemory, 0, 0, 0, &RawScaleCoeff);  // intervalIdx    0 -> +/- 10V

		if (fGetPrintDebugInfo())
		{
			RtPrintf("Gain:      %f  \n", RawScaleCoeff.fGain);
			RtPrintf("Offset:    %f  \n", RawScaleCoeff.fOffset);
			RtPrintf("kFact:     %f  \n", RawScaleCoeff.kFact);
			RtPrintf("HighLimit: %.8x  \n", RawScaleCoeff.highLimit);
			RtPrintf("LowLimit:  %.8x  \n", RawScaleCoeff.lowLimit);
		}

		/*	if(fGetPrintDebugInfo())
		{
		RtPrintf(" Order:  %d  c[2]: %d c[1]: %d  c[0]:%d \n", ScaleCoeff.order  ,(int)(ScaleCoeff.c[2] * 1000) ,(int)( ScaleCoeff.c[1] * 1000) , (int)(ScaleCoeff.c[0]*1000) );
		}
		*/

		// No need to continue if there are no used channels
		if (s_NIPCIBoards[CardNumber].NumberOfUsedAnalogChannels == 0)
			return;

		// Set Card Frequency
		if (s_NIPCIBoards[CardNumber].deviceType == NIPCI6232_DEVICE_ID)
		{
			// On 6232 Card use fix sampling rate of 200k
			uiSamplePeriodDivisor = NIPCI6232_SAMPLE_PERIOD_DIVISOR;
			uiNumberOfSamples = 1;
			uiNumberOfDMABlocks = 2;
		}
		else
		{
			if (uiActiveSlowCard)
			{
				//When there is a slow card in the system, scanrate is limited
				if (uiRequestedScanrate >= NIPCI62XX_FAST_SAMPLING_RATE)
				{
					uiRequestedScanrate = NIPCI62XX_FAST_SAMPLING_RATE;
					Analog_DebugInfo("Active Slow Card found - reducing max sampling rate \n");
				}
			}

			if (uiRequestedScanrate > NIPCI62XX_FAST_SAMPLING_RATE)
			{
				// Highspeed mode, calculate sampling rate
				uiSamplePeriodDivisor = NIPCI62XX_MAX_FREQUENCY / (s_NIPCIBoards[CardNumber].NumberOfUsedAnalogChannels * uiRequestedScanrate);
				uiSamplePeriodDivisor = NIPCI6250_MAX_SAMPLE_PERIOD_DIVISOR;
			}
			else
			{
				// Normal mode -> fixed 1000kHz sampling rate
				uiSamplePeriodDivisor = NIPCI6250_MAX_SAMPLE_PERIOD_DIVISOR;
			}

			// On 6250 sampling rate depends on channel and scanrate		
			uiNumberOfSamples = uiRequestedScanrate / NIPCI62XX_FAST_SAMPLING_RATE; // TEST !!!!!!!!
			uiNumberOfDMABlocks = NIPCI62XX_NO_OF_SAMPLES;
			//		uiNumberOfSamples		= uiRequestedScanrate / NIPCI62XX_FAST_SAMPLING_RATE * 2 ; // TEST !!!!!!!!
			//		uiNumberOfSamples		= uiRequestedScanrate / NIPCI62XX_FAST_SAMPLING_RATE ;

			// Error checking
			//if(uiSamplePeriodDivisor > NIPCI6250_MAX_SAMPLE_PERIOD_DIVISOR)
			//	uiSamplePeriodDivisor = NIPCI6250_MAX_SAMPLE_PERIOD_DIVISOR;

			if (uiNumberOfSamples <= 1)
				uiNumberOfSamples = 1;
		}

		if (fGetPrintDebugInfo())
		{
			RtPrintf("Sample Period Divisor: %d \n", uiSamplePeriodDivisor);
			RtPrintf("Sample Rate:           %d Hz\n", NIPCI62XX_MAX_FREQUENCY / uiSamplePeriodDivisor);
			RtPrintf("Number of Samples:     %d \n", uiNumberOfSamples);
			RtPrintf("Number of DMA Blocks:  %d \n", uiNumberOfDMABlocks);
		}

		// Configure Analog Input
		aiSetFifoRequestMode(s_NIPCIBoards[CardNumber].board);

		aiEnvironmentalize(s_NIPCIBoards[CardNumber].board);

		aiHardwareGating(s_NIPCIBoards[CardNumber].board);

		aiTrigger(s_NIPCIBoards[CardNumber].board,
			tMSeries::tAI_Trigger_Select::kAI_START1_SelectPulse,
			tMSeries::tAI_Trigger_Select::kAI_START1_PolarityRising_Edge,
			tMSeries::tAI_Trigger_Select::kAI_START2_SelectPulse,
			tMSeries::tAI_Trigger_Select::kAI_START2_PolarityRising_Edge);

		aiSampleStop(s_NIPCIBoards[CardNumber].board,
			(s_NIPCIBoards[CardNumber].NumberOfUsedAnalogChannels > 1) ? kTrue : kFalse); // multi channel?

		aiNumberOfSamples(s_NIPCIBoards[CardNumber].board,
			0,      // posttrigger samples
			0,      // pretrigger samples
			continuous); // continuous?

		aiSampleStart(s_NIPCIBoards[CardNumber].board,
			uiSamplePeriodDivisor,
			3,
			tMSeries::tAI_START_STOP_Select::kAI_START_SelectSI_TC,
			tMSeries::tAI_START_STOP_Select::kAI_START_PolarityRising_Edge);

		aiConvert(s_NIPCIBoards[CardNumber].board,
			19,     // convert period divisor
			3,     // convert delay divisor 
			kFalse); // external sample clock?

		aiClearFifo(s_NIPCIBoards[CardNumber].board);

		/* DMA Settings */

		/* Calculate DMA-Size */
		uiDmaSizeInBytes = s_NIPCIBoards[CardNumber].NumberOfUsedAnalogChannels * sizeof(unsigned short)* (uiNumberOfDMABlocks);
		s_NIPCIBoards[CardNumber].uiDmaRequestSizeInBytes = s_NIPCIBoards[CardNumber].NumberOfUsedAnalogChannels * 2;

		if (fGetPrintDebugInfo())
		{
			RtPrintf("DMA Size: %d bytes \n", uiDmaSizeInBytes);
			RtPrintf("DMA Request Size: %d bytes \n", s_NIPCIBoards[CardNumber].uiDmaRequestSizeInBytes);
		}

		/* Enable dMA */
		s_NIPCIBoards[CardNumber].board->AI_AO_Select.setAI_DMA_Select(1);
		s_NIPCIBoards[CardNumber].board->AI_AO_Select.flush();

		status = s_NIPCIBoards[CardNumber].dma->config(0, tDMAChannel::kRing, tDMAChannel::kIn, uiDmaSizeInBytes, tDMAChannel::k16bit);

		if (status != kNoError)
		{
			if (fGetPrintDebugInfo())
				RtPrintf("Error: dma configuration (%d)\n", status);
		}

		status = s_NIPCIBoards[CardNumber].dma->start();
		if (status != kNoError)
		{
			if (fGetPrintDebugInfo())
				RtPrintf("Error: dma start (%d)\n", status);
		}
		else
		{
			/* Start Measurement here */
			aiArm(s_NIPCIBoards[CardNumber].board, kTrue);
			aiStart(s_NIPCIBoards[CardNumber].board);

			if (fGetPrintDebugInfo())
				RtPrintf("Starting Board & DMA \n");
		}

 

Hello,

 

sorry it took so long, but I had to setup a new workstation dedicated for debugging this problem. The code above is the entire initialization of the AI measurement. It's based on the aiex3 sample for continuous measurement and DMA data transfer.

 

I also have some new information regard the error: On my new test system I am not able to reproduce this the error with PCI-6250 stopping the acquisition. I now have two PC Systems where one shows the problem, the other does not. I will investigate further.

 

Previously I said the PCI-6232 card does not show any error, but this is not true. I noticed that on 64-bit modes the AI channels are mixed up. Example: I am measuring 16 channels, and have a 1kHz sinus on channel 1 ... in the acquired data i see the sinus on channels 4, 8 and 12. Again, the code is exactly the same that works fine when compiled for 32-bit.

0 Kudos
Message 3 of 15
(6,200 Views)

I used the unchanged aiex1 and aiex3 examples today to see if the problem lies in my own code or not.

The result is slightly different ... measurement values are always 0xffff.

 

Are the DDK examples 64-bit ready, or is it possible that the code has never been tested on a 64-bit system?

0 Kudos
Message 4 of 15
(6,182 Views)

Hello,

 

Did you ever find a solution to this?

John O'C
Staff Test Systems Engineer
Woodward, Inc.
Skokie, Illinois, USA

"Life is not a journey to the grave with the intention of arriving safely
in a pretty and well preserved body, but rather to skid in broadside,
thoroughly used up, totally worn out, and loudly proclaiming...
Wow...What a Ride!"
0 Kudos
Message 5 of 15
(1,940 Views)

Hello John,

 

are you having the same problem?

 

Our solution was to use measurement cards from a different manufacturer. We did work on this for some time, but the NI Support eventually claimed that 64-bit RTX/OS was never the intended use case for the card and they could not help us.

 

Best regards

 

0 Kudos
Message 6 of 15
(1,924 Views)

Was it an issue with the card or an issue with using RTX64 with LabWindows?

 

I have 5 systems that I will be upgrading. The old systems use NI Cards, NI Measurement Studio for the GUI, RTX, and Visual Studio as the development environment.

 

The upgrade is going to use newer NI Cards, NI Measurement Studio for the GUI, RTX64, and Visual Studio as the development environment. I want to determine where the conflict lies. RTX worked fine with the NI cards our systems are about 15 years old. Is the conflict between LabWindows and RTX64, or is it between RTX64 and the cards?

 

Are you using LabWindows? I looked back and don't see that mentioned. I am wondering why I thought you were using LabWindows?

John O'C
Staff Test Systems Engineer
Woodward, Inc.
Skokie, Illinois, USA

"Life is not a journey to the grave with the intention of arriving safely
in a pretty and well preserved body, but rather to skid in broadside,
thoroughly used up, totally worn out, and loudly proclaiming...
Wow...What a Ride!"
0 Kudos
Message 7 of 15
(1,919 Views)

We never used LabWindows or any other NI Software (except for the DDK/RTX Samples). This was a driver developed for a specific customer who has his own measurement software. The driver was developed based on the Samples provided by NI for RTX operating systems a couple of years back.

 

It did work fine on Windows/RTX 32-bit machines for years and we only encountered the problem after switching to RTX64.The problem did also occur with the unaltered NI/DDK Samples (i think we used aiex3), so we were able to rule out the cause being our driver or the customer's measurement application.

 

I assume that something inside the NI-Driver/Samples is not RTX/64-bit compatible, but we never found out what it was. I had a lot of communication with NI Support who tried to reproduce the problem. In the end, they realized they had no RTX64 license and refused to buy one. Maybe it is a good idea to contact support again, since its now three years later and RTX64 is pretty much standar, so they might have that license now.

0 Kudos
Message 8 of 15
(1,908 Views)

Thank you for the information. What cards did you end up using instead?

John O'C
Staff Test Systems Engineer
Woodward, Inc.
Skokie, Illinois, USA

"Life is not a journey to the grave with the intention of arriving safely
in a pretty and well preserved body, but rather to skid in broadside,
thoroughly used up, totally worn out, and loudly proclaiming...
Wow...What a Ride!"
0 Kudos
Message 9 of 15
(1,903 Views)

Hi Reini,

where can I find the driver for RTX64 und PCI-6250, especially the lib-Files?

 

Thank you

 

Xie

0 Kudos
Message 10 of 15
(1,286 Views)