We have some CAN issues in WEC2013 with new librairies.
We produced Dashboard for our client for several years now, and we were using 1.3 WEC2013 version with c# Library (1.6 or 1.7), it was working very well, and still works at this time, but we would like to upgrade because start delay (from 10-15 seconds to 5 seconds) is way better since 1.4 WEC2013 version.
So we updated with last bootloader and last image (1.6), and we also updated c# librairies (2.4) because old Libraries do not work with new image.
Now that everything is updated, our dashboard does not work correctly, and it seems that the problem is coming from messages coming fast (10ms for example). I tried CamDemo program, when it receive message every 500ms, there is no problem, but if it becomes faster, we lways have “Can error” message.
Can you help us please ? we really want to update whole system.
I just take CamDemo DotNet project from last librairies and I make it work with Visual studio 2013.
Can initialisation is OK, when I click on receive, I change the code to receive all Can messages (in while(true) instruction), like below.
///< Configure timeout (optional) to 5 sec, by default it is set to 1 sec
can.Can_SetConfigInt(hCAN, “Timeout”, 5000, TdxCommon.ParamStorageType.StoreVolatile);
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(canBuf)); ///< Initialize unmanged memory to hold the struct.
Marshal.StructureToPtr(canBuf, ptr, true);
returnvalue = can.Can_Read(hCAN, ptr);
if (returnvalue != 0) ///< receive CAN data
can.tCanMsg ptr2 = (can.tCanMsg)Marshal.PtrToStructure(ptr, typeof(can.tCanMsg));
txtReceive.Text = "Can Msg Id = " + ptr2.id.ToString(); ///< print CAN message ID
txtReceive.Text += "\r\nCan Data Length = " + ptr2.dataLen.ToString() ///< print CAN data length
+ "\r\nData\t = ";
for (loopCount = 0; loopCount < ptr2.dataLen; loopCount++)
txtReceive.Text = ptr2.data[loopCount].ToString(); ///< print the received data
txtReceive.Text += "CAN Read Error";
//MessageBox.Show("CAN Read Error");
ptr = Marshal.AllocHGlobal(Marshal.SizeOf(canBuf));
After some other tests, it seems that under 20-30 ms cycle time, the driver is not able to manage correctly the incoming messages, we only have CAN error, but if we stop sending messages from outside, all the messages not correctly read because of the CAN error are read (like they were saved in a buffer memory), buf it we try to read several messages at 10ms cycle time, we only get CAN error.
We do not have this issue with old wince image and old libraries.
You can find the c# project in link below. I used it with Visual Studio 2013.
I change the code, to init the CAN at start, and it runs a thread with Read method to read constantly messages, if everything is connected correctly, it should directly work at startup.
I use a PCANalyser to send messages from the computer.
In my configuration, it is connected to a Colibri evaluation board 3.2 with colibri module im6xs 1.1A, WEC2013 (1.6).
@alex.tx I don’t have 2 boards so I cannot answer for sure, but I think you will have the same issue, you can try to send a lot of messages at 10 ms cycle time with the second board, you probably get the can error.
hello @alex.tx did you manage to make some test ? it is a very important point for us, we have another project in which we will sell our dahsboard with colibri module, but if we have to use old image, and start the program in 13 seconds instead of 6 seconds, it will be difficult for us to sell it…
I used CANDoDemo application to test the CAN library ( I took C demo to test whether its a library issue or something related to C# application).
I used the baud rate as 1.25k with an interframe gap of 5 ms and tested by transferring 1000 frames. On the application side, I just printed the number of frames received and it did show me the correct result.
Let me know your CAN settings to help me reproduce the issue