The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design >> Mixed-Signal Design >> Bandpass Sigma Delta Converter
https://designers-guide.org/forum/YaBB.pl?num=1213204643

Message started by tipu on Jun 11th, 2008, 10:17am

Title: Bandpass Sigma Delta Converter
Post by tipu on Jun 11th, 2008, 10:17am

Hello,

I am designing a 2nd order bandpass sigma delta converter on Matlab and want to set the coefficients by using the Schreier Toolbox but unfortunately it does not give me the required modulated output.I am using a single bit quantizer,2 integrators first of which is a non-delaying and the second one is delaying,the center frequency if set to be 1/4 of the sampling frequency with an OSR of 128.I want to know whether the Schireir toolbox works fine for the Bandpass Sigma Delta or not?

If Any one here who has already worked on this one can help me it would be really great.

Title: Re: Bandpass Sigma Delta Converter
Post by pancho_hideboo on Jun 11th, 2008, 7:57pm


tipu wrote on Jun 11th, 2008, 10:17am:
I am designing a 2nd order bandpass sigma delta converter on Matlab and want to set the coefficients by using the Schreier Toolbox but unfortunately it does not give me the required modulated output.I am using a single bit quantizer,2 integrators first of which is a non-delaying and the second one is delaying,the center frequency if set to be 1/4 of the sampling frequency with an OSR of 128.I want to know whether the Schireir toolbox works fine for the Bandpass Sigma Delta or not?

It can work for BP-DSM.

Show me your M-file to design BP-DSM where synthesizeNTF(),  simulateDSM(), simulateSNR(), etc. are used.

Title: Re: Bandpass Sigma Delta Converter
Post by tipu on Jun 13th, 2008, 4:37am

hello pancho_hideboo,

Thanks for your response.

I am posting the .m file.Here it is!!

%Parameters
order=2;
OSR=128;
opt=2;
H_inf=1.6;
f0=1/4;

nLev=2;
Nfft=2^13;
tone_bin=57;
t=[0:Nfft-1];
u=0.5*(nLev-1)*sin(2*pi*(tone_bin)/Nfft*t);
n=1:150;

%Synthesizing the NTF:
H=synthesizeNTF(order,OSR,opt,H_inf,f0);
form='CRFB';
[a,g,b,c]=realizeNTF(H,form);
b(2:end)=0;

%ABCD Matrix
[ABCD] = stuffABCD(a,g,b,c,form);
[ABCDs umax]=scaleABCD(ABCD,nLev=2,xLim=1);
[a g b c]=mapABCD(ABCDs,form);
[NTF STF]=calculateTF(ABCD);

%Pole Zero Plot,Rms Gain
plotPZ(H);
f=linspace(0,0.5,1000);
z=exp(2i*pi*f);
plot(f,dbv(evalTF(H,z)));
sigma_H=dbv(rmsGain(H,f0-0.25/OSR,f0+0.25/OSR));

%Plotting the Output in the time Domain
v=simulateDSM(u,H,nLev);
stairs(t(n),u(n),'g');
hold on;
stairs(t(n),v(n),'b')

%Calculating the Spectral Contents of the modulator
%Determining the SNR
spec=fft(v.*hann(Nfft))/(Nfft*(nLev-1)/4);
snr=calculateSNR(spec(1:ceil(Nfft/(2*OSR))+1),tone_bin);
NBW=1.5/Nfft;
Sqq=4*(evalTF(H,exp(2*pi*f))/(nLev-1)).^2/3;
f=linspace(0,0.5,Nfft/2+1);
plot(f,dbv(spec(1:Nfft/2+1)),'b')
hold on;
plot(f,dbp(Sqq*NBW),'m','Linewidth',1);

%The Dynamic Range plotting
%Peak SNR
amp=[-90:5:-20 -17:2:-1];
snr=simulateSNR(H,OSR,amp,f0,nLev);
plot(amp,snr,'-b',amp,snr,'db');
[pk_snr pk_amp]=peakSNR(snr,amp);

Title: Re: Bandpass Sigma Delta Converter
Post by pancho_hideboo on Jun 22nd, 2008, 10:44pm

Before you post code, confirm code's validity, that is, syntax.
Your code is not valid, so it can't work. This is basic problem before you study bandpass delta-sigma.

