Hello
I am going to implement a USB Device using LPC1768 and I need the isochronous transfer type for my application. To this purpose I studied the keil's USBAudio example. It is written in the datasheet of the MCU that the frame interrupt is generated every 1 ms, but this interrupt occurs very much more than one time in 1 ms in USBAudio. Where am I wrong?
Sorry Tsuneo. I checked the crystal and It's near to XTAL pins (about 1 cm). The clock configuration of the system_LPC17xx.c (configuration wizard tab) is as follows (the crystal is 12 MHz):
PLL1 Configuaration (USB PLL) Checked MSEL: PLL Multiplier Selection 4 PSEL: PLL Divider Selection 2 USBSEL: Divide Value for USB Clock from PLL1 0
I added the following code in the beginning of the USB_SOF_Event to create pulses on the DAC in each SOF event:
int flag; void USB_SOF_Event (void) { LPC_DAC->DACR = (flag ? 1023 << 6 : 0); flag ^= 1; }
but the frequency of the generated wave is high (order of hunderd KHz). If I place such code in the beginning of the endpoint event witch is handled through DMA the frequency of the generated square wave is as expected. Is the problem still relative to the USB clock?
> but the frequency of the generated wave is high (order of hunderd KHz).
Sound like the FRAME interrupt flag is not cleared by the stack.
Add this line to your USB_SOF_Event()
LPC_USB->USBDevIntClr = FRAME_INT; // clear FRAME interrupt flag
Tsuneo
The problem is solved. I appreciate your help.