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

PSoC™ 6 Forum Discussions

Kenshow
Level 8
Level 8
50 solutions authored 25 solutions authored 10 solutions authored

Hello,

I'm not sure about analog, so please let me know as following:

It outputs a 2MHz sine wave and receives it with a sensor. The signal received by the sensor is amplified and phase-compared with the original sine wave. Is it possible to configure this amplification and phase comparison with the analog circuit in PSoC4, 5 or 6?

When handling with 2MHz signals, where in the datasheet of PSoC do you determine if an amplifier or comparator is available?

Thanks,

Kenshow

0 Likes
1 Solution

NoTa,

Here is an example of the ADC_SAR operating in stroboscope mode. Using this mode of operation it is possible to acquire a waveform with resolution ~50ns. The drawback is that the incoming signal has to be periodic and stable over the time of acquisition. With conditions fulfilled, a single ADC snapshot is made per each period, and offset delay is slowly incremented for each next snapshot. The PSoC5 SAR_ADC sampling time is 4 clocks, which can be as high as 18 MHz, which should define the resolution of this approach. Surprisingly, the observed resolution is higher (~1 clock), which needs further research. I suspect that in 8-bit mode the majority of the charge is collected during the first ADC sampling clock.

The project uses KIT-059 onboard 22pf capacitor (C41) as device under test. A short PWM pulse (~500ns) is charging this capacitor, producing short ramp waveform. PWM_1 period is set to 32 clocks. PWM_2_tc serves as a strobe signal, and its period is set to 33 clocks. The ADC is preset into the ready state by API, waiting for a hardware trigger, which is fired every 32 periods of PWM_1. A simplified diagram is shown below.

Stroboscope_8bit_01a_strobe.png

Project shows that using SAR_ADC (PSoC5) it is possible to resolve signals with time step of about 50ns, which should be sufficient for sampling 2MHz sine signal. Then, with the help of some math, a relative phase of the sine can be extracted. PSoC6 SAR_ADC is faster, so achievable resolution should be even better. Compared to the Tayloe approach, with SAR_ADC the input signal should be of low-impedance and sufficient amplitude (~1V), so some wide-band  (>20MHz) external Opamp may be needed between PZT sensor and ADC. The Tayloe approach, on the other hand, can be used for very high frequencies (>100MHz) and has microvolts sensitivity, but suitable mostly for sine-shaped input waveform. The math associated with Tayloe approach is very basic.

The project uses community libraries:

SerialPlot: interface to real-time data charts

PSoC Annotation Library v1.0 (optional)

/odissey1

Figure 1. ADC is in externally strobed mode. DMA is gated by software and hardware. The gate is hardware triggered. DMA transfers ADC data into RAM buffer for later processing and visualization.

Stroboscope_8bit_01a_A.png

Figure 2. Pulse train generator. PWM_1 produces 8 clocks wide pulse, with period 32 clocks. PWM_2 generates a strobe pulse, with period of 33 clocks. Device under test is KIT-059 onboard capacitor (22pF), producing short ramp test signal. Note that o-scope probe capacitance (~20pf) also affects signal shape and amplitude.

Stroboscope_8bit_01a_PWM.png

Figure 3. Acquired data is visualized using SerialPlot charting tool and corresponding interface component. Communication with computer is performed through UART.

Stroboscope_8bit_01a_UART.png

Figure 4. Project annotation using PSoC Annotation Library. Note that the o-scope probe capacitance affects signal shape. The signal amplitude almost doubles with probe disconnected. A low capacitance (~1.5pF) active probe is recommended.

Stroboscope_8bit_01a_C.png

Figure 5. Yellow trace - ramp signal from DUT, Cyan - PWM_1 sync (tc) signal, Fuchsia - ADC strobe, Blue - DMA trigger. Ramp's risetime is approx. 500ns.

Stroboscope_8bit_01a_D1.png

Figure 6. Acquired waveform visualized using SerialPlot charting software. Two full periods of 32 points each, acquired with interval 1sec, are displayed. Estimated ADC resolution is approx. 50 ns.

Stroboscope_8bit_01a_E.png