Your "tone_bin=57" is not proper.
I think tone_bin should be 2049.
Why do you set tone_bin as 57 ?


tipu wrote on Jun 13th, 2008, 4:37am:
%Parameters
order=2;
OSR=128;
opt=2;
H_inf=1.6;
f0=1/4;

nLev=2;
Nfft=2^13;
tone_bin=57;
t=[0:Nfft-1];
u=0.5*(nLev-1)*sin(2*pi*(tone_bin)/Nfft*t);
n=1:150;

%Synthesizing the NTF:
H=synthesizeNTF(order,OSR,opt,H_inf,f0);
form='CRFB';
[a,g,b,c]=realizeNTF(H,form);
b(2:end)=0;

%ABCD Matrix
[ABCD] = stuffABCD(a,g,b,c,form);
[ABCDs umax]=scaleABCD(ABCD,nLev=2,xLim=1);
[a g b c]=mapABCD(ABCDs,form);
[NTF STF]=calculateTF(ABCD);

%Pole Zero Plot,Rms Gain
plotPZ(H);
f=linspace(0,0.5,1000);
z=exp(2i*pi*f);
plot(f,dbv(evalTF(H,z)));
sigma_H=dbv(rmsGain(H,f0-0.25/OSR,f0+0.25/OSR));

%Plotting the Output in the time Domain
v=simulateDSM(u,H,nLev);
stairs(t(n),u(n),'g');
hold on;
stairs(t(n),v(n),'b')

%Calculating the Spectral Contents of the modulator
%Determining the SNR
spec=fft(v.*hann(Nfft))/(Nfft*(nLev-1)/4);
snr=calculateSNR(spec(1:ceil(Nfft/(2*OSR))+1),tone_bin);
NBW=1.5/Nfft;
Sqq=4*(evalTF(H,exp(2*pi*f))/(nLev-1)).^2/3;
f=linspace(0,0.5,Nfft/2+1);

plot(f,dbv(spec(1:Nfft/2+1)),'b')
hold on;
plot(f,dbp(Sqq*NBW),'m','Linewidth',1);

%The Dynamic Range plotting
%Peak SNR
amp=[-90:5:-20 -17:2:-1];
snr=simulateSNR(H,OSR,amp,f0,nLev);
plot(amp,snr,'-b',amp,snr,'db');
[pk_snr pk_amp]=peakSNR(snr,amp);


Title: Re: Bandpass Sigma Delta Converter
Post by pancho_hideboo on Jun 22nd, 2008, 11:26pm

I don't check your M-file throughly.
There are still many wrong or improper issues in your M-file.

At least, the following code can work as BP-DSM.
You have to study why time domain waveforms are like these.


Code:
% The Designer's Guide Community Forum>Design>Mixed-Signal Design>Bandpass Sigma Delta Converter
% http://www.designers-guide.org/Forum/YaBB.pl?num=1213204643/0

close all, clear, clc
stdout = 1;

%Parameters
order = 2;
OSR = 128;
opt = 2;
H_inf = 1.6;
f0 = 1/4;

nLev = 2;
Nfft = 2^13;

Tstep = 1;
Textra = 100*Tstep;
Tstop = Nfft*Tstep + Textra;
delta_f = 1/(Tstop-Textra);

%tone_bin=57;
tone_bin = fix(f0/delta_f + 0.5);
if mod(tone_bin, 2) == 0
  tone_bin = tone_bin + 1;
end
fprintf(stdout, 'tone_bin=%d\n', tone_bin);

t1 = fix(Textra/Tstep);
t2 = t1 + Nfft-1;
t = 0:t2;
u = 0.5*(nLev-1)*sin(2*pi*(tone_bin)/Nfft*t);
n = 1:150;
n = n + t1;

%Synthesizing the NTF:
H = synthesizeNTF(order, OSR, opt, H_inf, f0);

%Pole Zero Plot,Rms Gain
figure(1), plotPZ(H); grid on
f = linspace(0,0.5,1000); z = exp(2i*pi*f);
figure(2), plot(f,dbv(evalTF(H,z)));
grid on
sigma_H = dbv(rmsGain(H, f0-0.25/OSR, f0+0.25/OSR));

