SonixDAQ Software (SDK)

From WikiSonix
Jump to: navigation, search

Introduction[edit]

As mentioned before the DAQ is only a receive module and has no control over the transmit. The DAQ SDK uses Texo SDK in order to provide full control over the transmit. This way the transmit sequence can be customized using the Texo and the corresponding pre-beamformed channel data can be received using the DAQ.

Console Program[edit]

Initialization[edit]

The DAQ SDK is very similar to the Texo SDK. First, both DAQ and Texo need to be initialized. For proper initialization of the Texo refer to Texo SDK documentation.


The following code initializes the DAQ. The code first checks to see if the DAQ is connected or not. If connected, the software checks to see if the DAQ has already been programmed or not. If programmed, the software will skip the initialization. Otherwise it will start the programming.

For proper initialization of the DAQ make sure DAQ_FIRMWARE_PATH is referring to the correct path for the DAQ firmware

#define DAQ_FIRMWARE_PATH "D:\\mydaq\\fw\\"

Note: Inside the fw folder there are different folders for different versions of the DAQ. The software will automatically use the correct folder. Thus, sub folders should not be included in the firmware path.


The variable sampling_80MHz tells the DAQ either to load the 80MHz sampling bitstream or original 40MHz sampling bitstream. To see this better, if you check inside the firmware folder, you can see that there are two RX bitsreams. One is called daqrx.bit and the other is called daqrx80.bit.

  • If sampling_80MHz = true, the DAQ will load the 80MHz sampling bitstream.
  • If sampling_80MHz = false, the DAQ will load the 40MHz sampling bitstream.


    daq = sonixdaq::getInstance();
    if (!daq->isConnected())
    {
        printf("DAQ not connected or off\n");
        scanf("%c", &sel);
        return -1;
    }
    else
    {
        printf("is connected ... ");
    }

    if (!daq->isInitialized())
    {
        daq->setFirmwarePath(DAQ_FIRMWARE_PATH);
        printf("Programming ... ");
        if (!daq->init(sampling_80MHz))
        {
            printf(daq->getLastError().c_str());
            scanf("%c", &sel);
            return -1;
        }
        printf("Done\n\n");
    }


The following two steps will finalize the initialization:


    tex.setSyncSignals(0, 1, 3);


This line sets up the synchronization pulses for BNC cables. The inputs for setSyncSignals are as follows


tex.setSyncSignals(input trigger, 1st output trigger, 2nd output trigger)


The above setting sets the Sonix to send line Trigger (i.e. 1) to the first BNC output and 40MHz clock (i.e. 3) to the second BNC output. For further information refer to Texo SDK.

Note: Clock output is only available on the SonixTouch and Upgraded SonixRP systems.

Note: Setting the output trigger to 2 will activate the frame trigger instead of line trigger. For further information check the Texo SDK.


The last step in the initialization is to open up the DAQ connector. Assuming that the DAQ is connected to the lower probe connector i.e. 3, the following code will open the 3rd connector so that it can listen to the same echoes that are coming back from the transducer simultaneously


    tex.forceConnector(3);

Loading a Sequence[edit]

After initialization, a probe needs to be selected and a transmit sequence needs to be loaded into the hardware. These steps are very similar to programming Texo SDK. Some custom transmit sequences are provided as examples. These include: fixed plane wave transmit and transmits with sliding aperture.

Running The Sequence for Data Collection[edit]

Once you trigger run function, both Texo and DAQ will start the data collection simultaneously. For each transmit, Texo will collect one beamformed scan line and DAQ will collect pre-beamformed channel data corresponding to the same transmit.

Saving Data[edit]

Following data collection you can save the data. Once you enter the folder name, the DAQ data will be recorded in the following address:

D:\\DAQDATA\\myfolder

The corresponding texo data will also be recorded in the same folder with the name data.txo.

DAQ Parameters[edit]

The followings are the DAQ parameters that can be programmed in the DAQ SDK. The parameter corresponds the same settings that are provided in the DAQ control software

rlprms.lineDuration = 110; // line duration in micro seconds
rlprms.numSamples = 4000 / (1 + rlprms.decimation); // assuming 3000 samples at 40MHz

seqprms.freeRun = false;
seqprms.hpfBypass = false;
seqprms.divisor = 10; // data size = 16GB / 2^divisor
seqprms.externalTrigger = true;
seqprms.externalClock = false; // set to true if external clock is provided
seqprms.lnaGain = 1; // 16dB, 18dB, 21dB
seqprms.pgaGain = 1; // 21dB, 24dB, 27dB, 30dB
seqprms.biasCurrent = 1; // 0,1,2,...,7
...

Acquisition Parameters[edit]

  • lineDuration: acquisition time, this value is in micro seconds
  • numSamples: number of samples to be acquired from each channel
  • freeRun: sets the DAQ to acquire continuously or stop after defined acquisition data size.
  • hpfBypass: by pass the digital high pass filter or not.
  • divisor: the size of data to be acquired i.e. dataSize = 16GB / 2^divisor
  • externalTrigger: defines whether the DAQ should listen to the external sync signal or not. To have synchronized data, this parameter has to be true. Otherwise, the acquisition of the DAQ will not be in sync with transmit.
  • externalClock: defines whether the DAQ should use the external clock or use its own internal clock. Set this to false if external clock is not provided.

Gain Parameters[edit]

  • lnaGain: LNA gain [0:1:2] corresponds to [16dB, 18dB, 21dB].
  • pgaGain: PGA gain [0:1:3] corresponds to [21dB, 24dB, 27dB, 30dB].
  • biasCurrent: switch gain [0:1:7] where 0 completely turns off the switch.


TGC Parameters[edit]

  • fixedTGC: defines whether the DAQ should use flat TGC or adjustable TGC.
  • fixedTGCLevel: [0:1:100] fixed TGC value. This value is only used if fixedTGC parameter is set to be true.
  • TGCcurve: If fixedTGC is set to be false, a TGC curve needs to be defined. Currently, this curve is defines by 3 points with X, Y values ranging from 0 to 1 where 1 corresponds to maximum value of TGC for Y and maximum acquisition depth for X.
    if (seqprms.fixedTGC)
    {
        seqprms.fixedTGCLevel = 100;
    }
    else
    {
        // set TGC curve
        tgc.setX(0, 0.0f);
        tgc.setX(1, 0.5f);
        tgc.setX(2, 0.8f);

        tgc.setY(0, 1.0f);
        tgc.setY(1, 1.0f);
        tgc.setY(2, 1.0f);
    }

Sampling Frequency Parameters[edit]

The following two parameters control the sampling frequency of the DAQ data: sampling, decimation. Setting the boolean variable parameters sampling_80MHz will take care of sampling frequency in the code as follows:

    // sampling and decimation
    if (sampling_80MHz)
    {
        rlprms.sampling = 80;   // DAQ sampling frequency 80 -> 80 [MHz]
        rlprms.decimation = 0;  // no decimation for 80MHz sampling
    }
    else
    {
        rlprms.sampling = 40;   // DAQ sampling frequency 40 -> 40 [MHz]
        rlprms.decimation = 0;  // Fs = sampling / (1+decimation) e.g. decimation = 1 -> Fs=20 MHz
    }