Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

ai_fifo_empty_st

Ok, for my OSX M-Series driver, I've successfully got a few things working, but I'm still stuck with some AI. Going through the examples and checking the status registers, everything seems fine until I actually begin scanning. AI_SCAN_IN_PROG_St never goes high, and AI_FIFO_Empty_St stays high throughout, giving me zeros or garbage data. Has anyone else seen this? My two test cards are PCIe NI 6221 and PCIe NI 6251.

R
----
Rob Dotson
Asst. Research Scientist
Center for Neural Science
New York University
0 Kudos
Message 1 of 7
(8,974 Views)
 

Hi Rob-

A couple of thoughts-

1.  AI_SCAN_IN_PROG_St will only be high during an active scan cycle.  It should not stay high during the entire acquisition.  So, if you're using a single channel or a multi-channel acquisition with a very fast convert clock then you might not be able to observe status changes of that bitfield by polling.

2.  This might be an obvious question, but which polarity did you set in AI_FIFO_Flags_Polarity for your FIFO flag registers?  It may be that they are set to active low and that the FIFO is not always empty.  Can you elaborate on how garbage-y your data is?  Is it seemingly random, or does it correspond to your input signal in any way?

Is your example based on the MHDDK examples?  Have you considered using those examples directly or NI-DAQmx Base?  If you wouldn't mind posting some of your device setup code we could probably give better feedback.

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 2 of 7
(8,964 Views)
All of my code is ported directly from the ddk examples, however, AI_FIFO_Flags_Polarity isn't listed in any of the example code in the ddk, nor is it in the m-series register map. After a search, I was able to find a reference to it in the e-series rlp manual, as part of the AI_Personal register. The ddk is always writing the default (0) to this bit, so that's what I'm doing as well.

How different are the daq-stc & daq-stc2 chips? Are all of the registers 1-to-1? If a bitfield is defined for the stc, and 'reserved' for the stc2, is it safe to assume that the documentation is incomplete, and we can use the registers in the same way?

Below are the two example files for aiPersonalize() for the e & m series cards. Notice the m-series card writes very little to AI_Personal.

// e series
void AI_Board_Personalize(tSTC *theSTC)
{
/ *** /

theSTC->AI_Personal.setAI_CONVERT_Pulse_Timebase(theSTC->AI_Personal.kAI_CONVERT_Pulse_TimebasePulse_Width);
theSTC->AI_Personal.setAI_CONVERT_Pulse_Width(theSTC->AI_Personal.kAI_CONVERT_Pulse_WidthAbout_1_Clock_Period);
theSTC->AI_Personal.setAI_FIFO_Flags_Polarity(theSTC->AI_Personal.kAI_FIFO_Flags_PolarityActive_Low );
theSTC->AI_Personal.setAI_LOCALMUX_CLK_Pulse_Width(theSTC->AI_Personal.kAI_LOCALMUX_CLK_Pulse_WidthAbout_1_Clock_Period);
theSTC->AI_Personal.setAI_AIFREQ_Polarity(theSTC->AI_Personal.kAI_AIFREQ_PolarityActive_High);
theSTC->AI_Personal.setAI_SHIFTIN_Polarity(theSTC->AI_Personal.kAI_SHIFTIN_PolarityActive_Low);
theSTC->AI_Personal.setAI_SHIFTIN_Pulse_Width(theSTC->AI_Personal.kAI_SHIFTIN_Pulse_WidthAbout_2_Clock_Periods );
theSTC->AI_Personal.setAI_EOC_Polarity(theSTC->AI_Personal.kAI_EOC_PolarityRising_Edge);
theSTC->AI_Personal.setAI_SOC_Polarity(theSTC->AI_Personal.kAI_SOC_PolarityFalling_Edge);
theSTC->AI_Personal.setAI_Overrun_Mode(theSTC->AI_Personal.kAI_Overrun_ModeSOC_To_SHIFTIN_Trailing_Edge);
theSTC->AI_Personal.flush();

/ *** /
}

// m series
void aiPersonalize (tMSeries* board,
tMSeries::tAI_Output_Control::tAI_CONVERT_Output_Select convertOutputSelect)
{
/ *** /

board->AI_Personal.setAI_CONVERT_Pulse_Width (tMSeries::tAI_Personal::kAI_CONVERT_Pulse_WidthAbout_1_Clock_Period);
board->AI_Personal.flush ();

/ *** /
}
----
Rob Dotson
Asst. Research Scientist
Center for Neural Science
New York University
0 Kudos
Message 3 of 7
(8,957 Views)
Ok, I'm still not getting any data in the FIFO q ueue, and I'm hoping that the status registers somehow hold the key.

Before my AI_Start call, I get the following status:
AI_Status_1: AI_FIFO_Empty
AIFIFOData: 4294939142 (garbage, never changes)
Joint_Status_1: 0x0
Joint_Status_2: AI_EOC_st

which appears correct, as far as I can tell. After I AI_Start, I get the following, which never changes:
AI_Status_1: AI_FIFO_Empty | AI_START1_st
AIFIFOData: 4294939142 (garbage, never changes)
Joint_Status_1: AI_SC_Gate_st | AI_SI2_Q_st = 2 (WAIT 2)
Joint_Status_2: AI_EOC_st

What does the AI_SI2_Q_t state signify? What is it waiting for?

R
----
Rob Dotson
Asst. Research Scientist
Center for Neural Science
New York University
0 Kudos
Message 4 of 7
(8,935 Views)

Hi Rob-

AI_SI2_Q_st gives feedback on the state of the AI_SI2 counter state machine.  This is the counter that controls the AI convert clock (i.e. the clock that advances the multiplexor on the board and clocks the ADC for each sample in your scan).  A value of 2 means that the SI2 counter is waiting for a valid AI_Start (aka AI sample clock) signal to occur.  This most likely means that your sample clock is not running. 

Are you using an externally- or internally-clocked acquisition?  Can you please post the code that shows the setup for your AI timing and triggering?

Message Edited by Tom W [DE] on 07-24-2007 09:00 AM

Tom W
National Instruments
0 Kudos
Message 5 of 7
(8,917 Views)
Actually, that did it. In my aiStartOnDemand() method, I was sending a AI_START1_Pulse instead of AI_START_Pulse. Thanks for your help!
----
Rob Dotson
Asst. Research Scientist
Center for Neural Science
New York University
Message 6 of 7
(8,903 Views)

Hi Rob-

Glad to hear it- let me know if you run into anything else.

Thanks-

Tom W
National Instruments
0 Kudos
Message 7 of 7
(8,899 Views)