T4 SDIO SD Card "initialization failed!"

domingo

Well-known member
I modified a SPI SD card adapter to work as SDIO, soldered to the back pins on the T4.

I cut the connections between some of the pins of the SD adapter, so now each pad goes exclusively to each pin. This was many times checked with a multimeter. Then I soldered cables (CAT5) from the adapter to the Teensy, following the normal pinout.

When I try example codes like CardInfo.ino I get the error "Initializing SD card...initialization failed!"

Any idea what might be happening? I checked the connections and there are no shorts between the pads. Some of them have a difference of a few hundreds ohm, which I assume is normal. My mind is turning in circles right now, below a few pics of my setup.

IMG_0230.jpg
IMG_0232.jpg
IMG_0231.jpg
 
Not sure of the total length based on the photo array? It is a fast device so length won't help.

Also double check the wire association. Getting it all right took some revision for a PCB design linked below.

See Here and confirm the names to the Teensy Card and T_4.0 silkscreen :: Teensy-4-0-Breakout-Kit
 
This morning I made the cables shorter (ca. 2cm) but still not working. Is it possible to trace the problem with the error code?

SD errorCode: SD_CARD_ERROR_ACMD41 = 0x17
SD errorData = 0x0

The SD card is 128GB, could it be maybe a card size/format problem?

IMG_0233.jpg
 
This morning I made the cables shorter (ca. 2cm) but still not working. Is it possible to trace the problem with the error code?

SD errorCode: SD_CARD_ERROR_ACMD41 = 0x17
SD errorData = 0x0

The SD card is 128GB, could it be maybe a card size/format problem?

If you run the sketch SDErrorCodes.ino it will give you a list of the error codes. When you run the sketch ACMD41 error code shows:
Code:
0X17,SD_CARD_ERROR_ACMD41 - Activate card initialization
which pretty much states that it fails to initialize.

I have run aa 512GB sd card on the T4 without issue but that does not rule out a SD Card problem Some early version of sd cards have been known to fail. You can try a different card to see if it has the same problem.

The other thing is to make sure the connections are correct between the connector and the T4.
 
Do you have a datasheet or link to technical info on that SD socket? I see 2 pins are unused. Are you sure those are the card and write protect switches?
 
I tried a different 256GB card and the error now is SD_CARD_ERROR_CMD2 = 0x2,0x0 (SDIO read CID). Means it cannot even read the card ID I guess.

I'll try soldering VDD and GND directly to the other pins on the teensy, since I find strange that the ground of the empty pads of the SD card (VSS1) drop only 2.2v, although they are internally connected to VSS2 inside the card. VSS2 drops 3.3v normal.
 
Hi Paul,

The adapter is a very common one, probably the most commonly sold and what I could find where I live. I cut all the circuitry to be left only with the SD socket contacts. Then I found out that there where some internal connections under the socket, so I disassembled the metal socket and cut the connections between the pads inside. There was a particularly conflictive one linking the two pads on the extremes (DAT2 and DAT1), they came like that since they are not used in SPI I suppose. I separated them and voilá, all pads became an individual connection to each pin. I might desolder the SD socket again and take pictures to it.
The two empty pins correspond to VSS1, which is only used for bigger SD cards. Both connect to the same pad on the SD Card. Should I ground them?

Screen Shot 2022-01-03 at 11.49.19.png
 
Last edited:
I'm using Teensyduino 1.55 maybe that's the problem.

Is the CD pin relevant at all? In attachment the board inside. I opened all the traces (incl. CD), so the board became a dummy pin-to-pin socket.

IMG_0235.jpg
IMG_0237.jpg
 
This morning I made the cables shorter (ca. 2cm) but still not working. Is it possible to trace the problem with the error code?

SD errorCode: SD_CARD_ERROR_ACMD41 = 0x17
SD errorData = 0x0

ACMD41 is not the first command sent (CMD0 and CMD8 precede it) and it appears that this error code is sent if there is a timeout waiting for a response. I can't think of any reason why a card wouldn't respond at all to ACMD41. Unless it doesn't like the voltage range specified in the argument. Which is a pretty simple 3.2-3.4V and that shouldn't be a problem.
 
After installing Teensyduino 1.56 the error changed to:

0X25,SD_CARD_ERROR_DMA (DMA transfer failed)

I tried many things the whole day. Soldered again everything suspicious, but no success. I noticed that there was soldering debris between the SDIO pads and some of them were showing low resistance between them; let's say around 100k between DATA3 and DATA2 for example. After cleaning a soldering most of it again I get isolation over 2M between all adjacent pins, good sign, but still no communication with the card. To make things simpler I wired the 3.3v and GND directly, the soldering job seems well done :confused: I'm thinking that maybe I broke the M7's SDIO section inside the chip because of the previously mentioned bad isolation, but not that sure as to buy a new T4 yet. Wonder how could I verify that.

Any clues are welcome!
 
Perhaps to check the pins making it to the adapter: MicroMod-Beta-Testing

New Pin Test there has - this when running using SerMon to send a '2' should activate this test:
Code:
  else if ( xx == 2 )
  {
    // Paul's code changes FREQ to each pin
    // uint32_t xx = 2; // change this before compile - or add query in setup() to set
    loopPaulHz();
  }

That should put out a DMM measurable voltage/freq unique to each of those pins IIRC.
 
Thank you @defragster, just what I needed.

Long story: I measured the frequency of all pins after uploading the test code and everything was alright:

156Hz dat3
312Hz dat2
4994Hz cmd
2497Hz clk
1248Hz dat0
620Hz dat1

Then I opened again the socket and tested the card holding it directly on the legs. After a few attempts it worked :) Mystery solved. Probably what happened is that when soldering the pins on the socket the small legs that touch the Card's pads slightly change their position, since their only hold inside is the point where I soldered the cables outside.

I thought reusing/hacking this adapter was trivial, who would have imagined anyways... thanks for all the support. I must repair these legs now or simply wait for a proper socket/adapter.

Happy ending cheers!
 
I only used p#14 Paul code. As below:

Code:
// Create 6 different frequencies on the SD card pins
// for easy testing whether all 6 signals are connected.

void setup()
{
  GPIO8_GDIR |= (0x3F << 12);
}

uint32_t n=0;

void loop()
{
  n++;
  GPIO8_DR = (GPIO8_DR & ~(0x3F << 12)) | ((n & 0x3F) << 12);
  delayMicroseconds(100);
}
 
I only used p#14 Paul code. As below:
...

Thanks, I was just wondering if that code added as p#13 was tested to work given it is a 'New' version and not sure I tested that code path recently.

The NewPinTest allows exercising ALL pins.
 
Back
Top