完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,
我使用的是USPSPIGPIMODE代码来开发FW,所以主机应用程序可以与SPI从设备连接到FX3套件。 我的问题是“为什么没有CUU3PSPISETCONtiON()函数来调用SPI CONFIG,就像USPSPIDMADCODE代码一样?”如果SPI没有正确配置,它是如何工作的? 在我的情况下,我需要设置CPOL和CPHA。下面是来自USPSPIDMADCODE代码的代码。 请帮忙。 CyFxSpiInit(Untu16t Paeleln) { CYU3PSPICONFIGHTSPICONG; CYU3PDMACHANNEL CONTICONT DMACONFIG; CYU3PRESTROSTATUS SWT状态= CYU-U3PY成功; *启动SPI模块并配置主机。*/ 状态= CYU3pSPIN(); 如果(状态)!= CYU-U3PY成功 { 返回状态; } *启动SPI主程序块。在8MHz处运行SPI时钟 *并将字长配置为8位。还配置 *使用FW的从属选择。*/ CYU3PMESET((UIT88T**)和SpCONFIG,0,SIEZOF(SPICONFIG)); SPICONFICAL ISLSSB1 = CyFLUE; CopyFig.CPOL=Cytru. SPICONFIL.SNSNPOL = CyFLUE; SPCONFICAL.CPPHA = Cytru. SPICONFIG.交货时间= CyuU3pSysSnLa LaGueLead半字节CLK; 滞后时间= CyuU3pSysSnLaGa Lead Load半LCK; SPICONFIL.SSNCTRL = CyuU3pSysSnScTrLFFW; SPICONFICH时钟=8000000; SPICONFIG.WordLeN=8; 谢谢, 迪克 以上来自于百度翻译 以下为原文 Hi, I am using the U***SpiGpioMode code to development a FW so the host app can talk to a SPI slave device connect to FX3 kit. My question is "why there is no CyU3PSpiSetConfig() function call to setup SPI config as U***SpiDmaMode code does?" If the SPI is not correctly config, how can it work? In my case, I need to setup cpol and cpha. Below is the code from U***SpiDmaMode code. Please help. CyFxSpiInit (uint16_t pageLen) { CyU3PSpiConfig_t spiConfig; CyU3PDmaChannelConfig_t dmaConfig; CyU3PReturnStatus_t status = CY_U3P_SUCCESS; /* Start the SPI module and configure the master. */ status = CyU3PSpiInit(); if (status != CY_U3P_SUCCESS) { return status; } /* Start the SPI master block. Run the SPI clock at 8MHz * and configure the word length to 8 bits. Also configure * the slave select using FW. */ CyU3PMemSet ((uint8_t *)&spiConfig, 0, sizeof(spiConfig)); spiConfig.isL***First = CyFalse; spiConfig.cpol = CyTrue; spiConfig.ssnPol = CyFalse; spiConfig.cpha = CyTrue; spiConfig.leadTime = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK; spiConfig.lagTime = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK; spiConfig.ssnCtrl = CY_U3P_SPI_SSN_CTRL_FW; spiConfig.clock = 8000000; spiConfig.wordLen = 8; Thanks, Dick |
|
相关推荐
13个回答
|
|
你好,
我无法从FPGA波形中得到任何时钟。所以我检查了init代码,发现GPIO 53/56是输出的。在输出情况下,GPIOCONTION.OUTUVE不应该是CyTrue吗? /*配置GPIO 53作为输出(SPILCHILL)。*/ GPIOCONTION.OUTVAIL = CYFALSE; GPIOCONTION IMPUTEN = CyFLUE; GPIO构型。 GPIO配置。 GPIOCONTIONIN模式= CYU-U3PGPIOONIONITER; /*配置GPIO 56作为输出(MOSI)*/ GPIOCONTION.OUTVAIL = CYFALSE; GPIOCONTION IMPUTEN = CyFLUE; GPIO构型。 GPIO配置。 GPIOCONTIONIN模式= CYU-U3PGPIOONIONITER; 以上来自于百度翻译 以下为原文 Hi, I was unable to get any SPI_CLOCK from the FPGA waveform. So I checked the init code and found out GPIO 53/56 are output. In the output case, doesn't gpioConfig.outValue should be CyTrue? /* Configure GPIO 53 as output(SPI_CLOCK). */ gpioConfig.outValue = CyFalse; gpioConfig.inputEn = CyFalse; gpioConfig.driveLowEn = CyTrue; gpioConfig.driveHighEn = CyTrue; gpioConfig.intrMode = CY_U3P_GPIO_NO_INTR; /* Configure GPIO 56 as output(MOSI) */ gpioConfig.outValue = CyFalse; gpioConfig.inputEn = CyFalse; gpioConfig.driveLowEn = CyTrue; gpioConfig.driveHighEn = CyTrue; gpioConfig.intrMode = CY_U3P_GPIO_NO_INTR; |
|
|
|
在USPSPIDAMODE示例项目中使用了CYU3PSPISETCONTHORE(),因为在那里您可以使用SPI接口(SPI块)。
在U***SpiGpioMode,我们使用GPIOS来实现SPI功能,所以我们根本不使用SPI块。因此,没有使用CYU3PSPISETCONTHORE()。 在这里,您必须配置GPIOS并根据CPPHA和CPOL要求分别切换时钟。 例子: 对于CPOL=0,必须将SLCK GPIO设置为true,然后为false。这是在SPIGpiomode示例中实现的。 从USPSPIGOMMODE示例项目中摘录: CYU3PGPIOSET值(FX3A SPIX MOSI)((数据≫(7 -I))和0x01); CyFxSpiSetClockValue(Cyress); CYU3pBuyWATE(1); CyFxSpiSetClockValue(CyFLY); CYU3pBuyWATE(1); 对于CPOL=1,将SCLK GPIO设为FALSE然后TRUE。 你可以修改上面的片段如下: CYU3PGPIOSET值(FX3A SPIX MOSI)((数据≫(7 -I))和0x01); CyFxSpiSetClockValue(CyFLY); CYU3pBuyWATE(1); CyFxSpiSetClockValue(Cyress); CYU3pBuyWATE(1); 以上来自于百度翻译 以下为原文 CyU3PSpiSetConfig() is used in the U***SpiDmaMode example project because there you can use the SPI interface (SPI Block). In U***SpiGpioMode, we are using GPIOs to implement SPI functionality so there we are not at all using SPI Block. Therefore, there is no use of CyU3PSpiSetConfig(). Here, you have to configure the GPIOs and toggling the clock as per your Cpha and Cpol requirement respectively. Example: For Cpol = 0, you have to set the SLCK GPIO to True then False. This is implemented in the SPIGpiomode examaple Snippet from U***SpiGpiomode example project: CyU3PGpioSetValue (FX3_SPI_MOSI, ((data >> (7 - i)) & 0x01)); CyFxSpiSetClockValue (CyTrue); CyU3PBusyWait (1); CyFxSpiSetClockValue (CyFalse); CyU3PBusyWait (1); For Cpol = 1, set the SCLK GPIO to False then True. You can modify above snippet as below: CyU3PGpioSetValue (FX3_SPI_MOSI, ((data >> (7 - i)) & 0x01)); CyFxSpiSetClockValue (CyFalse); CyU3PBusyWait (1); CyFxSpiSetClockValue (CyTrue); CyU3PBusyWait (1); |
|
|
|
zhe0010 发表于 2018-12-29 11:14 不,在输出情况下,GPIOCONTION输入必须是FALSE,GPIOCONTION.OUTVIEW可以是假的或真的。但是在示例项目中,我们选择它为false。这意味着最初的输出值是Low。如果设置GPIOCONTION.OUTHOOL= CYTURE,初始值将很高。 以上来自于百度翻译 以下为原文 No, In output case, gpioConfig.inputEn must be False and gpioConfig.outValue can be False or True. But in the example project we have chosen it as False. It means the initial out value is Low. If you set gpioConfig.outValue = CyTrue, the initial value will be High. |
|
|
|
好啊。谢谢
将CPHA设置为1怎么样? 有时钟的GPIOIIT。我怎样才能安装到100KHz? /*初始化GPIO模块。*/ GPIOCROC.FASTLKDIV=2; 速度慢=0; SimeDIV= CYU-U3PGGPIOSIMPLE和DIVYBYY2; CKYSRC= CYU-U3PySysLCK; 半英寸=0; ApIdReStase= CYU3PGPIOIIT(&GPIOCROCK,NULL); 以上来自于百度翻译 以下为原文 Ok. Thx How about setting CPHA to 1? There is GpioInit for clock. How can I setup to 100KHz? /* Initialize the GPIO module. */ gpioClock.fastClkDiv = 2; gpioClock.slowClkDiv = 0; gpioClock.simpleDiv = CY_U3P_GPIO_SIMPLE_DIV_BY_2; gpioClock.clkSrc = CY_U3P_SYS_CLK; gpioClock.halfDiv = 0; apiRetStatus = CyU3PGpioInit(&gpioClock, NULL); |
|
|
|
你好,
我正在尝试U***SpiRegMode项目,看看是否能让它发挥作用。我认为这个示例项目似乎对SPI init有更多的控制。 至少我可以设置CPOL=0,CPHA=1,时钟设置为100kHz。 因为我的数据缓冲区已经很好的用于R/W,所以我需要的只是调用CYU3PSPITRANSMITWORSH()来传输到SPI。出于某种原因,我看不到我发送的数据。 有没有我可能错过的,所以传输没有我预期的功能? Cyu3PrimtStutuSuSut CyFxSpiTransfer UIT1616T BytCeNtt, UIT8*T*缓冲器, 四倍体 { CYU3PRESTROSTATUS SWT状态= CYU-U3PY成功; CYU3PSPISETSSNLIN(CyFLUE); 状态= CYU3pSPITRANSMITIONS(缓冲器,字节码); 如果(状态)!= CYU-U3PY成功 { CYU3PSPISETSSNLIN(Cyress); 返回状态; } 状态= CYU3PSPILIVER字(缓冲器,字节码); CYU3PSPISETSSNLIN(Cyress); 返回CYU-U3PL成功; } 谢谢, 迪克 以上来自于百度翻译 以下为原文 Hi, I am trying U***SpiRegMode project to see if I can get it work. I think this sample project seems to have more control over SPI init. At least I can setup CPOL=0, CPHA=1 and clock to 100KHz. Since my data buffer already good for r/w, so the only thing I need is call CyU3PSpiTransmitWords() to transfer to SPI. For some reason, I just can't see the data I send out. Is there anything I might be missing so the transmit is not functional as I expected? CyU3PReturnStatus_t CyFxSpiTransfer ( uint16_t byteCount, uint8_t *buffer, CyBool_t isRead) { CyU3PReturnStatus_t status = CY_U3P_SUCCESS; CyU3PSpiSetSsnLine (CyFalse); status = CyU3PSpiTransmitWords (buffer, byteCount); if (status != CY_U3P_SUCCESS) { CyU3PSpiSetSsnLine (CyTrue); return status; } status = CyU3PSpiReceiveWords (buffer, byteCount); CyU3PSpiSetSsnLine (CyTrue); return CY_U3P_SUCCESS; } Thanks, Dick |
|
|
|
我进入代码,并验证缓冲区为CyFxSpiTransfer是正确的,这是来自EP0。我还用DIOLAN适配器做了同样的事情,验证了从设备的功能。
所以我的问题是,CYU3PSPITRIMSITWORSS()函数有什么错误?这里有什么遗漏吗? DLN-2 UB-I2C/SPI/GPIO适配器 以上来自于百度翻译 以下为原文 I step into the code and verified the buffer into CyFxSpiTransfer is correct which came from EP0. I also used Diolan adapter doing the same thing which verified slave device is function. So my question is - what wrong with CyU3PSpiTransmitWords() function? Is there anything I am missing here? DLN-2 USB-I2C/SPI/GPIO Adapter |
|
|
|
|
|
|
|
虱目鱼, 你的奴隶装置是什么? 以上来自于百度翻译 以下为原文 MilkFish, What is your Slave device here? |
|
|
|
|
|
|
|
从上面的波形,CLK是好的,SS是活跃的低,但RXD,这是接收数据。
所以我的问题是“为什么CYU3PSPITRIMSITWORSS()不传递任何东西?” 以上来自于百度翻译 以下为原文 From the waveform above, CLK is fine, SS is active low, but the rxd which is the receive data. So my question is "why the CyU3PSpiTransmitWords() not transmit anything out?" |
|
|
|
|
|
|
|
我认为这个问题必须是解决方案。我已经尝试过做不同的SPIIT配置设置。实际上什么也没做。
以上来自于百度翻译 以下为原文 I thought the issue must be the config. I have been tried to do different SPI init config setting. Nothing actually working. |
|
|
|
你好,
CYU3pSPITRAMSMITION API返回的错误代码是什么? 当做, - Madhu Sudhan 以上来自于百度翻译 以下为原文 Hi, What error code does the CyU3PSpiTransmitWords API return? Regards, -Madhu Sudhan |
|
|
|
只有小组成员才能发言,加入小组>>
753个成员聚集在这个小组
加入小组2092 浏览 1 评论
1838 浏览 1 评论
3658 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1779 浏览 6 评论
1528 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
538浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
397浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
426浏览 2评论
372浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
890浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-12 05:06 , Processed in 1.295624 second(s), Total 99, Slave 84 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号