ea4357 can be enumerated, but get setconfiugre value of 0

This commit is contained in:
hathach 2013-05-29 16:56:15 +07:00
parent d5836751d9
commit 04a641f067
5 changed files with 19 additions and 9 deletions

View File

@ -57,6 +57,13 @@ void board_init(void)
// USB1 Power: EA4357 channel A U20 is enabled by SJ5 connected to pad 1-2, no more action required
// TODO Device only USB0
// 1.5Kohm pull-up resistor is needed on the USB DP data signal. GPIO28 (base), P9_5 (LPC4357) controls
scu_pinmux(0x9, 5, MD_PUP|MD_EZI|MD_ZI, FUNC4); // GPIO5[18]
GPIO_SetDir(5, BIT_(18), 1); // output
GPIO_ClearValue(5, BIT_(18));
// init I2C and set up MIC2555 to have 15k pull-down on USB1 D+ & D-
I2C_Init(LPC_I2C0, 100000);
I2C_Cmd(LPC_I2C0, ENABLE);

View File

@ -58,8 +58,6 @@
#include "common/common.h"
#include "dcd_nxp_romdriver.h"
#define ROM_API ( * (*((USBD_API_T***) 0x1FFF1FF8)) ) // TODO remove rom API dependency
tusb_error_t dcd_init(void) ATTR_WARN_UNUSED_RESULT;
tusb_error_t dcd_controller_reset(uint8_t coreid) ATTR_WARN_UNUSED_RESULT;
void dcd_controller_connect(uint8_t coreid);

View File

@ -153,6 +153,7 @@ tusb_error_t dcd_init(void)
&membase , &memsize) );
#endif
hal_interrupt_enable(0);
ROM_API->hw->Connect(g_hUsb, 1);
return TUSB_ERROR_NONE;
@ -172,7 +173,7 @@ tusb_error_t dcd_controller_reset(uint8_t coreid)
void dcd_controller_connect(uint8_t coreid)
{
ROM_API->hw->Connect(g_hUsb, 1);
// ROM_API->hw->Connect(g_hUsb, 1);
}
void dcd_isr(uint8_t coreid)

View File

@ -54,8 +54,10 @@
#if (MCU == MCU_LPC18XX) || (MCU == MCU_LPC43XX)
#include "dcd_lpc18xx_lpc43xx.h"
#define ROM_API ( * ((USBD_API_T**) DEVICE_ROM_DRIVER_ADDR) )
#elif (MCU == MCU_LPC13UXX)
#include "dcd_lpc13xx.h"
#define ROM_API ( * (*((USBD_API_T***) DEVICE_ROM_DRIVER_ADDR)) )
#else
#error forgot something, thach ?
#endif

View File

@ -70,8 +70,10 @@ tusb_error_t hal_init(void)
LPC_USB0->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5);
#else // TODO OTG
// dcd_controller_reset(0);
LPC_USB0->USBMODE_D = LPC43XX_USBMODE_DEVICE;
dcd_controller_connect(0);
// LPC_USB0->USBMODE_D = LPC43XX_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)*/;
// LPC_USB0->PORTSC1_D |= (1<<24); // force full speed
// dcd_controller_connect(0);
#endif
hal_interrupt_enable(0);
@ -104,18 +106,18 @@ tusb_error_t hal_init(void)
return TUSB_ERROR_NONE;
}
#if TUSB_CFG_CONTROLLER0_MODE
void USB0_IRQHandler(void)
{
#if TUSB_CFG_CONTROLLER0_MODE
tusb_isr(0);
#endif
}
#endif
#if TUSB_CFG_CONTROLLER1_MODE
void USB1_IRQHandler(void)
{
#if TUSB_CFG_CONTROLLER1_MODE
tusb_isr(1);
#endif
}
#endif
#endif