完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,
为什么函数SPSPIFLASHSTATE两次读取TH SPI闪存模块的状态? DO while循环结束时的检查只比较第一个接收到的关于忙和WIP标志的字节。也是M25P40数据表告诉不需要阅读现状两次在指令集的描述。 但我确定的是,结果错写的如果我只是曾经的地方阅读的现状。 有人能解释一下我的行为吗? 谢谢, 隆皮 以上来自于百度翻译 以下为原文 Hi, why is the function GetSpiFlashStatus reading the status of th SPI flash module twice? The checks at the end of the do while loop just compare the first received byte concerning on BUSY and WIP flags. Also the datasheet of the M25P40 is telling no need to read the status twice at the instruction set description. But what I have identified is, that it results in wrong writes if I read the status at that place just once. Can anybody explain me that behaviour, please? thanks, Lumpi |
|
相关推荐
7个回答
|
|
嗨,Lumpi,
你在u***flashprog工程实例谈cyfxflashprogspiwaitforstatus功能?. 请让我知道。 谢谢, 西克里希纳。 以上来自于百度翻译 以下为原文 Hi Lumpi, Are you talking about CyFxFlashProgSpiWaitForStatus function in USBFlashProg example project?. Please let me know. Thanks, sai krishna. |
|
|
|
嗨,Sai Krishna,
这个函数,但它总是在项目中相同的功能: CyfxFlash Pro 青霉 - CyfxSubSigigoMo.c - CyfxSbbRigReal.c CyfXAc *等待来自SPI闪存的状态响应。*/Cyu3PrEntStutsUst CyfxSmithWistFoStand(空隙){UIT88T BUF〔2〕,RDYBUF〔2〕;CYU3PRESTROSTATUS SUT状态=CYU-U3PY成功;//等待来自SPI闪存装置的状态响应。*/do{Buf(0)=0x06;/*写使能命令。*/CYFXSPISETSnLIN(CyFLY);状态=CYFXSPITRAN SMITION(BUF,1);CyFxSpiSetSsnLine(Cytru.);IF(状态)!{Cyu3Upl成功){CyU3pDebug(2),“SPI WRIN使能命令失败\NR”);返回状态;}BUF(0)=0x05;/*读取状态命令*/CYFXSPISETSnLIN(CyFLY);状态=CYFXSPITRAN SMITION(BUF,1);如果(状态)!{Cyu3Upl成功){CYU3pDebug打印(2,“SPI Read Stand命令失败\NR”);CyFxSpiSetSsnLine(CyTrm);返回状态;}状态=CYFXSPIMPEVER词(RDYBUF,2);CyFxSpiSetSsnLine(Cytrut);IF(状态)!= cy_u3p_success){ cyu3pdebugprint(2,”SPI状态读取失败nn R”);} }而返回状态;((rd_buf [ 0 ] &;1)| |(!(RDYBUF〔0〕和0x2));返回CYU-U3PY成功;} 当做, 隆皮 以上来自于百度翻译 以下为原文 Hi Sai Krishna, e. g. this function but it is all the time the same function in Project: - cyfxflashprog.c - cyfxu***spidmamode.c - cyfxu***spigpiomode.c - cyfxu***spiregmode.c - cyfxuac.c /* Wait for the status response from the SPI flash. */ CyU3PReturnStatus_t CyFxSpiWaitForStatus ( void) { uint8_t buf[2], rd_buf[2]; CyU3PReturnStatus_t status = CY_U3P_SUCCESS; /* Wait for status response from SPI flash device. */ do { buf[0] = 0x06; /* Write enable command. */ CyFxSpiSetSsnLine (CyFalse); status = CyFxSpiTransmitWords (buf, 1); CyFxSpiSetSsnLine (CyTrue); if (status != CY_U3P_SUCCESS) { CyU3PDebugPrint (2, "SPI WR_ENABLE command failednr"); return status; } buf[0] = 0x05; /* Read status command */ CyFxSpiSetSsnLine (CyFalse); status = CyFxSpiTransmitWords (buf, 1); if (status != CY_U3P_SUCCESS) { CyU3PDebugPrint (2, "SPI READ_STATUS command failednr"); CyFxSpiSetSsnLine (CyTrue); return status; } status = CyFxSpiReceiveWords (rd_buf, 2); CyFxSpiSetSsnLine (CyTrue); if(status != CY_U3P_SUCCESS) { CyU3PDebugPrint (2, "SPI status read failednr"); return status; } } while ((rd_buf[0] & 1)|| (!(rd_buf[0] & 0x2))); return CY_U3P_SUCCESS; } regards, lumpi |
|
|
|
你好,
我修改了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 |
|
|
|
你好,
我正在使用完全相同的代码,是的,我正在擦除Flash。我只是在写大量数据到Flash中遇到这个问题。2MB。然后大部分数据是正确的,但是一些小块被破坏了。 当做, 隆皮 以上来自于百度翻译 以下为原文 Hi, I am using exactly the same code and yes I am erasing flash. I just have that problem in case of writing a huge amount of data into flash. e. g. 2MB. Then most of the data is correct but some small blocks are corrupted. regards, lumpi |
|
|
|
嗨,Lumpi,
我们仅用4KB的数据测试写操作和读操作。 我们将测试这些操作大量的数据(像你说的2MB),让你知道。 谢谢, 西克里希纳。 以上来自于百度翻译 以下为原文 Hi Lumpi, We tested write and read operations with 4KB of data only. We will test these operations for large amount of data (like as you said 2MB) and let you know. Thanks, sai krishna. |
|
|
|
嗨,Sai Krishna,
我现在发现了这个问题。我曾在环超时计数器和我没有检查错误条件。如果擦除Flash需要很长的时间直到忙标志将无效。现在我有一个较长的可能超时我也查看和回复如果超时错误发生。 问题是,在读取一个字节的超时时间是短,两次读状态超时是足够的案例。所以现在我把它改为用一个明智的TIMOUT读一个字节。 谢谢, 隆皮 以上来自于百度翻译 以下为原文 Hi Sai Krishna, I have now the issue found. I had a timeout counter in the loop and I have not checked the error condition. In case of erase flash it needs a very long time till busy flag will be deasserted. Now I have a longer posiible timeout and also I check and return if a timout error occurs. The problem was, that in case of reading one byte the timeout was to short and in case of two times reading the status the timeout was enough. So now I changed it to reading one byte with a wise timout. Thanks, lumpi |
|
|
|
嗨,Lumpi,
很高兴听到这样的话: 谢谢, 西克里希纳。 以上来自于百度翻译 以下为原文 Hi Lumpi, Good to hear that :) Thanks, sai krishna. |
|
|
|
只有小组成员才能发言,加入小组>>
752个成员聚集在这个小组
加入小组2070 浏览 1 评论
1826 浏览 1 评论
3639 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1761 浏览 6 评论
1512 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
510浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
360浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
410浏览 2评论
357浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
857浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-23 19:52 , Processed in 0.953485 second(s), Total 61, Slave 54 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号