How to reset voice and creator?

How do I reset the boards into the initial state?

I have two boards of each, matrix creator and matrix voice (one with esp32, one without).
I’m doing hal (non-esp32) programming only, though I experimented with other stuff previously. (though the pi is fresh, with no other stuff on it)

One of my matrix voice boards runs properly, but the other one stutters a bunch when running the everloop, and sometimes throws floating point errors and crashes my app. This is the one with the esp32. The other matrix voice board runs properly with no problems (same pi, same everything else).

Also,

One of my matrix creator boards runs properly, but the other one has a really hard time hearing anything… I have to shout. (again, same pi, same everything else).

What I would like to do is reset the two boards that don’t work to initial conditions, so that I can tell if they’re actually broken, or if I just got them into a weird state.

so how do I do that?

Hello @unicornmafia,

You could test your boards with the following steps:
(It’s better if you test it with a rasbian from scratch )

  1. Install matrixio-creator-init (it works for: MATRIX Voice and Creator)
# Add repo and key
curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list

# Update packages and install
sudo apt-get update
sudo apt-get upgrade

# Installation
sudo apt install matrixio-creator-init
  1. Verify the source list:
$ cat /etc/apt/sources.list.d/matrixlabs.list 
deb https://apt.matrix.one/raspbian stretch main
  1. Verify matrixio packages:
$ dpkg -l | grep matrix
ii  matrixio-creator-init           0.4.1                        armhf        Install scripts that can program the MATRIX Creator FPGA and SAM3 IMU.
ii  matrixio-openocd                1.0.1                        armhf        Open on-chip JTAG debug solution for ARM and MIPS systems
ii  matrixio-xc3sprog               1.1.1                        armhf        Spartan3, XCF and CPLD JTAG programmer and other utilities.

Now we need to test the status of the FPGA, could you run:

$ sudo /usr/share/matrixlabs/matrixio-devices/matrix-init.bash

If all of the scripts go well, you could read the version of the software in the FPGA:

  • MATRIX Voice
$ sudo /usr/share/matrixlabs/matrixio-devices/fpga_info 
IDENTIFY = 6032bad2
VERSION = 10004
  • MATRIX Creator
$ sudo /usr/share/matrixlabs/matrixio-devices/fpga_info 
IDENTIFY = 5c344e8
VERSION = 10005

Now run the HAL examples:

  • MATRIX Voice (non ESP32) and Creator : It will be work with this examples.

  • MATRIX Voice - ESP32: For this test, you need to be sure that the ESP32 is in reset state (Test without ESP32)

$ voice_esp32_reset
$ echo 0 > /sys/class/gpio/gpio25/value 

The GPIO25 control the reset signal in the ESP32

Then run the HAL examples.

$ git clone https://github.com/matrix-io/matrix-creator-hal.git
$ cd matrix-creator-hal
$ mkdir build && cd build
$ cmake ..
$ make -j4

I’mk looking forward to your answer.

Regards,

Kevin Patino

1 Like

@kevindpatino thanks for your help!!

I’ve tested the matrix voice using the above procedure. A couple minor issues:

  1. A reboot is required I think right before running the matrix-init.bash step.
  2. in your last step, there’s a typo “cd matrix-creator-chal”
  3. I don’t know if it makes any difference, but the hal repo says to do --recursive when you clone

My results:
I did exactly what you said (with the exceptions i list above) with a new raspbian stretch lite on rpi3 with my esp32 matrix voice, and can’t get anything to run because of floating point errors:

pi@raspberrypi:~/matrix-creator-hal/build/demos $ ./mic_energy
Floating point exception
pi@raspberrypi:~/matrix-creator-hal/build/demos $ ./mic_energy
Floating point exception
pi@raspberrypi:~/matrix-creator-hal/build/demos $ ./mic_energy
Floating point exception
pi@raspberrypi:~/matrix-creator-hal/build/demos $ ./mic_demo
Floating point exception
pi@raspberrypi:~/matrix-creator-hal/build/demos $ ./everloop_demo
^C
pi@raspberrypi:~/matrix-creator-hal/build/demos $ ./firmware_info
MCU ID = 0x0
MCU version = 0x0
pi@raspberrypi:~/matrix-creator-hal/build/demos $ ./ipaddress_demo
lo IP Address 127.0.0.1
wlan0 IP Address 10.0.0.62
show last integer: 62
pi@raspberrypi:~/matrix-creator-hal/build/demos $ ./micarray_recorder
Floating point exception

