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.
Question
Ola
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
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 accountSign in
Already have an account? Sign in here.
Sign In Now