NANO 33 SENSE: COM mismatch with Serial Monitor

Hello Community, all new NANO versions have their own "special behavior", but alright, they are very new. The NANO 33 SENSE is displayed as COM6 on my Windows 10 computer with IDE 1.8.9. Compiling and downloading works fine.

But when I start the serial monitor, the message: "Board at COM5 is not available" is displayed. In Windows Device Manager, no COM5 is visible.

A workaround is: - Close the Serial Monitor - Reset the NANO with its reset switch - Start Serial Monitor immediately (with sufficient delay at the beginning of the sketch)

That should be corrected.

… the perfect COM mismatch!

NANO_SENSE_3.png

With these new nano boards they seem to change port numbers while the sketch is uploading. (This becomes obvious if you put the board into bootloader mode by doubleclicking the button on it.) Sometimes the IDE seems to handle the switches automatically. Other times I've had to manually change the selected port in order, for instance, for the serial monitor to work.

I'm having this issue as well.

First, this board takes so much longer than other boards to compile, like 5 times as long. Second, everytime it uploads the sketch, my com ports changes after it resets, so I have to manually change the port back in the Arduino IDE before I can use again. Annoying but still works.

It happens very often, just go to the tools tab and change the port.

And if you can no longer with that option close the arduino program, open it again and repeat the operation of the first paragraph.

Random port changes on Windows 10 after every upload. The Nano appears to be on either COM9 or COM11, seemingly at random.

The serial monitor gets stuck. Upload gets stuck.

Manually changing / re-setting the port in the IDE helps a few times. After a while, the IDE gets confused, and no ports work anymore - neither for serial monitor, nor for upload. The IDE needs a restart. That may happen once every 10 minutes if I recompile a lot.

None of this happens on macOS.

The BLE SENSE has TWO COM ports.
The second COM port also often referred to as “BOOTLOADER” can be invoked by quickly double tapping the reset button.
It can also be used to help clear out a sketch that does not behave. For that put it into BOOTLOADER then upload either BLINK or BARE MINIMUM from the EXAMPLES.

The IDE knows and expects this and can handle it.
Most often there is no need to chase the new COM port.

However there have been some scenarios with other boards of this nature where over aggressive antivirus, Cloud / network or portable based IDE installs can cause delays which result in some problems.

If yours is one of those types of problem then unless you have some decent knowledge of networking etc. it is often best to uninstall the IDE and re-install to a local drive

If you think it is antivirus / security based then you need to add the install locations to your whitelist / exclusions.

Another is USB 3.x issues. There are well known not just for Arduino but other USB peripherals too.
It can be your computers CHIPSET that may not be fully compliant. The most common fix is to insert a USB 2.0 hub between the Arduino (or errant peripheral ). This acts as a buffer in most cases

Last but not least are USB driver issues under Windows. If your USB drivers were supplied by Microsoft you should consider going to the hardware manufacturer site and getting the proper drivers as microsoft has a habit of breaking some of the drivers. This extends beyond USB with the second largest problem being Graphics card drivers supplied by microsoft.

Please rule all those aspects out first.

Also including a pdf that may help with some of those aspects (but not all)

Bob.

CLEAN UP BEFORE INSTALLING ANOTHER COPY OF THE IDE OR ARDUINO CREATE.pdf (347 KB)

Have tried it all ... Cleaned up the registry, have a new IDE, finally got the code to upload but now the Serial monitor plays dumb. Absolutely no data. Copied this code from https://circuitdigest.com/microcontroller-projects/arduino-nano-33-ble-sense-board-review-and-getting-started-guide and i have a blank serial monitor right now. Have even restarted and made sure i dont have anymore COM devices other than just this one. Radio Silence! Any thoughts ?

There is a problem with that code. Like all the native USB Arduino boards, the Nano 33 BLE doesn’t reset when you open Serial Monitor. This means that any output printed to Serial between the time the program starts and you opening Serial Monitor is lost. This means that if one of the sensors failed to initialize, you would not get the warning message and the board will just be stuck in an infinite while loop, giving no output.

The solution is to add a line of code that will cause the Nano 33 BLE to wait until the Serial Monitor has been opened before starting the program. On the line following this line:

  Serial.begin(9600); //Serial monitor to display all sensor values

Add this:

  while(!Serial);

Upload the improved sketch and open Serial Monitor. Do you see output? If so, what is it?

@sganesh07

I just tried in the in the online editor from the sketch provided from your link and dont have any issues.

Also tried it in 1.8.11 and again no issues.

Using Win 7 x64 pro here with full administrator privs.

Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.

