g0orx / linhpsdr

Linux HPSDR
GNU General Public License v3.0
74 stars 44 forks source link

On HPSDR, drive level do not seem to have any effect #117

Open vu3rdd opened 2 years ago

vu3rdd commented 2 years ago

Regardless of the drive level (even if it is zero), full PA power is going out. I printed the level value in protocol1.c being written into the registers with c0 = 0x12. It indeed changes according to the drive slider. However, the fwd power read from Alex couplers show full power from the PA going out. I am very puzzled why this is so. Same hardware works fine with powerSDR on windows and the power changes fine with the drive level.

vu3rdd commented 2 years ago

I just read the protocol documents again and found that the level sent to the radio has effect only for PennyLane and Hermes and not for Penelope. This may be because those two hardware has a programmable gain amplifier where as Penelope doesn't have one. That explains the behaviour that I see.

In KISSKonsole and in PowerSDR, the way transmit level control is implemented is by scaling the I/Q samples on software. As far as I can see, this doesn't seem to be implemented in linhpsdr.

g0orx commented 2 years ago

Sorry for delay but I have been away from home for a couple of weeks. I have pushed a change to allow selection of Penelope in the main Radio dialog and to scale the IQ signals for Protocol 1. I have no way to test this as I do not have a ATLAS based system so would be interested in hearing if the problem is resolved. -- John

vu3rdd commented 2 years ago

John, please don't be sorry. This is not as critical as your family and your well being.

I did have a brief look. I had to do two small changes for it to compile (without SOAPYSDR support) and for the Penelope radio button to appear on the dialog box.

diff --git a/radio_dialog.c b/radio_dialog.c
index 5648bf8..33b8b85 100644
--- a/radio_dialog.c
+++ b/radio_dialog.c
@@ -685,12 +685,15 @@ GtkWidget *create_radio_dialog(RADIO *radio) {
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(paswap),radio->enable_pa);
     g_signal_connect(paswap,"toggled",G_CALLBACK(enablepa_changed_cb),radio);
   }
+#ifdef SOAPYSDR
   else if(radio->discovered->device!=DEVICE_SOAPYSDR) {
     GtkWidget *iqswap=gtk_check_button_new_with_label("Swap I & Q");
     gtk_grid_attach(GTK_GRID(model_grid),iqswap,x,0,1,1);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(iqswap),radio->iqswap);
     g_signal_connect(iqswap,"toggled",G_CALLBACK(iqswap_changed_cb),radio);
-  } else if(radio->discovered->device!=DEVICE_METIS) {
+  }
+#endif
+  else if(radio->discovered->device==DEVICE_METIS) {
     GtkWidget *penelope=gtk_check_button_new_with_label("Penelope");
     gtk_grid_attach(GTK_GRID(model_grid),penelope,x,0,1,1);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(penelope),radio->penelope);

Even then somehow I wasn't heard today for one of the evening 40m net checkin. I will try again tomorrow morning and report back.

vu3rdd commented 2 years ago

OK, I think I figured out the problem. This portion of the code is not required, I believe:

https://github.com/g0orx/linhpsdr/blob/master/transmitter.c#L718-L723

That is because the ROUNDHTZ already multiplies with gain and rounds the value. And in the above code block, we again multiply with gain and round it.

vu3rdd commented 2 years ago

I sent a Pull request that seem to work okay for me.