I've made a PCB with multiple components (Temp, Barometer, Accelerometer) also with an Adafruit Micro SD module and W25Q32FV flash chip, but cannot get the SD or the flash chip to function using the basic example sketches. Every other module works perfectly.
The SD is connected to the Arduino Nano pins as follows:
MISO -> 15
MOSI -> 14
CS -> 13 (Reading this can go to any pin and this was convenient)
CLK -> 16
5V -> 5V
While the Flash:
CS -> 12
VCC -> 3.3V
All else the same
I have continuity tested everything and there is no issues with connection and the light on the SD module flashes on connecting the USB, but I am unable to initialise either device.
Those are the nominal data pins as labeled on the Nano module, not the physical pin numbers. That's assuming you are using the built-in SPI peripheral.
Might have referred to the chip pins incorrectly, but they're connected in the right spots. So if I have the CS connected to D10/SS it would be written as 10 in the code? That might be the issue then.
Edit: All right that lights the SD module up, but still doesn't read. I'll have a play around with the flash chip which might be causing issues.
With multiple SPI devices, i always assumed that the library would switch the CS pin 'HIGH' after use, but this is not always the case. Some SPI devices may be in a constant 'ON' (read 'LOW') state.
my solution was to add before any calls to the SD card.
int CSstate = digitalRead(FLASH_CS);
digitalWrite(FLASH_CS, HIGH);
(....... the SD code)
digitalWrite(FLASH_CS, CSstate);
and make sure that the CS pin for the SD card is kept HIGH normally as well (also initially)
You might try running the CardInfo example, paying attention to the CS pin assignment, just to be sure you have it connected correctly (there won't be any errors in the code). And yes, the pin numbers in the code are the Arduino pin numbers, not the Atmel chip pin numbers.
Most SD card libraries only deal with SD and SDHC cards, not SDXC cards (over 32GB I think).
Typical microSD card modules have a problem of not releasing the MISO line when CS is not asserted, making it impossible for more than one SPI device to be used. But you said Adafruit, and their modules are correct as far as I know. But it might still be instructive to see if the SD card alone works, and if the Flash chip alone works, and it's only both together that doesn't work.
There is still a potential voltage issue. I assume your SD module has a 3.3V regulator and a voltage translation chip to convert the Nano's 5V outputs on MOSI, SCK and CS to 3.3V, which is what the card runs at. But what about the flash chip? Is is running at 3.3V? If so, you probably shouldn't be feeding 5V lines to it. Could you post a schematic of how this is all hooked up?
I think trying each SPI device alone may be the best approach, and using example sketches from the libraries so you know there are no software errors.
It may have nothing to do with your problem, but the GPIO outputs of the Nano will be 5V when high, and you're running the flash chip at 3.3V. That violates the flash's Absolute Maximum for the voltage on any pin:
One alternative is to run the 328P at 3.3V and 8MHz. Then maybe everything can run at 3.3V, and no translation is needed. But I'm not sure the GY-291 would run at 3.3V.