Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Example aiex1 don’t work for PXI-6255 on QNX 6.4

Hi.

I’ve got PXI-6255 board placed in chassis PXI-1031. Chassis are connected with comp by PXI-8360 (in chassis) and PCI-8361 (in comp), i.e. by interface MXI-Express. I need to use register level program on OS QNX 6.4.

To begin, I wanted try simple program based on example aiex1 from DDK.

First, my test program found PXI-6255 as PCI device. It’s OK.

Second, thanks to forum, I know I would make initialization of Mite Interface Chip. I make following:

    UNALIGNED_PUT32((uint32_t*)((char*)Mite_baseaddr_ptr + 0xC0),

                                                                       (Mite_baseaddr & 0xffffff00) | 0x80);

But I don’t understand completely, why this construction must be.

Third, thanks to forum once more, I know that it’s advisable to read eeprom for test right work of board. I can read right information from eeprom.

Fourthly, I know (from forum also) that there is Scratch Pad Register, which allow to test register read/write operations. I make following:

  *((char*)Board_baseaddr_ptr + 0x05) = 0xee;

  byte = *((char*)Board_baseaddr_ptr + 0x05);

 

Variable byte = 0x00, but it must be same value (0xee). On that step something is wrong or sooner.

Then my program executes commands from example aiex1, after start acquisition reading from registers Joint_Status_2 and AI_Status_1 returns 0x0000 always.

Anyone, help me please to understand my possible mistake and what I can do further.

Thanks.

0 Kudos
Message 1 of 10
(8,032 Views)

Hello,

 

2.  You could have found Step two by examining the source code of the DDK.  The code to initialize the mite with the base address of bar1 appears in main.cpp in the initMite function.

 

This operation must take place so that the IO on the board is accessible. 

 

From looking at your pseudo code, it doesn't look like you are following the formula.  Is the variable "Mite_baseaddr" actually the BAR1 address of the PCI-6255? 

 

3.  What offsets of the EEPROM are you reading?  What values are you getting back?

 

4.  It looks like you are accessing the registers using a different function than what was used to initialize the mite.  Perhaps the new way of accessing the registers is getting in the way.

 

Lastly, I did a sanity check and the first two ai examples run fine on the PCI-6255 (which means they should work the same with the PXI-6255) with no modifications (tested with Linux).  How did you modify the bus interface for your OS? Did you start with the QNX example?

 

Thanks,

Steven T.

0 Kudos
Message 2 of 10
(8,026 Views)

Hellow, Steven

 

Thanks for your help.

 

Really, mistake took place in initialization of Mite Interface Chip.

 

Now, example aiex1 work almost right except for little problem.

 

For first acquisition number of samples that I read from FIFO don’t agree with number of  channels (numberOfChannels), for next acquisitions that numbers are equal. For example, if numberOfChannels = 6 then number of samples delivered from FIFO is 4, if numberOfChannels = 5 number of samples is 4, if numberOfChannels = 3 number of samples is 4.

 

In all cases, for next acquisitions that numbers are equal. Problem exists for first acquisition only.

 

Why?  Where is mistake?

 

Thanks.

0 Kudos
Message 3 of 10
(7,995 Views)

Hi Alex,

 

In which program are you running this example? Have you received any errors? Try to implement some troubleshooting steps such as probing or breakpoints in order to find out why the FIFO is not matching the number of channels.

 

Regards,

Jackie

DAQ Product Marketing Engineer
National Instruments
0 Kudos
Message 4 of 10
(7,978 Views)

Hellow, Jackie

Thanks for your response.

I’m trying this example in QNX® Momentics® Integrated Development Environment Version: 4.6.0  in debugger mode. No errors happened for run time. In sample reading cycle AI_Status_1 = 0x00b2. After last sample reading from FIFO AI_Status_1 = 0x10b0. I’m using step by stem mode in debugger and breakpoints, but I can’t find out error.

 

Can reason of this problem hide in time tunings?

 

Thanks.

0 Kudos
Message 5 of 10
(7,963 Views)

Additionally, I want report the following:

 

By experimental way I’ve fixed that first two samples (for channels 0 and 1 from six channels, from 0 to 5-th) absent in first portion of samples delivered from FIFO.

 

Thanks.

 

0 Kudos
Message 6 of 10
(7,949 Views)

Anybody answer me, please.

0 Kudos
Message 7 of 10
(7,925 Views)

Hello,

 

I don't understand your current problem.

 

Starting with aiex1, what parameters have you changed? 

* Specifically, how many channels/samples are you attempting to acquire? 

* What are the values being sent in the parameters of aiConvert?

Finally how many samples are you getting after the run?

Also, you mentioned that you solved one issue. What problem did you solve and how did you solve it?

 

Thanks,

Steven T.

0 Kudos
Message 8 of 10
(7,901 Views)

Hellow, Steven

 

First problem was bound with wrong initialization of Mite Interface Chip:

    UNALIGNED_PUT32((uint32_t*)((char*)Mite_baseaddr_ptr + 0xC0),

                                                                       (Mite_baseaddr & 0xffffff00) | 0x80);

Must be:

    UNALIGNED_PUT32((uint32_t*)((char*)Mite_baseaddr_ptr + 0xC0),

                                                                       (Board_baseaddr & 0xffffff00) | 0x80);

 

My current problem is that for first acquisition I don’t getting number of samples equal number of channels. For example aiex1 I changed only numberOfChannels (equal 6 instead of 2), at that numberOfSamples = 10. Parameters of aiConvert: periodDivisor = 280, delayDivisor = 280, externalSampleClock = false. As a result, after start program I received first data portion of 4 samples and next 9 data portions of 6 samples. Two absent samples from first data portion is for channels 0 and 1.

 

Thanks for interest relation.

 

0 Kudos
Message 9 of 10
(7,888 Views)

Hello,

 

If the first scan only places 4 samples in the AI FIFO (2 less than the number of channels requested), then I would expect this loop to run forever in aiex1.cpp (I added some debugging prints to make it easier to see the channels that should be getting returned).

 

       while ( m < numberOfChannels )
    {
        if(!board->AI_Status_1.readAI_FIFO_Empty_St())
        {
            value = board->AI_FIFO_Data.readRegister ();
            aiPolynomialScaler (&value, &scaled, &scale);
            printf ("Channel %d: %e,\n", m, scaled);
            m++;
        }
    }

    printf("\tEnd of Sample %d\n", n);

 

How is the example able to proceed past this loop?

 

I have checked the code for FIFO flushes and resets between aiStartOnDemand (board); and when the FIFO gets read.  I have also run the example with 6 channels, this time on Windows.

 

To proceed we would need these items:

1) We would need the exact output (with my added debug prints).

2) A complete dump of all registers accessed during the example.

 

Steven T.

0 Kudos
Message 10 of 10
(7,872 Views)