mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-19 23:08:34 +03:00
USB: implement USB reset by setting the on-board pull-up on D+ low
This commit is contained in:
committed by
Harald Welte
parent
4136c242a8
commit
f5869d4a59
@@ -194,6 +194,12 @@ extern int main(void)
|
|||||||
board_main_top();
|
board_main_top();
|
||||||
|
|
||||||
TRACE_INFO("USB init...\n\r");
|
TRACE_INFO("USB init...\n\r");
|
||||||
|
/* Signal USB reset by disabling the pull-up on USB D+ for at least 10 ms */
|
||||||
|
const Pin usb_dp_pullup = PIN_USB_PULLUP;
|
||||||
|
PIO_Configure(&usb_dp_pullup, 1);
|
||||||
|
PIO_Set(&usb_dp_pullup);
|
||||||
|
mdelay(15);
|
||||||
|
PIO_Clear(&usb_dp_pullup);
|
||||||
USBDFU_Initialize(&dfu_descriptors);
|
USBDFU_Initialize(&dfu_descriptors);
|
||||||
|
|
||||||
while (USBD_GetState() < USBD_STATE_CONFIGURED) {
|
while (USBD_GetState() < USBD_STATE_CONFIGURED) {
|
||||||
|
|||||||
@@ -85,11 +85,10 @@
|
|||||||
#define SIM_PWEN PIO_PA5
|
#define SIM_PWEN PIO_PA5
|
||||||
#define VCC_FWD PIO_PA26
|
#define VCC_FWD PIO_PA26
|
||||||
|
|
||||||
|
/** Pin configuration to control USB pull-up on D+
|
||||||
//** USB **/
|
* @details the USB pull-up on D+ is enable by default on the board but can be disabled by setting PA16 high
|
||||||
// USB pull-up control pin definition (PA16).
|
*/
|
||||||
// Default: 1 (USB Pullup deactivated)
|
#define PIN_USB_PULLUP {PIO_PA16, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
|
||||||
#define PIN_USB_PULLUP {1 << 16, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
|
||||||
|
|
||||||
// Board has UDP controller
|
// Board has UDP controller
|
||||||
#define BOARD_USB_UDP
|
#define BOARD_USB_UDP
|
||||||
|
|||||||
@@ -603,11 +603,17 @@ static const USBDDriverDescriptors driverDescriptors = {
|
|||||||
|
|
||||||
void SIMtrace_USB_Initialize(void)
|
void SIMtrace_USB_Initialize(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* Signal USB reset by disabling the pull-up on USB D+ for at least 10 ms */
|
||||||
|
const Pin usb_dp_pullup = PIN_USB_PULLUP;
|
||||||
|
PIO_Configure(&usb_dp_pullup, 1);
|
||||||
|
PIO_Set(&usb_dp_pullup);
|
||||||
|
mdelay(15);
|
||||||
|
PIO_Clear(&usb_dp_pullup);
|
||||||
|
|
||||||
// Get std USB driver
|
// Get std USB driver
|
||||||
USBDDriver *pUsbd = USBD_GetDriver();
|
USBDDriver *pUsbd = USBD_GetDriver();
|
||||||
|
|
||||||
TRACE_DEBUG(".");
|
|
||||||
|
|
||||||
// Initialize standard USB driver
|
// Initialize standard USB driver
|
||||||
USBDDriver_Initialize(pUsbd, &driverDescriptors, 0); // Multiple interface settings not supported
|
USBDDriver_Initialize(pUsbd, &driverDescriptors, 0); // Multiple interface settings not supported
|
||||||
USBD_Init();
|
USBD_Init();
|
||||||
|
|||||||
Reference in New Issue
Block a user