Dual SPI Advice

Searched around and couldn't find conclusive information regarding a detail when using two SPI devices.

Is there an advantage in using two separate SPI ports in comparison to two devices on the same port (implemented correctly in software)?

Reason for asking the question:
Built a remote using a 240x240pixel SPI display and an SPI transceiver.

Would like to use less pins if dual SPI on the same port has no hardware disadvantage.

Any experience or advice?

Appreciate the time.

Only reasons I can think of:

Some devices are not fully compliant with SPI, for example don't have a CS, still listen when you don't want to or don't release the datalines.

And and using multiple SPI buses can mean an improvement in speed, especially for devices with DMA.

What kind of arduino are you using? As mentioned above, unless you are doing some high speed data stuff that requires using DMA or dual cpus (like esp32) then a single CPU can only communicate with one SPI device at a time anyway, so there's no disadvantage to using a single SPI port.

You are building a remote? Remote what?

I have 4 SPI devices connected to one uController (micro controller) on the same port. I just use different CS pins to let the device know that it is being communicated with. Quite simple.

septillion:
Only reasons I can think of:

Some devices are not fully compliant with SPI, for example don't have a CS, still listen when you don't want to or don't release the datalines.

And and using multiple SPI buses can mean an improvement in speed, especially for devices with DMA.

Both devices have a CS pin and don't seem to have DMA. Makes sense.

PaulRB:
What kind of arduino are you using? As mentioned above, unless you are doing some high speed data stuff that requires using DMA or dual cpus (like esp32) then a single CPU can only communicate with one SPI device at a time anyway, so there's no disadvantage to using a single SPI port.

You are building a remote? Remote what?

Not sure if it's blasphemy, i'm using the Arduino IDE with a Teensy 3.6 and would like to switch to T4.
It's a small remote controller with a Adafruit 1.54" 240x240 display and nRF24 TX.

T4?

Idahowalker:
I have 4 SPI devices connected to one uController (micro controller) on the same port. I just use different CS pins to let the device know that it is being communicated with. Quite simple.

Yes I tried both methods and they both work. I was curious about underlying principles and if there is a hardware advantage for a separate SPI bus.

I guess multiple SPIs are meant for devices without CS. Why else would you need more than one?

drSnap:
I guess multiple SPIs are meant for devices without CS. Why else would you need more than one?

For high speed data stuff, like I said. One SPI bus could be communicating with one device at the same time as a second SPI bus communicates with a second device, rather than communicating in turn. Do to this you need multiple CPUs, or by using DMA (direct memory access).

I looked up teensy 4. Very impressive. 3.6 also very impressive. What kind of remote could need such speed/power?

Neither the display or transceiver have DMA and since the processor is single core I guess devices one same SPI bus should pose no disadvantage to a separate bus.

Will test it out though.


The remote itself does not need that power but it's great for fast refresh rates in the form factor of an arduino nano.

A problem will arise if the SPI devices do not release (go tristate) the MISO line when their CS is not asserted so another device can use it. Many microSD card modules have this problem. The other two lines, MOSI and CLK, as well as CS of course, are outputs from the processor, so no problem there.

drSnap:
Neither the display or transceiver have DMA

Its not displays or transceivers that have DMA, it's the processor. Its like a mini processor core inside the CPU chip that can do only one simple task: read data from memory and pass it to the SPI interface, or read from the SPI interface and write it into memory. Sophisticated processors can have several DMA "channels" and multiple CPU cores, so one DMA channel can be reading data from one SPI interface, one or more processor cores can be processing that data, and another DMA channel can be writing the results to a second SPI interface, and all this going on in parallel.

PaulRB:
Sophisticated processors can have several DMA "channels"

Like the Teensy 3.6 :smiley:

PaulRB:
Its not displays or transceivers that have DMA, it's the processor. Its like a mini processor core inside the CPU chip that can do only one simple task: read data from memory and pass it to the SPI interface, or read from the SPI interface and write it into memory. Sophisticated processors can have several DMA "channels" and multiple CPU cores, so one DMA channel can be reading data from one SPI interface, one or more processor cores can be processing that data, and another DMA channel can be writing the results to a second SPI interface, and all this going on in parallel.

Starting reading about DMA and I understand now. Will research the implementation for the display since DMA is available on the mcu. Thanks

drSnap:
Yes I tried both methods and they both work. I was curious about underlying principles and if there is a hardware advantage for a separate SPI bus.

I guess multiple SPIs are meant for devices without CS. Why else would you need more than one?

More like a want.

One could use an ESP32 and 2 SPI buss assigned tasks on different cores, thus using 2 SPI devices at the same time.

Consider a self calibrating magnetometer where, instead of reading one SPI magnetometer at a time, each magnetometer can be read at the same time, where the result set can be integrated from a same time Gauss reading.