Posting tips.

  • Your OS and version can be valuable information, please include it along with extra security you are using.
  • Always list the version of the IDE you are using and the board version if applicable.
  • How to insert an image into your post. ( Thanks Robin2 )
  • Add your sketch where applicable but please use CODE TAGS ( </> )
  • Add a SCHEMATIC were needed even if it is hand drawn
  • Add working links to any specific hardware as needed (NOT links to similar items)
  • Remember that the people trying to help cannot see your problem so give as much information as you can

COMMON ISSUES

  • Check you have a COMMON GROUND where required.
  • Where possible use USB 2.0 ports or a USB 2.0 POWERED HUB to rule out USB 3.0 issues.
  • Try other computers where possible.
  • Try other USB leads where possible.
  • You may not have the correct driver installed. CH340/341 or CP2102
  • There may be a problem with the board check your wiring first.
  • Remove any items connected to pins 0 and 1.
  • Boards using a MICRO usb connector need a cable that is both DATA and CHARGE. Many are CHARGE ONLY.

COMPUTER RELATED

  • close any other serial programs before opening the IDE.
  • Ensure you turn off any additional security / antivirus just to test.
  • There may be a problem with the PC try RESTARTING it.
  • You may be selecting the wrong COM port.
  • Avoid cloud/network based installations where possible OR ensure your Network/Cloud software is RUNNING.
  • Clear your browsers CACHE.
  • Close the IDE before using any other serial programs.
  • Preferably install IDE’s as ADMINISTRATOR or your OS equivalent

Arduino specific boards

  • CH340/341 based clones do not report useful information to the “get board info” button.
  • NANO (Old Types) some require you to use the OLD BOOTLOADER option.
  • NANO (New Types) See the specific sections lower in the forum.
  • NANO (New Types) Install your board CORE’s.
  • Unless using EXTERNAL PROGRAMMERS please leave the IDE selection at default “AVRISP mkII”.

CREATE editor install locations.

  • On macOs ~/Applications/ArduinoCreateAgent-1.1/ArduinoCreateAgent.app/Contents/MacOS/config.ini
  • On Linux ~/ArduinoCreateAgent-1.1/config.ini
  • On Windows C:\Users[your user]\AppData\Roaming\ArduinoCreateAgent-1.1

Performing the above actions may help resolve your problem without further help.

Thanks both of you. That was the fastest response i've had in any forum for a while. Really appreciate it.

I've fizzled the Code to something much smaller and simpler - void setup() { // put your setup code here, to run once: Serial.begin(9600); while(!Serial); //delay(5000); Serial.println("this better work!! "); }

