Simple CMOS Square Wave Generator with Variable Mode Output

A novel square-wave generator based on a single CCCII (current controlled conveyor), with only two external grounded passive components is proposed in this paper. The circuit provides precise, electronically controllable, voltage or current output square-wave signals. The simulation results using 0.18 mm CMOS parameters and experimental verification confirm the feasibility of the proposed circuit. The proposed generator can operate very well at up to 25 MHz with nonlinearity less than 5%.


Introduction
Square signal generators are widely used in communication, instrumentation, electronic and control systems such as generation of the carrier signal in communications or clock signals in electronic systems, or as control signals driving synchronous motors with permanent magnets [1]. They also find their place in various other applications based on processing of analogue signals, they are used for defining the duty cycle of a voltage controlled oscillator in sensor interfaces, in the operation of A/D and D/A converters, signal processing functions, as well as the clock pulse in digital systems.
Among various current mode devices, the second generation current conveyor (CCII) is one of the most versatile building blocks [2]. It is also characterised by a high slew rate, wide bandwidth, and a large dynamics range. In CCCII function, R x (intrinsic resistance) can be modified by varying the bias current I B , resulting in more precise voltage-following characteristic between ports x and y, thereby allowing the design of numerous tunable applications [2].
The proposed generator possesses the following advantages: a single active element and grounded passive components-based realization; the electronically adjustable period and oscillating condition (OC); operational frequency of up to 25 MHz; and low power consumption (1mW). It can be used for the generation of rectangular waveforms and pulse width modulation waveforms, considering that many applications such as music synthesizers, voltage regulation and power delivery units need the period adjustment function in the waveform generator. Based on HSPICE simulation and experimental results, the performance of the proposed square-wave generator is shown, and the obtained results are fully in line with the conducted theoretical analysis.

