Re: USB Composite library MIDI Get Bytes without using Callbacks
Posted: Fri Jan 14, 2022 4:33 pm
USB has something called the 'single ended zero' - usb reset. i.e. pull both D+ / D- to gnd for 10ms
https://www.usbmadesimple.co.uk/ums_3.htm
resetting the mcu do not necessarily send the 'single ended zero'. so it may be a problem on the *host* side, i.e. the host 'remembers' the previous state and do not enumerate ports again.
a usual 'trick' is to enable or disable the device in windows, i'm not sure if there are other 'short cuts'
in linux there is a little piece of code that can do that usb reset
https://github.com/jkulesza/usbreset
it is possible to do this usb reset in your codes, e.g. in setup etc
e.g.
the trouble here is actually this is incorrect, you need to restore the AFIO to USB after this.
it would be better to search in RM0008 for a proper means to do this usb reset
and you probably need to do this prior to calling usbComposite.begin() for that matter.
https://www.usbmadesimple.co.uk/ums_3.htm
resetting the mcu do not necessarily send the 'single ended zero'. so it may be a problem on the *host* side, i.e. the host 'remembers' the previous state and do not enumerate ports again.
a usual 'trick' is to enable or disable the device in windows, i'm not sure if there are other 'short cuts'
in linux there is a little piece of code that can do that usb reset
https://github.com/jkulesza/usbreset
it is possible to do this usb reset in your codes, e.g. in setup etc
e.g.
Code: Select all
pinMode(PA11, OUTPUT);
pinMode(PA12, OUTPUT);
digitalWrite(PA11, LOW);
digitalWrite(PA12, LOW);
delay(10);
pinMode(PA11, INPUT);
pinMode(PA12, INPUT);
it would be better to search in RM0008 for a proper means to do this usb reset
and you probably need to do this prior to calling usbComposite.begin() for that matter.