help whit Error in Arduino Nano 33 BLE Sense

Hello

i’m new to Arduino i’m trying to do this example here:

for Arduino board to recognize simple voice, but it give me error when i try upload the code to
Arduino Nano 33 BLE Sense

this the error:

Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: “Arduino Nano 33 BLE”

Library Arduino_TensorFlowLite has been declared precompiled:

Using precompiled library in C:\Users\Moham\Documents\Arduino\libraries\Arduino_TensorFlowLite\src\cortex-m4\fpv4-sp-d16-softfp

Sketch uses 176848 bytes (17%) of program storage space. Maximum is 983040 bytes.

Global variables use 76344 bytes (29%) of dynamic memory, leaving 185800 bytes for local variables. Maximum is 262144 bytes.

Device : nRF52840-QIAA

Version : Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]

Address : 0x0

Pages : 256

Page Size : 4096 bytes

Total Size : 1024KB

Planes : 1

Lock Regions : 0

Locked : none

Security : false

Erase flash

Done in 0.000 seconds

Write 176856 bytes to flash (44 pages)

[==============================] 100% (44/44 pages)

Done in 7.353 seconds

processing.app.SerialException: Error opening serial port ‘COM3’.

at processing.app.Serial.(Serial.java:152)

at processing.app.Serial.(Serial.java:82)

at processing.app.SerialMonitor$2.(SerialMonitor.java:132)

at processing.app.SerialMonitor.open(SerialMonitor.java:132)

at processing.app.AbstractMonitor.resume(AbstractMonitor.java:132)

at processing.app.Editor.resumeOrCloseSerialMonitor(Editor.java:2120)

at processing.app.Editor.access$1300(Editor.java:117)

at processing.app.Editor$UploadHandler.run(Editor.java:2089)

at java.lang.Thread.run(Thread.java:748)

Caused by: jssc.SerialPortException: Port name - COM3; Method name - openPort(); Exception type - Port not found.

at jssc.SerialPort.openPort(SerialPort.java:167)

at processing.app.Serial.(Serial.java:141)

… 8 more

Error opening serial port ‘COM3’.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

can any one help me ?

You get

Error opening serial port 'COM3'.

have you selected the right port for your board?

yes i select ht eright port after i upload the code to arduino the port deconnect i don't know why ?

It's just an unfortunate quirk of the Nano 33 BLE. Usually it's caused by having Serial Monitor or Serial Plotter open when you upload. You'll notice that sometimes the serial port number changes after an upload. Probably the upload was successful, but it's just the attempt to reopen the port after the upload that fails. You can test it out by uploading a simple sketch like Blink and then confirming that the behavior of the LED changed.

I try Blink sketch and it work no problem, for this example here:

after the port deconnect it try connect again but it say the port is unknown:
unknown.PNG

any idea why ?

unknown.PNG

I see a report about it here:

The fix that user found was to do this:

  • Tools > Board > Boards Manager
  • Wait for the update to finish.
  • From the list of available boards platforms, click on "Arduino nRF528x Boards (Mbed OS)".
  • From the dropdown version menu, select "1.1.6".
  • Click the "Install" button.
  • Wait for the installation to finish.
  • Click the "Close" button.
  • Connect your Nano 33 BLE Sense to your computer.
  • Press and release the "RST" button twice quickly. You should now see the "L" LED pulsing. If not, repeat the double reset process until you get the timing right and see the LED pulse. This will put the board in bootloader mode and cause your board to once again be recognized by the computer.
  • Tools > Port > select the port of your Nano 33 BLE Sense (note that the port number may be different when the board is in bootloader mode).
  • Open the IMU_Classifier sketch
  • Sketch > Upload

The code that creates the USB CDC serial port of the Nano 33 BLE Sense runs on the same nRF52840 microcontroller as your sketch. So a bug in the sketch can actually halt or break the USB code, resulting in the board no longer being recognized by the computer. I guess you already discovered that you can recover from this situation by putting the board in bootloader mode with the double reset trick.

After that, the task is to find the bug that is breaking the USB code. I'll show you a simple demonstration:

void setup() {
  volatile byte foo = 1 / 0;  // The variable must be volatile to prevent it from being optimized out.
}