Proposed square-wave generator circuits
The proposed variable mode square-wave generatorrelaxation oscillator is shown in Fig. 1. Square-wave generator in Fig. 1 consists of only one active component-CCCII; capacitor and one grounded resistor (which can be electronically controlled). The circuits employ a Schmitt trigger connection with a grounded capacitor. The oscillation frequency depends strongly on the nonlinear behaviour of the CCCII and the value of the x terminal resistance. The terminal relationships of CCCII in an ideal situation can be described as [2] 0; ; These equations, however, represent the CCCII in the linear operating region, when current at x port and voltages at z and x ports are limited [3]. In fact, CCCII is a nonlinear component and outside of the linear region the currents at x port and the voltages at z and x ports are saturated. A detailed structure of the proposed CC-CII based square-wave generator is shown in Fig. 2 (the well-known realization of classic translinear structure of CCCII). In order to generate the current output, it is necessary to add two additional MOS transistors (to form additional z output-dual output CCCII).
The resistor R can be replaced with an active resistor R eq at port z, composed of two MOSFET transistors. The parasitic resistances (the transresistance) of ports x is approximated as [4] ( ) where g m denotes the transconductances of the transistors M 6 (M 7 ) and M 4 (M 5 ) (function of bias current I B ) -the NMOS and PMOS components of translinear loop. µ is the carrier mobility; C OX is the gate capacitance per unit area, respectively. This nonlinear relation (2) implies the real limits of the bias currents in the possible practical implementation [4,5].
The voltage output v out (Fig. 1) has two possible saturation levels; V SAT+ =-V SAT-=V DD , and v out can be expressed only either as V SAT+ or as V SAT-, because the proposed configuration possesses high positive feedback. At steadystage operation, we can assume that v out switches from V SAT-to V SAT+ . The voltage across the capacitor C (v C ) that is charged from the lower threshold voltage (V TH-) to V SAT+ and can be expressed as At the end of first half-period, the capacitor voltage retained its upper threshold voltage (V TH+ ). On the basis of the internal structure of CCCII and its terminal relationships we can conclude that V TH-and V TH+ can be given by The interval at which the capacitor is charged-T 1 , can be derived from (3) as Analogously, the interval in which the capacitor discharged can be expressed as  From (5) and (6), bias current I B can be used for controlling the period of oscillation, owing to the existing dependency between the value of the transresistance of ports x (defined with equation (2)) and thus the duration of the intervals T 1 and T 2 . Additional controllability would be achieved by installation of an active resistor R eq at port z of CCCII, or an active C. For oscillation, the oscillator must fulfil two Barkhausen conditions: the loop gain must be slightly greater than unity; the loop phase shift must be 0 or 360 degrees [6]. The proposed circuits (relaxation oscillator) basically possess a certain form of amplifiers with positive feedback (forming circuits with two threshold voltage levels-Schmitt trigger comparator). In this way a portion of its output was fed back re-generatively to the input, and one of the output transistors is driven to saturation (ON state) and the other to cut-off (OFF state). In order for the proposed generator circuit to be able to generate a square wave output signal (voltage/current) -a oscillation condition (OC), it is necessary to set the value of capacitor C, the time constant that defines the rate of change on the x port of the CCCII, as well as the trigger thresholds levels. Namely, it is necessary that the trigger threshold, which depends directly on the value of R x , be reached fast enough (a function of time constant), in order to change the condition at the output of the generator circuit at all. Also, from (5) and (6) it is obvious that 2R>R x must be satisfied as one of OC. From these facts it is clear that there is control of the oscillation conditions over the electronically controlled value of the resistance R x . For the oscillations to start, it is necessary that the initial value of the loop gain be greater than 1, which is provided with slope dv x /di x at i x =0.The output frequency f o can be given by The voltage limits of x terminal are dominant, in order to describe the nonlinear behaviour of the proposed circuits. In this case the capacitor C can be assumed to be charged with the dependent voltage source v x =v y +i x R x through terminal resistance, controlled by the bias current. In the context of the functional dependency expressed in this way, the operation of the proposed relaxation oscillator can be analysed on the basis of the current-controlled resistive elements (CC-CII) driving plot (DP) in conjunction with the capacitor C-as seen by the capacitor at node (port) x. In the proposed relaxation oscillator, Fig.1, the linear capacitor C is connected at port x, e.g. to a current-controlled resistor described by functional relation (2), which is not bijective. This approach can be found in well-known texts pertaining to the problem of nonlinear system analysis [7][8][9][10] as original Chua vintage, because any two-terminal resistive device is characterized by its driving-point (DP) characteristic [8]. For the proposed circuits, Fig. 1, port x possesses such a characteristic. Fig. 3 shows the driving-point (DP) characteristic of CCCII port x (voltage vs. current) depending on the applied bias current I B . This dependency was recorded using MOS transistors with aspects ratios (W/L) given in Table 1 at V DD =-V SS =2.5 V and R=5 kW, using HSPICE simulation. In the generator circuit defined in Fig. 1, with the CCCII internal structure given in Fig. 2, a variable current source 15mA 20mA The v x -i x curve for current-controlled resistor at CCCII x port i x is connected to port x instead of capacitor C, recording voltage across port x (v x ) for different current values I B . This approach captured the characteristic that also included the reaction circuit existing in the proposed generator circuit.
With this recorded characteristic, the expected properties were confirmed for the proposed circuit, which has a strong nonlinearity (the exact position of the intersections of branches with different slopes depend on the step used in simulation procedure -the resolution itself in Fig. 3) which allows it to produce strong feedback as a pre-condition for the operation of the relaxation oscillator. To give a physical interpretation of this situation, it is necessary to observe that C ) of the characteristic shown in Fig. 3. We reach the state (not the equilibrium point) defined by threshold levels in a finite forward and backward time period. The nonlinear DP reveals the meaning of voltages V xSAT (|V xSAT± y 1.8 V) and threshold voltages at port x V xTH (|V xTH± y 1.6V), defining the limits of possible changes in x port voltage, as well as the extent of approximations that are included in equation (2)-(7) (the obtained values for threshold voltages indicated that the value for the intrinsic resistance was R x y 200Ω). Fig. 3 shows the influence of the bias current on the slope of the DP plot, as well as the slope dv x /di x at i x =0 -the slope of the characteristic ensures that the loop gain in the proposed circuit is sufficient to establish the oscillations in the systems with a positive feedback (R x is actually the positive differential resistance of the outer branches). As was described in [10] regarding the obtained characteristics shown in Figure 3, the locus of the response of the oscillator, following an initial state or excitation, can be estimated by choosing a sequence of points, choosing each new point at a short distance along the slope line of the previous point. The proposed generator possesses the slope at the equilibrium point greater than 2, and we can obtain the portrait of the oscillator in the state plane or the Lienard plane [10], as valuable tools in establishing the nature of the oscillator behavior. The locus for the relaxation oscillator, Fig. 1, for the steadystate response is almost a parallelogram in the Lienard plane, as for some other known solutions of relaxation oscillators [10]. The locus is almost horizontal at the top and the bottom of the locus, moving from one passive region to the other. These last segments of the locus are due to the fast regenerative switching intervals.
The above equations ((2)-(7) -for the case of a small signal operation) fail to adequately represent the real behaviour of the circuit for a large signal operation, because the input resistance R x is no longer constant. Namely, in this situation R x possesses different values for high and low voltage level at x input [3], and consequently CCCII definition equations must be changed. Defining these different values for R x as R xh and R xl for these two levels, the period of the oscillation can be expressed as I n the situation described in equation (8), we will come to a position to control the duty cycle of the generated oscillation. For the proposed square-wave generator, the obtained voltage levels and operation frequency range, the difference between R xl and R xh can be neglected, and consequently we are practically not in a position to electronically adjust the duty cycle.

