{"action":"created","issue":{"url":"https://api.github.com/repos/andysworkshop/stm32plus/issues/172","repository_url":"https://api.github.com/repos/andysworkshop/stm32plus","labels_url":"https://api.github.com/repos/andysworkshop/stm32plus/issues/172/labels{/name}","comments_url":"https://api.github.com/repos/andysworkshop/stm32plus/issues/172/comments","events_url":"https://api.github.com/repos/andysworkshop/stm32plus/issues/172/events","html_url":"https://github.com/andysworkshop/stm32plus/issues/172","id":155167026,"number":172,"title":"USB and low power modes in stm32f042","user":{"login":"iromero91","id":8483301,"avatar_url":"https://avatars.githubusercontent.com/u/8483301?v=3","gravatar_id":"","url":"https://api.github.com/users/iromero91","html_url":"https://github.com/iromero91","followers_url":"https://api.github.com/users/iromero91/followers","following_url":"https://api.github.com/users/iromero91/following{/other_user}","gists_url":"https://api.github.com/users/iromero91/gists{/gist_id}","starred_url":"https://api.github.com/users/iromero91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iromero91/subscriptions","organizations_url":"https://api.github.com/users/iromero91/orgs","repos_url":"https://api.github.com/users/iromero91/repos","events_url":"https://api.github.com/users/iromero91/events{/privacy}","received_events_url":"https://api.github.com/users/iromero91/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"andysworkshop","id":4107468,"avatar_url":"https://avatars.githubusercontent.com/u/4107468?v=3","gravatar_id":"","url":"https://api.github.com/users/andysworkshop","html_url":"https://github.com/andysworkshop","followers_url":"https://api.github.com/users/andysworkshop/followers","following_url":"https://api.github.com/users/andysworkshop/following{/other_user}","gists_url":"https://api.github.com/users/andysworkshop/gists{/gist_id}","starred_url":"https://api.github.com/users/andysworkshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andysworkshop/subscriptions","organizations_url":"https://api.github.com/users/andysworkshop/orgs","repos_url":"https://api.github.com/users/andysworkshop/repos","events_url":"https://api.github.com/users/andysworkshop/events{/privacy}","received_events_url":"https://api.github.com/users/andysworkshop/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2016-05-17T03:03:27Z","updated_at":"2016-05-17T20:43:34Z","closed_at":null,"body":"Hi! I've been trying out this library and it's been a lot less painful than dealing with STM32Cube. Right now i'm trying to figure out how to use the UsbCustomHid class and sleep mode at the same time. I have one GPIO line sensing the VBUS voltage and i wrote code that calls UsbCustomHid::stop() when VBUS is lost, and ::start() when it comes back, but i found out that once i call stop, start stops working and i can't get the device to enumerate again. This is a device that runs on a coin cell battery and i really need to lower power consumption when USB is not being used. I thought about slowing the clock too when USB is disconnected, but i haven't figured out what's involved with that yet."},"comment":{"url":"https://api.github.com/repos/andysworkshop/stm32plus/issues/comments/219847611","html_url":"https://github.com/andysworkshop/stm32plus/issues/172#issuecomment-219847611","issue_url":"https://api.github.com/repos/andysworkshop/stm32plus/issues/172","id":219847611,"user":{"login":"iromero91","id":8483301,"avatar_url":"https://avatars.githubusercontent.com/u/8483301?v=3","gravatar_id":"","url":"https://api.github.com/users/iromero91","html_url":"https://github.com/iromero91","followers_url":"https://api.github.com/users/iromero91/followers","following_url":"https://api.github.com/users/iromero91/following{/other_user}","gists_url":"https://api.github.com/users/iromero91/gists{/gist_id}","starred_url":"https://api.github.com/users/iromero91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iromero91/subscriptions","organizations_url":"https://api.github.com/users/iromero91/orgs","repos_url":"https://api.github.com/users/iromero91/repos","events_url":"https://api.github.com/users/iromero91/events{/privacy}","received_events_url":"https://api.github.com/users/iromero91/received_events","type":"User","site_admin":false},"created_at":"2016-05-17T20:43:34Z","updated_at":"2016-05-17T20:43:34Z","body":"I tried toggling start and stop a few times and i couldn't observe the problem, there shouldn't be a problem with alternate functions as I'm using the qfp48 package. I tried doing a soft reconnect on the usb port (put the port in suspend mode and back) on linux i did this: (my device was identified as 6-1)\r\n\r\n```\r\n# echo 0 > /sys/bus/usb/devices/6-1/power/autosuspend_delay_ms\r\n# echo auto > /sys/bus/usb/devices/6-1/power/control\r\n# echo on > /sys/bus/usb/devices/6-1/power/control\r\n```\r\n\r\nThe device disappeared from lsusb and the journal showed enumeration errors:\r\n\r\n```\r\n-- Logs begin at Thu 2016-05-05 00:43:49 CDT. --\r\nMay 17 15:36:25 cpz kernel: usb 6-1: USB disconnect, device number 15\r\nMay 17 15:36:26 cpz kernel: usb 6-1: new full-speed USB device number 16 using uhci_hcd\r\nMay 17 15:36:26 cpz kernel: usb 6-1: device not accepting address 16, error -32\r\nMay 17 15:36:26 cpz kernel: usb 6-1: new full-speed USB device number 17 using uhci_hcd\r\nMay 17 15:36:27 cpz kernel: usb 6-1: device not accepting address 17, error -32\r\nMay 17 15:36:27 cpz kernel: usb 6-1: new full-speed USB device number 18 using uhci_hcd\r\nMay 17 15:36:27 cpz kernel: usb 6-1: device not accepting address 18, error -32\r\nMay 17 15:36:27 cpz kernel: usb 6-1: new full-speed USB device number 19 using uhci_hcd\r\nMay 17 15:36:28 cpz kernel: usb 6-1: device not accepting address 19, error -32\r\nMay 17 15:36:28 cpz kernel: usb usb6-port1: unable to enumerate USB device\r\n```\r\nI don't know how to perform that on windows, but if you're in a PC or laptop that suspends it's ports on sleep mode you can try by putting it in sleep mode and waking the computer back up, the error will show up. I'm starting to think the library is failing to detect usb disconnect (suspend mode) after missing 3 SOF packets."}}