%Plotting the Output in the time Domain
figure(3);
v = simulateDSM(u, H, nLev);
stairs(t(n), u(n), 'g');
hold on;
stairs(t(n), v(n), 'b')
grid on

%Calculating the Spectral Contents of the modulator
%Determining the SNR
figure(4);
spec = fft(v(t1:t2).*hann(Nfft))/(Nfft*(nLev-1)/4);
snr = calculateSNR(spec(1:ceil(Nfft/(2*OSR))+1), tone_bin);
NBW = 1.5/Nfft;
f = linspace(0, 0.5, Nfft/2+1);
plot(f, dbv(spec(1:Nfft/2+1)), 'b')
hold on;
Sqq = 4*(evalTF(H, exp(2*pi*f))/(nLev-1)).^2/3;
plot(f, dbp(Sqq*NBW), 'm', 'Linewidth', 1);
grid on

%The Dynamic Range plotting
%Peak SNR
figure(5);
amp = [-90:5:-20 -17:2:-1];
snr = simulateSNR(H, OSR, amp, f0, nLev);
plot(amp,snr, '-b', amp,snr, 'db');
[pk_snr pk_amp] = peakSNR(snr, amp);
grid on


form = 'CRFB';
[a,g,b,c] = realizeNTF(H, form);
b(2:end) = 0;

%ABCD Matrix
[ABCD] = stuffABCD(a, g, b, c, form);
xLim = 1;
[ABCDs umax] = scaleABCD(ABCD, nLev, xLim);
[a g b c] = mapABCD(ABCDs, form);
[NTF STF] = calculateTF(ABCD);

Title: Re: Bandpass Sigma Delta Converter
Post by tipu on Jun 25th, 2008, 4:25am

Hello pancho_hideboo

I'm sorry for the inconvenience.I should have posted at least the correct syntax.Since you were helpful enough with your advice and suggestions I need to ask a one more things from you.I hope you will not mind that.

How did you calculate the tone_bin parameter?.I mean what formula did you use.I tried to learn about it  but I am very vague in my mind.I confess I didn't have any idea about it so just used  the random value. :-[

Thanks a lot for your help.

Title: Re: Bandpass Sigma Delta Converter
Post by pancho_hideboo on Jun 25th, 2008, 7:34am

Why do you set tone_bin as 57 ?
I'm very curious about the theory or reason why you set tone_bin as 57.


