YuzukiXR32 调试日记:SD卡驱动调试
-
首先,SDK抄一下EVB的相关文件
然后把
__PRJ_CONFIG_BOARD
修改到__PRJ_CONFIG_BOARD := YuzukiXR32
试试能不能编译编译
cd XR32SDK/project/example/sd/gcc make build
编译通过~
"section" :[ {"id": "0xa5ff5a00", "bin": "boot.bin", "cert": "null", "flash_offs": "0K", "sram_offs": "0x00067000", "ep": "0x00067101", "attr": "0x1"}, {"id": "0xa5fe5a01", "bin": "app.bin", "cert": "null", "flash_offs": "32K", "sram_offs": "0x00010000", "ep": "0x00010101", "attr": "0x1"}, {"id": "0xa5f75a08", "bin": "app_ext.bin", "cert": "null", "flash_offs": "332K", "sram_offs": "0x60000000", "ep": "0xffffffff", "attr": "0x1"} ] } generate image: xr_system.img
刷写程序
运行一下试试看
sd demo started SDC source:24 MHz clock=400 kHz,src:0, n:1, m:14 SDC source:24 MHz clock=400 kHz,src:0, n:1, m:14 __mci_irq_handler,535 raw_int:100 err! SDC err, cmd 8, RTO sdc 387 abnormal status: RespErr int err 100 __mci_irq_handler,535 raw_int:100 err! SDC err, cmd 55, RTO sdc 387 abnormal status: RespErr int err 100 __mci_irq_handler,535 raw_int:100 err! SDC err, cmd 55, RTO sdc 387 abnormal status: RespErr int err 100 __mci_irq_handler,535 raw_int:100 err! SDC err, cmd 55, RTO sdc 387 abnormal status: RespErr int err 100 __mci_irq_handler,535 raw_int:100 err! SDC err, cmd 55, RTO sdc 387 abnormal status: RespErr int err 100 sd scan error
不出所料,用不了,应该是引脚绑定不同,打开板级文件看看
__xip_rodata static const GPIO_PinMuxParam g_pinmux_sd0[BOARD_SD0_DATA_BITS + 2] = { { GPIO_PORT_A, GPIO_PIN_0, { GPIOA_P0_F3_SD_CMD, GPIO_DRIVING_LEVEL_2, GPIO_PULL_UP } }, /* CMD */ { GPIO_PORT_A, GPIO_PIN_2, { GPIOA_P2_F3_SD_CLK, GPIO_DRIVING_LEVEL_2, GPIO_PULL_UP } }, /* CLK */ { GPIO_PORT_A, GPIO_PIN_1, { GPIOA_P1_F3_SD_DATA0, GPIO_DRIVING_LEVEL_2, GPIO_PULL_UP } }, /* D0 */ // { GPIO_PORT_A, GPIO_PIN_3, { GPIOA_P3_F3_SD_DATA1, GPIO_DRIVING_LEVEL_2, GPIO_PULL_UP } }, /* D1 */ // { GPIO_PORT_A, GPIO_PIN_4, { GPIOA_P4_F3_SD_DATA2, GPIO_DRIVING_LEVEL_2, GPIO_PULL_UP } }, /* D2 */ // { GPIO_PORT_A, GPIO_PIN_5, { GPIOA_P5_F3_SD_DATA3, GPIO_DRIVING_LEVEL_2, GPIO_PULL_UP } }, /* D3 */ };
果然,绑定的脚是PA的SD脚位,参照YuzukiXR32的电路图,应该是使用PB驱动SDIO才对。
那就修改一下
__xip_rodata static const GPIO_PinMuxParam g_pinmux_sd0[BOARD_SD0_DATA_BITS + 2] = { { GPIO_PORT_B, GPIO_PIN_4, { GPIOB_P4_F3_SD_CMD, GPIO_DRIVING_LEVEL_2, GPIO_PULL_UP } }, /* CMD */ { GPIO_PORT_B, GPIO_PIN_7, { GPIOB_P7_F3_SD_CLK, GPIO_DRIVING_LEVEL_2, GPIO_PULL_UP } }, /* CLK */ { GPIO_PORT_B, GPIO_PIN_5, { GPIOB_P5_F3_SD_DATA0, GPIO_DRIVING_LEVEL_2, GPIO_PULL_UP } }, /* D0 */ };
成功运行
sd demo started SDC source:24 MHz clock=400 kHz,src:0, n:1, m:14 SDC source:24 MHz clock=400 kHz,src:0, n:1, m:14 SDC source:192 MHz clock=48000 kHz,src:1000000, n:0, m:1 write "hello word!" to sd card read data: hello word! sd demo over
-
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号