Use multiple SPIs on RPI (Raspberry Pi) 4B?
7 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Sylvain
on 14 Apr 2022
Edited: Sylvain
on 14 Apr 2022
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:
See Also
Categories
Find more on MATLAB Support Package for Raspberry Pi Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!