natevw / pi-spi

Simple RasPi SPI library (node.js)
93 stars 14 forks source link

raspberry pi 3b /dev/spidev0.1 will not be written #30

Closed atomroflman closed 5 years ago

atomroflman commented 5 years ago

Hi,

I've encountered the issue, that if I use SPI.initialize('/dev/spidev0.1') the write / transfer output will be directed to spidev0.0. I've tried initializing one and initializing before each transfer, none of it worked.

Any ideas, what went wrong?

Thanks.

natevw commented 5 years ago

Hello @atomroflman sorry to hear you are having trouble. I don't think it is a bug in the library, since this code only opens the Linux device files. So you might need to do more troubleshooting there.

I wonder though if this has something to do with the chip select lines on your Pi? If I'm remembering right all the devices /dev/spidev0.{x} will share the same clock and I/O lines so the only difference is the chip select. There's a diagram on page 15 of this Groking the Linux SPI Subsystem [pdf] presentation.

So that would be my first guess to look at, since I am not surprised you are also seeing most of the signals on spidev0.0 also but hopefully the chip select pin is changing depending on which device? These are the SPI0_CE0_N and SPI0_CE1_N and if I'm not mistaken the _N means they are inverted i.e. active low so the one you use actually gets pulled to 0.

natevw commented 5 years ago

I'm closing this since I don't think there's much more I can do here, but feel free to re-open if you have followup questions!