"can't send spi message" error when running Matrix Creator examples on resinOS

raspberrypi3

#1

Hello,

I am using a Raspberry Pi 3 with a Matrix Creator board. Using the Matrix documentation here I installed the necessary dependencies for the board through the dockerfile and tried to run the “mic_energy_direct” demo here.

However, I get the following output when running any of the matrix examples that involve the microphones:
“can’t send spi message”

Any help would be greatly appreciated. Thank you!


#4

Also, here is my full dockerfile installing matrix dependencies, for reference. The forum does not seem to allow me to post it in text due to it having more than two links in it:


#5

Hi @pcg108 - I can think of two things to try, judging from this: https://github.com/matrix-io/matrix-creator-quickstart/wiki/enable-spi and looking at how raspi-config works:

  1. Ensure that SPI is enabled. This is true by default in recent resinOS versions (what version are you using?). In the resin dashboard’s “Device configuration” page, check that “Define DT parameters / RESIN_HOST_CONFIG_dtparam” includes “spi=on” - default is "i2c_arm=on","spi=on","audio=on" and if that is set then it should be fine.

  2. Ensure that the SPI kernel module is loaded, by changing your CMD line in the Dockerfile to:

CMD modprobe spi-bcm2708 && python3 src/loop.py

(I’m not sure if it’s spi-bcm2708 or spi_bcm2708 so maybe try the second one if the first one doesn’t work)


#6

Hi @pcarranzav thank you for your reply! I double checked the device configuration and spi is indeed on, and I did step 2 as well (I had to change it to spi-bcm2835 since apparently the kernel module has been updated from spi-bcm2708 according to this)


#7

Hi @pcg108 - another idea. It seems like you need to program the FPGA on the Matrix on every boot, and this is handled by the matrixio-creator-init package https://github.com/cmetz/matrix-creator-init - but this works by starting a systemd service, and you don’t have systemd enabled in your container.

So I think what you could try is to start the script from that package manually:

CMD /usr/share/matrixlabs/matrixio-devices/matrix-init.bash && python3 src/loop.py

(Alternatively, you could enable systemd in your container by setting ENV INITSYSTEM on, and I think that would automatically start the service for you, but dunno if it would have other side effects in this case)


#8

Interesting, I tried this and I get the following:

INFO: [/dev/spidev0.0] was opened
MATRIX device has not been detected

Then when I try running even the LED demos which used to work, they no longer work since the Matrix Creator is not detected. Also in my dockerfile there was an

ENV INITSYSTEM on

already, and when I removed it the FPGA was reprogrammed but the same error (can’t send spi message) appears to be there


#10

@pcg108 that sounds odd.
Maybe try running it all after a reboot? Just to make sure it’s all starting from a clean state, I don’t know how the Creator works in that sense.

There’s also this: https://github.com/cmetz/matrix-creator-init/blob/master/matrix-mics.conf so another thing to try would be to modprobe those two modules too (though I can’t quite see how that would relate with an SPI message failing)


#20

Hi there!
Did you get a chance to dig into the suggestions from Pablo, we’re keen to get to this worked out, but need some help from your end.