I'm having a problem with servicing the CAN driver from our application. It seems like we're not able to read the CAN messages fast enough to keep up with the traffic and eventually a "Data Q is Full" message spills out the debug port and our app hangs. As soon as I halt the CAN traffic, the "Data Q is Full" message stops and our application resumes as if nothing has happened. The CAN bus load is 21-22% at 250 Kbps and about 380 frames/sec. Also, every 20,000 messages we check the number of messages in the queue and this doesn't get above 120, and usually stays below 25.
I guess my real problem is that when the CAN data queue fills up, the CAN driver, with its extremely high priority thread, hogs the CPU and effectively hangs our application and the entire system, until the CAN traffic stops. I tried increasing the priority of the app thread that reads CAN messages, but the increased priority upsets the scheduling of the other app threads and is unacceptable. Can something be done so that the CAN driver doesn't freeze the system when its "Data Q is Full"? |