1 2 Previous Next 27 Replies Latest reply on Jul 7, 2012 3:23 PM by DaKn_263916

    Multiphase Square Wave Generator

      I want to produce a multiphase voltage wave using VDAC’s and Timers. The included figure shows the waveform that I’m trying to create.  T1-T4 represent timings of each phase.





      I’ve had some success creating the waveform using one timer, two VDAC’s, and an AMuxSeq. I used two VDAC’s and a mux in efforts to make sure the rise and fall time of the phases were sharp (this may be an incorrect assumption). My project cannot create different values for T1-T4. Should I wire 4 timers together or simply sequentially start/stop a different timer for each phase?


      Can someone help me build a efficient timing scheme for creating different durations values for each phase?

        • 1. Re: Multiphase Square Wave Generator

          Here's my current project file.

          • 2. Re: Multiphase Square Wave Generator

            I think it depends on how precise our times have to be reproduced and how long your time phases are.


            When the frequency is low enough, you could do with just one timer and one DAC. the trick is to set up everything after a phase change for the next phase and using the strobe input of the DAC from the (single) timer TC.


            If frequency is too high, I would suggest to use a PWM which is able to generate two of your phases and with chance even all four.



            • 3. Re: Multiphase Square Wave Generator

              You can use the 'normal' wave generator strategy - driving the DAC from the DMA. See the WaveDAC8 AppNote for an example: http://www.cypress.com/?rID=54728 . You would need to modify the waveform stored in the RAM to match your timings.

              • 4. Re: Multiphase Square Wave Generator

                Some thoughts -




                1) You have built a constant I generator to drive load, with switches to reverse polarity,


                but that is not reflected in timing diagram, so not sure of its purpose ?




                2) Your description is that all pulses occur sequentially, so I only see the need to use one VDAC.




                3) Prior thread, ram based table makes good sense if this is a repetitive waveform. Store in table


                wave amplitude, width, and at each terminating PWM pulse, ISR, do the next lookups and write


                the VDAC and PWM period, duty cycle registers.




                Regards, Dana.

                • 5. Re: Multiphase Square Wave Generator

                  Or, following Dana's advice, use DMA to keep the CPU free from doing too much work. There is a WAVEDAC component using this feature (run a keyword search on that). If you still in need of a solution I'll have to dig for an example I programmed using a table in Rom sending out data to a DAC repeatedly.


                  Happy DACing



                  • 7. Re: Multiphase Square Wave Generator

                    The range of timing values for T1, T2, and T3 are between 0.3 - 10 milliseconds.




                    1) Yes, the purpose of the voltage signal is to control an external constant current generator (see image). The non-zero phases will be able to have their polarity switched. In the end I will need to control the exteranal analog switching using the PSoC timing scheme.


                    2) Yes, the pulses occur sequentially.


                    3) As I mentioned, I am considering the analog switching scheme in efforts to create a waveform with fast rise and fall times. My concern is that using one VDAC is that it isn't fast enough to change values before the switch changes polarity.




                    There may be no time delay between the two non-zero phases in some instances (T2=0). Thus, I will have no time between the two non-zero phases. T4 represents the delay between repeats of the waveform.




                    • 8. Re: Multiphase Square Wave Generator

                      Now I understand, I thought the original goal was a wide dynamic range of


                      setting amplitude, its clear you only need limited number of voltages. Excellent


                      approach using muxed fixed voltages.




                      Note the OP162 has limited C load capability, hence phase margin, because


                      the MAX4622 presents a lot of Cload, thats why it has such good Ron for an


                      analog swtitch, lots of channel, hence Miller. Look at datasheet, there is a


                      section on loading to handle the phase margin problem in the 162 to keep


                      the ringing down.




                      Regards, Dana.

                      • 9. Re: Multiphase Square Wave Generator

                        According to the data sheet, the VDAC has a settling time of 1µs max, in the 1V range (the typical value is 0.45µs). If this is enough, the DAC solution is viable. If not, the idea with the fixed voltages is fine.


                        If you want to have a more hardware-based solution, you need to use 4 timers (one for each period). You can trigger them in a linked ring (t1 trigeers T2, T2 trigger T3 and so on), and with each trigger event you can use a lookup table to select the proper output on your mux.


                        If you want to use only a single timer, you could use a DMA to set the timer periods. Each timer a timer reaches its TC, switches to the next output via the lookup table, triggers the DMA event to write the next period values, and the starts the timer again. (Though I think that this will get tricky)

                        • 10. Re: Multiphase Square Wave Generator

                          If the "bit" timing is same, pulse to pulse, a single LUT can


                          provide triggers and timing. I know the diagram does not in-


                          dicate this, but if it were.........




                          Regards, Dana.

                          • 11. Re: Multiphase Square Wave Generator

                            Btw: I think we should ask Dave for some official 'PSoC zealot' T-Shirts: we got already 5 different solutions for the same problem :)

                            • 12. Re: Multiphase Square Wave Generator

                              Are those shirts available in XXXL?



                              • 13. Re: Multiphase Square Wave Generator

                                When I stay with my preconceptions about the US: when Dave wears a XL shirt, it means XXXL in Germany :)


                                (Though I'm afraid that after this statement I will never receive such a shirt...)

                                • 14. Re: Multiphase Square Wave Generator

                                  OK, so XXXL in US is a tent, but I know, I'm a bit more in size than Dave.

                                  1 2 Previous Next