Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6970

General • Multiple devices on the SPI bus

$
0
0
I have some hardware where two SPI devices share the same MOSI/MISO/CLK pins, but have separate CS pins. By judicious use of the hardware/spi SDK calls to make sure that I set the bus speed (baudrate) and format before actually talking to the devices, I can share a single SPI (either 0 or 1).

However, I also have some hardware where there are separate MOSI/MISO/CLK connections.

I have code that checks my MOSI/MISO/CLK pin numbers to ensure that the relevant pins support SPI.
If I have the following code:

Code:

gpio_set_function (10, GPIO_FUNC_SPI);  // SPI1 SCKgpio_set_function (14, GPIO_FUNC_SPI);  // SPI1 SCKgpio_set_function (11, GPIO_FUNC_SPI);  // SPI1 TXgpio_set_function (15, GPIO_FUNC_SPI);  // SPI1 TXgpio_set_function (8, GPIO_FUNC_SPI);    // SPI1 RXgpio_set_function (12, GPIO_FUNC_SPI);  // SPI1 RX
then will it do what I hope, which is to effectively give me two pins for each of the MOSI/MISO/CLK signals?

Obviously, I can't use both devices simultaneously, and I have to manage CS for each of them myself (which I am doing for the first case anyway).

The use case (at the moment) is that I have TFT boards which also have touchscreens. Some have 14 pin connectors with separate SPI connections for display and touch, while others have 11 pin connectors where the SPI connections are already 'shared' on the module.

I am intending to use SPI#0 for a Wiznet W5500 module (wired ethernet), and am wanting to design some carrier boards which I can plug a Pico into, along with the TFT and Wiznet modules (sometimes DuPont jumpers just won't cut it...).

Has anyone already created such a board using Kicad or fritzing? Previously I have designed boards for Pi2/3 and had them manufactured by Aisler.

Statistics: Posted by SteveSpencer — Tue Nov 18, 2025 4:09 pm — Replies 2 — Views 111



Viewing all articles
Browse latest Browse all 6970

Trending Articles