audio streaming using usb

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi Dana

   

I try to use usbfs_audio example project

   

I didn't hear any voice in my speaker (I try the speaker in another project and the speaker works well)

   

I use a speaker with 8 ohm impadence and psoc 3.0 creator

   

How can I make it work?

   

 

   

second question: what is the best option to stream audio file from computer to Psoc -5 and to back to pc?

   

Thanks

0 Likes
1 Solution
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

PSOC cannot drive a 3.2 ohm speaker directly, your output, if

   

you get any, would be severly distorted at minimum. If you place

   

a series R of a few hundred ohms between speaker and PGA out

   

you might be able to hear something. I would also recommend you

   

clamp pin to its rails with somethinmg that looks like this -

   

 

   

   

 

   

There is a possibility you damaged the PSOC GPIO pin, PGA,

   

due to L effects from speaker by a direct connection to it. Disconnect

   

speaker and look at PGA output to see if audio looks "OK".

   

 

   

Better yet get a power amp to drive speaker, here are a zillion possi-

   

bilities -

   

 

   

    

   

         

   

The venerable LM386 – http://www.ti.com/product/lm386

   

 

   

 

   

    

   

          http://www.ti.com/lsds/ti/audio-ic/audio-operational-amplifier-product.page?familyAliasId=1200585

   

 

   

Regards, Dana.

View solution in original post

0 Likes
25 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

PSOC cannot drive a 3.2 ohm speaker directly, your output, if

   

you get any, would be severly distorted at minimum. If you place

   

a series R of a few hundred ohms between speaker and PGA out

   

you might be able to hear something. I would also recommend you

   

clamp pin to its rails with somethinmg that looks like this -

   

 

   

   

 

   

There is a possibility you damaged the PSOC GPIO pin, PGA,

   

due to L effects from speaker by a direct connection to it. Disconnect

   

speaker and look at PGA output to see if audio looks "OK".

   

 

   

Better yet get a power amp to drive speaker, here are a zillion possi-

   

bilities -

   

 

   

    

   

         

   

The venerable LM386 – http://www.ti.com/product/lm386

   

 

   

 

   

    

   

          http://www.ti.com/lsds/ti/audio-ic/audio-operational-amplifier-product.page?familyAliasId=1200585

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Thanks a lit Dana!!

   

I wil try it 🙂

   

The goal of my project is to stream a recorded file to the psoc then to filter it with the psoc and to get back the filtered file to the computer then to analyse it.

   

Do you know a way to pass a audio file using usb isochronous transfer and (  I tried example usbfs) and I cant figure out how much packets can i pass between the pc and psoc5 total?

   

I saw that i can pass txt files (64bytes)and it works well but not in the Isochronous transfer( which i think i need) it passes only part of the information of the file(half or less) what can I do in order to pass 10-20MB .wav file? 

0 Likes
lock attach
Attachments are accessible only for community members.
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

   

Perhaps to test enough Opamp (25ma max) + resistor.

   

Or 2xOpamp in half-bridge mode.

   

And another thing: where is connected Vref PGA_1?

Anonymous
Not applicable

 I will try what you suggestet , Thanks a lot!

   

I tried to connect the V_ref to  gnd, 3.3( external) and Vss internal, but with no success...

   

 

   

By the way What do you suggest about passing  the audio file from the PC to psoc and back?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Not sure if these would help -

   

 

   

    

   

                    

   

http://www.cypress.com/?rID=70131     AN82072 - PSoC® 3 and PSoC 5LP USB General Data Transfer with Standard HID Drivers

   

http://www.cypress.com/?rID=39553     AN56377 - PSoC® 3 and PSoC 5LP - Introduction to Implementing USB Data Transfers

   

http://www.cypress.com/?rID=39404     AN57473 - USB HID Basics with PSoC® 3 and PSoC 5LP

   

http://www.cypress.com/?rID=39327     AN57294 - USB 101: An Introduction to Universal Serial Bus 2.0

   

http://www.cypress.com/?rID=40103     AN58726 - PSoC® 3 / PSoC 5LP USB HID Intermediate (with Keyboard and Composite Device)

   

http://www.element14.com/community/docs/DOC-48266/l/cypress-ce60246--application-note-on-usbuart-for...     USBUART

   

 

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Speaker drive like this -

   

 

   

0 Likes
lock attach
Attachments are accessible only for community members.
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

Try this project. It has a lot of excess - part can be removed.
To test you can probably use the generators, creation for the sound cards.
A lot of them on the Internet. I use my, he is on this page.
But note that in most cases the signal my be be distorted integrated filter PC.
Pay attention to the draft Project # 102 - USB Audio using the PSoC 5L

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You can test your speaker by using wavedac component, just sub it for your

   

VDAC -

   

 

   

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received


Just noticed: in your project is not PGA_1_Start();

   

)))))

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi Dana,

   

thanks a lot:)

   

I am not sure I did it well

   

