RFExplorer / RFExplorer-for-Python

RF Explorer libraries and examples for Python 3
GNU Lesser General Public License v3.0
51 stars 25 forks source link

Set Generator dBm #25

Closed abe-martin closed 2 years ago

abe-martin commented 2 years ago

I'm trying to set the CW dBm of the signal generator, but can't seem to figure it out. The RFGenPowerLevel setting doesn't seem to affect the device. No matter what value I put in, the screen stays at -35 dBm. Is this a bug, or am I missing something? I think that objRFEGenerator.GetSignalGeneratorEstimatedAmplitude(objRFEGenerator.RFGenCWFrequencyMHZ) returns the correct value. I'm using the Slim combo if that's relevant. Is the power level set in dBm, or something else?

Here's my code:

# Transmit carrier wave
objRFEGenerator.RFGenCWFrequencyMHZ = CENTER_FREQ
objRFEGenerator.RFGenHighPowerSwitch = True
objRFEGenerator.RFGenPowerLevel = 10
print("Change CW settings --> Start:" + str(objRFEGenerator.RFGenCWFrequencyMHZ) + "MHz" + " - Power:" + str(objRFEGenerator.GetSignalGeneratorEstimatedAmplitude(objRFEGenerator.RFGenCWFrequencyMHZ)) + "dBm")
print('Starting transmission')
objRFEGenerator.SendCommand_GeneratorCW()
abe-martin commented 2 years ago

Never mind. After digging through the source code, it turns out that with the expansion board active, I needed to use objRFEGenerator.RFGenExpansionPowerDBM instead of objRFEGenerator.RFGenPowerLevel. Not intuitive, I would suggest merging those into a single command if possible.

arocholl commented 2 years ago

Hi @abe-martin thanks for your feedback, unfortunately the power setting is totally different for mainboard / expansion. Perhaps we can add better documentation or specific assert to avoid the confusion where in this situation.