aboutsummaryrefslogtreecommitdiffstats
path: root/os/common
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2018-02-08 08:34:51 +0200
committerFred Sundvik <fsundvik@gmail.com>2018-02-08 08:34:51 +0200
commitb7f761313c11d94b89b605f81a89ced34a57c603 (patch)
tree996a5442ada9db2daf529b382630101da1470224 /os/common
parent1178cf761cf3fd4b5dcbc30bb5a9b37190f1c7b1 (diff)
downloadChibiOS-Contrib-b7f761313c11d94b89b605f81a89ced34a57c603.tar.gz
ChibiOS-Contrib-b7f761313c11d94b89b605f81a89ced34a57c603.tar.bz2
ChibiOS-Contrib-b7f761313c11d94b89b605f81a89ced34a57c603.zip
Fix data usb data toggle sync problem
USB control transfers are structured as the following. For incoming transfers Setup (Data0 out) Data (Data1/Data0 in) - starting with data 1 Status (Data1 out) For outgoing transfers Setup (Data0 out) Data (Data1/Data0 out) - starting with data 1 Status (Data1 in) The in buffers (device to host) are always correctly synchronized, since they can always be reset to Data1 each setup packet without any synchronization problems. The problem occured for outgoing transfers (host to device). For incoming transfers the data banks always alternates, and will automatically stay in sync. Outgoing transfers also stays in sync when there's an odd number of data packets. However when the number is even, including zero, then the last packet received by the device will be data0 and the next setup packet also has to be data0, so there's a synchronization problem. This itself is not a problem since data toggle synchronization(DTS) is ignored for setup packets, however if the follwoing packet after that is also an out packet, then the data bank will be wrong and the packet dropped. In this case the USB spec don't allow sending a nack, so it will only recover after a timeout, when the host tries to send a new setup packet. The old code tried to take care of this situation by reinitializing both data banks when a setup packet is received. The problem is that the next packet might already have been received or is in progress of being received at this point, so the fixup comes to late. The new code does the fixup when a status packet is about to be sent from the device to avoid this problem.
Diffstat (limited to 'os/common')
0 files changed, 0 insertions, 0 deletions