Test and Measurement Forum

Calculating amount of blocks in Rapid Block Mode

Post your C and C++ discussions here

Calculating amount of blocks in Rapid Block Mode

Postby Jansen » Tue Jun 17, 2014 3:42 pm

Hi, I want to capture as many as possible power traces in the rapid block mode (I'm observing the power consumption of cryptographic devices for each encryption round).

I've have a predefined number of sample points to capture and a predefined timebase.
I now want to capture as many blocks as possible. For that I have to calculate how many blocks fit into the scope's memory.

To do this, I call setMemorySegments(1,&nMaxSamples) and after that divide nMaxSamples by the number of active channels (in my case probably always 2).
Now I know how many sample points I could capture per channel.
I divide this number again by the predefined amount of sample points to capture.
In my opinion this should give me the amount of segments that I could fill in the rapid block mode.

Sadly this way seems to be not correct.
In the next step I would use setMemorySegments and setNoOfCaptures to my calculated maximum.
This works, but runBlock will fail with "Invalid Timebase".
If I set setMemorySegments and setNoOfCaptures to about the half of my calculated maximum it works.

My question: What have I done wrong? How can I calculate a working and efficient segmentation of the memory?

Hardware: Picoscope 6402B
Posts: 0
Joined: Tue Jun 17, 2014 2:56 pm

Re: Calculating amount of blocks in Rapid Block Mode

Postby Hitesh » Thu Jun 19, 2014 9:39 am

Hi Jansen,

The principle that you are using seems to be ok.

The nMaxSamples value returned from the call to ps6000MemorySegments is the TOTAL number of samples across all the enabled channels so you could use something like:

Code: Select all
nSegments = nMaxSamples / (2 * nSamples);

which I believe is effectively what you are doing.

Please note that when you then call the ps6000MemorySegments function again, nMaxSamples will be updated.

Here you will need to check if the value of nMaxSamples is at least equal to numChannels * nSamples. If not, you will need to calculate the number of samples per channel again.

When you call ps6000RunBlock, the total of noOfPreTriggerSamples and noOfPostTriggerSamples should be equal to the number of samples to be collected per segment for a single channel.

I hope this helps.

Technical Support Engineer
Site Admin
Site Admin
Posts: 2790
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Calculating amount of blocks in Rapid Block Mode

Postby Jansen » Thu Jun 26, 2014 1:49 pm

Hi Hitesh,
thanks for your answer and the idea of verifying my calculated value by calling ps6000MemorySegments again.

I think I will use my calculation as a rough estimation for ps6000MemorySegments and then use ps6000MemorySegments over and over again for fine tuning.
Posts: 0
Joined: Tue Jun 17, 2014 2:56 pm

Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests