打印

STM32 SPI读写Flash

[复制链接]
2664|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
759612761|  楼主 | 2011-7-20 17:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
时钟打开了,为什么读取到得数据全部是0XFF ,请高手指点一下
沙发
zhangyang86| | 2011-7-21 01:08 | 只看该作者

使用特权

评论回复
板凳
lixiaoxu2meng| | 2011-7-21 07:49 | 只看该作者
flash 里没有写的地方就是 FF,楼主看看数据是否写进去了?读的地址是否对?

使用特权

评论回复
地板
759612761|  楼主 | 2011-7-21 11:23 | 只看该作者
读取Flash的ID都读取不到,程序一直在
void SPI_FLASH_WaitForWriteEnd(void)
{
  uint8_t flashstatus = 0;

  //Select the FLASH: Chip Select low
  SPI_FLASH_CS_LOW();

  //Send "Read Status Register" instruction
  SPI_FLASH_SendByte(0x05);

  //Loop as long as the memory is busy with a write cycle
  do
  {
    //Send a dummy byte to generate the clock needed by the FLASH
    //and put the value of the status register in FLASH_Status variable
    flashstatus = SPI_FLASH_SendByte(DUMMY_BYTE);

  }
  while ((flashstatus & WIP_FLAG) == SET); //Write in progress

  //Deselect the FLASH: Chip Select high
  SPI_FLASH_CS_HIGH();
}
调了两天了快,不知道什么原因

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

35

帖子

1

粉丝