Page 1 of 1

stm32使用SDIO与esp32通讯失败

Posted: Thu Sep 21, 2023 2:10 am
by legendss13
我目前正在使用stm32的sdio接口与esp32-WROOM-32U通讯,我已经按照文档移植了host代码到stm32f429igT6,esp32端也使用编译好的sdio-at固件,并烧录成功这是esp32端日志:
[0;32mI (1146) wifi_init: tcp mss: 1440[0m
[0;32mI (1150) wifi_init: WiFi IRAM OP enabled[0m
[0;32mI (1155) wifi_init: WiFi RX IRAM OP enabled[0m
[0;32mI (1160) wifi_init: WiFi SLP IRAM OP enabled[0m
[0;32mI (1165) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07[0m
[0;32mI (1172) phy_init: Support multiple PHY init data bins[0m

[09:31:56.823]收←◆I (1281) wifi:mode : softAP (c8:f0:9e:e2:d1:f5)
I (1282) wifi:Total power save buffer number: 16
I (1283) wifi:Init max length of beacon: 752/752
I (1284) wifi:Init max length of beacon: 752/752
module_name: WROOM-32
max tx power=78, ret=0
I (1296) wifi:set country: cc=CN\0
[09:31:56.872]收←◆ schan=1 nchan=13 policy=1

[0;32mI (1298) phy_init: PHY init data type updated from DEFAULT to SRRC[0m
v3.2.0.0
[0;32mI (1306) SDIO-AT: Cannot get read data address.[0m
I (1312) wifi:mode : sta (c8:f0:9e:e2:d1:f4) + softAP (c8:f0:9e:e2:d1:f5)
I (1317) wifi:enable tsf
I (1324) wifi:mode : softAP (c8:f0:9e:e2:d1:f5)
[0;32mI (1336) SDIO-AT: slave ready[0m

并且我已经执行了 ./components/esptool_py/esptool/espefuse.py -p <serial_port> set_flash_voltage 3.3V如下日志
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting...
Detecting chip type... ESP32

=== Run "set_flash_voltage" command ===
Enable internal flash voltage regulator (VDD_SDIO) to 3.3V.

The same value for XPD_SDIO_FORCE is already burned. Do not change the efuse.
The same value for XPD_SDIO_REG is already burned. Do not change the efuse.
The same value for XPD_SDIO_TIEH is already burned. Do not change the efuse.
VDD_SDIO setting complete.

Check all blocks for burn...
idx, BLOCK_NAME, Conclusion
Nothing to burn, see messages above.

IO13,IO14, IO15, IO2, IO4, IO12 这 6 个管脚使用10K 欧姆电阻进行上拉连接到stm32的sdio引脚;

下面是stm32的sdio部分初始化代码,其他地方没有做修改:

sdio_err_t sdio_driver_init(void)
{
sdio_init_t sdio_init = {
.width = WIDTH_4, //历程是WIDTH_1,也尝试了,并不起作用
.clock = 400000 // 12M clock
};
sdio_recv_SemHandle = xSemaphoreCreateBinary();
STM32SdioInit(sdio_init);
return SDIO_SUCCESS;
}
在初始化中调用了下面的函数:
void UserEsp32Init(void)
{
sdio_err_t err;
SDIO_LOGI(TAG, "host ready, start initializing slave...");
//HAL_GPIO_WritePin(GPIOC, WIFI_EN_Pin, GPIO_PIN_SET);
err = sdio_host_init();
if(err != SDIO_SUCCESS) {
printf("SDIO init error\r\n");
return;
}
printf("Sdio init done\r\n");

//xTaskCreate(sdio_send_task, "sdioSendTask", ESP32_SIZE, NULL, osPriorityNormal1, NULL);
//xTaskCreate(sdio_recv_task, "sdioRecvTask", ESP32_SIZE, NULL, osPriorityNormal1, NULL);
}
下面是stm32的打印,首先已经做了3s的延时等待esp32启动再进行host的初始化:
[09:31:54.938]收←◆I STM32_sdio: [Clock] freq=700.4kHz, requested=400.0kHz, divider=255

resp = 0
E STM32_sdio: SdioDriverInit: CMD3 timeout!

E STM32_sdio: SdioDriverInit: CMD3 timeout!

E STM32_sdio: SdioDriverInit: CMD3 timeout!

D STM32_sdio: Relative Card Address: 0x0000

E STM32_sdio: SdioDriverInit: CMD7 timeout!

E STM32_sdio: SdioDriverInit: CMD7 timeout!

E STM32_sdio: SdioDriverInit: CMD7 timeout!

D STM32_sdio: Card selected! RESP1_00000000

E STM32_sdio: STM32ReadReg: CMD52 timeout!

E STM32_sdio: STM32ReadReg: CMD52 timeout!

E STM32_sdio: STM32ReadReg: CMD52 timeout!

I STM32_sdio: Use 4bit bus width
E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

esp_slave_init_io
E STM32_sdio: STM32ReadReg: CMD52 timeout!

E STM32_sdio: STM32ReadReg: CMD52 timeout!

E STM32_sdio: STM32ReadReg: CMD52 timeout!

D sdio_transport: IOE: 0x00
E STM32_sdio: STM32ReadReg: CMD52 timeout!

E STM32_sdio: STM32ReadReg: CMD52 timeout!

E STM32_sdio: STM32ReadReg: CMD52 timeout!

D sdio_transport: IOR: 0x00
E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

D sdio_transport: IOE: 0x00
E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

D sdio_transport: IOE: 0x00
E STM32_sdio: STM32ReadReg: CMD52 timeout!

E STM32_sdio: STM32ReadReg: CMD52 timeout!

E STM32_sdio: STM32ReadReg: CMD52 timeout!

D sdio_transport: IE: 0x00
E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

D sdio_transport: IE: 0x00
E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

D sdio_transport: Function 0 BSL: 0x00
E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

D sdio_transport: Function 0 BSH: 0x00
E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

D sdio_transport: Function 1 BSL: 0x00
E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

D sdio_transport: Function 1 BSH: 0x00
E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

D sdio_transport: Function 2 BSL: 0x00
E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

E STM32_sdio: STM32WriteReg: CMD52 timeout!

D sdio_transport: Function 2 BSH: 0x00


我现在不知道问题出在哪里了,查阅了所有文档也没解决