Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

XNET and counter Synchronization

Hi all,

 

I need help to finalize a measurement on the test bench I'm developing. I've to measure the response time of the motor under test. I send a speed order on the CAN bus, and I have to measure the time between the frame sending and the beginning of the movement.

 

Actually, I'm sending the CAN frames and the position measurement on the same loop. But results are strange, and I think it would be better if the synchronization could be made in hardware.

 

Do you have any example or method description?

 

My software configuration:

- Windows 7 Pro SP1, 32 bits

- LabVIEW 2014 SP1 f3

- NI-XNET 14.1

- MAX 14.5.0f0

- DAQmx 14.20f1

For the Hardware:

- card NI PCIe-6323 , X Serie DAQ

- card XNET NI PCI-8512 (1 port)

- RTSI cable between the 2 cards

- my motor works in CAN HS @ 250kBaud

- I measure the position with an optic coder, connected to a counter of the DAQ card.

 

Thank you per advance!

 

Francis M
0 Kudos
Message 1 of 3
(4,645 Views)

Yeah this type of thing is always hard to measure.  I had a similar requirement once where I had to measure the time it took for a motor to go from 0 to 2000 RPM.  But they wanted this to include the time for the device to get the message, process it, and spin up the motor.  So someone suggested we output the start message, then start a timer and wait until the RPM is 2000.  There are a few issues with measuring this all of which made a simple requirement hard to nail down because we were so close to the limit.

 

If you send the frame, and start a timer, you can't be sure that the message was actually sent yet.  When you use the XNet write all that does is add the frame to a queue of messages to send out, it doesn't mean it was sent.  And even if your queue is empty, and you can assume that the message is sent out more or less at that time, you can't say it got to your device at that time.  CAN is made to have collisions, and if that happens messages are retransmitted automatically by the tranceiver hardware.

 

What we ended up doing is having the device under test output a high signal on a digital output when it got the signal to start the motor, then measure that with DAQ hardware, and measure the RPM speed with DAQ hardware on the same hardware timer.  This wasn't verifying the requirement exactly as it was written, but it was approved by the customer.

 

All I'm saying is you will have similar issues and whatever you come up with will be flawed in some way.

Message 2 of 3
(4,640 Views)

Hi Hoovahh,

Thank you for your response, very precise as usual! unfortunally, it's why i supposed...

Another idea, which can help other readers: using a second CAN card, connected by RTSI with the DAQ card, it's possible to synchronise timestamp and start measurement when the frame is send (the second card is just here to spy the bus). One of my colleagues has made something like this on an old project, with the NI-CAN driver (not NI-XNET).

Regards,

Francis M
0 Kudos
Message 3 of 3
(4,584 Views)