DSPRelated.com
Forums

Realisation the Decoder of the convolutional code

Started by Fhr89 2 years ago3 replieslatest reply 2 years ago176 views

I am testing the realisation of a decoder for convolutional code with constraint length K = 7 and code rate = 1/2.

As my test environment, transmitter and receiver, I use an example from mathworks.

The transmitter for the test:

M = 2; % Modulation order

I decided to test with the simplest modulation scheme BPSK

bps = log2(M); % Bits per modulation symbol

numSymPerFrame = 1000;

dataIn = randi([0 1],K*bps*numSymPerFrame,1);

Applied convolutional encode the input data.

codedout = convenc(dataIn,trellis);

Applied modulation to the encoded symbols.

txSig = qammod(codedout,M,'InputType','bit');

Convert Eb/No to an equivalent SNR ratio. Pass the signal through an AWGN channel.

EbNo = 9;

snr = EbNo + 10*log10(bps*coderate);

rxSig = awgn(txSig,snr,'measured');

Demodulate the received signal:

demodSig = qamdemod(rxSig,M,'OutputType','bit');

To decode the binary demodulated signal I use my implementation of Viterbi decoder   Viterbi decoder function

I have computed Bit error rate and it is 30% . This number shows me there is a big mistake. I have check my realisation about 100 times and cant find whre i have mistaken

Could someone help me to find this error?

[ - ]
Reply by drmikeFebruary 17, 2022

To debug something like this you should check that each step does what you expect.  Instead of random data, use a fixed pattern like alternating 1 0 1 0.  You can then check the "codeout" by hand - is it exactly as expected?  Then remove the noise and check if the demodSig is what it should be - again, you can compute this by hand to verify.  Then pass that to the Viterbi decoder.  

Your bug could be any where.  So you need to check that every step of the way is as expected.  If every step is good without noise, and you have a problem with noise, then it's a more subtle bug.  

In any case, you can't keep looking at the whole thing.  Each step has to be what you expect.  And if you don't get what you expect - either the code is wrong, or what you are expecting is wrong!  

Dig into it, and you'll figure it out.  But take it one step at a time.

[ - ]
Reply by SlartibartfastFebruary 17, 2022

Don't rely on a single performance point to figure out what's going on.   Vary the Eb/No and plot BER against Eb/No.  If you get a normal waterfall curve then much of the decoder is working.   If the curve is 3dB from where it should be, you almost certainly have a factor of two error in the noise calibration, which is very common.   If the error rate is constant, or doesn't make a waterfall, or does some other kind of wacky thing, then it may give you some clues on what might be wrong.

You don't mention whether you're using hard or soft decision on the decoder.   If you are using soft decision, one thing to try is just use hard decision and see if that helps.  If it does, your soft decision logic needs work.

Good luck with it.

[ - ]
Reply by Mannai_MuraliFebruary 17, 2022

Due to 1/2 rate coding your EbNo of uncoded data will be 9+3=12;

SNR=EbNo*BitRate/Bandwidth

T-->Bit period

Bandwidth=1/(2*T)

For Error calculation Decoded bits will arrive after 3 to 5 times Constraint length.

This delay must be accounted in comparing Transmitted bit and received bit.Due to misalignment BER will become totally wrong.

Your BER must be better than EbNo=12dB of uncoded BPSK