{"action":"created","issue":{"url":"https://api.github.com/repos/arduino/Arduino/issues/3946","labels_url":"https://api.github.com/repos/arduino/Arduino/issues/3946/labels{/name}","comments_url":"https://api.github.com/repos/arduino/Arduino/issues/3946/comments","events_url":"https://api.github.com/repos/arduino/Arduino/issues/3946/events","html_url":"https://github.com/arduino/Arduino/issues/3946","id":110723552,"number":3946,"title":"Leonardo fails to send exactly 64 bytes.","user":{"login":"embmicro","id":5651612,"avatar_url":"https://avatars.githubusercontent.com/u/5651612?v=3","gravatar_id":"","url":"https://api.github.com/users/embmicro","html_url":"https://github.com/embmicro","followers_url":"https://api.github.com/users/embmicro/followers","following_url":"https://api.github.com/users/embmicro/following{/other_user}","gists_url":"https://api.github.com/users/embmicro/gists{/gist_id}","starred_url":"https://api.github.com/users/embmicro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/embmicro/subscriptions","organizations_url":"https://api.github.com/users/embmicro/orgs","repos_url":"https://api.github.com/users/embmicro/repos","events_url":"https://api.github.com/users/embmicro/events{/privacy}","received_events_url":"https://api.github.com/users/embmicro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2015-10-09T19:37:33Z","updated_at":"2015-10-13T19:50:51Z","closed_at":null,"body":"When using the virtual serial port on the Leonardo I found that if I send exactly 64 bytes it doesn't send until another byte is sent. Below is a demo to show this problem.\r\n\r\n    void setup() {\r\n      // put your setup code here, to run once:\r\n\r\n    }\r\n\r\n    void loop() {\r\n      if (Serial) {\r\n        if (Serial.available() > 0) {\r\n          Serial.read();\r\n          char buff[65] = \"D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_IN ),USB_ENDPOINT_TYPE\";\r\n          Serial.write(buff,64);\r\n          Serial.flush();\r\n        }\r\n      }\r\n    }\r\n\r\nAfter sending a character, nothing appears in the terminal. However, sending another then prints all 128 characters. This happens regardless of the serial port monitor I've tried. I've also tried on Linux and Windows 10 with slightly different, but similar results. This is with 1.6.5."},"comment":{"url":"https://api.github.com/repos/arduino/Arduino/issues/comments/147830077","html_url":"https://github.com/arduino/Arduino/issues/3946#issuecomment-147830077","issue_url":"https://api.github.com/repos/arduino/Arduino/issues/3946","id":147830077,"user":{"login":"NicoHood","id":6888294,"avatar_url":"https://avatars.githubusercontent.com/u/6888294?v=3","gravatar_id":"","url":"https://api.github.com/users/NicoHood","html_url":"https://github.com/NicoHood","followers_url":"https://api.github.com/users/NicoHood/followers","following_url":"https://api.github.com/users/NicoHood/following{/other_user}","gists_url":"https://api.github.com/users/NicoHood/gists{/gist_id}","starred_url":"https://api.github.com/users/NicoHood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicoHood/subscriptions","organizations_url":"https://api.github.com/users/NicoHood/orgs","repos_url":"https://api.github.com/users/NicoHood/repos","events_url":"https://api.github.com/users/NicoHood/events{/privacy}","received_events_url":"https://api.github.com/users/NicoHood/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T19:50:51Z","updated_at":"2015-10-13T19:50:51Z","body":"This then makes sense, but doesnt solve the problem at all. It will now flush on every sending. making flush() useless, and the ISR as well.\r\n\r\nPlease try the suggested ` USB_Flush(u8 ep)` fix without any other modifications.\r\n\r\nSerial is not blocking, serial is interrupt driven and only blocking on a full buffer (also HW serial). That is speed also. Flushing usb everytime makes it slow and blocking."}}