Strange TX calibration behavior

I’m seeing something odd when setting the transmit gain via Soapy. When I initialize in the following order:
//TX settings
if (SoapySDRDevice_setSampleRate(state->sdr, SOAPY_SDR_TX, 0, state->sample_rate) != 0)
{
printf(“TX setSampleRate 0 fail: %s\n”, SoapySDRDevice_lastError());
return EXIT_FAILURE;
}
if (SoapySDRDevice_setFrequency(state->sdr, SOAPY_SDR_TX, 0, state->tx_frequency, NULL) != 0)
{
printf(“setFrequency fail: %s\n”, SoapySDRDevice_lastError());
return EXIT_FAILURE;
}
if (SoapySDRDevice_setAntenna(state->sdr, SOAPY_SDR_TX, 0, state->tx_port) != 0)
{
printf(“setAntenna fail: %s\n”, SoapySDRDevice_lastError());
return EXIT_FAILURE;
}
if (SoapySDRDevice_setBandwidth(state->sdr, SOAPY_SDR_TX, 0, state->tx_bandwidth) != 0)
{
printf(“setBandwidth fail: %s\n”, SoapySDRDevice_lastError());
return EXIT_FAILURE;
}
if (SoapySDRDevice_setGain(state->sdr, SOAPY_SDR_TX, 0, state->tx_gain) != 0)
{
printf(“setGain fail: %s\n”, SoapySDRDevice_lastError());
return EXIT_FAILURE;
}

I get the following message:
[ERROR] Tx Calibration: MCU error 5 (Loopback signal weak: not connected/insufficient gain?)

If I move the setGain call to the beginning of this block of code the TX cal works just fine. Is there some order dependency on TX (and/or RX) setup?

It appears that SoapySDRDevice_setBandwidth automatically calls filter calibration procedure. So you have to set your gain before it, or just manually call calibration after you set the gain.

Thanks for the heads up. Are you aware of any other order dependencies I might need to be aware of?