GD32F450 SDRAM的问题

[复制链接]
 楼主| pq113_6 发表于 2021-6-26 07:40 | 显示全部楼层 |阅读模式
板子是GD32450i-EVAL,用官方例程14_EXMC_SDRAM,增加一个打印
/* compare two buffers */
    for(i = 0;i < BUFFER_SIZE;i++){
        if (rxbuffer[i] != txbuffer[i]){
            printf("\r\nfail[%d]:%d != %d", i, rxbuffer[i], txbuffer[i]);
            writereadstatus ++;
            break;
        }
    }
打印结果:
fail[0]:96 != 0
就是说SDRAM的第一个字节写入错误。
我自己写的代码:
    uint8_t *pbAddr = (uint8_t *)EXMC_SDRAM_ADDR0;
    *pbAddr = 0x00;
    *(pbAddr + 1) = 0xaa;
    *(pbAddr + 1024) = 0x00;
    *(pbAddr + 1024 + 1) = 0xaa;
    Printf("[%x] = 0x%x\n", (uint32_t)pbAddr, *pbAddr);
    Printf("[%x] = 0x%x\n", (uint32_t)(pbAddr + 1), *(pbAddr + 1));
    Printf("[%x] = 0x%x\n", (uint32_t)(pbAddr + 1024), *(pbAddr + 1024));
    Printf("[%x] = 0x%x\n", (uint32_t)(pbAddr + 1024 + 1), *(pbAddr + 1024 + 1));
打印结果:
[c0000000] = 0x0
[c0000001] = 0xaa
[c0000400] = 0x40
[c0000401] = 0xaa
有人知道查问题的方向吗?不稳定导致的?但是每次的错误都是一样的。
SDRAM初始化寄存器值和发送的Command值
REG_EXMC_SDCTL:39d9
REG_EXMC_SDTCFG:1115461
Command:11
Command:12
Command:f3
Command:46014
 楼主| pq113_6 发表于 2021-6-26 07:42 | 显示全部楼层
update一下:
*pbAddr = 0x00;
    *(pbAddr + 1) = 0xaa;
    *(pbAddr + 1024) = 0x55;
    *(pbAddr + 1024 + 1) = 0xaa;
    Printf("[%x] = 0x%x\n", (uint32_t)pbAddr, *pbAddr);
    Printf("[%x] = 0x%x\n", (uint32_t)(pbAddr + 1), *(pbAddr + 1));
    Printf("[%x] = 0x%x\n", (uint32_t)(pbAddr + 1024), *(pbAddr + 1024));
    Printf("[%x] = 0x%x\n", (uint32_t)(pbAddr + 1024 + 1), *(pbAddr + 1024 + 1));
出错的位置改为写入0x55又对了
[c0000000] = 0x0
[c0000001] = 0xaa
[c0000400] = 0x55
[c0000401] = 0xaa
 楼主| pq113_6 发表于 2021-6-26 09:47 | 显示全部楼层
已解决,SDRAM的pin初始化有问题,不能用PULL UP
linxi6414 发表于 2021-6-27 19:07 | 显示全部楼层
这款芯片目前什么价?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

36

主题

284

帖子

3

粉丝
快速回复 在线客服 返回列表 返回顶部