{"action":"created","issue":{"url":"https://api.github.com/repos/libopencm3/libopencm3/issues/672","repository_url":"https://api.github.com/repos/libopencm3/libopencm3","labels_url":"https://api.github.com/repos/libopencm3/libopencm3/issues/672/labels{/name}","comments_url":"https://api.github.com/repos/libopencm3/libopencm3/issues/672/comments","events_url":"https://api.github.com/repos/libopencm3/libopencm3/issues/672/events","html_url":"https://github.com/libopencm3/libopencm3/pull/672","id":164714420,"number":672,"title":"STM32F2: make control usb stack more robust.","user":{"login":"jhoenicke","id":897826,"avatar_url":"https://avatars.githubusercontent.com/u/897826?v=3","gravatar_id":"","url":"https://api.github.com/users/jhoenicke","html_url":"https://github.com/jhoenicke","followers_url":"https://api.github.com/users/jhoenicke/followers","following_url":"https://api.github.com/users/jhoenicke/following{/other_user}","gists_url":"https://api.github.com/users/jhoenicke/gists{/gist_id}","starred_url":"https://api.github.com/users/jhoenicke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhoenicke/subscriptions","organizations_url":"https://api.github.com/users/jhoenicke/orgs","repos_url":"https://api.github.com/users/jhoenicke/repos","events_url":"https://api.github.com/users/jhoenicke/events{/privacy}","received_events_url":"https://api.github.com/users/jhoenicke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":22,"created_at":"2016-07-10T12:53:01Z","updated_at":"2016-11-17T22:11:00Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/libopencm3/libopencm3/pulls/672","html_url":"https://github.com/libopencm3/libopencm3/pull/672","diff_url":"https://github.com/libopencm3/libopencm3/pull/672.diff","patch_url":"https://github.com/libopencm3/libopencm3/pull/672.patch"},"body":"These patches aim to fix the problems of #668.  There are 3 parts:\n1. If we detect there is a packet in the TxFIFO (TSIZ0.pktcnt is not zero) when a SETUP is received, then this packet is discarded by flushing the FIFO.  It doesn't hurt, since the packet was definitely for a different request that is no longer requested.  It is necessary since otherwise the control port doesn't answer the new setup packet.\n2. We first check for DIEPINT before checking for RXFLVL.  This is necessary, because the usb_control statemachine requires that we first call usb_control_in on setup_read transactions before calling usb_control_out.\n3. We keep better track of rxbcnt (I didn't have the problem but we should fix it nonetheless).  I also removed the FIXME delay loop as I think it is no longer necessary.\n\nI didn't implement the idea of not answering a SETUP packet if there is another SETUP in the queue.  The idea of @zyp (to poll but not pop GRXSTSR) does not work.  There is still the SETUP_DONE packet in the RXFIFO.  Also, I don't want to change to much.  So the current implementation will still answer the wrong SETUP packet in the case where usbd_poll is called after a timeout.\n"},"comment":{"url":"https://api.github.com/repos/libopencm3/libopencm3/issues/comments/261386098","html_url":"https://github.com/libopencm3/libopencm3/pull/672#issuecomment-261386098","issue_url":"https://api.github.com/repos/libopencm3/libopencm3/issues/672","id":261386098,"user":{"login":"karlp","id":127907,"avatar_url":"https://avatars.githubusercontent.com/u/127907?v=3","gravatar_id":"","url":"https://api.github.com/users/karlp","html_url":"https://github.com/karlp","followers_url":"https://api.github.com/users/karlp/followers","following_url":"https://api.github.com/users/karlp/following{/other_user}","gists_url":"https://api.github.com/users/karlp/gists{/gist_id}","starred_url":"https://api.github.com/users/karlp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karlp/subscriptions","organizations_url":"https://api.github.com/users/karlp/orgs","repos_url":"https://api.github.com/users/karlp/repos","events_url":"https://api.github.com/users/karlp/events{/privacy}","received_events_url":"https://api.github.com/users/karlp/received_events","type":"User","site_admin":false},"created_at":"2016-11-17T22:11:00Z","updated_at":"2016-11-17T22:11:00Z","body":"It's probably all good, now that earlier comments have been addressed, but I've not looked at it since, and want to explore how the test cases work.  I want to make sure that I'm seeing the failure before, and not after.  (I've not been seeing the failure before at this stage)  However, I'm currently dedicating virtually all of my spare development time to a personal christmas project, and simple haven't had time to look at anything meaningful in locm3 for the last month or two, and don't expect to be able to again until at least after christmas."}}
{"actor":{"display_login":"karlp"}}