CAN issue with new library C#

Hello,

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.

We are using colibri imx6s 256mb 1.1A.

Thanks.

Does it mean you can repro this issue using CamDemo program? If so could you get a detailed setup ans steps description necessary to reproduce described issue at our office?

Hello,
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);

        while (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
                }
            }
            else
            {
                txtReceive.Text += "CAN Read Error";
                //MessageBox.Show("CAN Read Error");
            }
            Marshal.FreeHGlobal(ptr);        
            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.

In serial port debug, I have the message “CAN: queue overrun.” when the messages are coming at 10ms cycle time.

Dear @aehki

To investigate your problem I Need to repro it locally. Please provide:

  • Setup descriptions

  • Required SW executable(s) for Colibri and for development computer if involved.

  • Detailed steps required to get results you are observing.

  • SW source code including project file.

Hello,

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).

[link text][1]
[1]: https://share.toradex.com/opd94j9srypowih?direct

Hello @alex.tx,
Did you make some test with the project I sent ?

Unfortunately we do not have a CAN adapter for PC. Can your issue be replicated by using 2 Colibri evaluation boards?

@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…

hello @alex.tx any news about this issue ?,@alex.tx any news about this issue ?

Hi @aehki,
Let me test it and will get back to you.

Hi @aehki,

Which CAN did you use? FlexCAN or MCP2515?

@sahil.tx in our dashboard, we use FlexCan, here I try both but I have the same problem.

@sahil.tx Hello, any news about the can issue ?

@sahil.tx, @alex.tx Hello, any news about the can issue ?

Hi @aehki,

I am still working on it. Will update you soon

Hi @aehki,

Can you help me in reproducing the issue?

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