Connecting two SDRs together for one to act as a signal generator

If I have two SDRs like the BladeRF and I want to use one as a signal generator and connect them together do I have to attenuate the connections?

It depends on the specifications of the particular hardware, but in most cases yes, you must use an attenuator. Specifically, you want to compare the maximum transmit power (how much power the transmitter can produce) to the maximum receive power (the incoming power above which the receiver will be damaged).

Unfortunately, at a glance the bladeRF web site doesn't give these specifications, so for the purposes of this answer I'll use the published figures for the HackRF One instead, but you’ll have to obtain the specs for your own hardware. The maximum transmit power in that case is given as 15 dBm (decibels relative to one milliwatt; i.e. 31 milliwatts). The maximum receive power is given as -5 dBm. Since we have them in the form of decibels, we can subtract the latter from the former to conclude there is a 20 dB gap.

This means that for this example you should use an attenuator of at least 20 dB to avoid hardware damage. You may need even more attenuation than that to avoid distortion of the received signal, as the point of hardware damage is likely above the point of clipping.

You could use less attenuation by configuring your devices properly. For example, you can decrease transmit amplifier gain or send lower-amplitude samples, and you can also decrease or shut off receive amplification. But this is running the risk of hardware damage due to software misconfiguration — do you really want to take that chance? (However, using transmit power controls to avoid clipping on the receive side or to simulate a weaker signal is reasonable.)

For my own testing purposes, I am using a 0-80 dB manually-variable attenuator I picked up at a flea market. I find it quite useful and recommend you obtain a similar device if you can (new ones can be fairly expensive, however).

• For higher-power transmitters, transmit power may be given in watts. Convert to dBm, $10\cdot\log_{10}\left(\tfrac{P}{0.001 W}\right)$, and remember that transmit power may be poorly calibrated and exceed the specified value.