USB host lite removable USB

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

USB host lite removable USB

944 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by elef on Mon Jul 16 08:27:35 MST 2012
Hi,

I'm trying to make the code functional in the USB host lite demo when you remove and insert USB memory stick.

LPC_USB->HcRhPortStatus1 = OR_RH_PORT_PRS; // Initiate port reset
Prior to this line being run in Host_EnumDev(), there are no problems with the interrupt when you insert and remove the USB stick. It generates an interrupt every single time, and correctly reads the CCS flag as low or high and shows if the device is being connected or disconnected.

However, once that line has executed, no more interrupts
Why? Is there a way to turn them back on? I tried setting the interrupt enable flags again, didnt make any difference.

How can i detect when the USB is inserted or removed? Preferably by interrupt?

I know it is not as nice, but maybe i can poll to see if USB is connected? Problem is, i can't poll the CCS or CSC or DRWE or RHSC flags as none of them are being changed. What am i doing wrong? At least 2 or 3 of them should change when a USB is removed.

LPC1768 RevA. I checked the errata sheet, doesn't mention anything about this, so i'm guessing i am doing something wrong...
0 项奖励
回复
4 回复数

790 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by elef on Fri Jul 20 06:10:21 MST 2012
Tsuneo,
Thank you. I could not get those going because they did not work with LPCxpresso or cmsis2, i was going to start fixing them up, when i thought i would check the pull down resistors on the USB board before i go to all the effort of porting the code.

Guess what? they were missing! last time i am buying a demo board from ebay!!!
arrrrrghhh!!!!

anyways, added pulldowns, they work great. Don't have any issues now with detecting insertion or removal of USB stick.
0 项奖励
回复

790 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Tsuneo on Thu Jul 19 19:58:49 MST 2012
I tested these examples on NXP "USB host mass storage class (MSC) example" page,
http://ics.nxp.com/support/software/usb.host.msc/

USBHostLite for LPC23xx/LPC24xx V1.00 (Jan 4, 2010)
http://ics.nxp.com/support/documents/microcontrollers/zip/usb.host.lite.zip

USBHostLite for LPC17xx VBeta 0.01 (Jul 14, 2009)
http://ics.nxp.com/support/documents/microcontrollers/zip/usb.host.lite.lpc17xx.zip

I have a LPCXpresso LPC1769 board, but I was too lazy to make connections of a USB receptacle, and to run it on LPCXpresso IDE. Sound like the problem relates to porting. I'll test it on this setting.

Tsuneo
0 项奖励
回复

790 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by elef on Wed Jul 18 18:26:07 MST 2012
Thanks. I'll have to check out that version. When you say "Original" which one are you referring to? Because there are 2 versions on the NXP website, and also the link to code red with a 3rd version! None of them are the same...

I wonder if my demo board has anything to do with it, it might have the wrong pull down resistors (might be 10k instead of 15k) but i'll check that too.
Although, that doesn't explain why it works 100% of the time before it enumerates... And then stops working after enumeration. Will let you know what i find!

FYI, i have tried these 2 versions:
RDB1768cmsis2.zip
from:
http://support.code-red-tech.com/CodeRedWiki/RDB1768cmsisExampleProjects

and
USB Host Example for Keil MCB1700 (Dec 8, 2009)
from:


I haven't tried this one, is this the one you tried?
MCB1700 Sample Code Bundle for LPC1769 Peripherals using LPCXpresso V2.00 (Jan 10, 2011)
http://ics.nxp.com/support/lpcxpresso/
0 项奖励
回复

790 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Tsuneo on Wed Jul 18 09:29:13 MST 2012

Quote:
However, once that line has executed, no more interrupts



On my side, the interrupt occurs with CSC (ConnectStatusChange), at both of plug in/ off of a USB stick, after the main() finishes file copy.

I tested it on the original USBHostLite on the NXP site,
- USBHostLite_LPC17xx.001 (Olimex LPC1766)
and
- USBHostLite.100 (Olimex LPCE2468)

Tsuneo
0 项奖励
回复