Multiple SPI slaves

Hey all!

Having some troubles with multiple SPI slaves.
My sketches run great if I only use TFT and MCP2515 or TFT and MAX6675.

But if I run the trio, the max6675 blocks the SPI bus.
They all are connected on the same SPI(miso,mosi,clk)

Already tried to set the cs pins as outputs and going HIGH;going LOW,
but doesn't work.

Can someone give me a good hint?

Hardware used:
Arduino Pro
MCP2515
1.8 TFT
MAX6675

CS pins:
TFT pin10
MCP2515 pin 5
MAX6675 pin 6

Try to analyze the CS pins logic levels when you have the 3 connected.It can be only one device active at a time so perhaps in your code or library you are using it could be left the CS pin active, then try to send a message and does nothing.It would be wonderful if you have a logic analyzer to debug that ...
Without it a scope would be helpful.
Happy codding

I don't have a scoop or a LA.
What do I need to check in the libraries files?

Can't I just "over rule" the libraries, with some extra coded lines?
Like defines some pins as outputs and declare them high or low?

You shouldn't need to "over rule" the libraries. Post the code that fails.

Have you tried the MCP2515 and MAX6675 together without the TFT display?

Problem solved by switching from the max6675 to max31855 library!

Thx!! :slight_smile:

Are you certain this is not D5?

MCP_CAN  CAN0(5); // Set CS to pin 10

First thing you should do is disable all slave SPI device interfaces. I used variables for the CS pins maxCS, mcpCS, and tftCS below. Assign them pin numbers by #define.

void setup()
{
  Serial.begin(115200);
  
  pinMode(maxCS,OUTPUT);
  digitalWrite(maxCS,HIGH);

  pinMode(mcpCS,OUTPUT);
  digitalWrite(mcpCS,HIGH);

  pinMode(tftCS,OUTPUT);
  digitalWrite(tftCS,HIGH);