20 Channel Function Generator

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

cross mob
WeGa_288606
Level 4
Level 4
25 sign-ins 10 sign-ins 5 sign-ins

Hello Everyone,

   

I am very new to the PSoC concept but I am very interested in growing my skills. My project goal is to develop a 20 channel function generator with an USB interface and then use an API/GUI to select the type of signals I would like on each of the 20 outputs. My requirements are such that the amplitude is in the range of 0-3 volts in 0.05 step and 0-20 Hz in 0.01 step (roughly 7 bit and 11 bit respectively). For the short term however my questions are:

   

1. Would I be able to meet such requirements with a PSoC 3?

   

2. Would there be much in external circuitry required?

   

3. Could I use internal amplifiers to adjust the amplitude i.e. gain control?

   

4. For now I would just like to get started with generating a square wave (not a PWM based design) on 20 of the PSoC3 pins so I can probe around with an Oscope as I explore how to use the hardware/software. I have the first touch PSoC3 starter kit. I am thinking I need  comparators/timers (20 of them actually) and just toggle the output with the count as 1/2 the period of the square wave. I do need to hold the resolution requirements for this. Not really clear how to get started on this. I watched some Cypress Videos and I have general navigation skills but I just need some help picking the right direction.

   

Guidance is highly appreciated.

   

Best Regards,

   

Wess

0 Likes
19 Replies
Anonymous
Not applicable

Hello Wess,

   
   

It's quite an ambitious application that you are trying to develop with PSoC3.  An USB dll file is already available and hence provoding an USB GUI is possible.

   
   

PSoC 3 has 4 Op-amps, 4 Comparators, 4 DACs(Configurable as either IDAC or VDAC). There are 4 SC/CT blocks, which are nothing but combination of Opamps and switched capacitances- these can be configured as Programmable Gain Amplifier(PGA), Inverting/Non-Inverting amplifier, Mixer, Track and hold block .

   
   

Using VDACs it is possible to generate analog waveforms. This code example shows how to generate a Sine wave using a DAC- 

   
   


   

Sine Wave Generator with DAC - PSoC® 3 / PSoC 5 - http://www.cypress.com/?rID=38627

   
   

You can use a VDAC and multiplex it with Track and hold component as described in the following blog post to generate more waveforms- Buy One Get Three Free - Making Four VDAC8s from Onehttp://www.cypress.com/?rID=43474. You may need external filter on top of this implementation to get smooth waveform.

   
   

 

   
   

However for generation of square wave you have multiple options. You can use the PWM modules- which are avaliable as Fixed function blocks and UDB based implementation.

   
   

This blog post gives some information about the same, 

   
   

How Many PWM Outputs Can a PSoC 3 or 5 Generate? - http://www.cypress.com/?rID=40091

   
   

UDB Doubters- http://www.cypress.com/?rID=43496

   
   

 

   
   

I hope this helps, Please let us know if you need any further help.

   
   

 

   
   

-Udayan

0 Likes
WeGa_288606
Level 4
Level 4
25 sign-ins 10 sign-ins 5 sign-ins

Hi Udayan

   

Thanks for the help and fast reply. I got my PWM up fairly quickly. Would you please help me understand the 4-OP-AMPS limitation here? For example when I had read the data sheet for PSoC3 I recall reading something like "Any GPIO to any digital or analog peripheral routability" So I thought I would be able to use say 20 of the OPAMPS on the pins? Sorry for the basic question but I really do not have PGA/FPGA background what so ever but I am trying to come up to speed on this stuff.

   

Is there a PSoC that you believe could help me achieve my design goal?

   

 

   

Thanks,

   

Wess

0 Likes
Anonymous
Not applicable

 Hello Wess,

   

Yes you can connect/route any peripheral(including Op-amps) to any pin on the chip. However there are only 4 Opamps available for your use on PSoC3 device. Apart from these 4 Opamps you have 4 Comparators and 4 SC/CT blocks as told earlier. You can get amplifiers with programmable gain using these SC blocks. 

0 Likes
WeGa_288606
Level 4
Level 4
25 sign-ins 10 sign-ins 5 sign-ins

OK thanks but that is not the question I am asking. You are suggeting that I only have 4 available and my question is why could I not map a OPAMP to every pin on the PSoC for example? Like the one post you referenced on PWM showed that it is possible to have 52 PWM? What determines the limit of each of the features? Why 4 OPAMPs and not 52 for example or 52 SC/CT etc....? Is this is the datasheet? If so what part? I looked for it but it is not sticking out at me.... Thanks...

0 Likes
Anonymous
Not applicable

 Hello Wess,

   
   

In PSoC3 we have what is called UDB-Universal Digital Block. These blocks are programmable blocks which can be configured to implement any digital logic. That includes any communication protocol like I2C, SPI, state machine or even PWM. There are 24 such UDBs and using each UDB we can get 2 PWMs and using the fixed function Timers we can get 4 more PWMs. The PSoC architecture is such that there are only 4 Op-amps and 4 SC/CT Blocks. You can connect these blocks to any pin on the chip. The part CY8C3866 is the part that has all the features. Refer to its datasheet available at  http://www.cypress.com/?rID=35178, you will get information about all the features available on PSoC3. You can have 52 Op-amps or 52 SC/CT blocks on one chip. Please describe the kind of waveforms that you need to generate and the parameters and controls you want have on your GUI. 

   
   

-Udayan

