STM32 SPI读写Flash

[复制链接]
3390|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

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