Skip to content

Commit f000538

Browse files
committed
Removed disable from disconnect to see if it affects the success of the soft reset test.
1 parent 09c5982 commit f000538

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

usb/device/targets/TARGET_NORDIC/TARGET_MCU_NRF52840/USBPhy_Nordic.cpp

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ void USBPhyHw::connect() {
139139
// when the internal regulator has settled
140140
if(!nrf_drv_usbd_is_enabled())
141141
nrf_drv_usbd_enable();
142+
143+
if(nrf_drv_power_usbstatus_get() == NRF_DRV_POWER_USB_STATE_READY
144+
&& !nrf_drv_usbd_is_started())
145+
nrf_drv_usbd_start(false);//nrf_drv_usbd_start(true);
142146
}
143147
}
144148

@@ -148,8 +152,8 @@ void USBPhyHw::disconnect() {
148152

149153
if(nrf_drv_usbd_is_started())
150154
nrf_drv_usbd_stop();
151-
if(nrf_drv_usbd_is_enabled())
152-
nrf_drv_usbd_disable();
155+
// if(nrf_drv_usbd_is_enabled())
156+
// nrf_drv_usbd_disable();
153157
}
154158

155159
void USBPhyHw::configure() {
@@ -232,7 +236,16 @@ void USBPhyHw::ep0_read(uint8_t *data, uint32_t size) {
232236
transfer->p_data.rx = data;
233237
transfer->size = size;
234238

235-
// Update the number of bytes remaining in the setup data stage
239+
// if((setup_total == 1) && ((setup_buf.bmRequestType & SETUP_TRANSFER_DIR_MASK) == 0))
240+
// {
241+
// setup_remaining -= size;
242+
// }
243+
// else
244+
// {
245+
// // Update the number of bytes remaining in the setup data stage
246+
// setup_remaining -= size;
247+
// }
248+
236249
setup_remaining -= size;
237250

238251
nrf_drv_usbd_setup_data_clear(); // tell the hardware to receive another OUT packet
@@ -412,10 +425,10 @@ void USBPhyHw::process() {
412425
if(setup_buf.wLength == 0) {
413426
nrf_drv_usbd_setup_clear();
414427
}
415-
else if((setup_buf.bmRequestType & SETUP_TRANSFER_DIR_MASK) == 0) {
416-
// HOST->DEVICE transfer, need to notify hardware of Data OUT stage
417-
nrf_drv_usbd_setup_data_clear();
418-
}
428+
// else if((setup_buf.bmRequestType & SETUP_TRANSFER_DIR_MASK) == 0) {
429+
// // HOST->DEVICE transfer, need to notify hardware of Data OUT stage
430+
// nrf_drv_usbd_setup_data_clear();
431+
// }
419432

420433
// Notify the Mbed stack
421434
events->ep0_setup();
@@ -496,6 +509,10 @@ void USBPhyHw::_reset(void)
496509
// Disable all endpoints except for control endpoints
497510
nrf_drv_usbd_ep_default_config();
498511

512+
nrf_drv_usbd_setup_clear();
513+
514+
usb_event_type = USB_HW_EVENT_NONE;
515+
499516
// TODO - Clear all endpoint interrupts?
500517
}
501518

0 commit comments

Comments
 (0)