c - DSP - data carrier detection in Bell 202 modem -
i need perform detecting correct afsk signal present in input signal. have working demodulator, diagram here.
as can see modulation bell 202 - tones 1200hz , 2200hz @ 1200 baud, sampled @ 9600hz (8 samples/symbol). decoding tones @ 9600hz bits @ 1200 bps made in function. demod function returning current tone 9600 times per second.
my c code of demodulator stm32f103rb is:
#define n 8 int16_t samples_array[n]; uint8_t sampleindex; //tables coefficients int16_t coeffxxx[n] generated values each frequency , q int32_t afsk_demod(int16_t sample) //when return >0 tone 2200hz, else it's 1200hz, input 12 bit sample { int16_t sample2; int32_t outloi = 0, outloq = 0, outhii = 0, outhiq = 0; samples_array[sampleindex] = sample; sampleindex = (sampleindex + 1) % n; for(uint8_t = 0; < n; i++) { sample2 = samples_array[(sampleindex + i) % n]; outloi += sample2*coeffloi[i]; outloq += sample2*coeffloq[i]; outhii += sample2*coeffhii[i]; outhiq += sample2*coeffhiq[i]; } return ((outhii >> 11) * (outhii >> 11) + (outhiq >> 11) * (outhiq >> 11) - (outloi >> 11) * (outloi >> 11) - (outloq >> 11) * (outloq >> 11)); //adc 12-bit }
demodulator working (i can decode lot of frames it) of course.
receiver has open squelch, must distinguish between noise , correct afsk signal. need prevent packet collision in half-duplex channel.
because of using fm receiver, amplitude of packet (when there fm carrier) on receiver output lower noise, when there no fm carrier.
how can detect, correct afsk signal present @ demod input?
Comments
Post a Comment