void loop() {}

On the Nano 33 BLE, that divide by zero crashes Mbed OS, which is indicated by the "L" LED doing a 4X long, 4X short blink pattern. The crash would still

With that minimal example, it's easy enough to spot the problem, but with an extremely complex program such as those used for machine learning, this can be very difficult to do.

Unfortunately, I don't know what the problem is with the "IMU_Classifier" sketch. It was certainly working at the time that blog post was written, but it appears that some change made to the Arduino Mbed OS Boards platform between the 1.1.6 and the 1.3.0 releases broke compatibility.

for number 10 step you mean this file:

correct ? if yes i try it but give me the error in the attachmant

error 2.txt (33 KB)

You saved the webpage of the sketch, so you got all the HTML and JavaScript in your sketch. I'm confused because before you said this:

mohammadalh:
for this example here:
Get started with machine learning on Arduino | Arduino Blog

after the port deconnect it try connect again but it say the port is unknown:
unknown.PNG

So if you don't even know how to download the sketch, how were you able to upload it before?

i downoload the two file:
IMU_Classifier.ino
model.h
and i open the IMU_Classifier.ino file and upload it and than give ne the error i post before

l'm new to arduino i start only two and half week ago so thank you for your help

OK, I still don't understand, but let's move on. Please follow these instructions:

  • Download the Arduino TensorFlow Lite Tutorials sketches: https://github.com/arduino/ArduinoTensorFlowLiteTutorials/archive/master.zip
  • Unzip the downloaded file.
  • (In the Arduino IDE) File > Open
  • From the folder you unzipped, select the file GestureToEmoji/ArduinoSketches/IMU_Classifier/IMU_Classifier.ino
  • Click the "Open" button.
  • Click on the "model.h" tab.
  • Replace the contents of the tab with the model you trained in Colab, following the instructions in the tutorial.
  • Save the sketch somewhere safe.

Now try uploading the sketch to your Nano 33 BLE, as before.

mohammadalh:
l'm new to arduino i start only two and half week ago so thank you for your help

This is a pretty advanced project. I'm certain you can get it working with enough persistence, but this is something that would be challenging even to someone with years of experience with Arduino.

i don't use Colab, i'm trying do this example


Load and run the example
Once the library has been added, go to File -> Examples. You should see an example near the bottom of the list named TensorFlowLite:micro_speech. Select it and click micro_speech to load the example.

which instructions in the tutorial ???

I have been having similar difficulties, which have been partially resolved by using the 1.1.6 version of the Arduino mbed-enabled Boards package. However, I make the following observation:

Uploading the Blink sketch went flawlessly, Uploading the "hello-world" sketch from the github TensorFlow repository completed, but ended with a report that "Board at COM12 is not available." Checking Tools -> Port showed "COM12 (Arduino Nano 33 BLE)." (COM12 is the port at which my BLE Sense board shows up while in normal operation; it is at COM13 during upload.) I then set "File -> Preferences" to verbose for both compile and upload, and clicked the upload button again. The (compile and) upload completed successfully again, but there was no report that COM12 was not available. Opening the Serial Plotter showed the approximate sine wave, as intended.

On previous occasions, opening the Serial plotter after receiving the "Board at COM12 is not available." report, has produced a condition in which all attempts to communicate with the BLE Sense fail (both in "normal" mode, and having enabled the bootloader by double-clicking the reset button) until I disconnect the BLE Sense, power down my computer, and reboot. In the "fail" condition, WIN7 Device Manager shows nothing at either COM12 or COM13, whether the BLE Sense is in normal or bootloader-enabled mode.

Additionally, in the "fail" condition, WIN7 reports that "a connected usb device is broken," regardless of whether the BLE Sense is in normal or bootloader mode.

Further observation:

On powering up my WIN7 system with the BLE Sense connected produced the "fail" condition described above. A simple restart did not effect any change. In order to have the system recognize the BLE Sense, I had to power-down the system (and actually pull the plug), then power up the system with the BLE Sense NOT CONNECTED, subsequently connecting the BLE Sense, in order for the BLE Sense to be properly recognized.

thank you for your information