0 Likes
WeGa_288606
Level 4
Level 4
25 sign-ins 10 sign-ins 5 sign-ins

For now I would be happy generating a square positive pulse varying frequency and amplitude through the GUI. Eventually I would like to have sine wave, bipolar square pulse, (+/-) uni polar square pulse, and sawtooth all varying frequency and amplitude. The immediate goal is just to learn and understand PSoC. This is not for a bench top function generator this is for a biomedical drug delivery system that our group is researching.  

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

Hello Wess,

   

Alright you could understand basics of PSoC3 first and then get into complex projects. The tool used to create projects for PSoC3/PSoC5 is PSoC Creator. Go through the following Application Note to understand how to create projects on PSoC Creator. It also illustrates basics of PWM module. 

       

The Example project attached(pdf file) should help you understand the USB interface. The project is being updated for the latest version of PSoC Creator as of now. It will be available on the website soon, you can use it once it is up on the web.

   


-Udayan

0 Likes
WeGa_288606
Level 4
Level 4
25 sign-ins 10 sign-ins 5 sign-ins

Do you have an example of how to generate a bipolar square wave?

0 Likes
Anonymous
Not applicable

Hello Wess,

   

When you say Bipolar Square Wave, what voltage levels are you referring to. Because PSoC(or any microcontroller) is typically powered by an unipolar supply, 5V, 3.3 V etc). Once you get the PWM from PSoC ,you may have to use external components to perform level shifting if you need negative voltage level.

0 Likes
WeGa_288606
Level 4
Level 4
25 sign-ins 10 sign-ins 5 sign-ins

Hello,

   

I would like to generate a signal from -2 V to 2 V. Isnt the sine wave example generating a bipolar wave? I have not tried it yet but it must be for it to be a sine wave. no?

0 Likes
Anonymous
Not applicable

Hello Wess,

   

You might have to use external components to get negative voltages. PSoC is powered by unipolar supply(0.5V to 5V ). To generate a square wave with -2 Volts and 2 Volts amplitude, you may need some kind of level translator(op-amp based or other ic) in addition to PSoC. Infact no microcontroller would be able to do this.

   

Regards,

   

Udayan

0 Likes
WeGa_288606
Level 4
Level 4
25 sign-ins 10 sign-ins 5 sign-ins

How about -3.3 to 3.3?

0 Likes
Anonymous
Not applicable

Hi Wess,

   

 

   

Converting a unipolar signal from PSoC to a bipolar can be done in a much more simpler way. This would require external passive components: a Capacitor and a diode.

   

A clamper will can be used to convert a sine wave of 0-4V into a -2 to +2V Sine wave. The voltage source required for this clamper can also be derived from PSoC, by voltage divider (or a VDAC).

   

You can understand about the basics of clamper by glancing through Wiki link  

   

http://en.wikipedia.org/wiki/Clamper_(electronics)

   

 

   

This is a cost effective and simple way to achieve voltage shifting over using external opamps or shifters.

   

Regards,

   

dasg

0 Likes
Anonymous
Not applicable

Hello Wess,

   

It is not possible to generate any negative voltage, since the chip is not capable of operating at those voltages.You can generate a PWM with voltage levels 0-VDDD(0-3.3V or 0-5 V) or (0 - Vref), where Vref is a configurable voltage above 0 Volts.

   

Correction to post Number 6, You can not have 52 Op-amps or 52 SC/CT blocks on single PSoC chip.

0 Likes
WeGa_288606
Level 4
Level 4
25 sign-ins 10 sign-ins 5 sign-ins

Hi Udayan,

   

I was not expecting the PSoC to provide the V-. However, I am either completely clueless about electrical engineering or the PSoC is making some claims about its capabilities with respect to mixed analog/digital features. Inverting the signal in theory should be possible with the internal Op Amp and an external Vref to a mapped pin along with minimal external components. Is there some reason why this cannot be done? In fact it is very similar to the Wikipedia link your colleague provided.

   

Cheers,

   

Wess

   



 

0 Likes
Anonymous
Not applicable

Hello Wess,

   

Consider the case of a Negative Clamper as shown below: 

   

In the positive cycle of the input AC signal, the diode is forward biased and conducts, charging the capacitor to the peak value of VIN. During the negative cycle, the diode is reverse biased and thus does not conduct. The output voltage is therefore equal to the voltage stored in the capacitor plus the input voltage again, so VOUT = -2VIN.

   

Consider the scenario where we have a PWM signal from PSoC3(0 to 3.3V). Considering the diode is an ideal diode, the it will conduct for any voltage above zero volts. Hence this circuit may not help you directly . The PWM from PSoC has to be passed through a level shifter circuit. I will investigate more on this and get back to you with a possible circuitry.

0 Likes
WeGa_288606
Level 4
Level 4
25 sign-ins 10 sign-ins 5 sign-ins

Hello,

   

I could not see the picture. Would you please post it again or send it to my email at: wess.gates at edtric dot com. Thanks!

0 Likes
Anonymous
Not applicable

Hello Wess,

   

You can view the picture at http://en.wikipedia.org/wiki/File:Negative_Voltage_Clamping_Circuit.svg

0 Likes
WeGa_288606
Level 4
Level 4
25 sign-ins 10 sign-ins 5 sign-ins

Well but I guess the point I am trying to understand is why could I not do this through the PSoC internal opamp coupled with external components and routing the signals through pins?

   

http://en.wikipedia.org/wiki/File:Precision_op-amp_clamp.svg

0 Likes