Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Periodic message timing

I am trying to set up a PCI-CAN/2 board to transmit a packet every 10ms. This seems to work fine until I open another CAN object and query my test unit. I see upwards of 50 - 60 ms pauses in the periodic message in which it is not transmitted. Is there something specific I need to do to ensure that the periodic timing is maintained while accessing other non-periodic CAN objects? Is this extremely CPU dependant? I've attached the function that sets up the periodic CAN object. thx

Gep
0 Kudos
Message 1 of 4
(4,113 Views)
I really will not have a good idea without also seeing your other CAN object, it is most likely causing a conflict. Try changing the size of your write Queue to a value other than 0.
If you have the write queue set to 0 (yours was in the CVI code) it can cause a problem by overwrtiting the previous data item without indicating an overflow. Read the Description for the ncWrite function call.

I doubt you have your other object configured with the same CAN Arbitration ID, because that could cause problems as well, but it would probably give errors.
0 Kudos
Message 2 of 4
(4,113 Views)
Attached is the code for two other objects that may conflict. One is simply listening for a periodic message from the test unit. The other is a query type message that polls the test item for stored failure data. Either of these can cause my issue with timing.
I've also attached the Network Interface object code.


Gep
0 Kudos
Message 3 of 4
(4,113 Views)
I am sorry, but I don't have a good definite answer. (I now use Labview instead of CVI), but I see a few things to think about trying.
1.The write Queue length still bothers me, it seems to me that if you have more than 1 object or message, you need a queue, so try setting it to a value other than 0
2. You have ncWaitForState, which caused me similar problems long ago. The ncWaitForState() suspends current execution, so your delay could be because it is stuck in a wait state. Try using ncCreateNotification instead
3. You may need to configure ALL objects at the same time, grouping them and calling ncConfig() only once, then use ncAction() to start and stop the objects.


dhuff
0 Kudos
Message 4 of 4
(4,113 Views)