lpcware

LPC11u37h usb DEVCMDSTAT register.. cannot change the DEV_ADDR bits...

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by siangming on Wed Dec 10 23:26:05 MST 2014
Hi all,

i am trying to implement a simple USB device on the lpc11u37h.

i am writing my own device drivers on the lpc, but my program got stuck at the Set Address request from the host PC (win 7).

1. i am getting a valid new address from the host.
2. i am writing the new address into DEVCMDSTAT register inside the ISR of the endpoint0 IN interrupt (which correspond to the STATUS stage completion). i know for sure that i am writing the new address in the STATUS stage completion because i set a flag during the SETADDRESS request handling and check for this flag in my endpoint0 IN ISR before i proceed to set the new address.

Here comes the problem.. upon inspection of the register values, i realised i cannot write to the DEV_ADDR (bit0..6) of the DEVCMDSTAT.

ptrToUSB->DEVCMDSTAT |= 0x7F; has no effect on the last 7bits of the register.

- To investigate further, i loaded an example USB HID application by NXP into my LPC chip and it can enumerate ok on the same host pc. This proves my LPC hardware is ok.
- Next, i tried to write to the DEV_ADDR (bit0..6) of the DEVCMDSTAT at the beginning of my program (just after reset_handler)..i also cannot change the bit0..6 at all.. but i can change the other bits of the DEVCMDSTAT register...

Can anyone advise if the LPC11u37h is hard-wired such that we need to satisfy some conditions/settings in some registers before we can write to the DEV_ADDR (bit0..6) of the DEVCMDSTAT??

i am so lost.... HELP!!!

Outcomes