Giter Club home page Giter Club logo

experiphdriver's Issues

使用FM25L16B和STM32 SPI通信的问题,原始代码是错的,应该修改如下

`/* 设置写使能所存器*/
void SetWriteEnableLatchForFM25xxx(FM25ObjectType *fram)
{
uint8_t opCode = FM25_WREN;

fram->ChipSelect(FM25CS_Enable);
fram->Write(&opCode, 1);
fram->ChipSelect(FM25CS_Disable);/*此处应该是DISABLE,好几处这里都需要修改 */

ReadStatusForFM25xxx(fram);

}

/向FM25xxx写入数据/
void WriteBytesToFM25xxx(FM25ObjectType *fram, uint32_t regAddress, uint8_t *wData, uint16_t wSize)
{
uint8_t data[128];
uint8_t temp;
uint16_t index = 0;

data[index++] = FM25_WRITE;

if (fram->memAddLength == FM258BitMemAdd)
{
    data[index++] = (uint8_t)regAddress;

    if ((fram->mode == FM25L04B) || (fram->mode == FM25040B))
    {
        temp = (uint8_t)(regAddress >> 8);
        data[0] |= ((temp & 0x01) << 3);
    }
}
else if (fram->memAddLength == FM2516BitMemAdd)
{
    data[index++] = (uint8_t)(regAddress >> 8);
    data[index++] = (uint8_t)regAddress;
}
else
{
    data[index++] = (uint8_t)(regAddress >> 16);
    data[index++] = (uint8_t)(regAddress >> 8);
    data[index++] = (uint8_t)regAddress;
}

for (int i = 0; i < wSize; i++)
{
    data[index++] = wData[i];
}

if (((fram->status) & 0x0C) != 0x00)
{
    WriteStatusForFM25xx(fram, fram->status & (~FM25_BPALL)); /* 这里应该是去掉写保护,原始代码没有去掉*/
}

if (((fram->status) & 0x02) != 0x02)
{
    SetWriteEnableLatchForFM25xxx(fram);/*去掉写保护后应该再写使能,才能正常写入数据*/
}

fram->ChipSelect(FM25CS_Enable);
fram->Write(data, index);
fram->ChipSelect(FM25CS_Disable);

WriteStatusForFM25xx(fram, fram->status | FM25_BPALL);

}`

查看注释部分

spi

没有上传模拟spi的代码

请求一个示例

您好,我是一个STM32初学者,非常感谢你们出的这一系列外设的驱动,对初学者很友好。我最近在调试AD7192这个数模转换器,用来你们的驱动,但是总是有点小问题,希望您们能在每一个驱动中给出一个示例,来演示如何初始化、如何调用函数,对于我这种小白帮助会很大,谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.