ps5000aSetSigGenArbitrary output frequency calculation

Post general discussions on using our drivers to write your own software here
Post Reply
hmaarrfk
Newbie
Posts: 0
Joined: Sun Jun 24, 2012 11:41 pm

ps5000aSetSigGenArbitrary output frequency calculation

Post by hmaarrfk »

Hello,

I'm working with a PS5244A and I was having trouble getting the correct frequency output (repetition rate) from the arbitrary waveform generator.

I am using the PS5000Asdk_r10_5_0_28 version of the sdk.

The formula given in the programming guide

Code: Select all

outputFrequency = dacFrequency * deltaPhase
                  ------------   ----------------
                  arbWaveSize   2^(phaseAccumSize - bufferAddressWidth)
Seems to be very off.

The problem seems to stem from the fact that the PS5244A has a buffer size of 49512 which is not a power of 2, you can obtain this from the PS5X44A_MAX_SIG_GEN_BUFFER_SIZE defined constant. To get a more accurate estimate of the ouptut frequency, you must replace 2^(bufferAddressWdith) with 49512.

If the formula were correct, you would expect the PS5244A to simply take the the value of the top 16 bits as the address and make that value restart at 49512. The picoscope seems to do some arithmetic to convert the top 16 bits to a 49512.

This becomes problematic when trying to control the waveform on a 5ns timescale (the output frequency of the DAC).

This can be easily verified by giving an arbitrary waveform and a deltaPhase value of 0x8000. According to the datasheet, this should output a sample every 10 nano seconds, but the samples are output every ~13 nano seconds.

Could you:
1. Update the driver so that it simply takes the value of the top 16 bits as the index in the given waveform as described in the programming guide <- I think this would be the preferred option since it keeps the arithmetic simple.
2. Release the code/formula that converts the phaseAccumulator value to an index in the arbitrary waveform?

Thank you,

Mark

Karunen
Advanced User
Advanced User
Posts: 194
Joined: Thu Nov 21, 2013 9:22 am

Re: ps5000aSetSigGenArbitrary output frequency calculation

Post by Karunen »

Hi Mark,

I notice you reference PS5244A, only the models ending in B have the AWG function,
also the value you would want to be using for 2^(bufferAdressWidth) is 49152 which is 48kS, there is an error in the documentation which has been reported.

Could you please check which dll version your application is using?

Thank you,
Karunen

Technical Specialist
Pico Technology

hmaarrfk
Newbie
Posts: 0
Joined: Sun Jun 24, 2012 11:41 pm

Re: ps5000aSetSigGenArbitrary output frequency calculation

Post by hmaarrfk »

Hi Karunen,

Sorry, the A vs B was a typo on my behalf.

I,m not at work today, but the version of the dll is the one that came with PS5000Asdk_r10_5_0_28.zip

The issue is that bufferAddressWidth is not an integer. You cannot have log2(49152) = 15.6 bits. Typically, a bit width is an integer...

This doesnt affect things for small values of deltaPhase but for larger values, it would be good to know how one obtains the top "15.6" for the buffer index.

Mark

Karunen
Advanced User
Advanced User
Posts: 194
Joined: Thu Nov 21, 2013 9:22 am

Re: ps5000aSetSigGenArbitrary output frequency calculation

Post by Karunen »

Hi Mark,

Below is a snippet from the PS5000a series SDK, used to find the delta phase from the frequency value,

Code: Select all

delta = ((1.0 * frequency * waveformSize) / unit->AWGFileSize) * (AWG_PHASE_ACCUMULATOR * 1/AWG_DAC_FREQUENCY);
These are the values are for the 5XX4B series:

frequency = frequency of waveform in hz
waveformSize = size of value form (maximum 49152 samples)
unit - > AWGFileSize = 49152
AWG_PHASE_ACCUMULATOR = 2^32
AWG_DAC_FREQUENCY = 200e6

Please note that 49152 is not the bufferAdressWidth, it is the size of the buffer that stores the values for the AWG.

Thank you,
Karunen

Technical Specialist
Pico Technology

Karunen
Advanced User
Advanced User
Posts: 194
Joined: Thu Nov 21, 2013 9:22 am

Re: ps5000aSetSigGenArbitrary output frequency calculation

Post by Karunen »

Hi Mark,

Your application might also be using a older dll, please download the dll from below and drop it into the SDK folder
PS5000a.zip
PS5000a.dll version 1.0.0.158
(1.1 MiB) Downloaded 617 times
Thank you,
Karunen

Technical Specialist
Pico Technology

Post Reply