SPI devices block each other?

I have a small project with a LoRa module, a display and the Arduino MEGA 2560. The display and the LoRa module works perfectly alone, but when I use both parts together only the display works.

After searching in the Internet, I found the information, that it is possible to use multiple SPI devices with the SS Pin (Slave Select Pin), but I couldn't found a SS pin on the display and the LoRa module.

My parts:

Display: https://www.amazon.de/gp/product/B00YQ08U70/ (320x240 pixels, 3.2")
Display Shield: https://www.amazon.de/gp/product/B00Y0XV1KG/

LoRa module: https://www.amazon.com/gp/product/B01HYO608A/

Libraries:

Display: UTFT: UTFT - Rinky-Dink Electronics
LoRa: RadioHead: GitHub - PaulStoffregen/RadioHead: Version of RadioHead library for Teensy boards

Connections: Image Attachment

Thanks for your advice.

I couldn't found a SS pin on the display and the LoRa module.

It is marked "CS" on the LoRa module.

Knowing which pins your are using without knowing where they are connected is not that useful.

You really need to show us the schematics, where the pins are connected when the LoRa device and display are working.

And the code.

Thanks for your reply!!!

LoRa -> Arduino
VIN -> 5V
GND -> GND
G0 -> 20
RST -> 21

(Pins in the middle of Arduino MEGA)
SCK -> SCK
MISO -> MISO
MOSI -> MOSI

Display:
With this shield: https://www.amazon.de/AptoFun-2-4-TFT-LCD-Arduino/dp/B00Y0XV1KG/

Alwin07:
Thanks for your reply!!!

LoRa -> Arduino
VIN -> 5V
GND -> GND
G0 -> 20
RST -> 21
SCK -> SCK
MISO -> MISO
MOSI -> MOSI

That cannot be correct, there is no connection for the CS\SS on the LoRa device.

Am very sorry! :confused:

I forgot: CS -> 9

Alwin07:
After searching in the Internet, I found the information, that it is possible to use multiple SPI devices with the SS Pin (Slave Select Pin), but I couldn't found a SS pin on the display and the LoRa module.

Do some more searching and you will find that each SPI device needs its own SS\CS pin even if your using only one device.

Alwin07:
Display:
With this shield: https://www.amazon.de/AptoFun-2-4-TFT-LCD-Arduino/dp/B00Y0XV1KG/

Not a lot of help is it ?

We can only guess at the connections the shield is using from that link (i dont speak German).

There is a good reason for asking you for a schematic of how its all connected and for the code....................

Yes, I already know it! But my problem is that I couln't find the CS/SS Pin or Schematic of the display because it is connected with a strange shield.

If it helps I use this contrustructor:
UTFT screen(ILI9341_16,38,39,40,41)
UTFT(byte model, int RS, int WR, int CS, int RST, int SER=0);

That means 40 is the SS pin?

Alwin07:
Yes, I already know it! But my problem is that I couln't find the CS/SS Pin or Schematic of the display because it is connected with a strange shield.

If it helps I use this contrustructor:
UTFT screen(ILI9341_16,38,39,40,41)
UTFT(byte model, int RS, int WR, int CS, int RST, int SER=0);

That means 40 is the SS pin?

Yes, very likley.

And if you had posted the code you are using as requested we would have been able to tell you that several post ago.

Yes thanks.

But sadly my code with the pins is not working :frowning:

Code:

void enableRFM(){
  digitalWrite(DISPLAY_CS, LOW);
  digitalWrite(RFM95_CS, HIGH);
}
void disableRFM(){
  digitalWrite(DISPLAY_CS, HIGH);
  digitalWrite(RFM95_CS, LOW);
}

I have also tried to change HIGH and LOW.

There is a major "gotcha" with SPI, which is that many chips are not SPI compliant, yet claim to be
so. And even so if different devices use different clock modes and phases they may be impossible
to reconcile.

You should check in any datasheet than an SPI device genuinely releases the MISO line to high-impedance
state whenever CS is high, and that it completely ignores clocks when CS is high.

The common offenders seem to be chips which claim to support I2C and SPI using the same pins - this
is not possible to do and allow sharing on the SPI bus.