summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-11-06 14:53:18 +0700
committerhathach <[email protected]>2013-11-06 14:53:18 +0700
commit60d444b4521428511fdf7864c9c6e2193f5572b6 (patch)
tree58511da2052f8f2b7079dcfec8ecf915207e4015
parent58b41a05db5bf564a4d93312d8fdee368604ed55 (diff)
fix a bug with USB1, but still cannot get interrupt occurred on USB1
-rw-r--r--demos/bsp/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_cgu.c3
-rw-r--r--tinyusb/device/dcd_lpc43xx.c3
-rw-r--r--tinyusb/hal/hal_lpc43xx.c2
3 files changed, 5 insertions, 3 deletions
diff --git a/demos/bsp/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_cgu.c b/demos/bsp/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_cgu.c
index ba5306c2e..b091668c8 100644
--- a/demos/bsp/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_cgu.c
+++ b/demos/bsp/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_cgu.c
@@ -23,7 +23,7 @@
* warranty that such application will be suitable for the specified
* use without further testing or modification.
* Permission to use, copy, modify, and distribute this software and its
-* documentation is hereby granted, under NXP Semiconductors�
+* documentation is hereby granted, under NXP Semiconductors�
* relevant copyright in the software, without fee, provided that it
* is used in conjunction with NXP Semiconductors microcontrollers. This
* copyright, permission, and disclaimer notice must appear in all copies of
@@ -200,6 +200,7 @@ uint32_t CGU_Init(void){
// Disable PLL1 CPU hang???
//CGU_EnableEntity(CGU_CLKSRC_PLL1, DISABLE);
CGU_SetPLL1(6);
+// CGU_SetPLL1(5);
CGU_EnableEntity(CGU_CLKSRC_PLL1, ENABLE);
CGU_EntityConnect(CGU_CLKSRC_PLL1, CGU_BASE_M4);
CGU_UpdateClock();
diff --git a/tinyusb/device/dcd_lpc43xx.c b/tinyusb/device/dcd_lpc43xx.c
index 9d38a3d91..cbff0a67f 100644
--- a/tinyusb/device/dcd_lpc43xx.c
+++ b/tinyusb/device/dcd_lpc43xx.c
@@ -256,7 +256,8 @@ static void lpc43xx_controller_init(uint8_t coreid)
lpc_usb->USBCMD_D &= ~0x00FF0000; // Interrupt Threshold Interval = 0
lpc_usb->ENDPOINTLISTADDR = (uint32_t) p_dcd->qhd; // Endpoint List Address has to be 2K alignment
- lpc_usb->USBINTR_D = INT_MASK_USB | INT_MASK_ERROR | INT_MASK_PORT_CHANGE | INT_MASK_RESET | INT_MASK_SUSPEND; // | INT_MASK_SOF| INT_MASK_NAK;
+ lpc_usb->USBSTS_D = lpc_usb->USBSTS_D;
+ lpc_usb->USBINTR_D = INT_MASK_USB | INT_MASK_ERROR | INT_MASK_PORT_CHANGE | INT_MASK_RESET | INT_MASK_SUSPEND; // | INT_MASK_SOF| INT_MASK_NAK;
}
tusb_error_t dcd_init(void)
diff --git a/tinyusb/hal/hal_lpc43xx.c b/tinyusb/hal/hal_lpc43xx.c
index 1c5c221ef..b59b433b3 100644
--- a/tinyusb/hal/hal_lpc43xx.c
+++ b/tinyusb/hal/hal_lpc43xx.c
@@ -112,7 +112,7 @@ tusb_error_t hal_init(void)
#if TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST
LPC_USB1->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5);
#else // TODO OTG
- LPC_USB0->USBMODE_D = LPC43XX_USBMODE_DEVICE;
+ LPC_USB1->USBMODE_D = LPC43XX_USBMODE_DEVICE;
dcd_controller_connect(1);
#endif