Binary output for Nordic nRF9161 DK + IKS02A1 is not working as expected

Hi All,

I am trying to build a fire alarm detection system by analysing the sound.
For this, I am using the Nordic nRF9161 DK with IKS02A.
I created a public project (585872), used Audio (MFE) as a processing block, and Classification as a learning block.

When I tried to run the model in a web browser, it worked fine. But when I try to deploy the impulse to Nordic nRF9161 DK + IKS02A1 (binary output), its not working. Always showing the same result.

Starting inferencing in 2 seconds…
Sampling…
Timing: DSP 140.000000 ms, inference 16.000000 ms, anomaly 0 ms
#Classification results:
FireAlarm: 0.000000
Noise: 0.996094
Starting inferencing in 2 seconds…
Sampling…
Timing: DSP 141.000000 ms, inference 15.000000 ms, anomaly 0 ms
#Classification results:
FireAlarm: 0.000000
Noise: 0.996094

Any suggestions/input would be of great help.

Thanks in advance.

Hi @saroopvs

Welcome to the forum are you using our firmware to test with, and you are testing via impulse runner? If so its published on github here - > GitHub - edgeimpulse/firmware-nordic-nrf91x1: Official Edge Impulse firmware for nRF9161DK and nRF9151DK

If this is how you are running it I will try to give some debugging steps for you, but if I’m correct this iks02a1 is on an additional board you have connected to the devkit? If so you may need Nordics help here, did you ask on their forum?

If you are using an alternative microphone make sure its compatible with the required sampling rate of the project / firmware too 16khz from the firmware - > firmware-nordic-nrf91x1/src/sensors/ei_microphone.cpp at afb65a1285a4876e434fc0c5d535ebcd3cb9cec4 · edgeimpulse/firmware-nordic-nrf91x1 · GitHub

cc @mateusz @vojislav

Best

Eoin

Hi @Eoin,

Thanks for your reply.

I am not using ‘edge-impulse-run-impulse’ command to run the impulse, instead of this, I am connected to the devkit through minicom using the command ‘minicom -C communication.log -b 115200 -D /dev/ttyACM0’

I used the github repo to get the result, but the result was same as described.
after using this code, I tried acquiring the sound data to ensure the code and hardware setup worked. From this, I can eliminate my doubt about the hardware setup. The same setup was used to acquire the sound data for training.

In the GitHub repo code, I believe that the fun ‘inference_sampling_work_handler’ is used to get the samples for the classification, and ‘dmic_read’ (dmic_read(mic_dev, 0, &buffer, &size, READ_TIMEOUT)) is the fun to capture the sound data from the mic. While checking the buffer data, after a few cycles of dmic_read, the data is :- Buffer Data (3200 bytes): 07 00 07 00 07 00 07 00 07 00 07 00…

Hi @saroopvs,

Thanks for reporting this issue, I will look into it. I will try to reproduce it with my audio model, and see if I have a same problem, if not I will ask you for your project ID so i can take a look.

Cheers,
Vojislav

Hi @vojislav ,

Thank you for responding.
Waiting for your results.

Hi @saroopvs

I see the same problem on my audio model.

> AT+RUNIMPULSE
Inferencing settings:
	Interval: 0.0625ms.
	Frame size: 16000
	Sample length: 1000.00 ms.	No. of classes: 3
Starting inferencing, press 'b' to break
Starting inferencing in 2 seconds...
Sampling...
Predictions (DSP: 141.000000 ms., Classification: 39.000000 ms., Anomaly: 0ms.):
#Classification results:
    helloworld: 0.000000
    noise: 0.234375
    unknown: 0.765625
Starting inferencing in 2 seconds...
Sampling...
Predictions (DSP: 134.000000 ms., Classification: 39.000000 ms., Anomaly: 0ms.):
#Classification results:
    helloworld: 0.996094
    noise: 0.000000
    unknown: 0.000000
Starting inferencing in 2 seconds...
Sampling...
Predictions (DSP: 134.000000 ms., Classification: 39.000000 ms., Anomaly: 0ms.):
#Classification results:
    helloworld: 0.996094
    noise: 0.000000
    unknown: 0.000000
Starting inferencing in 2 seconds...
Sampling...
Predictions (DSP: 134.000000 ms., Classification: 39.000000 ms., Anomaly: 0ms.):
#Classification results:
    helloworld: 0.996094
    noise: 0.000000
    unknown: 0.000000

as you already stated it is probably something with data/buffer that is used with microphone.
I will look into it.

Cheers,
Vojislav

I appreciate your response, @vojislav .
I’m hoping you’ll resolve the problem quickly.
I will make an effort on my end as well.

1 Like

Hi @saroopvs

I found the issue, applying the fix now, and it should land in production shortly.
I will let you know as soon as it is live.

Thanks for reaching out and pointing there is an issue!

Best regards,
Vojislav

Hi @vojislav ,

Thanks for your replay.
I also found the issue and fixed it for my code.
It was due to the configuration issue in the channel selection.
In the ‘ei_microphone_inference_start’ function, it was PDM_CHAN_LEFT. But actually it should be PDM_CHAN_RIGHT. The same configuration is used in the ‘ei_microphone_sample_start’ function. But there it was correct. Because of that, data acquisition was working correctly.
That’s why I did not suspect any configuration issue in the first place.

Is this the same thing you found in the code?

Best regards,
Saroop

Yes, that was the issue!
You can continue building locally with C++ deployment until we have the fix in prod after that you will be able to use nRF9161dk deployment again!

Cheers!

Hi @vojislav
I am using Nordic nRF9161 DK, and I already have an Embedded C program running on it.
So, is there any way to download the Edgeimpulse library as a C library instead of a C++ library?

Hi @saroopvs,

So EI only supports C++ deployment but for pure C applications there is a way to resolve this.
This is done by compiling the impulse as a shared library then link to it from a C application.

For more info please look into:

and

Thanks @vojislav
I will check this.

1 Like