完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在尝试使用PIC32MZ2048EFH144中的SQI模块来读写SST26VF064B串行闪存。启用和谐中的SQI仅设置IO引脚,所以我使用来自和谐v1.09中的PIO示例。从2到4设置总线速度为25MHz。我已经确认PBCLK5被设置为100MHz的输出并被启用,并且REFCLK02被关闭,它们在和谐时钟设置屏幕和SFR中都被确认。SQICFG寄存器看起来像SQI1CLKCON寄存器一样按照代码正确设置,不幸的是时钟稳定了。SQI1CLKCON寄存器中的e位从不设置,因此代码位于函数末尾的while循环中。我将代码更改回其原始设置(DRV_SQI_CS_OEN_1和CLK_DIV_2),并得到相同的结果。我检查了SQI1CON寄存器,并且CMDINIT位被设置为2,这看起来是不正确的,但是在上面的代码中清除它们(空闲)仍然不会影响结果,SQICLK永远不会稳定。非常感谢您的帮助!拉里!
以上来自于百度翻译 以下为原文 I am trying to use the SQI module in the PIC32MZ2048EFH144 to read and write to a SST26VF064B serial flash. The project is in MPLAB X 3.40, XC32 V1.42, and I am using HARMony v1.09. Enabling the SQI in Harmony only sets the IO pins so I am using the PIO example from within Harmony v1.09. Here is the SQI_Initialize from the example: // ***************************************************************************** // ***************************************************************************** // Section: SQI Static Driver Functions // ***************************************************************************** // ***************************************************************************** void DRV_SQI_Initialize(void) { // Set up SQI Configuration (SQI1CFG) Register PLIB_SQI_ConfigWordSet(DRV_SQI_ID_0, 1, DRV_SQI_CS_OEN_BOTH, // was DRV_SQI_CS_OEN_1, DRV_SQI_DATA_OEN_QUAD, 0, // Resets control, transmit, receive buffers and state machines 1, // Burst Enable (always set to '1') 0, // SQID2 doesn?t act as HOLD# signal in single and dual lane modes 0, // SQID3 doesn?t act as WP# signal in single and dual lane modes 0, // Receive latch is not active in transmit mode DRV_SQI_DATA_FORMAT_MSBF, DRV_SQI_DATA_MODE_0, DRV_SQI_XFER_MODE_PIO ); // Configure SQI1CLKCON PLIB_SQI_ClockDividerSet(DRV_SQI_ID_0, CLK_DIV_4); // was CLK_DIV_2 PLIB_SQI_ClockEnable(DRV_SQI_ID_0); while (!PLIB_SQI_ClockIsStable(DRV_SQI_ID_0)); } The only changes made were to allow both CS_0 and CS_1 to be used (I also have a microSD card for later development) and to change the clock divider from 2 to 4 to set the bus speed at 25MHz. I have confirmed that PBCLK5 is set for a 100MHz output and enabled and that REFCLK02 is turned off, they are confirmed both in the Harmony clock settings screen and in the SFR's. The SQICFG register appears to be set properly per the code as is the SQI1CLKCON register, unfortunately the clock stable bit in the SQI1CLKCON register never sets so the code sits in the while loop at the end of the function. I changed the code back to its original settings (DRV_SQI_CS_OEN_1 and CLK_DIV_2) and get the same results. I checked the SQI1CON register and the CMDINIT bits were set to 2 which seems incorrect but clearing them (idle) in the code above still does not affect the outcome, the SQICLK never stabilizes. Any help would be GREATLY appreciated!! Larry |
|
相关推荐
15个回答
|
|
嗨,你检查过这些例子吗:c:micro..onyv1_10apps..sqic:micro..onyv2_02_00bappsfs(我认为这个例子只存在于V2.xx)
以上来自于百度翻译 以下为原文 Hi, Did you check these examples : c:microchipharmonyv1_10appsexamplesperipheralsqi c:microchipharmonyv2_02_00bappsfs (I think this example exists only in V2.xx) Regards |
|
|
|
嗨,RISC,谢谢你的回复…我有V1.07.01和V2.01B,SqiFlash的PIOO-RIAD函数与我在V1.09i中的功能相同,我正在下载最新和最大的和谐V2.02B,看看是否有什么不同,我会回我所看到的。
以上来自于百度翻译 以下为原文 Hi RISC, Thanks for responding ... I have v1.07.01 and v2.01b, the sqi_flash_pio_read functions are identical to what I have in V1.09 I am downloading the latest and greatest Harmony v2.02b to see if there is any difference I'll post back what I see. Larry |
|
|
|
RISC,Harmony v2.02b代码仍然相同,看起来我是在PIC32MZ手册的SQI部分编写自己的代码……不得不在2周前为CAN系统做同样的事情,因为和声不起作用…谢谢,拉里
以上来自于百度翻译 以下为原文 RISC, Harmony v2.02b code is still the same, looks like I am writing my own code from the SQI section of the PIC32MZ manual ... Had to do the same for the CAN system 2 weeks ago as Harmony did not work ... Thanks, Larry |
|
|
|
我很高兴报告成功……问题是时钟,在研究如何编写我自己的代码时,我发现SQI模块需要两个LoK源,PBCK5只运行硬件使用SFR和数据缓冲器,RIFCK02是驱动SqICLK输出的时钟源。SQI实现精细化,就像我刚读JEDEC ID一样,与Flash芯片交谈。
以上来自于百度翻译 以下为原文 I am happy to report success ... The issue was the clocking, in researching how to write my own code I discovered that the SQI module needs two clok sources, PBCLK5 only runs the hardware to use the SFR's and data buffers, REFCLK02 is the clock source for driving the SQICLK output. The SQI intializes fine, as does talking to the flash chip as I just read the JEDEC ID. |
|
|
|
感谢报告这种特殊需要(2个时钟源)
以上来自于百度翻译 以下为原文 Thanks for reporting back this peculiar need (2 clock sources) |
|
|
|
|
|
|
|
嗨,我有一个PIC32 MZ0512EFE064,我想用SQI端口运行一个SST26VF16B。就像有人说的和谐只是给你的引脚设置,但不是司机。我有一个在200 MHz的SysCLK和25MHz的ReFLK02。我在另一个论坛上看到,在Apps/GFX/EnthalLoad资源中,你有一个驱动到SST26VF032 B。它看起来是很好的初始化,但是当我看到SqiLK时,我什么也没看到。你是在哪里让司机读JEDEC ID的?
以上来自于百度翻译 以下为原文 Hi, I have a pic32MZ0512efe064 and i'm trying to run a SST26VF16B with the SQI port. Like someone said the harmony just give you the pins settings but not a driver. I have a SYSCLK at 200MHZ and the REFCLK02 at 25MHZ. I read in other forum that in apps/gfx/external_resources you have a driver to the SST26VF032B. It seems to be initialize fine but when i look at the SQIclk i saw nothing. where did you take the driver to read the JEDEC ID? |
|
|
|
好的,对于每个人:PBCLK5和REFCLK02不必是相同的速度,PBCLK只是运行SFR的,可以留在100MHz。REFCLK02将是您的SQI时钟.sunugal,您是否启用输出,就好像它要进入i/o引脚?这使得CLK输出进入SQI时钟。它不会转到输出引脚,可扩展菜单中的时钟配置将警告您它不会退出,但是需要打开。mayk888,我使用的驱动程序在:.ony/v1_09/apps/./peripherl/sqi/flash_read_pio_mode/.ware/srcs中找到。h和drv_sqi_._sst26vf032b.cI知道您正在与一个016部分通话,只需检查页面大小是否正确。读取JEDEC ID的函数是DRV_SQI_Flash_ID_Check()已知问题:驱动程序在DRV_SQI_PIO_PageRead()函数中有错误,同时等待读取数据是che单击配置的缓冲区阈值,而不管数据是否已被读取并且阈值是否达到,因此它不断地从数据FIFO读取(严重吗?)我把这个代码改为启用和检查RX INT标志:祝大家好运!
以上来自于百度翻译 以下为原文 Ok, for everyone: PBCLK5 and REFCLK02 do not have to be the same speed, PBCLK simply runs the SFR's and can be left at 100MHz. REFCLK02 will be your SQI clock speed sunugal, did you enable the output as if it was going to an i/o pin? This enables the clk output to go to the SQI clock. It does not go to an output pin, and the clock configuration in the expandable menus will warn you that it does not go out, but it needs to be turned on. mayk888, the driver I used is found at: harmony/v1_09/apps/examples/peripherl/sqi/flash_read_pio_mode/firmware/src The files you need are drv_sqi_static.h and drv_sqi_static_sst26vf032b.c I know you are talking to an 016 part, just check that the page size is correct. The function to read the JEDEC ID is DRV_SQI_Flash_ID_Check() Known problem: The driver has a mistake in the DRV_SQI_PIO_PageRead() function - while waiting to read the data it is checking the configured buffer threshold value, not whether data has been read and the threshold reached, so it reads from the data FIFO constantly (seriously?) /* Setup control word to read 256 bytes */ PLIB_SQI_ControlWordSet(DRV_SQI_ID_0,1,SQI_CS_1,DRV_SQI_LANE_QUAD,DRV_SQI_CMD_RECEIVE,FLASH_PAGE_SIZE); /* Setup receive buffer threshold */ _DRV_SQI_BufferThrSet(0, 0, 24); for (readLoop=0; readLoop < 8; readLoop++) { while ((PLIB_SQI_RxBufferThresholdGet(DRV_SQI_ID_0)& 0xFF) != 24); for (bufLoop=0; bufLoop < 8; bufLoop++){ *readBuffer++ = PLIB_SQI_ReceiveData(DRV_SQI_ID_0); } } I changed this code to this which enables and checks the RX INT flag: // clear the rx threshold flag and enable SQI1INTSTATbits.RXTHRIF = 0; SQI1INTENbits.RXTHRIE = 1; /* Setup receive buffer threshold */ _DRV_SQI_BufferThrSet(0, 0, 16); // 16 bytes = 4 32bit words /* Setup control word to read 256 bytes */ PLIB_SQI_ControlWordSet(DRV_SQI_ID_0, 1, SQI_CS_0, DRV_SQI_LANE_QUAD, DRV_SQI_CMD_RECEIVE, FLASH_PAGE_SIZE); // read 4 words 16 times = 64 words = 256 bytes for (readLoop = 0; readLoop < 16; readLoop++) { // wait to reach the threshold while (SQI1INTSTATbits.RXTHRIF == 0); // bit set, we have reached the threshold SQI1INTSTATbits.RXTHRIF = 0; // read the four words for (bufLoop = 0; bufLoop < 4; bufLoop++) { *readBuffer++ = PLIB_SQI_ReceiveData(DRV_SQI_ID_0); } } // clear the IE and IF flags SQI1INTENbits.RXTHRIE = 0; SQI1INTSTATbits.RXTHRIF = 0; Good luck everyone! |
|
|
|
你好,拉菲特,谢谢你的回应,我试着使用这些驱动程序,但我不明白什么。当你使用“空SqyPiooPaWrad(UTI32)地址)时,你会说哪些数据要写入?
以上来自于百度翻译 以下为原文 Hello laffelt, thanks for responding, i'm trying to use these drivers, but i don't understand somethings. When you use "void SQI_PIO_PageWrite (uint32_t address)" where do you say which data want to write? |
|
|
|
|
|
|
|
嗨,Mayk88,函数调用是“空DrvsQiiPioOpPayWrrad(Unt32)闪存地址,Unt8*t*WrreBuffice),WruteBuffor是指向要写入的数据的指针。在Flash芯片规格中的页面大小,我知道032和064部分有256字节的页面,不确定其他页面。闪存的一些提示:1。你只能在一个时间写一个页面。你必须等待(通常大约18Ms)才能在你写另一篇文章之前写好这个页面。你写的Flash数组中的区域必须先擦除才能写入。4。如果你想重写已经写的数据,你必须先擦掉它。祝你好运!
以上来自于百度翻译 以下为原文 Hi mayk888, The function call is "void DRV_SQI_PIO_PageWrite(uint32_t flashAddress, uint8_t* writeBuffer)" and writebuffer is a pointer to the data you want written. The page size in in the flash chip spec, I know the 032 and 064 parts have 256 bytes pages, not sure about the others. A few hints on flash memory: 1. You can only write one page at a time 2. You have to wait (usually about 18mS) for the page to write before you write another 3. The area in the flash array you are writing has to be erased before you can write to it. 4. if you want to overwrite data already written you must erase it first. Good luck! |
|
|
|
|
|
|
|
Sunugal,听起来你的数据传入的速度快于你能处理的速度,这与你的时钟设置是有道理的:以1MHz运行PBCLK5非常慢,我会尽可能快地设置它,因为时钟速度决定你能读写到SQI控制寄存器和缓冲器的速度。我运行我的100兆赫,这是最快的外围时钟可以运行与核心运行在200兆赫。当它设置在1 MHz时,你的核心就坐在那里等待访问。在SQI外部时钟设置为100MHz的情况下,您的数据以超出您能够访问的速度飞行。其次,您的REFCLK02应该设置为ADC指定的最大值或低于最大值。如果将数据从ADC中计时的速度快于额定速度,则可能导致数据损坏。一个警告是,您使用的PIC32与我使用的PIC32相同,并且我知道REFCLK输入时钟速度存在错误。它不应该高于100MHz或者时钟不能正常工作。
以上来自于百度翻译 以下为原文 sunugal, Sounds like your data is coming in faster than you can handle, and that makes sense with your clock settings: Running PBCLK5 at 1MHz is VERY slow, I would set that as fast as I can because that clock speed determines how fast you can read and write to the SQI control registers and buffers. I run mine at 100MHZ which is the fastest the peripheral clocks can run with the core running at 200MHz. With it set at 1 MHz your core is sitting around waiting for access. And with the SQI external clock set at 100MHz your data is flying in way faster than you can get access to it. Secondly, your REFCLK02 should be set at or below the maximum your ADC is specified at. You can get corrupted data if you are clocking it out of your ADC faster than it is rated for. One caution, you are using the same PIC32 as I am, and I know that there is an errata out there on the REFCLK input clock speed. It should not be any higher than 100MHz or the clock may not operate properly. |
|
|
|
|
|
|
|
SungAUL,如果您读取的值可能是接收缓冲区中的数据,但它是无效的。什么是告诉你,接收缓冲区是满的,需要阅读?如果您没有指示SQI模块在接收缓冲器中接收任何数据,那么接收中断标志只需要被清除。
以上来自于百度翻译 以下为原文 sunugal, If you are reading the same value that is probably data that is in the receive buffer but it is invalid. What is telling you that the receive buffer is full and needs to be read? If you haven't instructed the SQI module to receive any data anything in the receive buffer and the receive interrupt flags simply need to be cleared. |
|
|
|
只有小组成员才能发言,加入小组>>
5183 浏览 9 评论
2005 浏览 8 评论
1932 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3178 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2229 浏览 5 评论
739浏览 1评论
624浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
510浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
637浏览 0评论
535浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-27 17:24 , Processed in 1.515825 second(s), Total 106, Slave 89 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号