Jump to content
  • 0

Protocol SPI Limited "CmdWrite" in sensor


Ola

Question

Hi, I have some problems with writing many times in a for loop inside "function loop()". My code is as follows:

// Test Sensor SPI cmd

function initialize(){

Select.Active.value = 1;

Clock.Polarity.value = 0;

Clock.Phase.value = 0;

// CmdWrite(8, 0x00, 0, 16, 0x0101) // CTRL_REG1

// var ID = CmdRead0(8, 0x01, 0, 16, 1);

return true;

}

function loop(){

var n = 32;

for(var i = 0; i < n; i++){

CmdWrite(8, 0x00, 0, 16, i & 0xFFFF); // DATA

}

return true;

}

function finish(){

return "done";

}

In this case the SPI frequency is 6.25MHz and sensor "Rate" =500kHz. This case is working OK with n=32. If I decrease the SPI frequency to 2MHz the number of "CmdWrite" is also decreased?

I have this message in the message tab:

Loop transfer longer than specified rate. Increase frequency.

If I increase n=64 I have this message:

Too many bits in loop function transfer (3328>2048). Select device configuration with more Pattern custom samples.

Is it possible to increase the "n" to 1024?

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Hi @Ola

In each loop iteration you want to transfer 32 times 24 bits with a clock rate of 6.25MHz. This can be done with a loop rate of at most 7.8kHz = 6.25MHz / 32 / (24+1?) ? because it depends on the specified delays.

The 5th AD3 configuration allocates 32ki logic and pattern buffer. For each bit it needs 2 or 4 samples, 32768/2/25, so N can be up to about 650.

When transferring more bits than the Logic Analyzer device buffer, the data need to be streamed over USB, with AD3 the max rate is about 10Msps.

image.png

Link to comment
Share on other sites

  • 0

I increased the buffer memory to 32k and maximized the SPI frequency to 62.5MHz. In this case I could transfer 512 command's with 24 bit's without problem's.

I could not understand the "Rate" variable. I guess it is related to "Iterations". I also tried this iteration's function but it failed at 5? Could you explain how many iteration's is possible depending on memory size.

Link to comment
Share on other sites

  • 0

I just saw that the memory is 16*32k. Is it possible to decrease the number of data lines and increase the memory to the rest 3-data lines?

Is this possible in software?

Link to comment
Share on other sites

  • 0

For long transfers maximum is about 10MHz:

55 minutes ago, attila said:

When transferring more bits than the Logic Analyzer device buffer, the data need to be streamed over USB, with AD3 the max rate is about 10Msps.

Rate is for the loop function:

image.png

It is not possible, each of the 16 DIO channels has its own 32ki buffer.

Link to comment
Share on other sites

  • 0

The "iterations" sesames to just repeat loop() function with a number and the iteration rate is defined in "Rate". Is there a variable that could be used to change data inside the loop() function? It sesames to be a limit on how many iteration's you could do until it fail's. In my case it is 10 with N=512 and frequency=15.625MHz and Rate=1kHz.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...