GrumpyOldPizza / ArduinoCore-stm32l0

Arduino Core for STM32L0
125 stars 67 forks source link

Disable USB pullup when stopping USB #176

Open matthijskooijman opened 3 years ago

matthijskooijman commented 3 years ago

It turns out that stopping the USB peripheral does not automatically reset this pullup, so stopping USB (e.g. through USBDevice.detach()) would let the pullup enabled, making the USB host think the board was still connected (but any subsequent communication would fail). Additionally, this would use around 300μA of current.

This is a bug in the USB HAL used. This commit backports a small change from the HAL v1.11.3 to fix this.

This fixes #171