View solution in original post

10 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hello Kenshow san,

I am not exactly sure about your requirement from the description. As I understand you are interested in part with an opamp for amplification and comparator for phase comparison. Correct me if I am wrong. PSoC4, PSo5 and PSoC 6 supports these requirements. All these devices have Continous Time Blocks(CTB) which can be configured as Opamp or comparator according to your requirement. Additionally comparators are also present(eg:LPCOMP in PSoC4 and PSoC6 devices). You can search for the keywords in the datasheet. If you are worried the exact part which you are trying to use does not have the feature, kindly check "Ordering Information" section in the datasheet which lists out important features. Inside Programmable Analog subsystem you can see the details of the components. You can check the spec of these components in electrical specfication table.

Best Regards,
Vasanth

0 Likes

HI Vasanth,

Thank you for your reply.

I would like to ask if there is a problem with OpAmp of PSoC to amplify a 2MHz sine wave. This OpAmp doesn't seem to be a problem in the audio band, but I'd like to know what part of the datasheet to look at to see if it can accurately amplify the 2MHz band.

Thanks,

Kenshow

0 Likes
Kenshow
Level 8
Level 8
50 solutions authored 25 solutions authored 10 solutions authored

Hi,

It is easy to judge if there is a graph of voltage gain vs. frequency characteristics. However, it is not in this data sheet. I think that it will be judged from the parameters of GBW, and it is judged that amplification of a small 2MHz signal from the sensor cannot be realized, is it correct?

Thanks,

Kenshow

0 Likes

NoTa,

Can you describe your project details. For example, what information is received from the sensor: is it amplitude or phase of the signal? Also, where the 2MHz sine is generated? Is it produced by PSoC?

/odissey1

0 Likes

Hi odissey1,

I can't tell you the details, but the ultrasonic sensor receives a 2MHz sine wave. I would like to amplify this with an operational amplifier and compare the phase with the source 2MHz.

2MHz oscillation → ultrasonic transmission → reception → OpAMP → phase comparator→

    +----------------------------------------------------------------------------------------↑

I am investigating whether these analog circuits can be realized by the analog circuits inside PSoC.

Thanks,

Kenshow

0 Likes

NoTa,

2MHz is quite high for PSoC itself. I suggest using a simple Tayloe mixer to downsample incoming sine signal. See, for example this YouTube video (closer to the end)

https://youtu.be/JuuKF1RFvBM

There are many other links for Tayloe detector schematic. See.e.g:

http://www.norcalqrp.org/files/Tayloe_mixer_x3a.pdf

https://www.arrl.org/files/file/Technology/tis/info/pdf/020708qex013.pdf

Basically, it is 4x fast analog switch, which is controlled by a pair of quadrature signals I and Q. The output is practically a DC voltage and can be amplified by slow opamps in psoc. Knowing the amplitudes of the quadrature signals, one can calculate the phase of the incoming sine signal.

The analog switch is cheap ($1). So all it needs is to generate a pair of digital quadrature signals I and Q at 2MHz, alongside with the source sine.

/odissey1

P.S. How do you plan to generate 2MHz sine for PZT excitation?

NoTa,

Another approach, which I may think of, and which doesn't need any external parts, is equivalent time sampling using SAR_ADC. This requires that the incoming signal stays steady over time, no phase or amplitude variations allowed. The idea is to use the ADC in the externally triggered mode, taking a single measurement at some offset time from the sine start. The ADC snapshot takes only ~6 bus clocks, which is about resolution of this technique. Taking consequently snapshots at 1,2,3,...,N clock offsets allows to strobe the incoming sine signal with resolution of about 20-50ns.

The drawback is slow acquisition, and some boring math to calculate the phase.

/odissey1

0 Likes

Hi odissey1,

Thank you for your advices. I am scrutinizing them, but it is a difficult situation to realize.

I couldn't understand about the ADC in the previous post. Could you please tell me a little more detail using the sample code or circuit image?

Thanks,

Kenshow

0 Likes

NoTa,

