host port plugged isr detect, but control xfer not work

This commit is contained in:
hathach 2018-12-06 00:10:49 +07:00
parent 10d67ae25c
commit 5d4d3431c2
1 changed files with 31 additions and 2 deletions

View File

@ -182,7 +182,17 @@ void board_init(void)
USBMODE_VBUS_HIGH = 1
};
// USB0
/* USB0
* For USB Device operation; insert jumpers in position 1-2 in JP17/JP18/JP19. GPIO28 controls USB
* connect functionality and LED32 lights when the USB Device is connected. SJ4 has pads 1-2 shorted
* by default. LED33 is controlled by GPIO27 and signals USB-up state. GPIO54 is used for VBUS
* sensing.
* For USB Host operation; insert jumpers in position 2-3 in JP17/JP18/JP19. USB Host power is
* controlled via distribution switch U20 (found in schematic page 11). Signal GPIO26 is active low and
* enables +5V on VBUS2. LED35 light whenever +5V is present on VBUS2. GPIO55 is connected to
* status feedback from the distribution switch. GPIO54 is used for VBUS sensing. 15Kohm pull-down
* resistors are always active
*/
#if CFG_TUSB_RHPORT0_MODE
Chip_USB0_Init();
@ -193,13 +203,32 @@ void board_init(void)
// Set mode
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
LPC_USB0->USBMODE_H = USBMODE_HOST | (USBMODE_VBUS_HIGH << 5);
LPC_USB0->PORTSC1_D |= (1<<24); // FIXME force full speed for debugging
#else // TODO OTG
LPC_USB0->USBMODE_D = USBMODE_DEVICE;
LPC_USB0->OTGSC = (1<<3) | (1<<0) /*| (1<<16)| (1<<24)| (1<<25)| (1<<26)| (1<<27)| (1<<28)| (1<<29)| (1<<30)*/;
#endif
#endif
// USB1
/* USB1
* When USB channel #1 is used as USB Host, 15Kohm pull-down resistors are needed on the USB data
* signals. These are activated inside the USB OTG chip (U31), and this has to be done via the I2C
* interface of GPIO52/GPIO53.
* J20 is the connector to use when USB Host is used. In order to provide +5V to the external USB
* device connected to this connector (J20), channel A of U20 must be enabled. It is enabled by default
* since SJ5 is normally connected between pin 1-2. LED34 lights green when +5V is available on J20.
* JP15 shall not be inserted. JP16 has no effect
*
* When USB channel #1 is used as USB Device, a 1.5Kohm pull-up resistor is needed on the USB DP
* data signal. There are two methods to create this. JP15 is inserted and the pull-up resistor is always
* enabled. Alternatively, the pull-up resistor is activated inside the USB OTG chip (U31), and this has to
* be done via the I2C interface of GPIO52/GPIO53. In the latter case, JP15 shall not be inserted.
* J19 is the connector to use when USB Device is used. Normally it should be a USB-B connector for
* creating a USB Device interface, but the mini-AB connector can also be used in this case. The status
* of VBUS can be read via U31.
* JP16 shall not be inserted.
*/
#if CFG_TUSB_RHPORT1_MODE
Chip_USB1_Init();