I connectred the components as you said and did Start() to the components( Opamp_1_Start();
    PGA_Inv_1_Start();
    WaveDAC8_1_Start();)

   

but it tells me 7 Errors -- M0012 mismatching type

   

attaches schematic of the project

   

whatwould you suggest me?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

To post a complete project use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

The API names for the components start with the component names, so in your case it is PGA_1_Start() and not

   

PGA_Inv_1_Start().

   



Bob
 

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi Bob,

   

attached with the change..

   

Best regards,

0 Likes
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Corrected version attached.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

The Wavedac of course gets replaced by your VDAC8 after you have

   

tested your speaker lashup.

   

 

   

The differential drive to speaker yields 4 X the drive power of single ended

   

speaker drive.

   

 

   

Regards, Dana.

   

 

   

Anonymous
Not applicable

Thanks!

   

No errors at all but unfortunately it still doesnt work for me...

   

i followed the instructions to connect to p1[7] and Gnd but in the USBFS_AUDIO.cydwrfile I see Speaker_1 -p0[0] and Speaker_2- p0[1]

   

I tried to connect to those pins but didnt work as well

   

shoud I change the output pins there?

   

 

   

Best regards,

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

 

   

Nothing wrong perhaps you have little experience.
You can set the desired contacts if you open the file USBFS_AUDIO01.cydwr and click on
the arrow to the right of column "port".
Note: in your example uses P0.0 And P0.1
In the project I suggested above, I am using P3.6 And P3.7
By the way, an opamp and PGA_Inv have very different output parameters. I suggest using the same - an opamp.

It is possible in Windows, you will need to announce your device as the default device.
In this case, you can use the audio player PC.

0 Likes
Anonymous
Not applicable

Hyorica!! It work.

   

Thanks!!

   

I connected the speaker to P0[0] and vadj and play with the R11 and it's work well

   

Thanks a lot!!

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

"By the way, an opamp and PGA_Inv have very different output parameters. I suggest using the same - an opamp."

   

 

   

Yes and no. They both use the same basic OpAmp with its attendant phase and magnitude

   

response. They will exhibit different GBW closed loop for same G, and different Rin, Rout. However

   

at G = 1, - 1, the effects on Rout relative to load virtually irrelevant for this application for todays high

   

Aol devices. Same for GBW.

   

 

   

Zocl ~= Zool / Ab, so for both cases essentially closed loop output Zocl is = open loop output Zool / loop

   

gain.

   

 

   

Any good text book has this analysis of Inv vs Ninv response and how they effectively degenerate

   

to equivalent closed loop performance at low G, this type of application being considered. The foundation

   

book is Burr Brown, Graeme, Toby, and Huelsman. Analog devices, LTC have ap notes delving into

   

these basic topics.

   

 

   

"They both use the same basic OpAmp", my statement above, that may not be the case,

   

I am filing an inquiry with Cypress to determine that.

   

 

   

Regards, Dana.

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

In this project I am only interested in the output current.
For Opamp i see:
DC and AC Electrical Characteristics for PSoC 5LP:
IOUT =10mA
for PGA it does not have.
In any case, I would prefer a symmetry with respect to the  speaker.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

"In any case, I would prefer a symmetry with respect to the  speaker."

   

 

   

Are you concerned with Cass A operation of the speaker ?

   

 

   

There is an issue I missed, the OpAmps in the SC blocks may not be the same

   

as in the PGA, although when they are operated at unity G they should be OK for

   

driving Speaker differentially.

   

 

   

I am going to file a CASE to see just how different they are in terms of GBW, Aol,

   

Slew, and Ro / Drive.

   

 

   

In the worst case just use 2 OpAmps or 2 PGA's to be absolutely sure speaker

   

drive becomes true differential. That way you will get 4X the power out of the speaker.

   

If yoiu could care less about speaker volume, drive it single ended, save 1 OpAmp or PGA.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Hi,

   

someone knows how to connect a microphone for the ADC_Filter_DAC example?should I amplify it physically or it is enough to use the internal opamp?

   

Best regards,

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

It depends on type of mic it is, ceramic, magnetic, capacitive,

   

and whether or not it has internal signal conditioning already built

   

in.

   

 

   

You most certainly can use internal OpAmp / PGA for that. But you have

   

to bias properly for each of the types.

   

 

   

Regards, Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

if it is electret mic it should look like this and then an opamp in serial if i am not wrong...

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Previous circuit does not show any of the necessary biasing, and

   

its gain fairly low. Just Google "electret microphone circuit opamp"

   

and you will get plenty of hits, like this one -

   

 

   

   

 

   

You probably do not need the output cap C3, and replace R2, R3 with Creator

   

reference Vdd/2 in analog component section. The LM358 becomes internal

   

OpAmp. You could possibly use the PGA to do this, getting rid of R4, R5 as well.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Thanks Dana.

   

I trying to  do it, hope it will work.

   

Best regards

0 Likes