Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial DIO on m-series (6229)

I am attemping to complete the comedi driver for m-series boards, specifically the 6229 board.  The gentleman who started this driver was basically extending the e-series driver to include the m-series support by mapping the e commands, etc to m commands, etc. 

<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8">AI_Command_1<meta name="GENERATOR" content="OpenOffice.org 2.0 (Linux)"><meta name="AUTHOR" content="Malcolm J. Borgendale"><meta name="CREATED" content="20050701;14380000"><meta name="CHANGEDBY" content="Malcolm J. Borgendale"><meta name="CHANGED" content="20050920;10490000">Anyway, the e cards have a feature for doing serial DIO on a few of the pins.  I cannot tell if the m cards support this or not.  There doesn't seem to be any examples of this in the DDK.  There are some similarly named bits in the mseries_registermap.doc file, but some of them have a SCXI_ prepended to them.  Are these equivilent to the similarly named bits on the e boards?

If this functionality exists on the 6229 board, could someone point me to some (hopefully detailed) documentation.

As a side question, there seems to be much better documentation for the e series boards.  Is NI ever going to have that amount and quality of docs for the m-series cards?

Thanks.
0 Kudos
Message 1 of 2
(7,099 Views)
Hi,

The Front I/O connector signals are the same used for ESeries:

DIO P0.0       - MOSI (Master Out Slave In) - pin 52
DIO P0.4       - MISO (Master In Slave Out) - pin 19
PFI10/P2.3    - SPICLK                                - pin 45

The registers involved are:

SCXI_Control
SCXI_Serial_Data_In
SCXI_Serial_Data_Out
SCXI_Status
SCXI_DIO_Enable

Here's some code on how to use those registers.

// ---- configuration ----

//   DIO0 to output and DIO4 to input
brd->DIO_Direction.writeRegister (0x1);

//   PFI10
brd->PFI_Output_Select_4.witePFI10_Output_Select(tMSeries::tPFI_Output_Select_4::kPFI10_Output_SelectExtStrobe);
brd->IO_Bidirection_Pin.writePFI10_Pin_Dir(tMSeries::tIO_Bidirection_Pin::kPFI10_Pin_DirOutput);

brd->SCXI_Control.setSCXI_Front_Panel_MISO_Enable(kTrue);
brd->SCXI_Control.setSCXI_HW_Serial_Timebase(tMSeries::tSCXI_Control::kSCXI_HW_Serial_Timebase100kHz);
brd->SCXI_Control.setSCXI_HW_Serial_Enable(kTrue);
brd->SCXI_Control.flush();

brd->SCXI_DIO_Enable.setSCXI_DIO_MOSI_Enable(tMSeries::tSCXI_DIO_Enable::kSCXI_DIO_MOSI_EnableOutput);
brd->SCXI_DIO_Enable.flush();

// ---- data transfers ----

// 1. The data to be shifted out is written:
brd->SCXI_Serial_Data_Out.writeRegister(data_out);

// 2. To start shifting set SCXI_HW_Serial_Start bit (it is a strobe bit, so it clears itself).
brd->SCXI_Control.writeSCXI_HW_Serial_Start(1);

// 3. While shifting is in progress SCXI_Shift_in_Prog bit is set. Poll this bit before reading data or starting another write.
while (brd->SCXI_Status.readSCXI_Shift_In_Prog() == kTrue)
{
   // wait
}

// 4. When SCXI_Shift_In_Prog bit clears, read data shifted in from the SCXI_Serial_Data_In register
data_in = brd->SCXI_Serial_Data_In.readRegister();

// 5. Repeat from 1 to start another write/read.


Hope this helps
Diego
0 Kudos
Message 2 of 2
(6,960 Views)