<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Register not getting set</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/40299/register-not-getting-set</link><description> 
I have the sample KEIL USB HID project for the LPC2148 and I have
a project I started in which I am going through the KEIL code section
by section attempting to thouroughly understand its function and tune
the code for my needs. 

 
In the KEIl project</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Register not getting set</title><link>https://community.arm.com/thread/81379?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2013 08:43:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:98d4d3e2-91c8-422b-822e-bc31e2e382fa</guid><dc:creator>Wesley Carlsen</dc:creator><description>&lt;p&gt;&lt;p&gt;
This is identical logic to the code I am using in my project which
is below and allows me to realize and setup the needed number of
endpoints all at once which in my case is the first four
endpoints:&lt;/p&gt;

&lt;p&gt;
void realizeEndpoints(char count)&lt;br /&gt;
{ char i;&lt;/p&gt;

&lt;p&gt;
for(i = 0; i &amp;lt; count; i++) { USBReEp |= (1 &amp;lt;&amp;lt; i);&lt;/p&gt;

&lt;p&gt;
USBEpInd = i; USBMaxPSize = 64;&lt;/p&gt;

&lt;p&gt;
while((USBDevIntSt &amp;amp; 0x00000100) == 0); USBDevIntClr |=
0x00000100; }&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;
When I run the sample code it goes over this line &amp;quot;while
((DEV_INT_STAT &amp;amp; EP_RLZED_INT) == 0);&amp;quot; with no problem but when i
run my code it gets stuck on &amp;quot;while((USBDevIntSt &amp;amp; 0x00000100) ==
0);&amp;quot; and they should be the same from what I can tell.&lt;/p&gt;

&lt;p&gt;
And I am confused by &amp;quot;you should pass bad parameter(s)&amp;quot;. So I
should try and pass in bad data to registers and so forth to see if
it also fails under those conditions?&lt;/p&gt;

&lt;p&gt;
Thanks,&lt;br /&gt;
Wesley&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Register not getting set</title><link>https://community.arm.com/thread/62185?ContentTypeID=1</link><pubDate>Sun, 11 Aug 2013 21:20:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7d5c4644-d8d5-45ce-9e86-d9d0ef62da8a</guid><dc:creator>Chinzei Tsuneo</dc:creator><description>&lt;p&gt;&lt;p&gt;
In the USBHID of current MDK-ARM (v4.72a), equivalent line appears
on USB_ConfigEP() subroutine.&lt;/p&gt;

&lt;pre&gt;
C:\Keil\ARM\Boards\Keil\MCB2140\USBHID\usbhw.c

/*
 *  Configure USB Endpoint according to Descriptor
 *    Parameters:      pEPD:  Pointer to Endpoint Descriptor
 *    Return Value:    None
 */

void USB_ConfigEP (USB_ENDPOINT_DESCRIPTOR *pEPD) {
  U32 num;

  num = EPAdr(pEPD-&amp;gt;bEndpointAddress);
  REALIZE_EP |= (1 &amp;lt;&amp;lt; num);
  EP_INDEX = num;
  MAXPACKET_SIZE = pEPD-&amp;gt;wMaxPacketSize;
  while ((DEV_INT_STAT &amp;amp; EP_RLZED_INT) == 0);    // &amp;lt;----
  DEV_INT_CLR = EP_RLZED_INT;
}
&lt;/pre&gt;

&lt;p&gt;
Above code lines exactly follow the example on the LPC2148 User
Manual, chapter 9.7.12&lt;br /&gt;
If the &amp;quot;while&amp;quot; clause wouldn&amp;#39;t finish, you should pass bad
parameter(s) to the USB registers, just before this line,&lt;br /&gt;
- REALIZE_EP (USBReEp)&lt;br /&gt;
- EP_INDEX (USBEpIn)&lt;br /&gt;
- MAXPACKET_SIZE (USBMaxPSize)&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>