你好,
我修改了SpigReMead示例,只在WaIfFrand状态中读取了一个状态字节(我修改了读取状态命令,如下面粘贴的代码片段)。我能够从SPI闪光灯中成功地读写。我相信你已经意识到,对于SPI闪存来说,你需要用0xC2命令擦除SPI闪存。我希望你在写Flash之前做擦除。如果不是,请这样做。
BUF〔0〕=0x05;/*读取状态命令*/
CYU3PSPISETSSNLIN(CyFLUE);
状态= CYU3pSPITRANSITITENT(BUF,1);
如果(状态)!= CYU-U3PY成功
{
CYU3pDebug打印(2,“SPI Read Stand命令失败NR”);
CYU3PSPISETSSNLIN(Cyress);
返回状态;
}状态=CYU3PSPILIVE Word(RDYBUF,1);
CYU3PSPISETSSNLIN(Cyress);
如果(状态)!= CYU-U3PY成功
{
CYU3pDebug打印(2,“SPI状态读取失败\R”);
返回状态;
}
}((RDYBUF〔0〕和AMP;1)〕(!)(RDYBUF〔0〕和AMP;0x2));
当做,
加亚特里
以上来自于百度翻译
以下为原文
Hi,
I modified the spiregmode example, and read only one status byte inside WaitforStatus (I modified the Read Status command as in the below pasted code snippet). I was able to succeffully read and write from the SPI flash. I believe you are aware of the fact that befor ewriting to SPI flash, you need to erase the SPI flash using 0xC2 command. I hope you are doing the erase before writing to the flash. If not please do so.
buf[0] = 0x05; /* Read status command */
CyU3PSpiSetSsnLine (CyFalse);
status = CyU3PSpiTransmitWords (buf, 1);
if (status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (2, "SPI READ_STATUS command failednr");
CyU3PSpiSetSsnLine (CyTrue);
return status;
}
status = CyU3PSpiReceiveWords (rd_buf, 1);
CyU3PSpiSetSsnLine (CyTrue);
if(status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (2, "SPI status read failednr");
return status;
}
} while ((rd_buf[0] & 1)|| (!(rd_buf[0] & 0x2)));
Regards,
Gayathri
你好,
我修改了SpigReMead示例,只在WaIfFrand状态中读取了一个状态字节(我修改了读取状态命令,如下面粘贴的代码片段)。我能够从SPI闪光灯中成功地读写。我相信你已经意识到,对于SPI闪存来说,你需要用0xC2命令擦除SPI闪存。我希望你在写Flash之前做擦除。如果不是,请这样做。
BUF〔0〕=0x05;/*读取状态命令*/
CYU3PSPISETSSNLIN(CyFLUE);
状态= CYU3pSPITRANSITITENT(BUF,1);
如果(状态)!= CYU-U3PY成功
{
CYU3pDebug打印(2,“SPI Read Stand命令失败NR”);
CYU3PSPISETSSNLIN(Cyress);
返回状态;
}状态=CYU3PSPILIVE Word(RDYBUF,1);
CYU3PSPISETSSNLIN(Cyress);
如果(状态)!= CYU-U3PY成功
{
CYU3pDebug打印(2,“SPI状态读取失败\R”);
返回状态;
}
}((RDYBUF〔0〕和AMP;1)〕(!)(RDYBUF〔0〕和AMP;0x2));
当做,
加亚特里
以上来自于百度翻译
以下为原文
Hi,
I modified the spiregmode example, and read only one status byte inside WaitforStatus (I modified the Read Status command as in the below pasted code snippet). I was able to succeffully read and write from the SPI flash. I believe you are aware of the fact that befor ewriting to SPI flash, you need to erase the SPI flash using 0xC2 command. I hope you are doing the erase before writing to the flash. If not please do so.
buf[0] = 0x05; /* Read status command */
CyU3PSpiSetSsnLine (CyFalse);
status = CyU3PSpiTransmitWords (buf, 1);
if (status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (2, "SPI READ_STATUS command failednr");
CyU3PSpiSetSsnLine (CyTrue);
return status;
}
status = CyU3PSpiReceiveWords (rd_buf, 1);
CyU3PSpiSetSsnLine (CyTrue);
if(status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (2, "SPI status read failednr");
return status;
}
} while ((rd_buf[0] & 1)|| (!(rd_buf[0] & 0x2)));
Regards,
Gayathri
举报