no SD_CLK signal on uSDHC2

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

no SD_CLK signal on uSDHC2

1,159 次查看
hailiu
Contributor IV

I am trying to config the uSDHC2 to use SD card based on the SDK code, but there is no SD_CLK signal output, I read the pres_state register, its value is 0xFF858088, it shows the SD_CLK is gating off. I checked the Vend_spec register value, its value is 0x20007809, seems all clocks are enabled.When I use INITA, there is no 80 clocks generated.

0 项奖励
10 回复数

1,139 次查看
hailiu
Contributor IV

Dear igor,

sorry for forgetting to mention the processor. I use iMX6 solo processor, the module is uSDHC2.

following is the initialization code, when host_init_active(usdhcBase) is executed, a 80 cycles clock should be observed on SD_CLK, I have see nothing.

int card_init(unsigned int usdhcBase,int bus_width)
{
int init_status = FAIL;

/* Software Reset to Interface Controller */
host_reset(usdhcBase, ESDHC_ONE_BIT_SUPPORT, LITTLEENDIAN);

/* card detect */
if(card_detect_test_en)
{
if(usdhc_card_detected(usdhcBase) == false)
{
printf("*Card on SD is not inserted.\n");
return FAIL;
}
else
printf("Card on SD is inserted.\n");
}

/* write protect */
if(write_protect_test_en)
{
if(usdhc_write_protected(usdhcBase) == true) {
printf("*Card on SD%d is write protected.\n", usdhcBase);
return FAIL;
}
else
printf("Card on SD%d is not write protected.\n", usdhcBase);
}

/* Initialize interrupt */
if (card_init_interrupt(usdhc_device) == FAIL)
{
printf("Interrupt initialize failed.\n");
return FAIL;
}
/* Enable Identification Frequency */
host_cfg_clock(usdhcBase, IDENTIFICATION_FREQ);

/* Send Init 80 Clock */
host_init_active(usdhcBase);

usdhc_printf("Reset card.\n");

/* Issue Software Reset to card */
if (card_software_reset(usdhcBase) == FAIL)
return FAIL;

/* SD Voltage Validation */
if (sd_voltage_validation(usdhcBase) == SUCCESS)
{
usdhc_printf("SD voltage validation passed.\n");
/* SD Initialization */
init_status = sd_init(usdhcBase, bus_width);
}

/* MMC Voltage Validation */
else if (mmc_voltage_validation(usdhcBase) == SUCCESS)
{
usdhc_printf("MMC voltage validation passed.\n");
/* MMC Initialization */
init_status = mmc_init(usdhcBase, bus_width);
}
return init_status;
}

0 项奖励

1,104 次查看
igorpadykov
NXP Employee
NXP Employee

reason may be in hardware, it can be shorted to ground or other signal.

One can attach jtag and try to toggle that pin (configuring it as gpio).

 

Best regards
igor

0 项奖励

1,096 次查看
hailiu
Contributor IV

Dear igor,

found a pattern that If I inserted a card Before turn on the power, then there is NO SD2_CLK, but if I inserted the card AFTER turn on the power, then there is SD2_clk, and the cvalidation can be passed. Something initialized wrong?

thank you

0 项奖励

1,099 次查看
hailiu
Contributor IV

Dear igor,

I configured pin SD2_CLK and SD_CMD both as IO pin, (GPIO1_IO10 and GPIO1_IO11), then write a 1 and 0, both pins can toggle. I guess it is still my initialization problem. Any more suggestion?

 

thank you

0 项奖励

1,102 次查看
hailiu
Contributor IV

thanks, I will try.

0 项奖励

1,149 次查看
hailiu
Contributor IV

tt

0 项奖励

1,140 次查看
hailiu
Contributor IV

tt

0 项奖励

1,143 次查看
igorpadykov
NXP Employee
NXP Employee

very simple initialization example can be found in baremetal sdk:

https://github.com/RT-Thread/rt-thread/tree/master/bsp/imx6sx/iMX6_Platform_SDK/sdk/drivers/usdhc/sr...

 

Best regards
igor

0 项奖励

1,112 次查看
hailiu
Contributor IV

Dear Igor,

I coded based on the SDK code you give me. It may have some thing related to the read wait and stop at gap between blocks. I will try to find it.

Does reset all (RSTA bit) will clear all the register's content? I tried to reset uSDHC manually using the RSTA bit, nothing happend, all the values in registers had not changed.

 

thank you.

0 项奖励

1,152 次查看
igorpadykov
NXP Employee
NXP Employee

Hi hailiu

 

could you please say what processor and sdk used in the case.

In general, initialization codes can be found in uboot:

https://source.codeaurora.org/external/imx/uboot-imx/tree/drivers/mmc/fsl_esdhc_imx.c?h=imx_v2020.04...

 

Best regards
igor

0 项奖励