I’m working with a system that needs to read the CAN network and register the read status in the database.
While I’m working without the DATABASE the reading Cycle takes less than 1ms to finish, but when I start to record the values in the DB, it start to lag some cycles, reaching even 15ms, and it is not possible to this application, because we are reading inputs that are really fast.
Have anybody ever worked with SQLite and CAN using C# and WINCE2013 at the same time that can help me ?
Could you write more detailed about how your C# application designed?
Maybe, you are reading the CAN message and immeditely writing using the SQLLite APIs in a thread. I guess SQLLite is taking more time to complete the API calls.
If this is the case then you need to create 2 separate threads, one for reading the CAN message and put the messages into the circular buffer and 2nd thread for if there are any messages in the circular buffer then write it the DB using SQL Lite APIs.
Once you made 2 threads, you can leverage CeSetThreadPriority and CeSetThreadAffinity APIs, find the best possible setting for your application.
I hope the above solution would help solve your issue.
Thank you for your reply. Glad to know that you found a solution.
It depends on which memory you are writing. Memory writing should be faster on following order: DDR, NAND, SD card. If you really want faster write performance, you could choose to write on DDR and after some timeout period sync DDR file to Flash or SD card. Please be remember that such methods won’t prevent data corruption during a power failure.
Actually I’ve not found the solution.
I’ve said that even writing a text file while reading the CAN network, generates a lag in the system, and we don’t know what to do. Even working with a C++ project the problem keeps happening.
Could you share the issue reproducible application with us? It will help us to look at the issue quickly.
Also, which version of the WinCE release image you are using? Is it V1.5 or v1.6?
Could you share C++ reproducible application, I am more comfortable work with C++ code and it will help me to quickly look and hack the code. I might take more time if I look at it in the C# project.
It would be very helpful if you use our “Toradex CE Libraries\libDemos\Can_Demo\src” code and modify it for reproducing the issue.