Error deploying Alexa demo on Nicla Voice

I am trying to program my Nicla voice with the Alexa Demo. It deploys ok. I am using Arduino IDE 2.0.3 and arduino cli 0.29.0. I can deploy the sketch Blink_Nicla ok and it flashes the green LED without issue. The Alexa demo deploys ok but the red led flashes. The serial monitor reports:

Loading synpackages
Error opening: mcu_fw_120_v91.synpkg failed: fail

Can you point me in the direction of some instructions so I can deploy correctly and get a working Alexa demo? It seems it is missing files.

This post seems to be relevant: GitHub - edgeimpulse/firmware-arduino-nicla-voice: Repository for the Arduino Nicla Voice as it mentions the package that is missing

1 Like

Hi John, thanks for posting here.
Since you are the first reporter I'll add some general info too (beside helping with your specific problem)

Basically the NDP120 chip requires a bunch of firmwares that are independent from the model you want to run, but must be in sync with Syntiant SDK release. This made the preflashed Alexa model obsolete before the board arrived to the customers (you can still test it by just powering the board after unboxing without flashing anything on it).

To ease the update procedure, we added the example called Syntiant_upload_fw_ymodem and the companion PC uploader ArduinoCore-mbed/libraries/NDP/examples/Syntiant_upload_fw_ymodem at master · arduino/ArduinoCore-mbed · GitHub .

This sketch and tool combination can be used to manually update the models, and for bundled examples this is a very uncommon action (it needs to be run only if the underlying SDK gets updated).

