Hello dear support team,
Is it possible that the can_write and can_read methods block each other when used in different threads?
I programmed CAN1 as a CANopen NMT master and CAN2 as a CANopen node. The NMT master transmits SYNC messages in 50ms intervals. This affects that the node response time grows to >500ms. If I deactivate the NMT master, then the response times of the node are <= 1ms. I play with the thread priorities, but I always come to the conclusion that one of the two functionalities does not get reasonable maturity. It seems that the write or read method or both can not be executed parallel to CAN1 and CAN2.
I work with the CE-Library V 2.3b4555.
I init CAN by using can_init(L"CAN1") and can_init(L"CAN2").
I use two threads for NMT-Master (CAN1). The first is for receiving messages and the second is for management and sending messages (e.g. creating sync or RPDO messages etc.). The prioritys for receive thread ist 124 and for the other 138.
I also use two threads for the node (CAN2). The first is for receiving messages and also for sending the direct answer (e.g. SDO answers). Its priority is set to 128. The second thread is for Management (e.g. creating heardbeat, mapping the io or TPDO messages etc.). Its priority is set to 160.
What I’m particularly surprised about is that the two management threads, which have a lower priority, nevertheless still approximately keep their running times. From this one could conclude that the can_read methods influence each other. Could that be? But I´m not sure.