Skip to content

Commit

Permalink
fpga: SD card test
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrilKoe committed Aug 10, 2023
1 parent 0156d56 commit f706ff4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions target/xilinx/constraints/genesys2.xdc
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ set_property -dict { PACKAGE_PIN Y20 IOSTANDARD LVCMOS33 } [get_ports { uart_r
## SD Card
set_property -dict { PACKAGE_PIN P28 IOSTANDARD LVCMOS33 } [get_ports { sd_cd_i }]; #IO_L8N_T1_D12_14 Sch=sd_cd
set_property -dict { PACKAGE_PIN R29 IOSTANDARD LVCMOS33 } [get_ports { sd_cmd_o }]; #IO_L7N_T1_D10_14 Sch=sd_cmd
set_property -dict { PACKAGE_PIN R26 IOSTANDARD LVCMOS33 } [get_ports { sd_d_io[0] }]; #IO_L10N_T1_D15_14 Sch=sd_dat[0]
set_property -dict { PACKAGE_PIN R30 IOSTANDARD LVCMOS33 } [get_ports { sd_d_io[1] }]; #IO_L9P_T1_DQS_14 Sch=sd_dat[1]
set_property -dict { PACKAGE_PIN P29 IOSTANDARD LVCMOS33 } [get_ports { sd_d_io[2] }]; #IO_L7P_T1_D09_14 Sch=sd_dat[2]
set_property -dict { PACKAGE_PIN T30 IOSTANDARD LVCMOS33 } [get_ports { sd_d_io[3] }]; #IO_L9N_T1_DQS_D13_14 Sch=sd_dat[3]
set_property -dict { PACKAGE_PIN R26 IOSTANDARD LVCMOS33 } [get_ports { sd_d_i }]; #IO_L10N_T1_D15_14 Sch=sd_dat[0]
set_property -dict { PACKAGE_PIN R30 IOSTANDARD LVCMOS33 } [get_ports { sd_d_io_1 }]; #IO_L9P_T1_DQS_14 Sch=sd_dat[1]
set_property -dict { PACKAGE_PIN P29 IOSTANDARD LVCMOS33 } [get_ports { sd_d_io_2 }]; #IO_L7P_T1_D09_14 Sch=sd_dat[2]
set_property -dict { PACKAGE_PIN T30 IOSTANDARD LVCMOS33 } [get_ports { sd_cs }]; #IO_L9N_T1_DQS_D13_14 Sch=sd_dat[3]
set_property -dict { PACKAGE_PIN AE24 IOSTANDARD LVCMOS33 } [get_ports { sd_reset_o }]; #IO_L12N_T1_MRCC_12 Sch=sd_reset
set_property -dict { PACKAGE_PIN R28 IOSTANDARD LVCMOS33 } [get_ports { sd_sclk_o }]; #IO_L11P_T1_SRCC_14 Sch=sd_sclk

Expand Down
12 changes: 8 additions & 4 deletions target/xilinx/src/cheshire_top_xilinx.sv
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ module cheshire_top_xilinx
`ifdef USE_SD
input logic sd_cd_i, // Card Detect
output logic sd_cmd_o,
inout wire [3:0] sd_d_io,
inout logic sd_d_io_1,
inout logic sd_d_io_2,
output logic sd_cs,
input logic sd_d_i,
output logic sd_reset_o,
output logic sd_sclk_o,
`endif
Expand Down Expand Up @@ -376,13 +379,14 @@ module cheshire_top_xilinx
// SCK - SD CLK signal
assign sd_sclk_o = spi_sck_en ? spi_sck_soc : 1'b1;
// CS - SD DAT3 signal
assign sd_d_io[3] = spi_cs_en[0] ? spi_cs_soc[0] : 1'b1;
assign sd_cs = spi_cs_en[0] ? spi_cs_soc[0] : 1'b1;
// MOSI - SD CMD signal
assign sd_cmd_o = spi_sd_en[0] ? spi_sd_soc_out[0] : 1'b1;
// MISO - SD DAT0 signal
assign spi_sd_soc_in[1] = sd_d_io[0];
assign spi_sd_soc_in[1] = sd_d_i;
// SD DAT1 and DAT2 signal tie-off - Not used for SPI mode
assign sd_d_io[2:1] = 2'b11;
assign sd_d_io_1 = 1'b1;
assign sd_d_io_2 = 1'b1;
// Bind input side of SoC low for output signals
assign spi_sd_soc_in[0] = 1'b0;
assign spi_sd_soc_in[2] = 1'b0;
Expand Down

0 comments on commit f706ff4

Please sign in to comment.