UNO Q low processing speed v UNO R4 Wifi

Ok, I’m sure I’m missing something here, and hoping someone can set me straight.

I was trying to see how much better the performance of the new UNO Q was compared to my older UNO R4 as I need the extra bandwidth, but to my surprise, the Q seems to be about 1000 time slower!!

I ran a VERY simple program (See at the end of this) - it simply increments an unsigned long on each cycle of “loop”, and every 20 seconds it outputs the current value and resets it to zero. As I said, really simple.

As I am testing both the UNO R4 WiFi and UNO Q, I have two versions of the program - one that outputs to “Serial”, and the other that outputs to “Monitor” using the “Arduino_RouterBridge”. Literally, the only changes are the “include” statement and the name change from “Serial” to “Monitor”.

These are the results I get every 20 seconds

Uno R4 Wifi outputs a current value of 19,144,119 +/- a couple of 100.

UNO Q - outputs a current value of 18,183 without variation. That is 1000 times slower.

Here is the code …

UNO R4 WiFi

unsigned long ulCount = 0;
uint8_t iSeconds = 20;
unsigned long ulPreviousTime;

void setup() {
  Serial.begin(9600);
  Serial.println(F("UNO Processor Speed check"));
  ulPreviousTime = millis();
}

void loop() {
  if ((millis() - ulPreviousTime) > (1000 * iSeconds)) {
    Serial.print(F("Count is : "));
    Serial.print(ulCount);
    Serial.println();

    ulCount = 0;
    ulPreviousTime = millis();
  }
  ulCount ++;
}

/*
 
Produces this output

17:36:50.078 -> Count is : 19144119
17:37:10.070 -> Count is : 19144081
17:37:30.103 -> Count is : 19144143

*/

And for the UNO Q

#include <Arduino_RouterBridge.h>

unsigned long ulCount = 0;
uint8_t iSeconds = 20;
unsigned long ulPreviousTime;

void setup() {
  Monitor.begin();
  Monitor.println(F("UNO Processor Speed check"));
  ulPreviousTime = millis();
}

void loop() {
  if ((millis() - ulPreviousTime) > (1000 * iSeconds)) {
    Monitor.print(F("Count is : "));
    Monitor.print(ulCount);
    Monitor.println();
  
    ulCount = 0;
    ulPreviousTime = millis();
  }
  ulCount ++;
}

/*

Produces this output

Count is :
18183

Count is :
18183

Count is :
18183

*/

Did you check for overflow on your variable??

~q

Hi - good point - I didn’t, and it should have been an obvious check to make!!
I will re-tune to just every second and see what gives and report back.

Thanks

1 Like

Ok, so it was a quick enough change to check again for overflow. Ran it on a cycle of 1 second on both boards.

The results are

UNO R4 WiFi : 957,400 +/-

UNO Q : 910

These results scale with the previous values, and with the UNO Unsigned Long having a max value of 4,294,967,295 I’m confident the reported values I’m seeing are what they are without overflow

UNO Q still 1,000 times slower.

strange days..

try watching the var..

void loop() {
 static int overFlow = 0;
  if ((millis() - ulPreviousTime) > (1000 * iSeconds)) {
    Monitor.print(F("Count is : "));
    Monitor.print(ulCount);
    Monitor.print(" Over:");
    Monitor.print(overFlow);
    Monitor.println();
    ulCount = 0;
    overFlow = 0;
    ulPreviousTime = millis();
  }

unsigned long lastCount = ulCount;
  ulCount ++;
  if (lastCount > ulCount){
    overFlow++;
   }
}

~q

just checked the specs..

the mcu side is running at 160 MHz..

that’s 160 million cycles per second..

pretty fast.. :slight_smile:

~q

Probably has to do with the 'Bridge'. when the code is used with it the counter is indeed at 910 after a second. But when you do something like this (without using the bridge) the 5 million is reached instantly

unsigned long ulCount = 0;   // Counter variable
bool ledBlinking = false;    // Whether LED should be blinking
unsigned long lastBlink = 0; // For blink timing
bool ledState = false;       // Current LED state

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH); // LED off on most boards
  Serial.begin(115200);
}

void loop() {
  ulCount++;

  // When count reaches 5 million, start blinking
  if (ulCount >= 5000000UL) {
    ledBlinking = true;
  }

  // Blink the LED if we're in blinking mode
  if (ledBlinking) {
    if (millis() - lastBlink >= 500) { // toggle every 500ms
      ledState = !ledState;
      digitalWrite(LED_BUILTIN, ledState ? LOW : HIGH); // LOW=ON on most boards
      lastBlink = millis();
    }
  }
}

that’s insane, sorry..

the bridge doesn’t get called until the count has happened, so that say’s something serious is happening between loops..

don’t have a Q, curious how much time is lost between loops..

grab a millis at loop end then one at loop start, what’s the diff??

sounds like a bug.. :slight_smile:

~q

Hi @r1250r-rider,

Try using the Serial object in the Uno Q program as well; it outputs on pins 0 (RX) and 1 (TX).

The reason you're measuring slow speed with Monitor is that it steps through multiple layers and involves network communication as well.

Please share the results with these changes!