summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Ringström <[email protected]>2021-08-13 14:11:14 +0200
committerTobias Ringström <[email protected]>2021-08-13 14:11:14 +0200
commit0ec794376bdc28aea3def01cc9fcbb7bcc6d5201 (patch)
tree16c16b4d5056d860b3056488cd921315f3f7db2c /src
parent89e4586653663b374272d9fd64a447b84352ae53 (diff)
Fix dcd_set_address bug when called more than once with different
addresses (e.g. after plugging the device into a different port).
Diffstat (limited to 'src')
-rw-r--r--src/portable/st/synopsys/dcd_synopsys.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/portable/st/synopsys/dcd_synopsys.c b/src/portable/st/synopsys/dcd_synopsys.c
index c15694eba..e36c2ba26 100644
--- a/src/portable/st/synopsys/dcd_synopsys.c
+++ b/src/portable/st/synopsys/dcd_synopsys.c
@@ -519,7 +519,7 @@ void dcd_int_disable (uint8_t rhport)
void dcd_set_address (uint8_t rhport, uint8_t dev_addr)
{
USB_OTG_DeviceTypeDef * dev = DEVICE_BASE(rhport);
- dev->DCFG |= (dev_addr << USB_OTG_DCFG_DAD_Pos) & USB_OTG_DCFG_DAD_Msk;
+ dev->DCFG = (dev->DCFG & ~USB_OTG_DCFG_DAD_Msk) | (dev_addr << USB_OTG_DCFG_DAD_Pos);
// Response with status after changing device address
dcd_edpt_xfer(rhport, tu_edpt_addr(0, TUSB_DIR_IN), NULL, 0);