Go Down

Topic: Nano 33 BLE vs Nano Every speed (Read 830 times) previous topic - next topic


Oct 23, 2019, 09:39 pm Last Edit: Oct 24, 2019, 08:38 pm by ETM
Nano 33 BLE vs Nano Every

I wrote an app that logs to a microSD card using a Nano Every.  Decided to switch project to a Nano 33 BLE in order to move from an external IMU to the internal IMU. After swapping and compiling I noticed that the routine processes much slower in the BLE.

Here is a minimized  piece of code demonstrating how the open-write-close of the microSD is much slower in the Nano 33 BLE at 89ms verses the same code in the Nano Every at 16ms.

Is there extra overhead in the BLE related to my unused Bluetooth hardware? Is the BLE energy saving? Or the ATMega4809 at 20 Mhz simply faster than the NINA-B306 at 64 Mhz?

Help is appreciated.


Code: [Select]

#include <SPI.h>
#include <SD.h>

const int chipSelect = 10;
unsigned long oldMillis = 0;
unsigned long newMillis = 0;

void setup() {

  while (!Serial) { ; }

  Serial.print("Initializing SD card...");

  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    while (1);
  Serial.println("card initialized.");

void loop() {

  File dataFile = SD.open("SDTest.txt", FILE_WRITE);

  if (dataFile) {
    dataFile.println("Write 22 bytes of data");
    newMillis = millis();
    Serial.println(newMillis - oldMillis);
    oldMillis = newMillis;
  else {
    Serial.println("error opening datalog.txt");


Jan 11, 2020, 03:39 pm Last Edit: Jan 11, 2020, 03:45 pm by davidhbrown Reason: messed up table
I'm having similar concerns. I wrote an even more trivial script to try to get a sense of the raw speed of a few different devices:
Code: [Select]
void setup() {
  // put your setup code here, to run once:
  pinMode(9, OUTPUT);

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(9, HIGH);
  digitalWrite(9, LOW);

And then measured the speed using a multimeter and an oscilloscope which agreed within 100Hz in each case:
DeviceMCUClockMeasured speed
Sparkfun Pro MicroATMEGA32U416MHz97.6kHz
Arduino NANO (Elegoo clone)ATMEGA328P16MHz126.1kHz
Arduino NANO EveryATMEGA480920MHz277.7kHz
Arduino NANO 33 BLENINA-b3 (nRF52840)64Mhz32.6kHz (!)

So, what with the poor library compatibility and abysmal compile times, I think I'm going to still with a separate BT module at least for now.


Jan 11, 2020, 09:22 pm Last Edit: Jan 11, 2020, 09:23 pm by Klaus_K
The issue is that the Nano 33 BLE is running mbed OS and you are using the Arduino way of accessing pins. The Arduino way is not fully compatible with the mbed OS style. But it allows older sketches to run on the new Nano 33 BLE and make use of new functionality like BLE.

Arduino NANO 33 BLE NINA-b3 (nRF52840) 64Mhz 32.6kHz (!)
To specify your results a bit more. This creates a puls 3us wide and repeated every 29us. So the loop function is repeated every 29us and the digitalWrite takes about 3us.

When you use the following code in mbed style. The puls is 30ns wide and is repeated every 526ns. So the puls is 100x faster and the loop runs 60x more often.

Code: [Select]
#include "mbed.h"

mbed::DigitalInOut ledPin( digitalPinToPinName( 9 ) );

void setup()

void loop()
  // put your main code here, to run repeatedly:
  ledPin = HIGH;
  ledPin = LOW;

These mbed OS functions are called by the Arduino code, but you can also use them directly.


Klaus, thank you for insights, expertise, code sample, and confirming my suspicion about Mbed's involvement. Indeed, running your code, my multimeter was completely unable to detect the pulse and the oscilloscope reports ~1.83Mhz with a 15ns pulse width (8.8ns rise/fall time). Maybe I'm reading it wrong, since that's about half what you said it would be (occasionally there's a wider pulse with a flat top, but usually it is just up and down). Regardless of those details, plenty fast, indeed.

The product page, https://store.arduino.cc/usa/nano-33-ble, includes the statement, "If you used Arduino Nano in your projects in the past, the Nano 33 BLE is a pin-equivalent substitute. Your code will still work, but remember, it operates at 3.3V." While this is presumably true, it is misleading if code needs to be substantially rewritten to operate at (at least) the speed of previous devices. Even on the getting started page, https://www.arduino.cc/en/Guide/NANO33BLE, there's no discussion of mbed.h

I think that if I want to learn a new framework, I might just go for it more directly.


David, the Nano 33 BLE might be a bit slower switching a pin when you use the Arduino framework. On the other side you get a 32bit ARM processor running at three times the clock speed. This will give you a significant performance advantage over the AVR for computations.
So, depending the code I would say it's still fair to say that it will run as fast as your program on previous devices, even if it is true that there are corner cases where this is not entirely true.

Go Up