Hello! I am using libserialport to connect to an Arduino Uno which controls a motor and returns some sensor data. On Linux everything works fine. On Windows the program stutters and freezes when sending and receiving data. The connection is running at 9600 baud.
I am using sp_blocking_write to send data, and a loop like below to receive data: while ( sp_input_waiting(m_connectedPort) ) { int read = sp_blocking_read_next(m_connectedPort, buf, 256, 2); ... } The 'loop' is done with a QTimer triggering at 16ms or approximately 60 frames per second. I am also drawing a graph in an OpenGL view in this 'loop' but commenting that out makes no difference. I built the Windows libserialport with msys2 following the instructions on the sigrok wiki, using a git clone (Mon 5 Sep 2016) and the Linux version was built from a git clone around April 2016. All hardware is exactly the same in both cases (I'm dual booting between Linux and Windows on the same computer). You can get a full description of this setup here: https://www.youtube.com/watch?v=V3kxl4dHAwE For the most part the receiving of data seems to be ok. When connected, the arduino is sending sensor data non-stop and pretty much saturates the connection. Looking at the graph as it's being drawn, there could be some very small stutters, but this is not such a big issue for now because... The worst problem is when sending from the computer to the arduino, the whole program can freeze for anywhere from half a second or so, up to 8-10 seconds and can even show "not responding" in the window title bar. The sent data is very small, it's just a few bytes (usually a 7 byte packet) to set the motor speed, and is sent a few times per second if being controlled manually, or at most 60 times a second when the computer is automatically controlling the motor speed. I also tried sp_nonblocking_write. The freezing and stuttering was cured, but the data was not sent correctly. When I look at the transmission line with an oscilloscope, I see only a single pulse, instead of doing the full 7 byte transmission (photo attached). Any ideas about other things I could try?
------------------------------------------------------------------------------
_______________________________________________ sigrok-devel mailing list sigrok-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sigrok-devel