drexjj / sbitx

An improved version of the sBITX application and operating system for the HF Signals sBitx hardware.
http://w9jes.com/
20 stars 7 forks source link

a possible fix for CW relay chatter for DE users #85

Closed MikeJohnshoy closed 1 month ago

MikeJohnshoy commented 1 month ago

In sbitx.c there is this code at line 1586. I think this code sets up the idea that when tr_switch is called it does one thing on the DE boxes and another thing on newer sbitx boxes.

void tr_switch(int tx_on){ if (sbitx_version == SBITX_DE) tr_switch_de(tx_on); else tr_switch_v2(tx_on);

Later in sbitx.c there is this code at line 1770. This code seems to want to force us down the tr_switch_v2 path.

else if (!strcmp(cmd, "tx")){
    if (!strcmp(value, "on"))
        tr_switch_v2(1);    // change to tr_switch(1)
    else
        tr_switch_v2(0);    // change to tr_switch(0)
    strcpy(response, "ok");

So what I do is change both calls to tr_switch_v2 to simply call tr_switch, and rely on the code at line 1586 to keep us straight.

WHY THIS MATTERS TO ME: On the DE there are a set of relays that switch band pass filters. This normally happens only when changing bands - not that much! But this code actuates the relays every time you push-to-talk (still not too bad) but in CW it happens with every dot and dash - a lot. If you don't have a DE you don't hear the relays. Unfortunately I think this possibly ties back to an early fix to keep the PA transistors from failing - maybe the band pass filters were supposed to absorb some errant energy during TR switching.

Gordon Gibby told me this fix over a year ago but I don't know why it never got picked up in Farhan's code.

One more issue: This change does fix the relay noise. A new issue is that down at the end of tr_switch_DE there is some code to restore the audio volume. On my DE, which now runs the tr_switch_DE code that it wasn't before, I get no audio after transmit UNTIL I WIGGLE THE VOLUME CONTROL. When I see this code again down around line 1576 (at the end of tr_switch_v2 code) it just looks a little different. Maybe the DE audio should be changed to mirror the V2 code?

drexjj commented 1 month ago

Thanks Mike. Which version of our software are you using?

MikeJohnshoy commented 1 month ago

Version 4.0, downloaded earlier today! But the DE relay behavior has been the same in all of the 64 bit versions, and Farhans versions also.

drexjj commented 1 month ago

I will test this with the V2/V3 hardware to see if it causes any issues.

else if (!strcmp(cmd, "tx")){
    if (!strcmp(value, "on"))
        tr_switch(1);    // change to tr_switch(1)
    else
        tr_switch(0);    // change to tr_switch(0)
    strcpy(response, "ok");
drexjj commented 1 month ago

I get no audio after transmit UNTIL I WIGGLE THE VOLUME CONTROL. When I see this code again down around line 1576 (at the end of tr_switch_v2 code) it just looks a little different. Maybe the DE audio should be changed to mirror the V2 code?

Are you referring to this in the V2 code that needs to be added in the DE code?

                    initialize_rx_vol();//added to set volume after tx -W2JON 

V2 Code

        else {
            in_tx = 0;
            //mute it all and hang on
            sound_mixer(audio_card, "Master", 0);
            sound_mixer(audio_card, "Capture", 0);
            delay(1);
                        fft_reset_m_bins();
            mute_count = MUTE_MAX;

                digitalWrite(LPF_A, LOW);
                digitalWrite(LPF_B, LOW);
                digitalWrite(LPF_C, LOW);
                digitalWrite(LPF_D, LOW);
            prev_lpf = -1; //force the lpf to be re-energized
            delay(10);
            //power down the PA chain to null any gain
            digitalWrite(TX_LINE, LOW);

                        //ADDED by KF7YDU, shuts down ext_ptt.
            digitalWrite(EXT_PTT, LOW);             
                        delay(5); 
            //audio codec is back on
                        check_r1_volume();//added to set volume after tx -W2JON 
                    initialize_rx_vol();//added to set volume after tx -W2JON 
                    sound_mixer(audio_card, "Master", rx_vol);
            sound_mixer(audio_card, "Capture", rx_gain);
            spectrum_reset();
            prev_lpf = -1;
            set_lpf_40mhz(freq_hdr);
            //rx_tx_ramp = 10;
    }

DE Code

        else {
            in_tx = 0;
            //mute it all and hang on
            sound_mixer(audio_card, "Master", 0);
            sound_mixer(audio_card, "Capture", 0);
            delay(1);
                fft_reset_m_bins();
            mute_count = MUTE_MAX;

            //power down the PA chain to null any gain
            digitalWrite(TX_POWER, LOW);
            delay(2);

            if (tr_relay){
            digitalWrite(LPF_A, LOW);
            digitalWrite(LPF_B, LOW);
            digitalWrite(LPF_C, LOW);
            digitalWrite(LPF_D, LOW);
            }
            delay(10);

            //drive the tx line low, switching the signal path 
            digitalWrite(TX_LINE, LOW);
            digitalWrite(EXT_PTT, LOW); //ADDED by KF7YDU, shuts down ext_ptt. 
            delay(5); 
            //audio codec is back on
                    check_r1_volume();
                    sound_mixer(audio_card, "Master", rx_vol);
            sound_mixer(audio_card, "Capture", rx_gain);
            spectrum_reset();
            //rx_tx_ramp = 10;
drexjj commented 1 month ago

Added to the DE-Relay-Fix branch for testing..

MikeJohnshoy commented 1 month ago

Yes! Adding the "initialize_rx_vol();" to the DE code restores audio after transmitting on my DE rig.

drexjj commented 1 month ago

Added to PR #92 for v4.02 release

drexjj commented 1 month ago

Tested and still see issues on 80m high power. The audio chain locks up. More testing while I have this repaired DE in my shop.

drexjj commented 1 month ago

Issue was the power supply I was using to power the DE. Wasn't supplying enough current. Released v4.02 to main.