I even tried changing the everloop_image.h to have the right number of LEDs, rebuilt, and still got the same issues.

Hello @unicornmafia

Just to be clear, this issue is just with your MATRIX Voice ESP32?

Then Could you confirm if you get this result:

  • MATRIX Voice
$ sudo /usr/share/matrixlabs/matrixio-devices/fpga_info 
IDENTIFY = 6032bad2
VERSION = 10004
  • Could you confirm that the ESP32 is in reset state?
$ voice_esp32_reset
$ echo 0 > /sys/class/gpio/gpio25/value 

Thank You

Kevin

@kevindpatino Yes, I am using ESP32 version of matrix voice, and yes, I get both of those results.

Second test on the Matrix Creator. Used same pi image from previous test, but I reran
sudo /usr/share/matrixlabs/matrixio-devices/matrix-init.bash
and rebuilt and reinstalled the hal again.
I get TONS of static on the output wav.
https://drive.google.com/file/d/1T4Kk-v079gB-Kqo2IpSsmWINA7o7FRsO/view?usp=sharing

Here’s what I did:

./micarray_recorder
 sox -r 16000 -c 1 -e signed -c 1 -e signed -b 16 mic_16000_s16le_channel_8.raw channel_8.wav

About this issue could you share each wav file per channel?

Thank You

Kevin

Yes, It looks like the noise is coming from channel 1 only. the other channels sound good.

https://drive.google.com/drive/folders/1uHVOrepZ090hXuIRAidNa4iQuk-UHZ-j?usp=sharing

Hello @unicornmafia

About your MATRIX Voice. If your MATRIX Voice show:

MATRIX Voice
$ sudo /usr/share/matrixlabs/matrixio-devices/fpga_info 
IDENTIFY = 6032bad2
VERSION = 10004

We tested the FPGA setup and the communication between your MATRIX Voice and Raspberry Pi. I will try to replicate your trouble. Let me test it.

Thank You!

Regards,

Kevin Patino

ok. after pulling out the matrix creator, putting pack in the matrix voice, rerunning matrix-init.bash, and rebuilding and reinstalling the hal source, the voice appears to be working again. I can’t explain why, except for maybe I missed a reboot step somewhere?
Here’s what I get from fpga_info:

pi@raspberrypi:~ $ sudo /usr/share/matrixlabs/matrixio-devices/matrix-init.bash
*** MATRIX Voice has a updated firmware
*** MATRIX Voice initial process has been launched
pi@raspberrypi:~ $ sudo /usr/share/matrixlabs/matrixio-devices/fpga_info
IDENTIFY = 6032bad2
VERSION = 10004

Hello @unicornmafia,

First, nice that your Voice it’s alive again :slight_smile:. I will track this issue, maybe we miss something in the ESP32 configuration. I will let you know if we find something.

Thank You,

Regards,

Kevin Patino

ok, so I’ve figured out what is going on:

It appears that the two lines:

voice_esp32_reset
echo 0 > /sys/class/gpio/gpio25/value

need to be performed every time the pi is rebooted, in order to keep the esp32 from interfering with the pi.

I get the stuttering etc, when I reboot, but then when I issue those two commands, it goes away. It’s repeatable.

Is there a way to get these to be set automatically on boot?

Thanks!

-Thomas

Hello @unicornmafia

In our latest release of MATRIX init package https://github.com/matrix-io/matrix-creator-init/releases/tag/v0.4.2, We added a matrix_voice.config in order to set up this pin on the boot process.

This file will be located in /etc/matrixio-devices

Could you run:

sudo apt update
sudo apt upgrade

Thank You,

Kevin Patino

@kevindpatino

