0
\$\begingroup\$

Would some kind soul be willing to review my circuit diagram that connects a barebones atmega328p with a microSD card? The partial circuit is here.

Details. This has already been made on a custom PCB, the pin connections to the microSD were based on diagrams like this.

Did I get them wrong?

I also used pullups on CS, D1 and D2 according to the way they did it at sparkfun, and per a general recommendation here.

The atmega328p is definitely working, I'm programming it using an ISP and it blinkulates da led, and runs some other i2c components. If the ISP is working then it seems to me at least MOSI/MISO/CLK were hooked up correctly.

Basically when the arduino code calls:

if (!SD.begin(CS_PIN)) { errorHalt("begin failed"); }

using the SdFat library, the chip hangs. I've used similar connections with SD breakout boards which seemed to work fine, but I'm going to double check the specific atmega328p <--> microSD connections again, very soon.

\$\endgroup\$
  • \$\begingroup\$ Signal names in the circuit look ok. Did you configure the SPI/GPIO correctly? E.g. "If SS is configured as an input, it must be held high to ensure Master SPI operation." Could be any kind of error though, µC configuration, incorrect wiring, power supply, ... \$\endgroup\$ – JimmyB Oct 27 '17 at 15:17
  • \$\begingroup\$ It's a reasonable question but I think that is handled by the library. Their example code is fairly clear, and when I used the same code it worked with an Uno/microSD module. \$\endgroup\$ – Owen White Oct 27 '17 at 16:49
  • \$\begingroup\$ have you tried it without the ISP being attached? \$\endgroup\$ – jp-jee Oct 28 '17 at 12:10
  • \$\begingroup\$ I did. All testing was with the ISP disconnected. One very strange thing is I have taken a microSD module, and connected that to the board through the ISP pins, and a jumper for CS, and it works. That allowed me to send signals to MISO, MOSI, SCK etc and show the exact same pins on the microSD connector are receiving signals all in correct order. The module works, the microSD on the board does not. \$\endgroup\$ – Owen White Oct 29 '17 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.