社区标签  赛灵思-ChipDebug
标签

赛灵思

帖子数
1.9W+
阅读量
23.6W+
开源自定义ip不支持板子,该怎么修改啊-ChipDebug
该帖子内容已隐藏,请登录后查看

登录后继续查看

该帖子内容已隐藏,请评论后查看

登录后继续评论

该帖子内容已隐藏,请评论后查看

登录后继续评论

Spi模式設定(PYNQ-Z2)-ChipDebugSpi模式設定(PYNQ-Z2)-ChipDebugSpi模式設定(PYNQ-Z2)-ChipDebug
热门评论
chipdebug的头像-ChipDebugchipdebug徽章-创作大使-ChipDebug等级-LV3-ChipDebug超级版主2
我看了pyznq的代码,你用spi_open_device这上函数打开应该就可以实现slave,

spi spi_open_device(unsigned int device) {
    int status;
    u16 dev_id;
    unsigned int base_address;
    u32 control;

    if (device < XPAR_XSPI_NUM_INSTANCES) {
        dev_id = (u16) device;
    }
    else {
        int found = 0;
        for (u16 i = 0; i < XPAR_XSPI_NUM_INSTANCES; ++i) {
            if (XSpi_ConfigTable[i].BaseAddress == device) {
                found = 1;
                dev_id = i;
                break;
            }
        }
        if (!found)
            return -1;
    }
    status = XSpi_Initialize(&xspi[dev_id], dev_id);
    if (status != XST_SUCCESS) {
        return -1;
    }
    base_address = xspi[dev_id].BaseAddr;
    // Soft reset SPI
    XSpi_WriteReg(base_address, XSP_SRR_OFFSET, 0xA);
    // Master mode
    control = XSpi_ReadReg(base_address, XSP_CR_OFFSET);
    // Master Mode
    control |= XSP_CR_MASTER_MODE_MASK;
    // Enable SPI
    control |= XSP_CR_ENABLE_MASK;
    // Slave select manually
    control |= XSP_INTR_SLAVE_MODE_MASK;
    // Enable Transmitter
    control &= ~XSP_CR_TRANS_INHIBIT_MASK;
    // Write configuration word
    XSpi_WriteReg(base_address, XSP_CR_OFFSET, control);

    return (spi) dev_id;
}
该帖子内容已隐藏,请登录后查看

登录后继续查看

该帖子内容已隐藏,请登录后查看

登录后继续查看