Hi all,

thank you for reading this.

I've been trying to use the FDMDV modem 1600 to transmit data. Meaning I
altered the code slightly to transmit a text message. I am transmitting
characters instead of the codec2 bits which are sent to the modulator.

Enclosed is a text document with the source code for the functions used.

On the other end I do actually see the text but instead it is all jumbled
up.

So I am repetitively transmitting this for example:

"CQ-CQ-This_9H5JF_NINE_HOTEL_FIVE_JULIETT_FOXTROT,_CALLING_CQ_AND_STANDING
BY."

On the other side is the a signalink and an altered FreeDV program. The
FreeDV program features an additional text panel where the
f-packed_codec_bits are being copied to an external unsigned char *
malloced space.

Instead of the sentence as is I am getting something like this:

BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BY___aND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYcQ-CQ-cQ-C___aND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-BYaND-

Any help is really appreciated.

Many thanks,





-
//---------------------------------------------------
//
//   Snippet from SM1000 code (modified)
//
//---------------------------------------------------

/* Acknowledge switch events */
switch_ack(&sw_select);
switch_ack(&sw_back);
switch_ack(&sw_ptt);


switch (core_state) {
case STATE_MENU:
        if (!menuLEDTicker) {
                led_pwr(LED_INV);
                menuLEDTicker = MENU_LED_PERIOD;
        }
        break;
case STATE_TX:
/* Transmit 
-------------------------------------------------------------------------*/

        /* ADC2 is the SM1000 microphone, DAC1 is the modulator signal we send 
to radio tx */

        if (adc2_read(&adc16k[FDMDV_OS_TAPS_16K], n_samples_16k) == 0) {
                GPIOE->ODR = (1 << 3);

                /* clipping indicator */

                
                for (i=0; i<n_samples_16k; i++) {
                        if (abs(adc16k[FDMDV_OS_TAPS_16K+i]) > 28000)
                                led_err(1);
                }

                fdmdv_16_to_8_short(adc8k, &adc16k[FDMDV_OS_TAPS_16K], 
n_samples);


// Additional code for trying a simple data transmission
                                                        
                                                        
//                      #ifdef RDIO_DATA_TEST                                   
                                                                        
if (op_mode == DATA){
        
        led_rt(1);
        led_err(1);

        switch(data_text_ctr% NO_DATA_TEXTS){

        case(10) :
                uchar_ptr = data_text_B;
                break;
        case(9) :
                uchar_ptr = data_text_A;
                break;
        
        case(8) :
                uchar_ptr = data_text_9;
                break;
        
        case(7) :
                uchar_ptr = data_text_8;
                break;
        
        case(6) :
                uchar_ptr = data_text_7;
                break;
        
        case(5) :
                uchar_ptr = data_text_6;
                break;
        
        case(4) :
                uchar_ptr = data_text_5;
                break;
        case(3) :
                uchar_ptr = data_text_4;
                break;                          
        case(2) :
                uchar_ptr = data_text_3;
                break;
        case(1) :
                uchar_ptr = data_text_2;
                break;
        case(0) :
                uchar_ptr = data_text_1;
                break;

        }
        
        if((counter % 10) == 0){
                data_text_ctr++;                                        
        }
        
        if(counter < 11){ 
        counter++;
        int char_num = sizeof(uchar_ptr)/sizeof(uchar_ptr[0]);
        *(off) = 0;
        
jak_origmod_freedv_comptx_fdmdv_1600(f,&dac8k[FDMDV_OS_TAPS_8K],uchar_ptr,char_num,
 off);       
        for(i=0; i<n_samples; i++)
                dac8k[FDMDV_OS_TAPS_8K+i] *= 0.398; /* 8dB back off from peak */
        fdmdv_8_to_16_short(dac16k, &dac8k[FDMDV_OS_TAPS_8K], n_samples);
        dac1_write(dac16k, n_samples_16k);
        }





//-----------------------------------------------------
//
// FreeDV Function
//
//-----------------------------------------------------

#ifdef JAK_FUNCTIONS
void jak_data_fdmdv_mod_1600(struct freedv *f, short mod_out1[], unsigned char 
* mod_in, int char_num,int* off){
        int    bit, byte, i, j;
        int    bits_per_codec_frame, bits_per_modem_frame;
        int    data, codeword1, data_flag_index;
        COMP   tx_fdm[f->n_nat_modem_samples];
        // Jak Edit
        COMP     mod_out[f->n_nat_modem_samples];
        // Jak Edit
        bits_per_codec_frame = codec2_bits_per_frame(f->codec2);
        bits_per_modem_frame = fdmdv_bits_per_frame(f->fdmdv);


        /* unpack bits, MSB first */

        int num_chars_codec_frame = bits_per_codec_frame / 8;
        int offset = 0;
        bit = 7; byte = 0;
        offset = *(off);
        for (i = 0; i<bits_per_codec_frame; i++) {
                mod_out1[i] = (mod_in[byte + *(off)] >> bit) & 0x1;
                bit--;
                if (bit < 0) {
                        bit = 7;
                        byte++;
                }
        }
                        
        // Rollover and retransmit string
        if (*(off)< char_num)
                (*(off)) += num_chars_codec_frame;
        else
                *(off) = 0;


        fdmdv_mod(f->fdmdv, tx_fdm, f->tx_bits, &f->tx_sync_bit);
        assert(f->tx_sync_bit == 1);

        fdmdv_mod(f->fdmdv, &tx_fdm[FDMDV_NOM_SAMPLES_PER_FRAME], 
&f->tx_bits[bits_per_modem_frame], &f->tx_sync_bit);
        assert(f->tx_sync_bit == 0);

        assert(2 * FDMDV_NOM_SAMPLES_PER_FRAME == f->n_nom_modem_samples);

        for (i = 0; i<f->n_nom_modem_samples; i++)
                mod_out[i] = fcmult(FDMDV_SCALE, tx_fdm[i]);

        for (i = 0; i<f->n_nom_modem_samples; i++)
                mod_out1[i] = mod_out[i].real;
                
}
#endif JAK_FUNCTIONS














------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freetel-codec2 mailing list
Freetel-codec2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freetel-codec2

Reply via email to