Topics

NEED A BIT OF HELP - TO FAULT FIND ARDUINO SKETCH ERROR FOR - USB FUNCTION


Joe
 

HI,
I am hoping someone can look at the info below and see where I might be causing the problem
The serial monitor seems to indicate things are ok?

When I select lsb is fine - good receiving
When I select USB,
the bitx vfo,   display stays the same, but the bitx rx will switch to 3 khz above the original lsb freq but does not actually cause the bitx to switch the USB 
I have been trying to figure this out for  weeks but not quite there...Sure could use some help....

Serial took 0ms to start
-------------NOTE-----------------------
THE SI5351 CLK0 IS CONNECTED TO BITX40 VFO 
NO CONNECTION ON CLK2 OR CLK1
 
-----------------------------------------------
SERIAL TEST OUTPUT BELOW- Appears ok?
-----------------------------------------------
ID = 0x9341
100 Hz
sw:0
7100000 - DIAL
We've switched from USB to LSB   --- DEFAULT STARTUP  LSB
VCO : 489850000
bfo :  1199850000
vfo :    7100000
mult : 100
clk2 : 2
 
USB   This is where i press the usb button
7099900  DIAL
We've switched from LSB to USB -------
VCO : 1910140000
bfo :    1200150000
vfo :      7099900
mult : 100
clk2 : 2
7100000
-------MY-- ARDUINO CODE----------------------------------------------
 
 if (bfo >= 1200150000ULL )      // TEST FOR USB
    {
      volatile uint32_t USB = 1200150000ULL;
      uint32_t vco = bfo + (vfo * SI5351_FREQ_MULT);// USB
      bfo = USB;
      tbfo = "USB";
     
      si5351.set_freq(( bfo + vfo) * 100ULL,  SI5351_CLK2);//
      Serial.println("We've switched from LSB to USB");
      Serial.print("VCO : "); Serial.println(vco);
    }
  //  else if (bfo < 1200150000ULL )  // MUST BE LSB THEN
 else 
    {
      
      volatile uint32_t LSB = 1199850000ULL;
      uint32_t vco = bfo - (vfo * SI5351_FREQ_MULT);// //LSB
      bfo = LSB;
      tbfo = "LSB";
      
      si5351.set_freq(( bfo - vfo) * 100ULL, SI5351_CLK2);//
      Serial.println("We've switched from USB to LSB");
      Serial.print("VCO : "); Serial.println(vco);
    }
 
ISSUE: -------------------------------------------------
When I switch to USB, THE BITX40 CHANGES where it receives up by 3khz LSB and is not actual upper sideband.
 
 
 
      //si5351.set_freq(( bfo - vfo) * 100ULL, SI5351_CLK2);//
      Serial.println("We've switched from USB to LSB");
      Serial.print("VCO : "); Serial.println(vco);
    }
  // TEST WITH SERIAL OUTPUTS --------------------------------------------T E S T 
    
        Serial.print("bfo : "); Serial.println(bfo);
        Serial.print("vfo : "); Serial.println(vfo);
        Serial.print("mult : "); Serial.println(int(SI5351_FREQ_MULT));
        Serial.print("clk2 : "); Serial.println(SI5351_CLK2);
        


Thanks for looking

Joe
VE1BWV