Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Clear Pending Write

Solved!
Go to solution

Greetings.

 

Background


In my application I have two devices on the CANBUS: a controller and a USB-8473.  The controller communicates using a query / repsonse protocol: my application sends a query or command frame; the device responds.  The protocol requires several query / response exchanges to get the controller into a particular mode.  If a failure occurs, the program sends a reset frame to the controller and starts over from the beginning.

 

Observations


From what I can tell, when a frame is passed to the NICAN API to be written to the CANBUS, the API continues indefinately trying to write the frame until it succeeds.

 

Question


To start over, the program needs to clear the pending frame.  To clear the pending frame, I did this...

 

  ncAction( fHandle, NC_OP_RESET, 0 )

 

Is this the best choice?  Is there another method to flush the pending frame (flush the write queue)?

 

Thank you,

Brian

0 Kudos
Message 1 of 5
(7,350 Views)
Solution
Accepted by topic author Brian C

Brian,

 

The current way you are doing this flush, ncAction with the Reset opcode, is recommended.  Is there some reason you are looking to use a different function?

 

Regards,

 

Ben

Ben

National Instruments
Certified LabVIEW Associate Developer
Certified TestStand Developer
0 Kudos
Message 2 of 5
(7,331 Views)

Ben,

 

Thank you for the reply.

 

I'm looking for something different because ncAction / Reset clears everything including the baud rate and the error counts.

 

Brian

 

0 Kudos
Message 3 of 5
(7,325 Views)

ncAction with the Reset opcode is going to be your only option for clearing the Write Queue of your USB CAN interface.  I will make the suggestion to our R&D department that in some situations it would be useful to have something like an ncAction / Flush instead of the full Reset.

 

Regards,

 

Ben

Ben

National Instruments
Certified LabVIEW Associate Developer
Certified TestStand Developer
Message 4 of 5
(7,313 Views)

Thank you and I hope you have a good day,

Brian

 

0 Kudos
Message 5 of 5
(7,309 Views)