Nick.swidinsky
New member
Hi all,
I am working on speed comparisons between the Teensy 3.2 and 4.0 chips. We currently have numerous 3.2 chips in use around the lab, but we are thinking about upgrading them to the 4.0 chips. I have ran a comparison of the analog read function on the two chips at various clock speeds, but I get interesting results which I am unsure about. I have attached an image that shows the different read speeds for both chips at the various clock speeds.
There are two things that confuse me, first is why the teensy 3.2 is showing a higher read speed for the 72MHz trial then any other clock speed, and second why the 4.0 reads consistently around 1 us for all clock speeds when I have seen others mention that it is around 2 us. I have also played around with the averaging but it does not change any of my numbers on the 4.0 while having a drastic change on the 3.2.
Here is my code in arduino:
I am quite new to coding in arduino so I am sure that there are plenty of improvements to be made to my code. Any help on this would be wonderful. Thanks!
I am working on speed comparisons between the Teensy 3.2 and 4.0 chips. We currently have numerous 3.2 chips in use around the lab, but we are thinking about upgrading them to the 4.0 chips. I have ran a comparison of the analog read function on the two chips at various clock speeds, but I get interesting results which I am unsure about. I have attached an image that shows the different read speeds for both chips at the various clock speeds.
There are two things that confuse me, first is why the teensy 3.2 is showing a higher read speed for the 72MHz trial then any other clock speed, and second why the 4.0 reads consistently around 1 us for all clock speeds when I have seen others mention that it is around 2 us. I have also played around with the averaging but it does not change any of my numbers on the 4.0 while having a drastic change on the 3.2.
Here is my code in arduino:
Code:
long t = 0;
long loopnumb = 0;
void setup()
{
Serial.begin(115200);
pinMode(A0, INPUT);
//analogReadAveraging(4); //tested different averaging
Serial.println(); //used for formatting in my text file
}
void loop()
{
noInterrupts(); //disable all interrupts to increase speed
loopnumb = loopnumb + 1;
for(int i=0; i<1000; i++) { //Run 1000 reads to make data easier to read
analogRead(A0);
}
t = micros(); // calculate elapsed time in microseconds
//Serial.print("Time per sample: ");
Serial.print(t);
Serial.print(", ");
//Serial.print("Loop Number: ");
Serial.println(loopnumb);
interrupts();
}
I am quite new to coding in arduino so I am sure that there are plenty of improvements to be made to my code. Any help on this would be wonderful. Thanks!
Last edited by a moderator: