They both have an empty interrupt routine declared. And yes there is a EPRAM
that the USB controller can only access if the 48MHz USB Clock is running and it
is since I set that up in the code.
void USB_ISR(void) __iqr
{
//eventually handle transfers here, for now let the enumeration process fail
}
Oddly enough in messing with the code this afternoon it now connects same as the
old code and fails enumeration as it should at the moment. I don't really
know what I did to fix the problem yet but I am still working on the issue.
I now have two other issues:
1. If I run my code it doesn't seem to fall into the VIC Interrupt routine
I set "USB_ISR" even if I plug/unplug the USB cable but it does restart the
attempted connection process; I can tell by the setup packets sent back and
forth (which I can see via my hardware analyzer) when I un-plug and re-plug in
the cable.
2. The same as I mentioned on this forum
post http://www.keil.com/forum/23615/ it seems as though a specific
register is not getting set; if I look at it in debug mode it reads 0x10 not
0x100.
Thanks,
Wesley
________________________________
From: capiman26061973
To: l...
Sent: Thursday, August 8, 2013 1:31 PM
Subject: [lpc2000] Re: LPC2148 USB HID KEIL Sample Project Issues
Hello Wesley,
two things to check come into my mind:
- Does one have an interrupt routine and the other has none.
- As far as i remember, USB buffer must be placed into
a RAM area which the USB controller can access.
Best regards,
Martin
--- In l..., Wesley Carlsen wrote: >
> I have the following code in two different uVision projects (one is the
default project that I got from the KEIL website that sets up a USB HID and the
other is a barebones project I created to understand how the sample USB code
works). I borrowed all of this code verbatim (in only changed the constants to
register values and numbers) from the sample KEIL USB HID project (which works
fine and enumerates succesfully with the set address and reset uncommented),
however I commented these items out to make the code as basic as possible (even
though I know it will fail enumeration when I run the sample KEIL code the
computer sees the device and says "device unknown" but when I run this code
absolutely nothing happens at all. I have a hardware analyzer hooked up and when
I run my project absolutely nothing shows up but when I run the demo project it
starts the enumeration process and fails (understandably).
>
>
> Thanks,
> Wesley
>
> void setup()
> {
> PCONP |= 0x80000000;
/* Turn On USB PCLK */
> IODIR0 &= 0xFF7FFFFF; // set P0.23 to input
> IODIR0 |= 0x80000000; // set P0.31 to CONNECT
>
> PINSEL1 = (PINSEL1 & ~((unsigned long)3 << 14)) | ((unsigned long)1 <<
14);
> PINSEL1 = (PINSEL1 & ~((unsigned long)3 << 30)) | ((unsigned long)2 <<
30);
>
> /* Configure 48MHz USB Clock; FOsc = 12MHz, M = 4, P = 2 */
> PLL1CFG = 0x23;
/* M = 4, P = 2 */
> PLL1CON = 1;
/* PLL Enable */
> PLL1FEED = 0xAA;
/* Feed Sequence 1 */
> PLL1FEED = 0x55;
/* Feed Sequence 2 */
>
> while ((PLL1STAT & (1 << 10)) == 0); /* Wait for PLL Lock */
>
> PLL1CON = 3; /* PLL Enable & Connect */
> PLL1FEED = 0xAA;
/* Feed Sequence 1 */
> PLL1FEED = 0x55;
/* Feed Sequence 2 */
>
> VICVectAddr5 = (unsigned long)USB_ISR; /* USB Interrupt ->
Vector 5 */
> VICVectCntl5 = 0x20 | 22;
/* USB Interrupt -> IRQ Slot 5 */
> VICIntEnable = 1 << 22;
/* Enable USB Interrupt */
>
> USBDevIntEn = 4 | 8; /* Enable Device Status Interrupt */
>
> //reset();
> //setAddress(0);
>
> WrCmdDat(0x00FE0500, DAT_WR_BYTE(1)); //DAW_WR_BYTE is simply a macro
that ORs with number with the appropriate surrounding bits for the given
command
>
> }
>
> [Non-text portions of this message have been removed]
>
[Non-text portions of this message have been removed]
two things to check come into my mind:
- Does one have an interrupt routine and the other has none.
- As far as i remember, USB buffer must be placed into
a RAM area which the USB controller can access.
Best regards,
Martin
--- In l..., Wesley Carlsen wrote: >
> I have the following code in two different uVision projects (one is the
default project that I got from the KEIL website that sets up a USB HID and the
other is a barebones project I created to understand how the sample USB code
works). I borrowed all of this code verbatim (in only changed the constants to
register values and numbers) from the sample KEIL USB HID project (which works
fine and enumerates succesfully with the set address and reset uncommented),
however I commented these items out to make the code as basic as possible (even
though I know it will fail enumeration when I run the sample KEIL code the
computer sees the device and says "device unknown" but when I run this code
absolutely nothing happens at all. I have a hardware analyzer hooked up and when
I run my project absolutely nothing shows up but when I run the demo project it
starts the enumeration process and fails (understandably).
>
>
> Thanks,
> Wesley
>
> void setup()
> {
> PCONP |= 0x80000000; /* Turn On USB PCLK */
> IODIR0 &= 0xFF7FFFFF; // set P0.23 to input
> IODIR0 |= 0x80000000; // set P0.31 to CONNECT
>
> PINSEL1 = (PINSEL1 & ~((unsigned long)3 << 14)) | ((unsigned long)1 <<
14);
> PINSEL1 = (PINSEL1 & ~((unsigned long)3 << 30)) | ((unsigned long)2 <<
30);
>
> /* Configure 48MHz USB Clock; FOsc = 12MHz, M = 4, P = 2 */
> PLL1CFG = 0x23; /* M = 4, P = 2 */
> PLL1CON = 1; /* PLL Enable */
> PLL1FEED = 0xAA; /* Feed Sequence 1 */
> PLL1FEED = 0x55; /* Feed Sequence 2 */
>
> while ((PLL1STAT & (1 << 10)) == 0); /* Wait for PLL Lock */
>
> PLL1CON = 3; /* PLL Enable & Connect */
> PLL1FEED = 0xAA; /* Feed Sequence 1 */
> PLL1FEED = 0x55; /* Feed Sequence 2 */
>
> VICVectAddr5 = (unsigned long)USB_ISR; /* USB Interrupt -> Vector 5 */
> VICVectCntl5 = 0x20 | 22; /* USB Interrupt -> IRQ Slot 5
*/
> VICIntEnable = 1 << 22; /* Enable USB Interrupt */
>
> USBDevIntEn = 4 | 8; /* Enable Device Status Interrupt */
>
> //reset();
> //setAddress(0);
>
> WrCmdDat(0x00FE0500, DAT_WR_BYTE(1)); //DAW_WR_BYTE is simply a macro that
ORs with number with the appropriate surrounding bits for the given command
>
> }
>
> [Non-text portions of this message have been removed]
>
Reply by Wesley Carlsen●August 8, 20132013-08-08
I have the following code in two different uVision projects (one is the default
project that I got from the KEIL website that sets up a USB HID and the other is
a barebones project I created to understand how the sample USB code works). I
borrowed all of this code verbatim (in only changed the constants to register
values and numbers) from the sample KEIL USB HID project (which works fine and
enumerates succesfully with the set address and reset uncommented), however I
commented these items out to make the code as basic as possible (even though I
know it will fail enumeration when I run the sample KEIL code the computer sees
the device and says "device unknown" but when I run this code absolutely nothing
happens at all. I have a hardware analyzer hooked up and when I run my project
absolutely nothing shows up but when I run the demo project it starts the
enumeration process and fails (understandably).
Thanks,
Wesley
void setup()
{
PCONP |= 0x80000000; /* Turn On USB PCLK */
IODIR0 &= 0xFF7FFFFF; // set P0.23 to input
IODIR0 |= 0x80000000; // set P0.31 to CONNECT