Hello,
I am getting some really strange problems when using the ported usbaudio keil code from this zip file
ics.nxp.com/.../mcb1700.code.bundle.lpc1769.lpcxpresso.zip
with the LPC1769xpresso and the embedded artists base board, it is appearing as a usb composite device, do you think perhaps the usbdesc.c needs to be changed for the newer processor 1769. all jumpers and power seem to be correct.
> it is appearing as a usb composite device
Not particular. Audio devices have two interfaces, audio control and streaming. Windows Device manager displays two instances for single device, 1) a composite device under "USB controller" 2) a USB audio device under "Sound, Video or Game controller"
Do you have any other trouble?
Tsuneo
>1) a composite device under "USB controller"
This is appearing with a ! and a code 10, failed to start
>2) a USB audio device under "Sound, Video or Game controller"
no usb audio device appearing here.
I am wondering if it is a jumper settings here is pdf, email embeddedartists they say they will not give me any support because it your code wish I brought a keil board now.
www.embeddedartists.com/.../LPCXpresso_BaseBoard_rev_A_Users_Guide_Rev_PA16.pdf
After discussing with embedded artists about the base board, it perhaps maybe could be the newer MCU LPC1769 can anyone confirm this as being true, and what should be done.
I ran USBAudio example in the zip of your first post, on my lpcxpresso 1769 board. Your problem was reproduced. Just a USB composite device appears with yellow "!" on Device Manager. On a hardware bus analyzer, the device stalls Set_Interface requests (twice).
Looking in Set_Interface handler (USB_ReqSetInterface(), usbcore.c), I found critical bugs on this routine. These two "(uint32_t)pD" should be replaced with "(uint8_t)pD"
LPCXpresso\USBAudio\src\usbcore.c __inline uint32_t USB_ReqSetInterface (void) { USB_COMMON_DESCRIPTOR *pD; uint32_t ifn = 0, alt = 0, old = 0, msk = 0; uint32_t n, m; uint32_t set; switch (SetupPacket.bmRequestType.BM.Recipient) { case REQUEST_TO_INTERFACE: if (USB_Configuration == 0) return (FALSE); set = FALSE; pD = (USB_COMMON_DESCRIPTOR *)USB_ConfigDescriptor; while (pD->bLength) { switch (pD->bDescriptorType) { case USB_CONFIGURATION_DESCRIPTOR_TYPE: if (((USB_CONFIGURATION_DESCRIPTOR *)pD)->bConfigurationValue != USB_Configuration) { pD = (void *)((uint32_t)pD // <---- bug + ((__attribute__((packed)) USB_CONFIGURATION_DESCRIPTOR *)pD)->wTotalLength); continue; } break; case USB_INTERFACE_DESCRIPTOR_TYPE: ifn = ((USB_INTERFACE_DESCRIPTOR *)pD)->bInterfaceNumber; alt = ((USB_INTERFACE_DESCRIPTOR *)pD)->bAlternateSetting; msk = 0; if ((ifn == SetupPacket.wIndex.WB.L) && (alt == SetupPacket.wValue.WB.L)) { set = TRUE; old = USB_AltSetting[ifn]; USB_AltSetting[ifn] = (uint8_t)alt; } break; case USB_ENDPOINT_DESCRIPTOR_TYPE: if (ifn == SetupPacket.wIndex.WB.L) { n = ((USB_ENDPOINT_DESCRIPTOR *)pD)->bEndpointAddress & 0x8F; m = (n & 0x80) ? ((1 << 16) << (n & 0x0F)) : (1 << n); if (alt == SetupPacket.wValue.WB.L) { USB_EndPointMask |= m; USB_EndPointHalt &= ~m; USB_ConfigEP((USB_ENDPOINT_DESCRIPTOR *)pD); USB_EnableEP(n); USB_ResetEP(n); msk |= m; } else if ((alt == old) && ((msk & m) == 0)) { USB_EndPointMask &= ~m; USB_EndPointHalt &= ~m; USB_DisableEP(n); } } break; } pD = (void *)((uint32_t *)pD + pD->bLength); // <---- bug } break; default: return (FALSE); } return (set); }
Similar bugs live in USB_ReqSetConfiguration() (usbcore.c), which disturb endpoint realization. It means, this example never works because of these bugs. The same usbcore.c bugs are found in all of USB device examples (USBCDC, USBHID and USBMem) None of these USB examples never work.
Interesting enough, usbcore.c.bak in USBCDC and other examples seems fine, at least regarding to this bug.
Is the zip file of your first post the latest version?
Great thanks very very much, it works, but I don't know how to get audio out of the board, because it is set up for PWM and LP_PWM and LM4811 do you know how to modifier the code so I can get audio from the board using PWM and the low pass filter with the LM4811
thanks.
This is the link to the sample application of a speaker test tone the base board with the code for the LM4811
www.embeddedartists.com/.../lpc17xx_xpr_bb_120314.zip
www.filefactory.com/.../lpc17xx_xpr_bb_120314_1_zip
I still can not get any audio what so ever hope you can help.
> but I don't know how to get audio out of the board, because it is set up for PWM
This USBAudio example puts sound over DAC output to P0.26 I'm not sure, what connects to this pin on the Embedded Artists base board, because I don't have the base board. Above EA user's guide gives just vague information.
I was just giving schematics, trying to work out from that, I could end up just soldering a wire to P0.26 pin at this rate, if I can't work out this board.
by154w.bay154.mail.live.com/.../
I was told this
>ave a look in file usbdmain.c, row: 132. >This line does not seem correct: >LPC_ADC->ADCR = 0x00200E04; /* ADC: 10-bit AIN2 @ 4MHz */ >It should be like this instead, I think: >LPC_ADC->ADCR = 0x00200E01; /* ADC: 10-bit AIN0 @ 4MHz */
Also, test to hardcode the volume to some suitable value.
I think they were wrong on this one tho, I think it is correct
>To get audio out you do not have to do anything. The signal GPIO_14 that carries the audio >signal is the >same as on the mcb1700 board. It is also an analog output from the DAC so the PWM >functionality does >not have to be used. Just pure audio samples. >Have J31 and J32 inserted. >Have jumpers in J33 not inserted. Later on you can insert these jumpers and control the volume >via this. >I suspect the USBaudio code control the volume via scaling of the samples right now. You have >to change >which analog input that controls this. The mcb1700 board has the trimming pot >connected to ADIN0.2, >while on the LPCXpresso base board it is on ADIN0.0.
They say I could not be getting audio because of the trimming pot Pot val part of the code Get Potenciometer Value
void get_potval (void) { uint32_t val; LPC_ADC->ADCR |= 0x01000000; /* Start A/D Conversion */ do { val = LPC_ADC->ADGDR; /* Read A/D Data Register */ } while ((val & 0x80000000) == 0); /* Wait for end of A/D Conversion */ LPC_ADC->ADCR &= ~0x01000000; /* Stop A/D Conversion */ PotVal = ((val >> 8) & 0xF8) + /* Extract Potenciometer Value */ ((val >> 7) & 0x08); }
Not sure what to do or how to change it at the moment
If you look at board and schematics P0.25 is connected to one of Rotary Switch connectors QA J54 jumpers
TMS / PIO1_0 / AD1 / CT32B1_CAP0 P0.24 ain1 tms Qa
I can't understand why that is effecting the voulume and causing it to be muted or 0
It looks like I need to mod the Get Potenciometer code somehow does anybody know how to change it.
I took it off the base board and put in on a bread board, still no audio so I guess it must be another bug somewhere.
Did you managed to get audio out of your lpcxpresso yet if so please post the uvision project for me, please remember to include all files lpc17xx.h and system files which I see people always leaving out.
The files that reside in the common folder people always leave them out
Note that the license terms may not even allow any lpc17xx.h file to be posted.
For commercial projects, a customer may expect to receive a full delivery containing everything required to recreate a project. But even in that situation, the customer will have to miss something unless an open-source compiler is used.
Do you have any idea of this strange bug that is plaguing the lpcxpresso1769 I don't have hardware analyser do you have one maybe you could check why still not audio is coming out of the board from the code posted on nxp's website. which happens to be your code.
I'm a developer. If nothing else, I would be able to write a small piece of code that toggles the suspected pin at 1kHz to check if I do get audio. Then take the debugging from there depending on the outcome of the test.
Don't you have access to an oscilloscope or something, to figure out if you have an issue on the software side or with the hardware outside the processor?