Low Cost PCB's Low Cost Components

Author Topic: Fastest way to get sample memory out of Rigol scope???.......  (Read 2147 times)

0 Members and 1 Guest are viewing this topic.

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 1419
  • Country: us
Fastest way to get sample memory out of Rigol scope???.......
« on: November 26, 2015, 05:10:14 PM »
What's the fastest way to dump the full 24Mpoints sample memory to a PC?  I'm up for using any interface, driver, and OS.

Using the python library and Ethernet, it takes about 65 seconds to transfer 12M.  That's the best I have done so far.
https://github.com/pklaus/ds1054z

Can the labview drivers do better?  Is USB faster than ethernet?
 

Offline Gribo

  • Regular Contributor
  • *
  • Posts: 190
  • Country: ca
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #1 on: November 26, 2015, 11:38:00 PM »
LV won't help you in this case, neither will USB. The SCPI communication protocol (not very efficient) sits on top of TCP, which also has a certain overhead. If the Rigol scope supports some sort of binary protocol over UDP, you might be able to get better results.
 

Offline Karel

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: 00
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #2 on: November 26, 2015, 11:47:18 PM »
Last time I tried, DSRemote downloaded 24Mpts in 90 seconds (one channel).
The difference between theory and practice is less in theory than
the difference between theory and practice in practice.
Expensive tools cannot compensate for lack of experience.
 

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 1419
  • Country: us
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #3 on: November 27, 2015, 04:33:46 AM »
Cool.  I was not getting very good performance from dsremote but i was running it on a virtual machine so that might have had something to do with it.  Dsremote uses the python library too.  Dunno.
 

Offline Karel

  • Frequent Contributor
  • **
  • Posts: 961
  • Country: 00
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #4 on: November 27, 2015, 05:38:27 AM »
Dsremote uses the python library too.

No, it does not.
The difference between theory and practice is less in theory than
the difference between theory and practice in practice.
Expensive tools cannot compensate for lack of experience.
 

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 1419
  • Country: us
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #5 on: November 27, 2015, 06:49:36 AM »
The python lib github listed dsremote and i just figured that it was under the hood.  Ill have to see what the difference is between the two transfer functions. 
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 7542
  • Country: my
  • reassessing directives...
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #6 on: February 07, 2016, 02:26:48 AM »
maybe not that stellar and not your cup of tea, just for the sake of sharing, others may benefit. Windows environment, my testing construct program... 62.5 Seconds copying 24MB points... below is the code snip in VB, not your cup of tea again :P hmm, feel free to comment ... FWIW

Code: [Select]

'return data length given by visa/dso. dat must be preallocated with enough (lpLength) amount of memory
Public Function GetData(chId As Long, dat() As Byte, ByVal lpLength As Long) As Long
    Const TMC_SIZE = 11 'base-0 array index value
    Const MAX_BLOCK = 125000

    Dim datPtr As Long
    Dim datIdx As Long
    Dim blockSize As Long

    'multiple block read
    Dim sta As Long
    Dim enn As Long
    Dim lft As Long
    Dim req As Long
    Dim fCancel As Boolean

    If Not Connected Then Exit Function

    'check index and send command
    If chId < CH1_IDX And chId >= MATH_IDX Then Exit Function

    'make sure dat is allocated
    If lpLength <= TMC_SIZE Then Exit Function

    datPtr = VarPtr(dat(0))
    dat(0) = 0

    'get the return value. older DS1000E FW (TMC_SIZE = 0)
    If protocol = 1 Then
        SendCommand ":WAV:DATA? CHAN" + CStr(chId)
        viVScanf hWnd, "%t", datPtr
        GetData = strLength(dat, lpLength)
        Exit Function
    End If

    'newer DS1000Z FW. check if we are reading multiple block internal memory
    If TrigStat = "STOP" Then
        If Left(MemLength, 4) <> "NORM" Then

            'can read at once
            If lpLength <= MAX_BLOCK Then
                SendCommand ":WAV:STOP " + CStr(lpLength)

            'need multiple read
            Else
                SendCommand ":WAV:SOUR CHAN" + CStr(chId)
                lft = lpLength

                Do Until lft <= 0
                    sta = enn + 1

                    If lft >= MAX_BLOCK Then
                        req = MAX_BLOCK
                    Else
                        req = lft
                    End If

                    enn = sta + req - 1

                    SendCommand ":WAV:STOP " + CStr(enn)
                    SendCommand ":WAV:START " + CStr(sta)
                    SendCommand ":WAV:DATA?"

                    viVScanf hWnd, "%t", datPtr
                    blockSize = getTmcDataSize(dat(), datIdx)

                    'we have copied data
                    If blockSize > 0 Then
                        CopyMemory dat(datIdx), dat(datIdx + TMC_SIZE), blockSize
                        datIdx = datIdx + blockSize
                        datPtr = VarPtr(dat(datIdx))
   
                        'partial data copied, offset enn
                        If blockSize < req Then enn = enn - (req - blockSize)
                        lft = lft - blockSize

                        'callback for copy progress
                        RaiseEvent Downloading(blockSize, lpLength - lft, fCancel)
                        If fCancel Then Exit Do

                    'zero data copied, quit
                    Else
                        Exit Do
                    End If
                Loop

                'reset memory position
                If sta > 1 Then
                    SendCommand ":WAV:START 1"
                    SendCommand ":WAV:STOP " + CStr(RIG_SCREEN_RES_V2)
                End If

                GetData = lpLength - lft
                Exit Function
            End If
        End If
    End If

    'reading single block at once
    SendCommand ":WAV:SOUR CHAN" + CStr(chId)
    SendCommand ":WAV:DATA?"

    viVScanf hWnd, "%t", datPtr
    blockSize = getTmcDataSize(dat(), datIdx)

    If blockSize > 0 Then CopyMemory dat(0), dat(TMC_SIZE), blockSize
    GetData = blockSize
End Function

'send visa command to rigol, return -1 if not connected
Public Function SendCommand(cmd As String) As Long
    SendCommand = -1
    If Not Connected Then Exit Function
    SendCommand = viVPrintf(hWnd, cmd + Chr(10), 0)
End Function

« Last Edit: February 07, 2016, 02:29:29 AM by Mechatrommer »
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2401
  • Country: us
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #7 on: February 07, 2016, 05:24:09 AM »
maybe not that stellar and not your cup of tea, just for the sake of sharing, others may benefit. Windows environment, my testing construct program... 62.5 Seconds copying 24MB points... below is the code snip in VB, not your cup of tea again :P hmm, feel free to comment ... FWIW


Hi

Just looking at this from the outside:

If it's running 100Mb ethernet, you get (at most) 6Gb in 60 seconds. With 100% efficiency ( no overhead) that comes out to 750 MB. If you get 24M points (and they are 2 bytes each) you are grabbing 48 MB of data. Either there is a lot more overhead (like 15X), or the LAN speed is not anywhere near your limiting factor.

Bob
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 7542
  • Country: my
  • reassessing directives...
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #8 on: February 07, 2016, 06:49:51 AM »
sorry i didnt mention i thought its understandable. thats a USB2 connection using visa32.dll driver, no ethernet, i dont play ethernet. and its a plain 24 Mega Bytes, not 24 Mega Words... fwiw...
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf