SPI problem with radio and SD devices

I am trying to save data on a SD card through rf24 radio link and add the time, but can't get them to work together. the radio link works ok without the SD but not when the SD device is in place. The TX gets ack when SD device not fitted but no ack when it is fitted.
I have separate CS pins for each device, pin 10 for radio, pin 14 for SD, and switch them on/off when needed with no effect.
Below is a simplified test prog:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
const int SDCS = 14; // CS pin of SD card
const int RadCE = 9; // CS pin of Radio card
const int RadCS = 10; // CS pin of Radio card
RF24 radio(RadCE, RadCS); // Tx/Rx Pins 9-CE, 10-CSN, 11-MOSI, 12-MISO, 13-SCK, 3.3V, GND
const byte address[6] = {"00003"}; // 5 letter pipe/address string of nodes
char dataReceived[10]; // Max text chars, matching Tx
int input = 0; // test data

void Receive_Remote_Count() { // Receive data from remote sensors
digitalWrite(RadCS, LOW);

if (radio.available()) {
radio.read(&dataReceived, sizeof(dataReceived)); // Receive "count" & no. of bit
Serial.println(dataReceived);
input = 1; // Data to save
}
else {
input = 0;
}
Serial.print(" Receiving "); Serial.println(input);
digitalWrite(RadCS, HIGH);

}

void setup() {
Serial.begin(9600);
Serial.println("Radio Test");
delay(1000); // Give time to read

radio.begin();
radio.setDataRate( RF24_250KBPS );
radio.setPALevel(RF24_PA_LOW); // Power setting MIN, LOW, HIGH or MAX
radio.openReadingPipe(0, address);
radio.startListening(); // Set as Receiver

SPI.begin();
pinMode(SDCS, OUTPUT);
digitalWrite(RadCS, HIGH);
digitalWrite(SDCS, HIGH);
}

void loop() {
Receive_Remote_Count();
delay(1000);
}

The easier you make it to read and copy your code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

A number of cheap SD modules don't release the MISO line when the SD module is not selected. I think that that is a possibe cause of the problem.

A link to the (schematic of the) module can be ueful.

Hi, I am using Catalex MicroSD card adapter

On the cards, Chip Select is listed as CS on SD card, whereas the radio card adapter its CSN. The CS on radio card has to be HIGH for Off. Is it LOW for Off on the SD card?

Looking at the schematic you provided, then what @sterretje guessed is correct. The MISO signal coming from the SD card runs through the buffer IC1D which is always enabled, which means that the MISO signal on pin 4 is always active.

From memory, that is one of them that is problematic ( thanks @markd333 for confirming that my memory is not that bad :wink: ). Do a search (e.g. arduino catalex problem - Google Search).

One possible solution is mentioned in https://forum.arduino.cc/t/catalex-microsd-card-reader-issues/581003/6; no idea if it works but I don't think it's correct. And another one is arduino:sd-card-modules [fryktoria.com].

@sterretje , yes, I agree. :+1:t4: The proposed solution at https://forum.arduino.cc/t/catalex-microsd-card-reader-issues/581003/3 doesn't solve the problem. The MISO signal is still active all the time.

Some solutions on other modules have been to bypass the buffer circuitry for the MISO signal completely. I think some sort of surgery is going to be needed on that SD module in order to make it behave with other SPI devices.

Off the top of my head, I wonder if lifting pin 13 of the 74ABT125 and connecting it to pin 1 of the header (the CS signal) would work.

Thanks for your help, folks. I will try the things suggested and let you know, when I have nerve to try. The Catalex card is useless on multi-SPI as it is.