after doing the update/upgrade, doing a git pull, and rebuilding/reinstalling the HAL, I have found that I cannot get it to stop stuttering/throwing floating point errors at all any more.

I tried to redo the voice_esp32_reset, and it still has the problem
I tried to redo the echo 0 > /sys/class/gpio/gpio25/value
and this causes it to stop working entirely. After this, it always throws a floating point error and will never allow me to run any other programs (even the HAL demos) until I reboot.

Any idea what to do next?

Hello @unicornmafia,

Could you upload this example in the ESP32?.

Maybe you are running an outdated example in the ESP32.

However, I’m working on try to replicate this issue.

Let me know how this test works.

Regards,

Kevin Patino

Hi @kevindpatino!

Thanks so much for your help on this.
Unfortunately, this demo doesn’t fix it either.

Here’s what I observe:

  1. when I program the everloop demo into the esp32 it works properly
  2. when I reboot, it still runs the esp32 everloop demo on boot
  3. when I issue echo 0 > /sys/class/gpio/gpio25/value, it halts the everloop demo
  4. when I run voice_esp32_reset, it restarts the everloop demo
  5. when I issue echo 0 > /sys/class/gpio/gpio25/value, and then try the NON-esp32 hal everloop demo, nothing happens
  6. when I run voice_esp32_reset, and then run the NON-esp32 hal everloop demo, they both seem to run and it flickers a bunch and stutters.

My guess is that the esp32 is not being reset. Note that this is the contents of my /etc/matrixio-devices/matrix_voice.config:

# Config FILE for MATRIX Voice

# TRUE or FALSE, Other value will be assume as a TRUE state
ESP32_BOOT_ON_RESET = FALSE

@unicornmafia,

I just tested and the functionality of the matrix_voice.config seems to work fine. When I put FALSE the ESP32 will be enabled and will be running after boot. If I put TRUE the ESP32 will start disabled. I also tried to use HAL demos when the ESP32 was disabled and it worked perfectly.

Can you explain what is the behavior you are expecting?

Thank you

@yoelrc88 According to what you say, it looks like I did misunderstand how the flag was supposed to be set. flag says “ESP32_BOOT_ON_RESET”. I figured FALSE would make it NOT boot on reset, and TRUE would make it boot on reset. From what you just said, apparently this is backwards?

Regardless, I did test with it set to TRUE, as you have said above, but it still does not work. When it’s set to TRUE, what happens is that it does shut off the esp32 when it boots (as you have described above), but then the NON-esp32 HAL demos hang and do nothing, and when I run my code (which is very simple) I get floating point errors. If I then run voice_esp32_reset, it starts the esp32 demo running again, and if I then run the non-esp32 HAL demo, it interferes (the aforementioned stuttering from the esp and pi competing)

if I do the echo 0 > /sys/class/gpio/gpio25/value from this state, it behaves the same as if it boots with the ESP32_BOOT_ON_RESET set to TRUE. i.e. it hangs when running the non-esp32 HAL demos.

Again note that this DID work before the most recent software update.

ok I understand.

Can you share the output of :
dpkg -l | grep matrix

Thank you

ii  libmatrixio-creator-hal:armhf   0.2.1                          armhf        Hardware Abstraction Layer for MATRIX.
ii  libmatrixio-creator-hal-dev     0.2.1                          armhf        Hardware Abstraction Layer for MATRIX (headers)
ii  libswresample-dev:armhf         7:3.2.10-1~deb9u1+rpt1         armhf        FFmpeg library for audio resampling, rematrixing etc. - development files
ii  libswresample2:armhf            7:3.2.10-1~deb9u1+rpt1         armhf        FFmpeg library for audio resampling, rematrixing etc. - runtime files
ii  matrixio-creator-init           0.4.2                          armhf        Install scripts that can program the MATRIX Creator FPGA and SAM3 IMU.
ii  matrixio-openocd                1.0.1                          armhf        Open on-chip JTAG debug solution for ARM and MIPS systems
ii  matrixio-xc3sprog               1.1.1                          armhf        Spartan3, XCF and CPLD JTAG programmer and other utilities.