Non-ideal effects
The parasitic components at the CCCII terminal can affect the value of the (7) at high frequency [2,4]. The terminals y and z possess high-value parasitic resistance at parallel with low-value parasitic capacitance, while port x only already defined the serial resistance R x . Considering the nonideal gains of active elements-CCCII (tracking errors), the port relations (1) can be rearranged as: i y =0; v x =av y +i x R x ; i z =bi x ; where α=1-e v and ε v (|ε v |<<1) represents the voltage tracking error from y to x terminal, β=1-e p and ε p (|ε p |<<1) denotes the current tracking error from x to z terminal of the CCCII, respectively. Generally, these tracking factors remain constant and frequency independent within low to medium frequency ranges. Taking the non-idealities of the CCCII into account, (7) respectively, becomes where R`=R//R z //R y . From (9), it is obvious that the nonideal parameters have only a slight effect on oscillating frequency and condition.
At high frequencies the voltage and current transfer function of CCCII, a and b, becomes frequency dependent-a(s) and b(s), s=jw. Also, parasitic impedances at all ports will be changed, and can be calculated as proposed in [11]-on port x an inductance L x in series with R x will appear, and it can be calculated after calculation of R x , from the -3dB cut-off frequency, f x , of the impedance Z x =v x /i x , by L x =R x /2pf x . Similar procedure is used for determination of C y , C z . In this situation, the value of R' and R x will be changed in accordance with parasitic impedances at ports y and z, appearing in parallel with R.
Within the operating range of the proposed generator (up to 25 MHz), the influences of the effects described here are not significantly affected, so that in the further analysis of the operation they are not captured.
For any divergence in the value of the parameter in relation to its nominal value, it is possible to determine the value of the frequency f 0 and calculate the corresponding error-the size of the error in determining the f 0 , which occurs as a consequence of the non-ideal nature of the components applied in the circuit proposed in Fig. 1. For example, in equation (9), parameter a was replaced with (1+da/100)a, where da stands for the percentage divergence in the value of the a parameter in relation to its nominal value, whereupon the value of the f 0 is calculated. After this, the percentage error-e, in measuring of f 0 is calculated as where f o is the frequency of oscillation defined with (7), and ' o f defined with (9). Table 1 correspond to the case where all the parameters of interest are known within the limits of ±1 % in relation to their nominal values, based on a uniform distribution of probability -the uncertainty budget which is based on the procedures described in GUM [12]. The specific nature of the uncertainty budget set in this manner is reflected in the fact that for certain parameters it is not possible to establish exact values of sensitivity coefficients, since the values depend on the form of the approximations of the function ln (in the form of a stepped series). The sensitivity to these parameters is represented as the interval of possible values.

The values in
If values in the upper bounds of such intervals are taken as a base for calculation of the combined measuring uncertainties, this would result in a probably unjusti-fied increase of the measuring uncertainty. However, it is not possible to determine to what extent this would be unjustified, by using the usual procedures of determining the measuring uncertainty, as described in GUM [12]. It is equally possible, for example, to make use of the mean values of sensitivity. By assuming a uniform distribution of the sensitivity (of the first error derivatives per parameter), standard measuring uncertainty equalling 2.2% is obtained, i.e. an expanded uncertainty (for the coverage factor k=2) amounting to 4.4% -however, it will always remain unknown how far we are from a realistic estimate.
The evaluation of uncertainty in the results of measuring obtained through a simulation of the impact made by variations of all the parameters of interest can be based on one of the methods known by their common name 'The Monte Carlo' method [13] (provided by the HSPICE software package itself). It is expected that such a method offers a more realistic evaluation of uncertainty, given the fact that it does not imply any assumptions, either regarding the distribution of the output value, the error in the measuring results, or the distributions of the sensitivity values. This analysis is used to investigate the effect of the process parameters and the mismatch between transistors, and it also gives the lower and upper limits of the interval, which contains 95% of errorabsolute value of the difference between the predicted and observed output value (Monte Carlo predicts the behavior of a circuit statistically when part values are varied within their tolerance range by 5%). Under the above described assumptions, the result of implementation of the Monte Carlo variants is shown in Fig. 4. The measuring uncertainty obtained here amounts to 1.8 %, and it ought to be compared with the data obtained from the uncertainty budget (4.4%). The number of individual simulations was 1000. During this analysis, the bias current was I B =80 μA, while the capacitor value was 100 pF (R=5 kΩ).
The extreme PVT (process-voltage-temperature) variation observed is +/-10%. This tolerance is applied over Table 1: Uncertainty Budget (the size of the error in determining the frequency of generated square-wave output signal, which occurs as a consequence of the non-ideal nature of the components applied in the circuit proposed in Fig. 1 the 0 0 C to 100 0 C temperature range, +/-5% supply variation and +/-5% variation of on-die calibrated capacitor. The +/-10% tolerance is mainly attributed to nonlinearity of current mirroring (as a consequence of the mismatch of the characteristics of the used MOS transistors, much less as a result of possible instability of the bias currents) with respect to temperature, supply variation and small but finite variation of the calibrated capacitor. In [14] highly accurate and stable solutions for realization of current reference sources in 0.18 mm CMOS technology are proposed, based on the behaviour of an original unbalanced current mirror structure. The obtained results confirm the conclusion resulting from the conducted analysis mentioned above, regarding the acceptable sensitivity characteristic of the proposed generator.  Table 2. It should be noted that the proposed circuits can work with the power supply in the range ±1.25 V-±2.5 V; however, with a decrease in the supply voltage, distortion increases in the output square-wave signal, which can be partially offset by the correct selection of passive components and the bias current. The power consumption of the proposed square-wave generator varies in the range from 0.12 mW to up to 1 mW.  Fig. 5a, for the voltage output, is similar to the designed oscillation frequency, equation (7). The transient responses of the generated square-wave current signals when I B is changed to 80 μA are shown in Fig.  5b, while the frequency is now changed to 3.425 MHz (1% error). The performance of the proposed generator at the higher frequency is further checked when the capacitor value is changed from 100 pF to 20 pF, Fig.  5c. The total harmonic distortion (simulated THD -as a measure of the deviation of the shape of the generated output voltage/current signals from the ideal squarewave signal, all in accordance with the definition of THD [10]) over full frequency operating range of the proposed CCCII-based square wave generator is lower than -23.35 dB (6.8%), and it is comparable with the results obtained in [15].
Additionally, variations of theoretically calculated and simulated values of oscillation frequency f 0 against bias current I B -the tuning aspects of the circuits, for C = 50 pF, and R=10 kW are simulated. In order to confirm the results obtained through theoretical analysis of the proposed relaxation oscillator and the ensuing derived equations, the recorded simulation characteristic (green curve in Fig. 6) was compared with the curve (red curve in Fig. 6) obtained at the basis of the derived relation (7), for the frequency of the output squarewave signal. Moreover, since the relation (2) defines the approximate value of the internal resistance of port x (which prevents the direct implementation of (2) in (7), since it would cause an error in calculation of f 0 ), its value is measured directly at the input port x of CCCII, in the process of simulation verification and for different values of current I B . The obtained values for R x are completely in accordance with the results obtained in [4,5], which only confirms the already stated fact about the very complex dependence of this CCCII parameter on the current I B .
The variation of simulated oscillation frequency is found very close to the theoretical oscillation frequency. Choosing a larger time step between the points at which this transfer characteristic is determined would give substantially flatter transfer characteristic. However, the author tried to describe as accurately as possible the characteristics of the proposed generator. The thermal performance of the proposed generator is further investigated, and simulated waveform of voltage output for different temperature values (25, 55 and 70 °C) is shown in Fig. 7. It can be observed from Fig. 7 that frequency f 0 is only slightly affected by the temperature variation, and for example, when the circuits operate at 70°C, the frequency, f 0 is 384.6 kHz (C=1 nF, I B =50 μA, R=5 kΩ), which represents a 5% deviation from the value at 25 °C. The percentage variation of output voltage amplitude over specified temperature range was 0.0024%, while output current stability was 0.0287 mA/°C. The temperature stability of of intrinsic resistance R x strongly depends on the physical parameter defined in equation (2). On the basis of analysis conducted in [16,17], we can conclude that e.g. R x contributes a positive temperature coefficient, thus current biasing circuit that provides a negative temperature coefficient is required for the compensation.  For experimental verifications, the CCCII+ were realized using commercially available AD844 (CFA) ICs as a current conveyor, while with LM13700 AN (OTA) an electronically tunable floating resistance simulator was obtained, which acts as the parasitic resistance at the node x of the CCCII, Fig. 8. By varying the external bias current which is applied to LM13700, the frequency of the oscillations is tuned.
The power supply voltages of ±5 V are applied to AD844 and ±9 V is applied to LM13700. The bias currents are set to I B =140 μA (the current source with stability of 0.5% was used) and passive components used are R=5 kΩ and C=0.01 μF. The experimentally observed waveforms of voltage output signals are shown in Fig. 9.

Figure 9:
Experimental results (scale: x-axis 0.2 ms/div and y-axis 2 V/div) Table 3 shows the comparison of the proposed generator with previously reported generator circuits. It is observed that the following features are available from the proposed circuit: only one active element; use of   [18] also uses only one active element and offers a higher operation frequency range, but the deployed active element demands a bias voltage in currents for proper operation. Also, MO-CIDITA [18] possesses a much more complex internal structure with more MOS transistors then CCCII.
The proposed circuit has lesser complexity in terms of design and component requirements in comparison with circuits (on the same basic platform -based on the use of CCII) presented in [3,15,21,23,27]. In standings with the comparative operating frequency, the generator proposed here can work in the megahertz range (MHz), which is an important advantage of the described design in many modern electronics and communication applications. The proposed circuit consumes the least power compared to all other circuits, except the generator proposed in [21].

Conclusion
This paper presents a new square-wave generator using only one CCCII, grounded resistors and one capacitor, which reduces noise effects and guarantees a low parasitic effect. The oscillation frequency of the proposed relaxation oscillator has been shown to strongly depend on the nonlinear behaviour of the CCCII where the value of the x terminal resistance R x is a very important factor in determining the oscillation frequency. The bias current is used to control the oscillating condition and oscillating frequency, which can also be adjusted by changing resistance and capacitor value. Both voltage and current signals can be obtained within a single topology (mixed output mode), which has gained recent popularity in analog signal processing. The circuit shows a good high frequency performance of the current mode circuits and is free from high frequency limitations such as slew rate and gain reduction problems in the OA realization. The proposed circuit exhibits low sensitivity properties and possesses high output impedances at current terminals, thus ensuring insensitive current outputs that require no additional current followers to be sensed. Application of only grounded passive components makes the circuit suitable for IC implementation. Finally, a good match between theoretical, simulation and practical results was confirmed in the paper.

Acknowledgments
Research was supported by Ministry of Education, Science and Technological Development, Republic of Serbia, Grant No. 42009 and 172057.

Conflicts of interest
The author declares no conflict of interest. The founding sponsors had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, and in the decision to publish the results.