The SAR_ADC sampling time is short (4  BUS_CLK for PSoC5). So in triggered mode it is possible to take a single sample with a "gate" of 4/BUS_CLK~50ns. Unfortunately, it is just a single measurement.

Now let's take a sample at offset 1 BUS_CLK from the sine 0 phase and save it. Then take another sample at offset of 2 ticks, etc. The intervals between sampling can be  longer than sine period, but eventually all sine waveform will be sampled with resolution of about 1-4 ticks. It is called "equivalent time sampling", and was used in old analog scopes to achieve picosecond resolution using slow ns electronics. This is true only if sine waveform does not change during entire process.

I will try to work out some demo if time permits.

/odissey1

0 Likes

NoTa,

Here is an example of the ADC_SAR operating in stroboscope mode. Using this mode of operation it is possible to acquire a waveform with resolution ~50ns. The drawback is that the incoming signal has to be periodic and stable over the time of acquisition. With conditions fulfilled, a single ADC snapshot is made per each period, and offset delay is slowly incremented for each next snapshot. The PSoC5 SAR_ADC sampling time is 4 clocks, which can be as high as 18 MHz, which should define the resolution of this approach. Surprisingly, the observed resolution is higher (~1 clock), which needs further research. I suspect that in 8-bit mode the majority of the charge is collected during the first ADC sampling clock.

The project uses KIT-059 onboard 22pf capacitor (C41) as device under test. A short PWM pulse (~500ns) is charging this capacitor, producing short ramp waveform. PWM_1 period is set to 32 clocks. PWM_2_tc serves as a strobe signal, and its period is set to 33 clocks. The ADC is preset into the ready state by API, waiting for a hardware trigger, which is fired every 32 periods of PWM_1. A simplified diagram is shown below.

Stroboscope_8bit_01a_strobe.png

Project shows that using SAR_ADC (PSoC5) it is possible to resolve signals with time step of about 50ns, which should be sufficient for sampling 2MHz sine signal. Then, with the help of some math, a relative phase of the sine can be extracted. PSoC6 SAR_ADC is faster, so achievable resolution should be even better. Compared to the Tayloe approach, with SAR_ADC the input signal should be of low-impedance and sufficient amplitude (~1V), so some wide-band  (>20MHz) external Opamp may be needed between PZT sensor and ADC. The Tayloe approach, on the other hand, can be used for very high frequencies (>100MHz) and has microvolts sensitivity, but suitable mostly for sine-shaped input waveform. The math associated with Tayloe approach is very basic.

The project uses community libraries:

SerialPlot: interface to real-time data charts

PSoC Annotation Library v1.0 (optional)

/odissey1

Figure 1. ADC is in externally strobed mode. DMA is gated by software and hardware. The gate is hardware triggered. DMA transfers ADC data into RAM buffer for later processing and visualization.

Stroboscope_8bit_01a_A.png

Figure 2. Pulse train generator. PWM_1 produces 8 clocks wide pulse, with period 32 clocks. PWM_2 generates a strobe pulse, with period of 33 clocks. Device under test is KIT-059 onboard capacitor (22pF), producing short ramp test signal. Note that o-scope probe capacitance (~20pf) also affects signal shape and amplitude.

Stroboscope_8bit_01a_PWM.png

Figure 3. Acquired data is visualized using SerialPlot charting tool and corresponding interface component. Communication with computer is performed through UART.

Stroboscope_8bit_01a_UART.png

Figure 4. Project annotation using PSoC Annotation Library. Note that the o-scope probe capacitance affects signal shape. The signal amplitude almost doubles with probe disconnected. A low capacitance (~1.5pF) active probe is recommended.

Stroboscope_8bit_01a_C.png

Figure 5. Yellow trace - ramp signal from DUT, Cyan - PWM_1 sync (tc) signal, Fuchsia - ADC strobe, Blue - DMA trigger. Ramp's risetime is approx. 500ns.

Stroboscope_8bit_01a_D1.png

Figure 6. Acquired waveform visualized using SerialPlot charting software. Two full periods of 32 points each, acquired with interval 1sec, are displayed. Estimated ADC resolution is approx. 50 ns.

Stroboscope_8bit_01a_E.png