Hi
I understand that your serial loader is the device: After uploading a new file the loader will usually perform a SW reset in order to continue and this also causes the device to be disconnected.
As far as I can tell there is no de-installation method that disconnects a device itself but looking at the low level de-installation after a USB reset (in the HW USB interrupt _usb_hs_otg_isr_common()):
if ((ulInterrupts & USBHS_USBINTR_URE) != 0) { // handle USB reset interrupt
fnDeInitEndpoints(ptrHSUSB, Channel); // abort any active endpoints and free transfer buffers
ptrHSUSB->EPCR0 = (USBHS_EPCR_RXE | USBHS_EPCR_RXR | USBHS_EPCR_TXE | USBHS_EPCR_TXR); // reset data toggle (synchronise) on endpoint 0
ptrHSUSB->EPSETUPSR = ptrHSUSB->EPSETUPSR; // clear all setup token semaphores by reading the EPSETUSR register and writing the same value back
ptrHSUSB->EPCOMPLETE = ptrHSUSB->EPCOMPLETE; // clear all the endpoint complete status bits by reading the EPCOMPLETE register and writing the same value back
#if defined _WINDOWS
ptrHSUSB->EPSETUPSR = 0;
ptrHSUSB->EPCOMPLETE = 0;
ptrHSUSB->USBSTS = USBHS_USBSTS_PCI; // usually a port change interrupt follows a reset
#endif
if ((ptrHSUSB->PORTSC1 & USBHS_PORTSC1_PR) == 0) { // if we are too slow responding the port reset will have completed
ptrHSUSB->USBCMD &= ~(USBHS_USBCMD_RS); // ensure not in run mode
ptrHSUSB->USBCMD = USBHS_USBCMD_RST; // command a hardware reset
fnUSBHS_init(((ptrHSUSB->PORTSC1 & USBHS_PORTSC1_PFSC) == 0), (QUEUE_LIMIT)Channel, ucHS_EndpointCount[Channel]); // re-initialise the controller
ucUSBHS_state[Channel] = 0;
}
else {
ucUSBHS_state[Channel] = USBHS_STATE_RESETTING; // the ulpi is still detecting the reset state
}
ptrHSUSB->USBINTR &= ~(USBHS_USBINTR_SLE); // disable the suspend interrupt
ptrHSUSB->PERIODICLISTBASE_DEVICEADDR = 0; // reset device address
uDisable_Interrupt(); // ensure interrupts remain blocked when putting messages to queue
fnUSB_handle_frame(USB_RESET_DETECTED, 0, 0, &hs_usb_hardware[Channel]); // generic handler routine
hs_usb_hardware[Channel].ucUSBAddress = 0; // reset the address to revert back to the default state
uEnable_Interrupt(); // re-enable interrupts
}
I suspect that it may be necessary to either provoke such a reset or else disable the USB (eg via USB controller reset) and execute the same, or part of this.
Could you describe exactly the goal and also how it would best be tested?
Regards
Mark