I was trying to see how long and what I could do in a task without having context switched out from under me. So I created the following program that is running on Core 1 by itself. Core 0 is running a web and socket server.
Code: Select all
void RunStateMgrTask(void * parameter){
uint32_t runCount1 = 0, runCount2 = 0;
double runCount3 = 0; //
while(1){
Serial.println("Running StateMgr Task");
runCount1 = runCount2 = 0;
for(runCount1 = 0; runCount1 < 0xffffff; runCount1++){
digitalWrite(GPIO_NUM_33,HIGH);
for(runCount2 = 0; runCount2 < 0x7ffffff; runCount2++){
runCount3 ++;
}
for(runCount2 = 0; runCount2 < 0x7ffffff; runCount2++){
runCount3 --;
}
}
digitalWrite(GPIO_NUM_33,LOW);
runCount3 = 0;
vTaskDelay(2000);
}
}
Also, if I move the line "digitalWrite(GPIO_NUM_33,HIGH);" outside of the for loop the LED does not come on. Why?
Code: Select all
void RunStateMgrTask(void * parameter){
uint32_t runCount1 = 0, runCount2 = 0;
double runCount3 = 0; //
while(1){
Serial.println("Running StateMgr Task");
runCount1 = runCount2 = 0;
digitalWrite(GPIO_NUM_33,HIGH);
for(runCount1 = 0; runCount1 < 0xffffff; runCount1++){
//digitalWrite(GPIO_NUM_33,HIGH);
for(runCount2 = 0; runCount2 < 0x7ffffff; runCount2++){
runCount3 ++;
}
for(runCount2 = 0; runCount2 < 0x7ffffff; runCount2++){
runCount3 --;
}
}
digitalWrite(GPIO_NUM_33,LOW);
runCount3 = 0;
vTaskDelay(2000);
}
}
IF anyone ask why I need to know this, I am moving toward a bare metal high speed (>= 100K transaction/sec) SPI.