If you use Edge Impulse, on the other hand, you'll need to update the model more often, so they conveniently wrapped the tools in the package you'll download after the training (https://docs.arduino.cc/tutorials/nicla-voice/getting-started-ml#uploading-the-model). When doing so, they also update the other firmwares to match the SDK version used to generate them.

Now, to target your specific problem:

  • upload Syntiant_upload_fw_ymodem example from NDP bundled library
  • extract the attached zip, which contains the compiled uploaders for various operating systems and the firmwares
  • in a console, execute
./syntiant-uploader send -m "Y" -w "Y" -p $portName $filename

replacing portName and filename with the relevant info.

For example

./syntiant-uploader send -m "Y" -w "Y" -p COM3 mcu_fw_120_v91.synpkg
./syntiant-uploader send -m "Y" -w "Y" -p COM3 dsp_firmware_v91.synpkg
./syntiant-uploader send -m "Y" -w "Y" -p COM3 model_name.synpkg

  • After uploading the three files you can reflash AlexaDemo and it will finally work.

As a last note, you can "host" more than one model at time (the external flash is 16MB) to make it easier swapping between projects (every sketch can call its different NDP.load("modelname.synpkg") ) .

nicla_voice_uploader_and_firmwares.zip (6.9 MB)

4 Likes

I have tried the following commands:

syntiant-uploader-win send -m "Y" -w "Y" -p COM32 "D:\Program Files (x86)\Arduino\arduino-cli\mcu_fw_120_v91.synpkg"

I get the com port from device manager or the arduino ide (though it needs to be closed when I use the uploader). For each command I get the message:

2023/02/08 10:19:03 main.go:78: Didn't get a nak when expected

I reflash with the alexa code and the red led is still flashing. Serial monitor reports:

Loading synpackages
Error opening: mcu_fw_120_v91.synpkg failed: fail

Did you manage to upload the Syntiant_upload_fw_ymodem sketch before launching the command? If so, I'll need some further investigation on windows

Ah, I missed that command as I didn't really understand it. It is working now.
Incidentally the sketch Syntiant_upload_fw_ymodem is also in the examples provided.

It would help if you also updated these pages: https://docs.arduino.cc/tutorials/nicla-vision/getting-started

2 Likes

I've had no luck with my Nicla Voice devices

I have two Nicla Voice units they both appear to not be working correctly. I flashed one of them to try and get the Alexa demo to work correctly. What are the correct functions of this Alexa demo?.

I followed the instructions above and it worked for me

Ok Thanks!
I will step through the instructions listed above for the unit I already flashed. I was
assuming the un-flashed unit from the factory should work correctly. I'm I wrong that both units will need to be re-flashed?

Hi, if you programmed it using an Arduino IDE as I did when I first got it, The Alexa sketch will cease to work. However if you follow their instructions it will work again.

ok
I will be giving it a try soon. Thanks for insight and help

Hello, this is José from the Arduino Content team.

@johnstaveley Thank you for your feedback. The audio analysis getting started guide for the Nicla Voice has been updated with the feedback posted here. It now has the update process described by @facchinm, I have tested it, and it is working.

Hi, I notice a number of differences when using this myself from the demo provided.

Firstly the default model on the classifier tab is 2D convolutional, to get the screenshot you provide in the tutorial I have to change it to dense network which forces a change in architecture.

Secondly the windows.bat file does not work and I receive the following errors:

You're using an untested version of Arduino CLI, this might cause issues (found: 0.32.1, expected: 0.18.x
Finding Nicla Voice core v9.9.9
Finding Nicla Voice core OK
Finding Nicla Voice...
Finding Nicla Voice OK at COM11
Flashing Arduino firmware...
Error during Upload: Platform 'arduino-git:mbed' not found: unknown package arduino-git
Platform arduino-git:mbed is not found in any known index
Maybe you need to add a 3rd party URL?
Press any key to continue . . .
Please wait target to reboot

Waiting for 0 seconds, press CTRL+C to quit ...
Finding Nicla Voice...
Writing synpkg to flash, skipping if present...
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
Writing NN model OK
Press any key to continue . . .

Fortunately I can flash the model manually:

D:\Training\NiclaColourSounds\Firmware\ndp120>syntiant-uploader-win send -m "Y" -w "Y" -p COM11 dsp_firmware_v91.synpkg
Sending 79828 bytes
blocks : 78
2023/04/22 11:13:01 main.go:81: dsp_firmware_v91.synpkg sent successful
D:\Training\NiclaColourSounds\Firmware\ndp120>syntiant-uploader-win send -m "Y" -w "Y" -p COM11 mcu_fw_120_v91.synpkg
Sending 22636 bytes
blocks : 23
2023/04/22 11:13:21 main.go:81: mcu_fw_120_v91.synpkg sent successful
D:\Training\NiclaColourSounds\Firmware\ndp120>syntiant-uploader-win send -m "Y" -w "Y" -p COM11 ei-model.synpkg
2023/04/22 11:13:25 main.go:64: open ei-model.synpkg: The system cannot find the file specified.
D:\Training\NiclaColourSounds\Firmware\ndp120>syntiant-uploader-win send -m "Y" -w "Y" -p COM11 ei_model.synpkg
Sending 545768 bytes
blocks : 533
2023/04/22 11:15:11 main.go:81: ei_model.synpkg sent successful

I then upload my program, using the arduino ide and it shows in the output that all words are identified as not_word.

#include "NDP.h"

//const bool lowestPower = true;
const bool lowestPower = false;

void wordDetected(char* label) {
  nicla::leds.begin();
  nicla::leds.setColor(blue);
  delay(200);
  nicla::leds.setColor(off);
  if (!lowestPower) {
    Serial.println(label);
  }
  nicla::leds.end();
}

void eventDetected() {
  nicla::leds.begin();
  nicla::leds.setColor(green);
  delay(200);
  nicla::leds.setColor(off);
  nicla::leds.end();
}

void errorDetected() {
  while (1) {
    nicla::leds.begin();
    nicla::leds.setColor(red);
    delay(200);
    nicla::leds.setColor(off);
    delay(200);
    nicla::leds.end();
  }
}

void setup() {

  Serial.begin(115200);
  nicla::begin();
  nicla::disableLDO();
  nicla::leds.begin();

  NDP.onError(errorDetected);
  NDP.onMatch(wordDetected);
  NDP.onEvent(eventDetected);
  Serial.println("Loading synpackages");
  NDP.begin("mcu_fw_120_v91.synpkg");
  NDP.load("dsp_firmware_v91.synpkg");
  NDP.load("ei_model.synpkg");
  Serial.println("packages loaded");
  NDP.getInfo();
  Serial.println("Configure mic");
  NDP.turnOnMicrophone();
  NDP.interrupts();

  // For maximum low power; please note that it's impossible to print after calling these functions
  nicla::leds.end();
  if (lowestPower) {
    NRF_UART0->ENABLE = 0;
  }
  //NDP.turnOffMicrophone();
}

void loop() {
  uint8_t command = 0xFF;

  while (Serial.available()) {
    command = Serial.read();
    if (command == 'f') {
      Serial.println("Interrupts disabled");
      NDP.noInterrupts();
    } else if (command == 'o') {
      Serial.println("Interrupts enabled");
      NDP.interrupts();
    }
  }
  //Serial.println("in the loop");
  delay(100);
}

This identifies everything as not word. In my classifer section of the model it was able to identify each of the words with 90% accuracy. If I go back to the performance classification part of the model it tells me that it will misidentify all words with 100% certainty which is what I experience in practice. i.e the model is good but just doesn't work on the Nicla voice.

I have made the model public so you can confirm what I am saying:

I have wasted many hours on trying to get the Nicla voice to work and other than the Alexa sample I cannot so far get anything from it. I am disappointed as so far it is a waste of £70.

Hi John. First of all, I must say that I benefited greatly from the questions we asked here, thank you.
I reviewed your project. You must to include noise and unknown data. I add to below a link. Keyword spotting (has a yes no noise and unknown).

For noise and unknown link:

Unfortunately, I only get a sound from one of the sounds I defined in nicla voice.
I think it is necessary to make a change in the code. "NDP.onMatch()"

As a solution to your technical question, you should first install visual studio c++ desktop files.

Then you can try the section for windows again, I'm leaving the link below. Please uninstall python(3.10) and node.js(18.16.0) and install the previous versions from the last version.
it worked for me this way.

This is important; Install the CLI tools via:

npm install -g edge-impulse-cli --force
You need to make sure it is fully loaded.

unfortunately, you may experience connection and installation problems again afterwards. but it works in the end :slight_smile:

Hi, I have done as you asked and put in noise and noises/words which are not in my identification set. I've put these in as my category "not_words". I have rebuilt the feature set and retrained the model which is now showing 96% accuracy. Great! I go to performance calibration and again I get 100% false rejection rate. Did I miss any steps? As it appears to still not work.

I did not understand your comment:
"I think it is necessary to make a change in the code. "NDP.onMatch()""
What do I need to change?

I have tried a completely new project using just the yes/no/noise/unknown data specified here: Keyword spotting - Edge Impulse Documentation I think my problem above is that I put noise and unknown in the same file which made detection poor. from the classifier I am expecting a model able to detect yes and no with 90% accuracy. However, on the nicla voice it seems to only be able to recognise 'no' and 'noise', it is never able to detect yes or unknown. Has the nicla voice ever been used to detect more than 1 word at a time? It seems in neither of my projects is this possible. Here is the project: Yes/No - Dashboard - Edge Impulse

I would like to elaborate on error in deploying Alexa demo on Nicla Voice. More specifically on a problem I have with NDP library's "Record and Stream" example I describe in another forum audio-analysis-with-machine-learning-and-the-nicla-voice. I would be glad to know if anyone succeeded in using the Record and Stream example in Arduino IDE.

Hi,
I'm trying to make the Alexa_demo sketch work.
I did the following steps:
image

Uploaded sketch Syntiant_upload_fw_ymodem
Formatted flash "F" via serial port monitor
Confirmed with "L" -> empty file list displayed
Uploaded mcu_fw_120_v91.synpkg
Uploaded dsp_firmware_v91.synpkg
Uploaded alexa_334_NDP120_B0_v11_v91.synpkg
All of them "sent successful"
Confirmed that the files are on the Flash memory -> Serial Monitor "L"
image

Uploaded sketch "Alexa_demo", and by checking the Serial monitor the packages are loaded.

When I speak to the microphone (saying "Alexa" or other words) nothing flashes (onMatch, onError, OnEvent).
I could see that if I press "f" / "o" interrupts are disabled/ enabled as described in the sketch.
Any hints of what I'm doing wrong?
Thank you so much for the help.
Best
Paolo

I too am having problems with getting Nicla running. My problem is when I press F in the Serial Monitor (115200 baud) nothing happens. Pressing S or L gets something displayed on the Serial Monitor. Any ideas ?
John

NB using windows 10 on a HP laptop. IDE 2.1.1 Uploaded sketch Syntiant_upload_fw_ymodem OK

I even re-tested with arduino ide 1.8xx, it does the same job :frowning: