PSoC4 opamp spice?

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

cross mob
Anonymous
Not applicable

Hi!

   

Is there a spice model of the PSoC4 opamp or maybe a component that is very similar to it?

   

Thanks.

0 Likes
12 Replies
Anonymous
Not applicable

Hello Neganur,

   

Cypress does not have a spice model for the opamp. Can you please let me know the reason for the spice model?

   

Thanks

   

Ramesh B

0 Likes
Anonymous
Not applicable

Hi Ramesh,

   

 

   

a spice model would help to estimate phase margin when using the internal amplifiers, for example as ADC driving amplifier. It's also useful to quickly gain an understanding of the limitations of a design so I don't have to breadboard everything right away.

   

Suppose Cypress has characterized the amplifiers, I would like to believe that it is beneficial to have a model of the amplifiers or, as already noted, some industry standard opamp that is very similar to the ones inside the PSoC.

   

 

   

Best regards,

   

Neg

0 Likes
JaBo_1574611
Level 4
Level 4
5 questions asked First question asked First solution authored

Well, I just simulated some filter circuits, but had to use a random opamp Spice model from another vendor since, I assume from this thread, Cypress does not currently have one (I used my best guess as to what opamp was closest to what the PSoC 4 [4200] one might be like from amongst the model choices available). The actual PSoC4 performance was so far off the simulation (not entirely surprising) that it's back to the drawing board for me. At this stage, I might not be able to use the built-in op amps even, although the datasheet specs imply that they should be good enough for what I want to use them for. I might be able to redesign my filters to work with the PSoC4 opamps, but without simulation models, it is going to be a much more elaborate process than I had hoped to engage in and may have to implement the filter with external opamps (which I know will work like a charm). So, in answer to the question: why a Spice model? It is so designs can be completed with confidence that it is going to work as expected when implemented. To mirror what neganur said, if no model is provided, having some guidance on how to adapt an industry standard model for simulating PSoC4 opamps would be of tremendous assistance.

0 Likes
JaBo_1574611
Level 4
Level 4
5 questions asked First question asked First solution authored