[quote author=tipu link=1213204643/0#5 date=1214393118]How did you calculate the tone_bin parameter?.I mean what formula did you use.I tried to learn about it  but I am very vague in my mind.I confess I didn't have any idea about it so just used  the random value. :-[/quote]
See my modified M-File surely.
I read your M-File including syntax errors.


The followings are extraction of modified M-File.

Tstep = 1;
Textra = 100*Tstep;
Tstop = Nfft*Tstep + Textra;
delta_f = 1/(Tstop-Textra);

%tone_bin=57;
tone_bin = fix(f0/delta_f + 0.5);
if mod(tone_bin, 2) == 0
  tone_bin = tone_bin + 1;
end
fprintf(stdout, 'tone_bin=%d\n', tone_bin);

Title: Re: Bandpass Sigma Delta Converter
Post by tipu on Jun 25th, 2008, 7:50am

Dear pancho_hideboo

I had already read that.What you have done is that you have multiplied the center frequency (which is 1/4) with the total number of FFT points (8192) in this case so that tone_bin will be lying in one of those FFT points??

I wanted to enquire about it in general terms? lets suppose that I am designing a LOW pass system with 1 MHz sampling frequency,20K center frequency and 4k Bandwidth(it's just an imaginary situation),then what would be my tone_bin?

Sorry if it sounds too naive or ridiculous to you :-[

Title: Re: Bandpass Sigma Delta Converter
Post by pancho_hideboo on Jun 29th, 2008, 5:05am


tipu wrote on Jun 25th, 2008, 7:50am:
What you have done is that you have multiplied the center frequency (which is 1/4) with the total number of FFT points (8192) in this case so that tone_bin will be lying in one of those FFT points??

Yes. It is very very very common in SNR evaluation of sinusolidal signal using DFT.
You don't seem to understand DFT(FFT).
I think you should learn DFT before studying delta sigma modulation theory.


tipu wrote on Jun 25th, 2008, 7:50am:
I wanted to enquire about it in general terms?

It is general.


tipu wrote on Jun 25th, 2008, 7:50am:
lets suppose that I am designing a LOW pass system with 1 MHz sampling frequency,20K center frequency

Where do you want to locate zeros of NTF ?
Do you want to locate them around 20kHz ?
If so, this is Bandpass Delta Sigma not Lowpass Delta Sigma.


tipu wrote on Jun 25th, 2008, 7:50am:
and 4k Bandwidth(it's just an imaginary situation),then what would be my tone_bin?

What do you mean by "an imaginary situation" ?

OSR=125, tone_bin=165


Code:
% The Designer's Guide Community Forum>Design>Mixed-Signal Design>Bandpass Sigma Delta Converter
% http://www.designers-guide.org/Forum/YaBB.pl?num=1213204643/0

close all, clear, clc
stdout = 1;

%Parameters
order = 2;
nLev = 2;
opt = 2;
H_inf = 1.6;

fs = 1e6;

%f0 = 1/4;
f0 = 20e3/fs; % Normalized by fs

%OSR = 128;
BW = 4e3;
OSR = fs/(2*BW);
fprintf(stdout, 'OSR=%d\n', OSR);

Nfft = 2^13;

Tstep = 1; % Normalized by (1/fs)
Textra = 100*Tstep;
Tstop = Nfft*Tstep + Textra;
delta_f = 1/(Tstop-Textra);

%tone_bin=57;
tone_bin = fix(f0/delta_f + 0.5);
if mod(tone_bin, 2) == 0
  tone_bin = tone_bin + 1;
end
fprintf(stdout, 'tone_bin=%d\n', tone_bin);

t1 = fix(Textra/Tstep);
t2 = t1 + Nfft-1;
t = 0:t2;
u = 0.5*(nLev-1)*sin(2*pi*(tone_bin)/Nfft*t);
n = 1:150;
n = n + t1;

%Synthesizing the NTF:
H = synthesizeNTF(order, OSR, opt, H_inf, f0);

%Pole Zero Plot,Rms Gain
figure(1), plotPZ(H); grid on
f = linspace(0, 0.5, 1000);
%figure(2), z = exp(2i*pi*f); plot(f,dbv(evalTF(H, z)));
figure(2), plot( f, dbv(squeeze(freqresp(H, 2*pi*f))) )
grid on
sigma_H = dbv(rmsGain(H, f0-0.25/OSR, f0+0.25/OSR));

%Plotting the Output in the time Domain
figure(3), hold on
v = simulateDSM(u, H, nLev);
stairs(t(n), u(n), 'g');
stairs(t(n), v(n), 'b')
grid on

%Calculating the Spectral Contents of the modulator
%Determining the SNR
figure(4), hold on
spec = fft( v(t1:t2) .* hann(Nfft) ) / (Nfft*(nLev-1)/4);
snr = calculateSNR(spec(1:ceil(Nfft/(2*OSR))+1), tone_bin);
NBW = 1.5/Nfft;
f = linspace(0, 0.5, Nfft/2+1);
plot(f, dbv(spec(1:Nfft/2+1)), 'b')
%z = exp(2i*pi*f); Sqq = 4*( evalTF(H, z) / (nLev-1) ) .^ 2/3;
Sqq = 4*( freqresp(H, 2*pi*f) / (nLev-1) ) .^ 2/3;
plot(f, dbp(squeeze(Sqq)*NBW), 'm', 'Linewidth', 1);
grid on

%The Dynamic Range plotting
%Peak SNR
figure(5);
amp = [-90:5:-20 -17:2:-1];
snr = simulateSNR(H, OSR, amp, f0, nLev);
plot(amp,snr, '-b', amp,snr, 'db');
[pk_snr pk_amp] = peakSNR(snr, amp);
grid on


form = 'CRFB';
[a,g,b,c] = realizeNTF(H, form);
b(2:end) = 0;

%ABCD Matrix
[ABCD] = stuffABCD(a, g, b, c, form);
xLim = 1;
[ABCDs umax] = scaleABCD(ABCD, nLev, xLim);
[a g b c] = mapABCD(ABCDs, form);
[NTF STF] = calculateTF(ABCD);


The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.