I have an application that is giving me a stack overflow error with too much CAN traffic. I only need to monitor one message, and if I only have that one message on the bus it works good. As soon as I add the other messages on the bus I get the error, so I figured I could just filter out the ones I don't wan't to read. I put the filter in my code, but I still get a stack overflow when all of the messages are being broadcast. How does the filter work? Do messages go to the memory stack first until a software routine has time to go through and filter unwanted messages?
Solved! Go to Solution.
Can you provide more information about your setup. What version of LabVIEW are you using? Perhaps attaching a simple version of your project that is having issues so we can understand the filtering you are doing, etc.
I have an update. I first found out that the filter was not working at all. Every message was getting passed through even though they should be filtered out. As I was deleting portions of the code, I noticed that the filter suddenly started working. After a number of iterations and deleting things one by I have it narrowed down. The code as is has a non-functioning filter. If I delete the COM port config's, then the filter starts working properly. If I leave the COM port configs in place and delete where I write messages on CAN2, then the filter works properly. I'm not sure how either one of these could be affecting my CAN1 filter. The attached code is in LabVIEW 2010.
Here is the project file. The two files are the only two in the test application that gave me problems. The test code I sent is a stripped down version of the main application, but the project file is used for both the full application and the test application so when you open the project some files will be missing, but the ones I posted earlier are the only two used for the test application.
The original application has 1 CAN channel without filtering, and 1 CAN channel with filtering. The order of initialization between the 2 CAN channels was not specified in code and was arbitrarily determined by the compiler. I forced the CAN channel without the filter to be initialize before the channel with the filter and then it works properly.