Closed jbush001 closed 6 years ago
SD Pin | SD Mode | SPI Mode | FPGA PIN |
---|---|---|---|
1 | CD/DAT3 | CS | PIN_AC14 |
2 | CMD | DI | PIN_AD14 |
3 | VSS1 | VSS1 | |
4 | VDD | VDD | |
5 | CLK | SCLK | PIN_AE13 |
6 | VSS2 | VSS2 | |
7 | DAT0 | DO | PIN_AE14 |
8 | DAT1 | PIN_AF13 | |
9 | DAT2 | PIN_AB14 |
Schematic for DE2-115 board:
Pin information from DE2-115 data sheet:
SPI/SD pin mapping:
https://en.wikipedia.org/wiki/Secure_Digital#Transfer_modes
FPGA pin configuration:
I/O configuration:
Mapping to SPI controller:
Simulation waveforms. The times at the top aren't accurate, is they assume a clock speed of 1 GHz rather than the 50 MHz that board runs at. Here is the initialization clock sequence (80 clocks with CS high).
Here is CMD0:
01000000 00000000 00000000 00000000 00000000 10010101
40 00 00 00 00 95
Closeup showing bit phase:
output in falling edge, sample on rising edge (mode 0)
Verified 250 system clocks per spi clock: 200kHz SPI clock at 50Mhz system clock. I tried slowing this down by increasing the divider on the dev board to ensure there wasn't an issue with clock speed, but there was no effect.
While waiting for response. CS is still low, DI is high.
Tried with 3 cards, all failed in the same way (no response to initial CMD0)
I hooked up a logic analyzer and it responded to the first command.
Unplugged the logic analyzer and it started failing again... Seems like this might be a connector issue.
(I should be sending CMD8 instead of CMD1 after CMD0, but that is a separate issue)
I also had to turn the board upside down to attach the probes. In the normal position, gravity pulls the card down away from the pins. Upside down, it pushes them against them. I might try sticking a piece of paper in with the card to apply more pressure.
I tried sticking paper in, turning the board over with no success. However, it works consistently if the probes are attached...
Hmm, what board is that BTW?
DE2-115
Ah didn't know if you were still using that. I actually bought one of those for myself when this project got started up years ago. I should brush it off.
Times out initializing card in SPI mode. It seems to never read anything but 0xff from the data out (DO) pin after sending CMD0.