я когдато писал на VHDL чтение карты в SPI режиме - вот фрагмент инициализации
вдруг пригодится ) - писал по даташиту на сд карты и даже работало )Код:--INITIALISATION start when SD_INIT => sd_stage <= CS_HI_80_PULSES; counter <= 127; --128 pulses while CS is high, CMD must be high too when CS_HI_80_PULSES => counter <= counter - 1; if counter = 0 then sd_stage <= SEND_CMD_00; SD_CS_n <= '0'; end if; when SEND_CMD_00 => sd_stage <= SEND_CMD; next_stage <= SEND_CMD_08; command <= X"FF400000000095"; recv_bits <= 8; -- responce 8 bits when SEND_CMD_08 => next_stage <= SEND_CMD_55; sd_stage <= SEND_CMD; command <= X"FF48000001AA87"; recv_bits <= 40; -- responce 40 bits when SEND_CMD_55 => sd_ver_2 <= not responce(34); sd_stage <= SEND_CMD; next_stage <= SEND_ACMD_41; command <= X"FF7700000000FF"; recv_bits <= 8; when SEND_ACMD_41 => sd_stage <= SEND_CMD; next_stage <= PROCESSING_INIT_1; command <= X"FF69" & '0' & sd_ver_2 & "000000" & X"000000FF"; recv_bits <= 8; when PROCESSING_INIT_1 => if responce(0) = '0' then if sd_ver_2 = '0' then sd_stage <= READY; sdhc <= '0'; else sd_stage <= SEND_CMD_59; end if; else sd_stage <= SEND_CMD_55; end if; when SEND_CMD_59 => sd_stage <= SEND_CMD; next_stage <= PROCESSING_INIT_2; command <= X"FF7B00000000FF"; recv_bits <= 8; when PROCESSING_INIT_2 => if responce (6 downto 0) = "0000000" then sd_stage <= SEND_CMD_16; else sd_stage <= SEND_CMD_59; end if; when SEND_CMD_16 => sd_stage <= SEND_CMD; next_stage <= PROCESSING_INIT_3; command <= X"FF5000000200FF"; recv_bits <= 8; when PROCESSING_INIT_3 => if responce (6 downto 0) = "0000000" then -- if sd_ver_2 = '0' then -- sd_stage <= READY; -- sdhc <= '0'; -- else sd_stage <= SEND_CMD; next_stage <= PROCESSING_INIT_4; command <= X"FF7A00000000FF"; recv_bits <= 40; -- end if; else sd_stage <= SEND_CMD_16; end if; when PROCESSING_INIT_4 => sdhc <= responce(30); sd_stage <= READY; --INITIALISATION end




Ответить с цитированием