Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

I can't acquire analog data when pretriggering conditions are met on a RTSI synchronization coming from a CAN device. What is the problem (NI-DAQ, NI-CAN, in CVI)

I use NIDAQ, PXI 6115 and PXI 8461. I would like to synchronize a pretrigerred acquisition with CAN event declare on the RTSI BUS.
Thanks for your answers.
Pascal
0 Kudos
Message 1 of 4
(4,292 Views)
Hello-

Would it be possible to give some more details about the problem. It might help to see a snipet of the code for the DAQ and CAN in CVI. Also, would it be possible to give a list of the driver versions (CAN, DAQ, etc). For testing purposes, is it possible to do a pretriggered acq on some source other than CAN?

Randy Solomonson
Application Engineer
National Instruments
0 Kudos
Message 2 of 4
(4,292 Views)
hello

next line in document give some lines of my code (I've got some pb to send it attached).
it is very simple.
when I declare the Pretrigger_Scans parameters greater than 1 no signal is acquired.

I try obviously with a waveform generation (sending trigger on RTSI0) to begin an acquisition with pretrig scan and it works very well.

may, I just think, it is the RTSI1 line for triggering with CAN which is not appropriate?

thanks for every things

Pascal




// CAN0 Configuration
AttrIdList[0] = NC_ATTR_BAUD_RATE;
AttrValueList[0] = NC_BAUD_125K;
AttrIdList[1] = NC_ATTR_START_ON_OPEN;
AttrValueList[1] = NC_TRUE;
AttrIdList[2] = NC_ATTR_READ_Q_LEN;
AttrValueList[2] = 10;
AttrIdList[3] = NC_ATTR_WRITE_Q_LEN;
AttrValueList[3] = 10;
AttrIdList[4] = NC_ATTR_CAN_COMP_STD;
AttrValueList[4] = 0;
AttrIdList[5] = NC_ATTR_CAN_MASK_STD;
AttrValueList[5] = NC_CAN_MASK_STD_DONTCARE;
AttrIdList[6] = NC_ATTR_CAN_COMP_XTD;
AttrValueList[6] = 0;
AttrIdList[7] = NC_ATTR_CAN_MASK_XTD;
AttrValueList[7] = NC_CAN_MASK_XTD_DONTCARE;

/* RTSI Config: RTSI output on line 1 upon transmitting frame */
AttrIdList[8] = NC_ATTR_RTSI_MODE;
AttrValueList[8] = NC_RTSI_OUT_ON_TX;
AttrIdList[9] = NC_ATTR_RTSI_SIGNAL;
AttrValueList[9] = 1;
AttrIdList[10] = NC_ATTR_RTSI_SIG_BEHAV;
AttrValueList[10] = NC_RTSISIG_PULSE;

// acquisition task configuration
if ((AIerror = nidaqAICreateTask (AIchannelString, kNidaqWaveformCapture,
&AInumChannels, &AItaskID)) >= noError)
{
AIerror = nidaqAIConfigScanClockRate (AItaskID, AIscanRate, &actualScanRate);

AIerror = nidaqAIConfigDigitalTrigger (AItaskID, "daq::3!(RTSI1)",
kNidaqTriggerOnRisingEdge,
Pretrigger_Scans);
}


...

AIerror = nidaqAIStart (AItaskID);

// Emission d'une trame CAN comme trigger d'acquisition
Transmit.ArbitrationId = 0x05;
Transmit.IsRemote=NC_FALSE;
Transmit.DataLength=8;
Transmit.Data[0] = 0x00;
Transmit.Data[1] = 0x01;
Transmit.Data[2] = 0x02;
Transmit.Data[3] = 0x03;
Transmit.Data[4] = 0x04;
Transmit.Data[5] = 0x05;
Transmit.Data[6] = 0x06;
Transmit.Data[7] = 0x07;

Status= ncWrite(TxHandle, sizeof(Transmit), &Transmit);

AIbacklog = 0;
dTime = Timer();

do
{
AIerror = nidaqAICheck (AItaskID, &AIacqstate, &AIbacklog);
SetCtrlVal(panelHandle,PANEL_BACKLOG, AIbacklog);
}
while ((AIbacklog < AInumScans) && (Timer() - dTime < 3.0));

if(Timer() - dTime < 3.0)
AIerror = nidaqAIRead (AItaskID, AIchannelString, AInumScans, 3.0, AIwaveforms);

nidaqAIStop(AItaskID);
0 Kudos
Message 3 of 4
(4,292 Views)
Pascal:

I have been working with Randy on determining what might be the problem here. I'll concentrate on the DAQ part since it seems to be responsible for not performing the pre-triggered acquisition. From the history of this conversation I can assume two things, please correct me if I am wrong:

1) "when I declare the Pretrigger_Scans parameters greater than 1 no signal is acquired."

This means that the application works fine when you do a regular triggered acquisition and that it is only when you change the pre-triggered scans to be more than 1 (it has to be set to 2 or more) when you get the problem. Is this the only thing that changes?

2)"I try obviously with a waveform generation (sending trigger on RTSI0) to begin an acquisition w
ith pretrig scan and it works very well."

I understand from this that you did get the pre-triggered acquisition to work but without the CAN part. You used RTSI 0 instead of RTSI1. It is not very clear where the trigger was coming from so I would like to know more details about this test.

By looking at the DAQ portion of your code I can't really find a problem with the DAQ calls. My main suspect is the Digital Trigger Config call:

AIerror = nidaqAIConfigDigitalTrigger (AItaskID, "daq::3!(RTSI1)",
kNidaqTriggerOnRisingEdge,
Pretrigger_Scans);

If you can perform a quick test where you use the exact same code but obtain the trigger from a PFI line, it would really help us a lot with the troubleshooting process. This way we can know for sure that the code is working and we can concentrate on troubleshooting the triggering through RTSI.

Any additional information about errors or what happens when you set it up for pre-triggered scans will also help.

Let us know.


Regards

Alejandro Asenjo
Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(4,292 Views)