完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我正在尝试使用SPWF04S模块的SPI接口,但成功非常有限
通过在复位脉冲结束时将中断引脚拉高,我可以通过启用SPI接口将模块从RESET中取出。该模块发送一些完全有意义的WIND消息。我得到'控制台处于活动状态''wifi硬件启动'等等,最终它会安静下来每隔几秒进行一次扫描(我得到'扫描有效'然后反复'扫描完成')这一切都很好。 我无法让模块响应我发送的任何命令。让我们说我想发送最简单的命令(AT)来确定控制台是否还活着......这是我到目前为止所尝试的 1- SET CS low ...发送0x02,0x00,0x02,0x01,0x00 ...将CS置高......等待INT变低...读取响应 2- SET CS低...发送0x02,0x00,0x02,0x01,0x00 ...保持CS低电平...等待INT变低...读取响应 3- SET CS low ...发送0x02,0x00,0x02,0x01,0x00 ...继续计时 ......等待INT变低......阅读回复 4- SET CS low ...发送0x02,0x00,0x02,0x01,0x00 ...继续计时 ...等待同步(0x02)...读取响应 “长度”字节按照TCP堆栈手册(高字节优先)中的示例进行排序,但我也尝试了以上所有这两个字节的反转(低字节优先,接收事务的字节顺序)但无济于事。 在这两种情况下,如果INT最终变低,那不是我期望的那种响应,只是另一个WIND(通常是下一个'扫描开始'或'扫描完成') 我已经阅读了手册,关于SPI的非常简短的部分没有多大帮助(看起来我应该像上面的1-一样(因为它显示CS在事务结束时变高)但是它的描述是多次接收不是我所看到的(我看到INT在每次交易后都变高,而不是像手册中那样保持低位)并且SPI交易的破碎英文描述也不匹配。我不知道如何我应该相信这些图表。所有的代码示例都有与SPI相关的部分,但仔细观察后,它们都使用了UART。 有人可以通过准确的传输描述或时序图或实际使用SPI接口的示例代码向我指出正确的方向。在过去的3天里,我一直在与此作斗争,所以任何帮助都将不胜感激。 非常感谢 伊恩 以上来自于谷歌翻译 以下为原文 I am attempting to use the SPI interface of the SPWF04S module but with very limited success I can get the module out of RESET with the SPI interface enabled by simply pulling the interrupt pin high as the reset pulse ends. The module sends some WIND messages that all make perfect sense. I get 'console active' 'wifi hardware started' etc etc and eventually it settles down to doing scans every few seconds ( I get 'scan active' followed by 'scan complete' repeatedly) That's all good. I can't get the module to respond to any commands I send it. Lets say I want to send the simplest command (AT) just to determine if the console is alive... Here is what I've tried so far 1- SET CS low ... Send 0x02, 0x00, 0x02, 0x01, 0x00 ... Set CS high ... Wait for INT to go low ... Read response 2- SET CS low ... Send 0x02, 0x00, 0x02, 0x01, 0x00 ... Leave CS low ... Wait for INT to go low ... Read response 3- SET CS low ... Send 0x02, 0x00, 0x02, 0x01, 0x00 ... continue clocking ... Wait for INT to go low ... Read response 4- SET CS low ... Send 0x02, 0x00, 0x02, 0x01, 0x00 ... continue clocking ... Wait for sync (0x02) ... Read response The 'length' bytes are ordered as in the examples in the TCP stack manual (high byte first) but I have also tried all of the above with the two bytes reversed (low byte first, as is the byte order of the receive transactions) but to no avail. In both cases, if INT does eventually go low, it is not the kind of response I am expecting, just another WIND (usually the next 'scan started' or 'scan complete') I've been through the manual, the very short section on SPI isn't much help (looks like I should be doing as 1- above (since it shows CS going high at the end of the transaction) but then it's description of the multiple receive isn't what I'm seeing (I see INT go high after every transaction, not staying low as in the manual) and the broken-english description of the SPI transactions don't match either. I'm not sure how far I should trust these diagrams. All of the code examples have sections relating to SPI but on closer inspection, they all use the UART. Can someone point me in the right direction here with either an accurate description of the transfers or timing diagrams or some example code that actually uses the SPI interface. I've been battling with this for the last 3 days so any help would be greatly appreciated. Many thanks Ian |
|
相关推荐
10个回答
|
|
|
嗨,伊恩,
你尝试过提供的参考代码吗? http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-software/x-cube-wifi1.html 包? 以上来自于谷歌翻译 以下为原文 Hi Ian, did you try the reference code provided by http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-software/x-cube-wifi1.html package? |
|
|
|
|
|
嗨Gerado
是的,我已经很好地了解了X-cube代码,但我没有在STM32上开发(希望最终在很大程度上是跨平台的),所以不能直接使用它。我曾考虑购买所需的评估板,并简单地确定销钉的尺寸,看看发生了什么,但不幸的是,我们的供应商都没有库存 https://my.st.com/content/my_st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idw04a1。 HTML 由于“美国***出口限制”,我有什么想法可以在英国获得其中一个?所有常见的嫌疑人RS,Onecall,Mouser等 - 没有运气此外,我想确保我的启动顺序绝对正确(所有需要的GPIO处于正确的级别)以启动SPI接口。虽然它大多数时候都在发送WIND,但总有一些在启动后立即不同步,而且看起来它指向硬件配置问题。 WIND ID 0x07(配置失败)和10 r n在有效负载中。查看TCP堆栈手册: - 引脚/引脚的任何想法都指的是什么? 今天我会继续抨击它,如果我取得任何进展,我会再次发布。 以上来自于谷歌翻译 以下为原文 Hi Gerado Yes, I've had a good look through the X-cube code but I'm not developing on STM32 (hoping eventually to be largely cross platform) so cannot use this directly. I had considered buying the required eval boards and simply scoping the pins to see what's going on but unfortunately none of our suppliers stock the https://my.st.com/content/my_st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idw04a1.html due to 'US government Export Restrictions', Any ideas how I could get one of these in the UK? All the usual suspects RS, Onecall, Mouser etc. - no luckFurthermore, I want to be sure that I am getting the boot sequence absolutely correct (all the required GPIOs at the correct levels) to start the SPI interface. Although it stars sending WINDs most of the time, there are always some that are unsynced immediately after boot and one looks like it is pointing to a hardware config problem. WIND ID 0x07 ( Configuration failure ) and 10rn in the payload. Looking at the TCP stack manual that is:- Any ideas which pin / pins this is referring to? I'll keep hacking away at it today and post again if I make any progress. |
|
|
|
|
|
关于X-NUCLEO-IDW04A1的可用性,您可以使用欧盟经销商。我会给你发私信。
关于WIND:7,没关系。 SPWF04Sx默认接口是UART(配置变量console_enabled为1,表示“仅限UART”)。您可以在GPIO9上使用pullup在HW中启用SPI,而无需更改console_enabled变量。要关闭此WIND,请将console_enabled更改为0(仅限SPI)。 以上来自于谷歌翻译 以下为原文 About X-NUCLEO-IDW04A1 availability, you can use an EU distributor. I'll send you a private message. About WIND:7, it's ok. SPWF04Sx default interface is UART (configuration variable console_enabled is 1, meaning 'UART only'). You can enable SPI in HW with pullup on GPIO9, without changing console_enabled variable. To switch this WIND off, change console_enabled to 0 (SPI only). |
|
|
|
|
|
SORTED IT !!!!!!!!!
感谢所有参与其中的人,我现在已经开始工作了 事实证明,SPI时钟极性/相位存在问题。模块似乎在时钟的上升沿采样输入数据,而不是下降沿,如手册图4所示。因此,数据在下降沿或其附近变化。我的MOSI数据相移了半个时钟到右边。在我正在使用的PIC32上,这意味着我必须在SPI配置寄存器中设置CKE位 请参阅WIND通知开头的附图... 黄色迹线= MOSI - 0x02 0x00 ..... 蓝色迹线= CLK(图像上仅50kHz,但现在以12MHz运行) 紫色痕迹= MISO - 0x02 0x14 ..... 绿色跟踪CS 如果信息有用,希望其他人能找到这个片段 伊恩 以上来自于谷歌翻译 以下为原文 SORTED IT !!!!!!!!! Thanks to everyone who has had input into this, I've now got it working It turned out to a be problem with the SPI clock polarity / phase. It appears that the module samples the incoming data on the rising edge of the clock, not the falling edge as shown on Figure 4 of the manual. Thus, the data changes at the falling edge or thereabouts. My MOSI data was phase shifted half a clock to the right. On the PIC32 I'm currently using that meant that I had to set the CKE bit in the SPI configuration register See the attached image of the start of a WIND notification... Yellow trace = MOSI - 0x02 0x00 ..... Blue trace = CLK (only 50kHz on the image but now running at 12MHz) Purple trace = MISO - 0x02 0x14 ..... Green trace CS Hope someone else will find this snippet if info useful Ian |
|
|
|
|
|
Ciao Ian,
图4中的时钟线是错误的。感谢您的反馈。我们将更新该图片。 以上来自于谷歌翻译 以下为原文 Ciao Ian, clock line on figure 4 is wrong. Thanks for feedback. We will update that picture. |
|
|
|
|
|
图5和图5也是6需要更新:IRQ为高(由于外部上拉),下降沿触发,来自SPWF04S的SYNC字(0x02)在MISO线上(不是MOSI)
以上来自于谷歌翻译 以下为原文 Also figures 5 & 6 needs to be updated: IRQ is high (because of external pullup), triggers on falling edges, and SYNC word (0x02) coming from SPWF04S is on MISO line (not the MOSI one) |
|
|
|
|
|
嗨,伊恩。
那你在SPI_CR1中设置CPOL = 0和CPHA = 0吗?或者你对CKE位意味着什么?我正在使用F469。 以上来自于谷歌翻译 以下为原文 Hi Ian. So did you set CPOL = 0 and CPHA = 0 In SPI_CR1? Or what do you mean with CKE bit? I'm using F469. |
|
|
|
|
|
可能CKE与之相关
PIC32。 在STM32上,它的CPOL = 0(SPI_CPOL_Low)和CPHA = 0(SPI_CPHA_1Edge) 以上来自于谷歌翻译 以下为原文 Probably CKE is something related to PIC32. On STM32 it's CPOL=0 (SPI_CPOL_Low) and CPHA=0 (SPI_CPHA_1Edge) |
|
|
|
|
|
嗨,GG,
我正在研究停车解决方案的数据记录器应用, 即使我试图通过spi接口,我已更新到最新的固件SPWF04S-171117-0328fe3-Full 当我打开spwf04sa时,第一个字节序列是0x02,0x02,0x16,0x07,0x02 ....... 如果你可以帮助我,我几乎没有疑问, 1.第3个和第4个字节是0x07,0x02,这是有效载荷长度,所以在我的情况下总有效载荷长度是多少...... 我真的很抱歉这个愚蠢的怀疑...... 2.当我发送a命令时,我应该等待IRQ开始接收数据,或者我应该立即轮询来自SPI缓冲区的数据。 3.当我收到IRQ时,我应该在轮询数据之前取消断言吗? 4.在IRQ引脚中有时是技巧,我相信当IRQ从高处变为低时,我应该轮询数据...... 提前谢谢了.... 以上来自于谷歌翻译 以下为原文 Hi GG, I am working on data logger application for parking solutions, Even i am trying to interface through spi, and i have updated to latest Firmware SPWF04S-171117-0328fe3-Full When i power ON the spwf04sa, the first byte sequence is 0x02, 0x02, 0x16, 0x07,0x02....... i have few queries if you can help me out, 1. The 3rd and 4th byte is 0x07, 0x02 which is payload length, so what is the total payload length in my case... i am really sorry for the silly doubt... 2. When i send the a command should i wait for the IRQ to start receiving the data or should i immediately poll for the data from the SPI buffer. 3. when i receive the IRQ, should i de-assert it before polling the data...? 4. It is sometimes trick in IRQ pin, i believe i should poll the data when the IRQ goes from high to low from above understanding... Many thanks in advance.... |
|
|
|
|
|
我有完全相同的问题,但SPI参数正确。
几个小时我一直在努力解决没有应答的SPWF04,直到我试图设置更高的SPI时钟(这个论坛上有人写道4Mb /秒没有正常工作,8Mb /秒确实如此)。 之后,SPWF04开始回答。 所以,如果有人有类似的问题, 希望这有助于某人。 R.BeneÅ¡ 以上来自于谷歌翻译 以下为原文 I had exactly the same issue, however SPI parameters correctly. Few hours I've struggled with non-answering SPWF04, until I tried to set higher SPI clock (someone on this forum wrote that 4Mb/sec didn't work properly, 8Mb/sec did). After that, SPWF04 started to answer. So if someone has similar issues, Hope this helps someone. R. BeneÅ¡ |
|
|
|
|
只有小组成员才能发言,加入小组>>
stm32mp157的异核通信的rpmsg_sdb的m4固件和a7驱动该如何编写?
1453 浏览 0 评论
stm32f103用freertos对一个采样率为1kHz的传感器,进行采样,数据出差
1502 浏览 0 评论
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
3649 浏览 1 评论
3842 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
2461 浏览 1 评论
STM32H7打开DCache后,出现了串口接收信息为空的现象,是哪里出了问题?
727浏览 5评论
用NANO STM32F103RBT6的开发板烧录不了是哪里出了问题?
661浏览 5评论
710浏览 5评论
外部中断触发类型为双边沿触发,进入中断回调后有什么办法判断该边沿是上升沿还是下降沿?
941浏览 5评论
STM32L071CBT6低温环境下无法正常工作是什么原因引起的?
745浏览 5评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 01:10 , Processed in 1.291964 second(s), Total 63, Slave 54 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2849