This "how to" describes the procedure to best configure the hardware or Firewire driver Sampling Rate , Buffer Size in Sample and Operation Mode in the FLEX Firewire Control Panel.
Audio processing latency (or delay) is a system characteristic that is dependent on computer system resources. The higher the sampling rate along with small audio and hardware buffers will produce the least amount of latency. This comes at a cost of higher CPU utilization which requires faster and/or multi-core CPUs. In general, larger buffers and lower sampling rates add more latency and stability to the system, but allows PCs with limited resources to run PowerSDR without audio "glitching".
On lower performing computer hardware, latency can adversely affect particular modes of operation, so this must be factored in when setting these parameters. For high rate CW, minimum latency is paramount. For digital and phone modes, incurring a little bit of latency by using larger buffers may increase stability and improve signal quality, especially if using VAC or other third-party audio programs. Therefore there is an equilibrium or comprise that must be achieved when setting these parameters that can only be determined by trial and error since not all computer system behave and consume resources in the same way.
Firewire or Hardware Sampling Rate and Buffer Sizes
As noted above sampling rate and buffer sizes are two very important parameters for configuring your FLEX software defined radio. Although in this article, we are primarily discussing the sampling rate and buffer size of the Firewire or hardware interface, there is also sampling rate and buffer settings in PowerSDR itself found in the Setup->Audio tab. Since PowerSDR utilizes these same settings and for optimal operation, the parameters need to be consistent between PowerSDR and the Firewire Control panel.
This is a very important point. The sampling rate and buffer size that is configured for the Firewire or radio hardware must be identical to the sampling rate and audio buffer settings in PowerSDR. Since the Firewire interface is the low-level hardware component of the software defined radio system, it should always be configured first.
Firewire Operation Mode Setting
Any real-time process running on a computer is susceptible to delays that cause audio stuttering or freezing. In a Windows PC these delays are called DPCs or deferred procedure calls. They cause the PC to wait for some hardware operation to complete. The longer the wait, the more disruptive it is on the real-time audio processing application, like PowerSDR.
The Firewire driver has logic that helps it recover from long duration DPCs and this is controlled by the Firewire Operation Mode. There are four (4) operation mode levels to choose from; Normal and Safe Modes 1 – 3. Technically these Operation Modes control how the hardware driver recovers from buffer over and underruns.
A PC that normally has low DPCs duration times can operate with the operation mode being "normal". As you run other programs on your PC, the duration times increase. As these times increase, you can choose to set the operation mode to SafeMode1 to SafeMode3 to improve the stability of the audio stream. Using higher lever SafeModes forces the Firewire driver to use larger buffers in order to better handle the recovery of long duration DPCs, which hopefully do not cause the real-time audio application (PowerSDR) from stuttering or in a worse case freezing altogether. Even though there is an Operation Mode labeled “normal” this is the most aggressive mode and does not recover from long duration DPCs gracefully. Excessive DPCs that introduce unpredictable system latencies in excess of 150 ms can cause the FLEX Firewire driver to "freeze" or produce audio drop outs if a too aggressive Operating Mode is used.
NOTE: The recommended operating mode for the FLEX Firewire driver is Safe Mode 1 and should be used in just about all cases. Please change the Firewire driver Operating Mode to Safe Mode 1 when you initially setup your Firewire based FLEX software defined radio. If you choose to operate with the Normal mode and your FLEX software defined radio freezes up or produces audio drop outs, you should revert to Safe Mode 1 immediately. In some circumstances, your PC may have internal system latencies that are so long that Safe Mode 1 does not work with your system. In these cases, you should select either Safe Mode 2 or Safe Mode 3 to provide a stable environment in which to run a Firewire-based FLEX software defined radio.
Setting the Operation Mode, Sampling Rate and Buffer Size
So how does one go about choosing and setting these three variables? Below will be a table that will recommend some values to start with, but in general you do the following:
- Set the Firewire Operation Mode to Safe Mode 1
- Set the Firewire sampling rate to the desired frequency
- Set the Firewire buffer size
- Match the Firewire sampling rate and audio buffer size in PowerSDR
Setting the Operation Mode and Sampling Rate is fairly straightforward. The value you choose for the Buffer size is not.
The FLEX Firewire driver has some built-in logic where it will not allow you to set the Firewire buffer size to a value that is too low for the currently defined sampling rate and operation mode . These minimum buffer values have been determined by the Firewire driver vendor (not FlexRadio Systems) and can not be modified or circumvented. Therefore not all buffer sizes will be available to use for all sampling rates when a safe mode is selected for the operation mode.
For example when using Safe Mode 1 with a sampling rate of 192 KHz , the minimum buffer size allowed by the Firewire driver is 896 . Since PowerSDR only utilizes audio buffer sizes that are powers of 2 (256, 512, 1024, and 2048) and the recommended minimum buffer size of 896 does not match one of the PowerSDR options and is greater than 512, you must use the next larger size buffer (1024) since it is imperative that the PowerSDR audio buffers and the Firewire buffer sizes match.
If this is the first time you are using or setting up a new software defined radio, a very conservative sampling rate such as 48 KHz and a large buffer (2048) is recommended until you understand how your PC is going to perform.
The table below shows all possible settings for each sampling rate.
The row highlighted in gray should be the initial setting you use if setting up a new computer or native Firewire based software defined radio for the first time. It should work for most systems. If not, then that is indicative of a hardware problem or the PC is too under powered to use PowerSDR.
|Valid Firewire Driver Configuration Parameters
FLEX Firewire Driver Version: 18.104.22.16854 and higher
|Sampling Rate||Buffer Setting||Operating Mode||Comments|
|48 KHz||512||Normal/ Safe Mode 1||Suggested for this sampling rate|
|48 KHz||1024||Normal/Safe Mode 1|
|48 KHz||2048||Safe Mode 1||Recommended Initial Setting|
|96 KHz||256||Normal||Recommended for fast CPUs only|
|96 KHz||512||Normal/Safe Mode 1|
|96 KHz||1024||Normal/ Safe Mode 1||Suggested for this sampling rate|
|96 KHz||2048||Normal/Safe Mode 1|
|192 KHz||256||Normal||Recommended for fast CPUs only|
|192 KHz||512||Normal||Recommended for fast CPUs only|
|192 KHz||1024||Normal/Safe Mode 1|
|192 KHz||2048||Normal/ Safe Mode 1||Suggested for this sampling rate|
How to Configure the Firewire Operating Mode, Sampling rate and Buffer Size
The following is a step-by-step procedure for configuring the Firewire sampling rate, operation mode and buffer size.
Step 1 . Open the FLEX Control Panel by left-clicking on the START button in the lower left-hand corner of your screen. Move your cursor to All Programs to expand the program menu. Continue to move your cursor up to the FlexRadio Systems application menu and select the FlexRadio application by doing a single left click of your mouse on it. Alternately you can double left click on the FlexRadio icon on your desktop if you selected the option to create one during the Firewire driver installation.
Using the table above as a starting point, set the Sampling Rate, Operation Mode, and Buffers Size in Sample values that best match your PC’s capabilities and preferred mode of operation.
In the example below in the Global Settings->Bus tab, the Sampling Rate is being set to 96 KHz . Click on the up/down arrows to the right of the parameter to display the parameter options.
In the example below in the Global Settings->BUS tab, the Operation Mode is being set to Safe Mode 1 from Normal Mode.
WARNING: If you try to set the buffer size to a value that is less than the system defined minimum setting, the buffer size will revert to the actual minimum buffer size which will probably NOT be one of the recommended buffer setting values listed above (256, 512, 1024, and 2048). Verify that the buffer value you set is one of the appropriate values.
Step 2. Once you have set the parameters noted above, left-click on the far right square button in the top right-hand side of the application window to exit the FLEX Firewire Control Panel.
Step 3. Now open the PowerSDR Setup form and configure the sampling rate and buffer size in the Audio->Primary tab to the exact same values you selected above for the FLEX Firewire driver.