Use multiple SPIs on RPI (Raspberry Pi) 4B?
7 次查看(过去 30 天)
显示 更早的评论
I am using a RPI 4B board to connect and use multiple SPI devices simultaneously. The RPI 4B board provides upto 6 SPI connections.
My question is that is it possible to switch between SPIs (for eg select SPI1, SPI2...) using MATLAB® Support Package for Raspberry Pi™?
I have already installed the "mathworks_raspbian_R21.1.0" image on the RPI and successfully booted the device. I am also able to connect to the device on the IP address. However, it only shows two CE {CE0, CE1} which I assume are only for SPI0 and there is no option to select SPI1 or others.
P.S. When connected to my RPI, the boardname is detected as "Raspberry Pi 2 Model B" instead of "Raspberry Pi 4 Model B", which I also don't understand why?
0 个评论
回答(1 个)
Sylvain
2022-4-14
编辑:Sylvain
2022-4-14
Hi Arish,
I faced the same issue and found that the Raspberry Pi is limited with GPIOs. Hence I am using microcontrollers to handle the SPI buses and bridge back to the Rpi using i2c. This works like a charm but require you to program microcontrollers.
An alternative would be to use the GPIO as CS lines, but you won't have a lot of them available. You could use a multiplexer for the SPI0 and SPI1 using an i2c intergrated circuit.
I learned the hard way the limitation of the RPi, PWM frequency capped to 8 kHz, only few GPIOs, and timing might be an issue (models running below 0.1s time step require some care).
No idea about why Rpi 4 is detected as Rpi 2, I just figured out I have the same issue:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Support Package for Raspberry Pi Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!