lpc4357 USB0 device usb0_dp 1.5k pull up

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

lpc4357 USB0 device usb0_dp 1.5k pull up

1,633 次查看
__placeholder__
Contributor II

I'm using the LPC4357-EVB development board and trying to get USB0 working as a device.  The LPC4357-EVB has a number of issues - 33ohm series resistors are installed on USB0_DP and USB0_DM, whereas the user guide is specific not to use external series resistors (User Guide Table 185 USB0_DP USB0_DM "Do not add an external series
resistor").  These have been removed and replaced with 0 ohm jumpers.  The second change I have made is that as a device I don't need the 15k pull downs on DP and DM, so these have been removed.

Schematic: element14: Schematics for the LPC4357-EVB | element14 | Technical Library 

The host does not start enumeration.  When I look at DP and DM both are pulled down to 0V. If I manually pull DP up to 3.3V with an external 1.5k resistor enumeration starts up (I get an address change packet straight way, but no HS chirp).  This is not ideal because the pull up needs to be disconnected for high speed operation.

According to the user guide there is a internal 1.5k pull up on DP which will switch on when USBCMD_D bit RS is set  (Table 469 - 25.6.3.1) and a voltage is present on USB0_VBUS (Table 460).  Table 460 also tells me that USB0_DM will be pulled up with a 1.5k resistor to 3.3V as well which confuses me - it what situation does both DP and DM get pulled high?

So why can't I get the internal 1.5k pull up to work?  I have set bit RS and there is 5V on USB0_VBUS.  USBMODE is set to device controller.  I think it might be my OTG settings - does OTGSC make any different in device mode?

标签 (2)
0 项奖励
回复
5 回复数

1,144 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi,

Thanks for your reply.

I'd highly recommend you to refer to the USB demos which is included in this library please, its link is below.

LPC43xx CMSIS-Compliant Standard Peripheral Firmware Driver Library (Keil, IAR) | www.LPCware.com 

Hope this helps.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,144 次查看
__placeholder__
Contributor II

It is not the software.  If I upload the same code to a different board (Embedded Artists) then the USB works in device mode.

At this point I can't see why the LPC4357-EVB does not work - the VBUS, DP and DM connections are fairly straight forward so I can't see why one board works and one does not. 

Given the LPC4357-EVB has a host of other design flaws and I can't check the VBUS pin because of the BGA part, I'm going to mark this one down as the LPC4357-EVB hardware. 

0 项奖励
回复

1,144 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi,

Thank you for your interest in NXP Semiconductor products and the opportunity to serve you.

The question statement also confuse me, in my opinion, your essential request is wondering how to make the LPC4370 work as Device mode with full-speed, is it right?
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,144 次查看
__placeholder__
Contributor II

Yes (except it is the LPC4357) - I would like to use USB0 as a device in high speed mode.  Full speed would be a good start, but I picked the LPC4357 over the LPC4088 specifically to get high speed USB.

0 项奖励
回复

1,144 次查看
__placeholder__
Contributor II

More information:  if I set the DP bit in OTGSC then the internal DP line is pulled up and enumeration begins.  The problem is that no interrupts are generated apart from SOF.  I believe the root cause is that when I set the RS bit in the USBCMD_D register the LPC does not pull up DP because it is not seeing voltage on USB0_VBUS.  I can't test the connection to the VBUS pin because of the BGA device and that the pin is dedicated, so the function can't be changed, but it does the same thing on two commercially assembled devices, so I doubt it is a bad connection on the LPC chip.

Initialization code is:

// PLL0 is 480 MHz, CLK_M4_USB0 is running, CLK_USB0_CFG is on

LPC_RGU->RESET_CTRL0 = (1<<17);

LPC_USB0->USBCMD_D = USBCMD_RST;

while (LPC_USB0->USBCMD_D & USBCMD_RST);

LPC_USB0->USBMODE_D = USBMODE_CM_DEV | USBMODE_SLOM;

LPC_CREG->CREG0 &= ~(1<<5); // turn on USB0 PHY

USBD_Reset();
USBD_SetAddress(0, FALSE);

LPC_USB0->OTGSC = (1UL<<0) | (1UL<<3); // OTG discharge VBUS, set DM termination pull down

LPC_USB0->PORTSC1_D &= ~(1UL << 24); // HS

LPC_USBx->USBINTR_D  = (1UL << 0 ) | (1UL << 2 ) | (1UL << 8 ) | (1UL << 16) | (1UL << 6 ) | (1UL << 7) | (1UL << 1) ;

NVIC_EnableIRQ(USB0_IRQn);

// endpoint setup stuff here ...

LPC_USB0->USBCMD_D |= 1; // connect

When running I see:

LPC_CREG->CREG0 = 0xFIC = 111100011100 = USB0 PHY enabled

LPC_USB0->USBMODE_D = 0xA = 1010 = device, setup lockout off

LPC_USB0->USBSTS_D = 0

LPC_USB0->OTGSC = 0x201109 = vbus dischrg, OTG term, B-device, B session end, 1ms int

LPC_USB0->USBINTR_D = 0x101C7 = USB int, error int, port change int, reset int, SOF int, sleep int

LPC_USB0->PORTSC1_D = 0x3D000804 = port enabled, full speed only, high speed

I think the OTGSC "B-session end" bit being set shows that the VBUS is below 0.8V, which is stopping the LPC from first pulling up DP and then enabling the SIE.  No VBUS sensing control on the LPC43xx?

0 项奖励
回复