I am trying to bit bang SPI for a SD Card, I went through this SD Card datasheet and I couldn't find any information regarding the mode that needs to be used. If I missed, please point it out.

Else what mode would be standard if nothing is mentioned? What CPOL and phase should I use?

  • 1
    \$\begingroup\$ Shouldn't you be able to pull out that information from 3.4.5, the bus timing figure? \$\endgroup\$ – Scott Seidman Oct 8 '18 at 13:05
  • \$\begingroup\$ What do you mean by Mode ? if it's line polarity (active high/low) it's on the figure Figure 3-6. \$\endgroup\$ – Damien Oct 8 '18 at 13:08
  • \$\begingroup\$ @ScottSeidman Kinda confusing because regarding the phase, sampling and transitioning takes place on edges, that is what I know but this image says that the data should be set up before the rising edge and should be changed after rising edge. That is what I conclude. \$\endgroup\$ – MaNyYaCk Oct 8 '18 at 13:18
  • \$\begingroup\$ @ScottSeidman Ok. Mode 2 is my guess? \$\endgroup\$ – MaNyYaCk Oct 8 '18 at 13:21
  • \$\begingroup\$ @Damien I believe that is regarding the voltage level. \$\endgroup\$ – MaNyYaCk Oct 8 '18 at 13:22

From the datasheet you link to enter image description here

The timing diagram at 3.4.5 shows that the clock idles low (CPOL=0), and that out changes on the clock trailing edge and in gets read on the rising edge (CPHA=0), which is SPI mode 0.

  • 1
    \$\begingroup\$ Thanks, Honestly I absolutely missed this diagram and was searching in the text if it is mentioned somewhere. This was a nice lesson @ reading datasheet \$\endgroup\$ – MaNyYaCk Oct 8 '18 at 13:54

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.