As an update, I redesigned my filter with considerably more pessimistic performance expectations from the PSoC 4200 opamps and did achieve an order of magnitude better performance from them with my new circuit. This, for me, is an experiment to see whether I can get away with using only the components on the PSoC 4200 for my application (it's in the low bandwidth audio spectrum), in which case the 4200 offers a huge advantage; or whether to use the 4200 the way I want to would require an external filter circuit, in which case it's advantage evaporates. Sadly, even with the huge improvement, it isn't good enough and I despair of any further improvements without a more detailed knowledge of the performance of the opamps. I am going to try some harsher cutoff frequencies and maybe reconfigure it as a low-pass and notch filter combination instead of the 4-pole low-pass filter I've been working with just to see what I can achieve (that approach would work with one approach I'm using, but flop for the other one I've been trying)... I'm still rootin' for the 4200, but my decision window closes fairly soon.

   

P.S. Here are a couple of related web pages I ran across in my searching... one is how to build accurate Spice models from datasheets (sadly, there's not really enough data on the 4200's opamp datasheet, but some guesses could be made), and the other is how to characterize new/unknown opamps.

   

http://masteringelectronicsdesign.com/buildi-an-op-amp-spice-model-from-its-datasheet/

   

http://www.analog.com/library/analogDialogue/archives/45-04/op_amp_measurements.html

0 Likes

Did you manage to create custom spice models from the links?

0 Likes

Sorry, just saw your reply now. No, I did not go through the effort. Although it would be cool to try, I just haven't had the time.

0 Likes
JaBo_1574611
Level 4
Level 4
5 questions asked First question asked First solution authored

Well, looks like the 4200 may survive the decision process. After a brain fart a couple of days ago (I finally got the chance to try it today), I figured out a last ditch method of solving the main problems I was having... and if it didn't work, then there was really no way of doing it while keeping the parameters I wanted (although it implied a further step that would reduce the signal quality, but also reduce the noise problem as well). Anyway, I've been able to use only the components on the 4200 and few external passive devices to successfully (and clearly) play an arbitrary 11-bit audio clip with an 11.025kHz sampling frequency. The 4200 can store a "whopping" 1.35 seconds or so at that resolution and sample rate without an external memory, heh... but there are lots of tricks possible even with that, and that's enough storage for what I need. I still don't know if the filter implementation I have is optimal (I can tweak it further later once I better characterize the opamps on the 4200), but my second iteration of the filter does seems to be good enough, and the trick I threw at it today put the noise into a band that is highly attenuated. The best news is that I didn't have to use the IDACs, since I need capacitive touch sensing as well in this application and this means I can use one 4200 for both parts.

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

James,

   

how did you upload voice into flash? can you provide any demo?

0 Likes

I'm still waiting for an answer back from Cypress on something, so I'm not uploading anything detailed to the forums until I hear back (I'm despairing that they'll ever get back to me even though they have said several times they would). Be that as it may... I made a recording (any tool will do, I used Audacity) at 44.1kHz (CD quality), converted to mono, normalized it a bit under 0dB (so it wouldn't be rail-to-rail), edited down to the audio clip I needed, faded in/out at the start/end to get rid of clicks/pops when I looped it, used the Audacity Effects->Change Tempo... tool to crunch it down to 1.35s without altering the pitch (although if you could keep the clip to under 1.4s or so, you wouldn't need to do this), then exported it to a signed 16-bit PCM/WAV file (again, all in Audacity). I then used ffmpeg (open source... I run Linux, but I know there are versions for other platforms) to downsample the WAV file to 11.025kHz and save it in RAW format (ffmpeg -i <infile>.wav -f s16be -ar 11025 -ac 1 -acodec pcm_s16be <outfile>.raw). I wrote a couple of small programs in C to take the 16-bit signed raw PCM files and convert them to unsigned 11-bit samples (with the mid-point being the "zero") and pack them into a bitstream encoded as 8-bit values (unsigned char) that could then be loaded into the PSoC 4 code using an #include statement (uint8_t audio_data[] = { #include <audio_data.dat> }; ... on separate lines). Then the PSoC 4 code needs to read the bitstream and pull out the 11-bit samples one at a time. I used a TCPWM module to convert the audio data into a digital PWM stream (it sends an interrupt when it's ready for the next sample) which is sent through the two onboard opamps with which I implemented a 4th order Chebychev low pass filter configuration (in a Sallen-Key configuration with a 4kHz cutoff frequency ... it gives roughly the same audio bandwidth as a telephone conversation, which was good enough for what I needed... important note: pay close attention to the maximum capacitance rating of the opamp output!). The thing that made it actually work is that I ended up clocking the TCPWM with the 48MHz clock to get a 22.050kHz output sample frequency, but sent the same sample twice to get the 11.025kHz sample frequency (and an 11-bit resolution) of the audio loaded into the device; however, since the PWM rate is at 22.050kHz, the filter is effective enough at that frequency to get rid of the squeal of the PWM (when I originally used a 24MHz clock, and an 11.025kHz PWM rate, the 11kHz squeal was irritating at the very least, I actually found it painful... no such problems at 22kHz). Anyway, if Cypress ever gets back to me like they promised, I might consider uploading my actual source code and project files, but hopefully the above is enough to duplicate what I did with a bit of work (heh, the Audacity and ffmpeg stuff took me hours to figure out how to do the way I wanted, so that should be time saved there at least).

0 Likes

Oh, I meant to add that if more than 1.4s was needed, the resolution could be decreased, the sampling frequency could be decreased (although 11kHz is about as low as possible while still maintaining any level of clarity), or a technique like 8-bit ADPCM encoding/decoding could be used. Furthermore, it would be pretty easy to use an external I2C memory to store more audio data. One of my self-imposed goals was to see if I could get the audio into and out of the PSoC 4200 with no external active devices (just a few passives to build the filter).

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Thank you very much for reply. Indeed, your description of the project is elaborate enough to duplicate it, if one wishes so. 

0 Likes
user_284806
Level 2
Level 2
First like given

I have a "guitar effects box" prototype with a 4200 and some passives, work under development. I can simultaneously do wah-wah / band-pass, reverb (~40ms), high pass, low pass, distortion and tremolo, all using software processing. A lot can be done with these chips, but I really miss a higher resolution DAC...

0 Likes