AnsweredAssumed Answered

g_serial serial gadget issue

Question asked by Edward Karpicz on Nov 28, 2014
Latest reply on Jan 21, 2015 by Edward Karpicz



I need to send 10-30 byte packets over /dev/ttyGS to Windows host PC. Time gaps between adjacent packets is random, max packets rate at now is quite low, about 400Hz.

Linux write() function is used to send data. The problem is that gadget may stop sending anything to host, unless I insert usleep(150) call between adjacent write() calls. Data transfer from host PC to Vybrid is always fine. Write problem arises on both 1N02G and 2N02G maskset chips. Am I alone having this issue?


My very first application code was write()-ing packets byte by byte, one byte per write() call. Serial gadget stopped transmitting almost immediately. Then I modified code to send whole packet using single write() call. This worked better, but still was problematic. I think that problem happens when two packets are too close to each other. Perhaps errata 6857 applies? 150 microseconds gap for workaround is chosen keeping in mind 1/125usec high speed USB microframe rate. I haven't yet tried to push usleep() argument down, perhaps it could be lower. 150us is OK for me. ...Still testing with 150us and hoping it won't hang any more.