03-27-2007 10:19 AM
If I run the application on a single module (CAN Card #1, Port 1), the issue will occur approximately 1 in 200 runs.
If I run the application on a single module (CAN Card #1, Port 1) and monitor it with NI MAX Bus Monitor (CAN Card #1, Port 2 (Listen Only)), the issue occurs approximately 1 in 7 runs.
If I run the application on a single module (CAN Card #1, Port 1) and monitor it with NI MAX Bus Monitor (CAN Card #2, Port 1 (Listen Only)), the issue occurs approximately 8 in 1 run.
03-27-2007 11:39 AM
I have not seen this before but do not flash with NI Card. I use Canalyzer -- although I would like to use NI in the future -- hence my interest! When I flash it will be with one arbitration ID so I do not see the need for a write mult. Also I will be flashing using ISO/DIS 15765-2 standard, which requires a first frame followed by a flow control response and then send a batch of consecutive frames based on the directions (Block size and seperation time) given by the flow control frame. Is your requirement similar?
Tom
03-28-2007 03:16 AM
Hi Tom,
The protocol I am using here is very similar, here's the basic sequence...
1). Create an array of NCTYPE_CAN_STRUCT * 512. (Note: 512 is the maximum number of frames)
2). Using the NCTYPE_CAN_STRUCT, create each frame in turn (Frame Type, Arbitration ID, Date Length, Data Bytes etc) and copy the structure into the next position in the buffer. If you have more than 512 frames, you will have to repeat this process again after the buffer has been transferred to the CAN card until all the frames have been processed.
At this point the buffer should contain x frames, ready for transmission.
3). Transmit the first frame to the module using ncWriteMulti, set the data size to (sizeof(NCTYPE_CAN_STRUCT)).
4). Wait for / receive the flow control frame.
5). Increment the buffer pointer to the second frame. (i.e. &TransmitBuffer[1])
6).Transmit the remaining frames to the module using ncWriteMulti, set the data size to (sizeof(NCTYPE_CAN_STRUCT)*Remaining Frames)
This method appears to have two major advantages over a For-Next loop using ncWrite to transmit a single frame at a time.
1). The PC processor usage is much lower, which is great for a multi threaded application.
2). The frames are transmitted much faster, resulting in a lower cycle time.
I hope this helps.
Aid
03-28-2007 05:52 AM
Hi Tom,
Apologies, after running some trials the following should read...
This method appears to have two major advantages over a For-Next loop using ncWrite to transmit a single frame at a time.
1). The PC processor usage is slightly lower, which is great for a multi threaded application.
2). The frames are transmitted slightly faster, resulting in a lower cycle time.
Of course this will also depend upon the application.
Aid
03-28-2007 06:29 AM
The data gets "corrupted" -- does this happen on the same frames each time or is it a purely random event. If it is random, I would check that there is a solid ground or reference and that the ECU that you are flashing is not trying to perform other tasks or that the bus voltage is not being loaded by something. If it is not random but occurs at about the same time or frame sequence, then check your program thoroughly to ensure it is not caused by a buffer problem or frame "building" part of the program. Other then that it sounds like maybe a bug when you try to fill the buffer to full. Maybe try to reduce the amount of messages stored for writing -- this may slow the flash sequence but if it gets rid of the problem it may be worth it!
Sorry I don't have a definitive answer, but, again, I've not seen this problem before!
Tom
03-28-2007 06:54 AM
Thanks Tom,
I've performed some more investigations this morning, with the following results....
1). The corruption appears in random frames, typically a single frame in a block, but I have seen two consecutive frames in a block.
2). If I send the buffer again without rebuilding it, the second attempt always works. Therefore it appears that the source buffer in my application does not contain the corruption.
3). I replaced the ncWriteMulti with a loop and ncWrite call to send single frames and observed a similar failure rate when the CAN Bus Monitor is active. Again if I resend the buffer without rebuilding it, the second attempt always works.
The really interesting bit is the influence of the Bus Monitor on the number of corrupted frames. The rate is significantly higher if I monitor the active CAN Port with a CAN Port on another card in the same machine. Since the Bus Monitor is in "Listen Only" mode and the data doesn't appear to be corrupted on my side I am currently working on the assumption that the issue lies in the driver.
Aid
03-28-2007 08:46 AM
03-28-2007 09:30 AM
03-28-2007 09:39 AM
I think you've narrowed it down to a problem in the CAN driver for the CAN card -- but you knew this already!!! Sounds like a bug.
Tom
03-28-2007 09:54 AM
Hi Tom
It's taken a while for me to come to this conclusion, but I don't think that there's anything left that's in my control. Thanks for the help, your input helped me to clarify my thoughts.
Do you know how I can get NI to look into this issue ?
Aid