void loop() { // put your main code here, to run repeatedly: }

I had a delay introduced before that made it work albeit inconsistently and even after introducing the command suggested above - i have the same inconsistency.

Am running IDE 1.8.5 on Windows 10 Home and as an Administrator only. I have changed 3 USB cables just to make sure. As mentioned above, i have no issues with the COM port or upload or the necessary headers required. I dont know if the Anti Virus does anything to the serial port connectivity but i did explicitly exclude my .ino file from the AV.

thanks.

Please provide a detailed description of what you mean by "inconsistency".

Thanks for the immediate response once again. Let me detail the iterations here.

Iteration 1 - Serial monitor showed the print statement.
Iteration 2 - i clicked the reset button when the Serial monitor is open - no change
Iteration 3 - i compile and upload again - it works
Iteration 4 - i close the serial monitor and open again - nothing happens
Iteration 5 - i clicked the reset button and opened the serial monitor - it works
Iteration 6 - i repeat the same thing - and it works
Iteration 7 - i open the serial monitor again - and nothing happens

So am guessing the call to reset and opening the serial monitor on IDE 1.8.5 seems to work a little more predictable than the others.

And what works for me is actually the delay statement than the while alternative. Here is a snapshot when it works.

thank you.

sganesh07: Iteration 4 - i close the serial monitor and open again - nothing happens

sganesh07: Iteration 7 - i open the serial monitor again - and nothing happens

This is the correct behavior, and exactly what we would expect. As I said before, the Nano 33 BLE Sense is not reset when you open Serial Monitor. Since your program only prints once after the program starts, it will only print again if you reset the board. The program already started and printed the output in Iterations 3 and 6, so in Iterations 4 and 7 it was just sitting in loop doing nothing, thus no output.

You might be used to the behavior of the non-native USB boards like the Uno, Nano, Mega, and Pro Mini, which do reset when the Serial Monitor is opened.

thanks @pert. Just so that am clear - 1. Even if the Serial monitor is open and i hit reset - nothing happens - is that also expected behavior ? 2. Between the (while!Serial) and delay(xx) - is there a recommendation ? coz on my actual program - i do initialize all of the sensors (am most keen on Gyroscope and Accelerometer only) up front and then on the loop i work with changing data (as i plan to use this to replace an old model of Quad that I had - with the nano + MPU6050 + HC-05 bluetooth)

I will also look for programmatic ways to mimic a reset but is that good programming in this world? am new to electronics in a way so pls bear with that question.

thanks.

sganesh07: 1. Even if the Serial monitor is open and i hit reset - nothing happens - is that also expected behavior ?

Yeah, when you reset the Nano 33 BLE Sense, it breaks the USB connection. You need to restart the Serial Monitor before it will connect again. This is also a different behavior from the non-native USB boards. The reason is that when you reset one of those boards, you only reset the primary microcontroller. The separate USB chip on the board continues running, so the connection to Serial Monitor is never broken.

sganesh07: 2. Between the (while!Serial) and delay(xx) - is there a recommendation ? coz on my actual program - i do initialize all of the sensors (am most keen on Gyroscope and Accelerometer only) up front and then on the loop i work with changing data (as i plan to use this to replace an old model of Quad that I had - with the nano + MPU6050 + HC-05 bluetooth)

The problem with while(!Serial) is that it causes your program to only run after Serial Monitor is opened. You would not want to add that line of code to a sketch that you wanted to run even without Serial Monitor having been opened. This is a common cause of confusion for beginners. Since all the official example sketches that have Serial output have this line, many beginners just copy/paste it into their sketch without understanding what it does, then can't figure out why their program only runs with Serial Monitor open. In the case where you were only using serial output for debugging during development, you could simply comment that line out once you were ready to start using the program without Serial Monitor.

The problem with the delay approach is that you must get Serial Monitor open before the delay ends. The other problem is that you have to wait for the delay to finish before the program starts running. I have had experiences with other boards like the ESP8266 and Uno WiFi Rev2 in its early days (since fixed) where I needed to add a short delay before the first Serial output to get the correct output, but I haven't seen that with the Nano 33 BLE boards. And the delay I needed was 100 ms or less, so that's a completely different situation.

sganesh07: I will also look for programmatic ways to mimic a reset but is that good programming in this world?

No. A properly written program will never need a reset. Why do you think you need one?

Thanks once again, Pert. To your question: on my original code i had the Quad moving up by 1 unit, move right by 1 unit, back left by 1 unit and down by 1 again. Like this, i used to test pitch, roll, yaw actions one by one just to make sure they did what they were supposed to. I used this just for my learning purpose and PID understanding but once it lands i will now have to recalibrate everything to the equivalent of (0,0,0) without expecting an explicit reset. It was just the way i had it. I will have to get it changed.

incidentally - on the same program - from https://circuitdigest.com/microcontroller-projects/arduino-nano-33-ble-sense-board-review-and-getting-started-guide the BARO.begin doesnt seem to happen and infact only the IMU seems to get its readings out but the others - HTS and APDS also dont seem initialize.

if (!BARO.begin()) //Initialize Pressure sensor { Serial.println("Failed to initialize Pressure Sensor!"); while (1);}

if (!HTS.begin()) //Initialize Temperature and Humidity sensor { Serial.println("Failed to initialize Temperature and Humidity Sensor!"); while (1);}

if (!APDS.begin()) //Initialize Colour, Proximity and Gesture sensor { Serial.println("Failed to initialize Colour, Proximity and Gesture Sensor!"); while (1);}

I made sure the IDE has the required libraries installed and while this is not as important as the IMU, kindly advise if am missing something obvious here.

thank you.

any workarounds if I'm using it in an IoT device? without any access to the serial monitor? any way of switching the transmission ports? because it seems to be transmitting information that I'm using on the bootloader port (com 6) instead of the Serial port (com 5)

enuker: any way of switching the transmission ports?

What do you mean by that? If you have no access to Serial Monitor, I'd think you'd want to switch to transmitting information over the network connection.

enuker: it seems to be transmitting information that I'm using on the bootloader port (com 6) instead of the Serial port (com 5)

What evidence do you have for that statement?

Hello,

thank you for your reply, it was an assumption after carrying out various tests, it may be incorrect but I'm facing a problem right now that whenever I upload a program onto the board or physically reset the board itself, I will not receive signals from it until I have opened up some sort of monitor (this could be the serial monitor on Arduino or Tera Term).

The software I'm trying to communicate with is Hairless MIDI, I was just assuming it may be because of that the Arduino is still trying to communicate through the com6 channel instead of com5, that's why I'm not getting anything through the Hairless MIDI terminal and by opening the serial monitor or Tera Term it would switch back to the intended com channel.

Of course, I may be wrong which would result in there's a problem in the Hairless MIDI itself, but I highly doubt it, because that this phenomenon of data not showing up on the Hairless MIDI terminal before opening up some sort of Serial monitor is only for the Arduino nano 33 BLE sense, when I've tried it with an Uno it worked fine and data was coming through.