完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我刚刚开始使用PIC24EP256MC202选择标准的一个重要部分,因为它有一个16位能力的SPI接口来驱动外部DAC。如果您检查两个公认的行业标准(例如Wiki)或一个常见的SPI DAC(例如Microchip MCP421)的数据表。在整个SPI传输过程中,发现从属选择应该是活动的。然而,微芯片是不兼容的,因为主模式中的从属选择仅在一个时钟周期内激活。什么样的基础上,当这些芯片功能不正常时,将它们作为SPI接口销售?对于软件不需要等待循环的问题,你有什么样的工作?为什么这个问题在硅勘误表中没有处理?附加的范围镜头显示了16位数据帧0x200 F的从属选择,时钟速度为1.25MHZEDIT,工作……绝不使用框架模式(SPIXCON2,FRMEN),试图得到SS信号,因为这导致时钟连续运行!当FRME被清除时,时钟只在事务持续时间内输出。这允许从使用普通IO引脚的软件驱动从属选择线,在将数据写入SPI缓冲器之前将其设置为真,并将其返回到假的某个合适的时间,如果有的话。
以上来自于百度翻译 以下为原文 I have just started to use the PIC24EP256MC202 an important part of the selection criteria being this had a 16 bit capable SPI interface for driving external DAC's. If you check both the accepted industry standard (e.g. Wiki) or the data sheet for a common SPI DAC (e.g. MICROCHIP MCP4921) you will discover slave select should be active during the entire SPI transfer. It seems however Microchip are non-compliant as there slave select in master mode is only active for a single clock period! On what basis are you selling these chips as containing an SPI interface when it is dysfunctional ? What work-around do you have for this problem that does not require wait loops in software ? Why is this issue not dealt with in the silicon errata ? The attached scope shot shows slave select with a 16 bit data frame 0x200F, clock speed is 1.25Mhz EDIT, WORK AROUND...... Never use framed mode (SPIxCON2, FRMEN) in an attempt to get an SS signal as this causes the clock to run continuously! When FRMEN is cleared the clock is only output for the duration of the transaction. This allows the slave select line to be driven by software using an ordinary io pin, setting it true prior to writing data to the spi buffer and returning it to false some suitable time later if at all. Attached Image(s) |
|
相关推荐
19个回答
|
|
|
嗯,不太可能-那件事通常是有效的。你到底是什么意思?PIC是一个主机,CS不保持低整个交易?CS是由用户代码驱动的,当一个主
以上来自于百度翻译 以下为原文 Hmmm, unlikely - that thing usually works. What do you mean exactly? Pic is a Master and CS is not kept low for the whole transaction? CS is driven by the user code, when a Master |
|
|
|
|
|
这是完全正确的,如果你检查一个典型的SPI从数据表,如MCP421 DAC,你会看到它应该是整个交易的低。在主模式中,PIC不只是以顺从的方式驱动SS。在软件中不可能解决这个问题,因为从选择需要精确地与SPI时钟对齐。
以上来自于百度翻译 以下为原文 That is exactly correct if you check the data sheet for a typical SPI slave such as the MCP4921 DAC you will see it is supposed to be low for the entire transaction. IN master mode the PIC DOES DRIVE SS just not in a compliant manner. It is not possible to resolve this in software as slave select needs to be EXACTLY aligned with the SPI clock. |
|
|
|
|
|
我明白了,你是指哪个软件?正如我所说的,在主模式下的SS线是用软件驱动的,所以可能会有一些简单的bug。而且,通常不需要SS与时钟对齐。
以上来自于百度翻译 以下为原文 I see, and understand. Which software are you referring to? Like I said, the SS line, in Master Mode, is driven in software - so there could be some simple bug going on. Also, it's not usually needed that SS is aligned with Clock. |
|
|
|
|
|
“而且,通常不需要SS与时钟对齐。”对不起,但是您没有正确地读取和理解MPC921数据表,也许您一般不熟悉SPI或硬件。首先,当SS激活时,它将在数据中移位,直到SS失效。假设PIC生成一个连续时钟(与任何其他正常的SPI主机一样),这完全取决于SS正确控制事务的时间。我所指的软件是在PIC处理器上运行的,我不明白为什么您认为其他软件可能会涉及。
以上来自于百度翻译 以下为原文 "Also, it's not usually needed that SS is aligned with Clock." I am sorry but you have failed to read and understand the MPC4921 data sheet correctly, perhaps you are not familiar with SPI or hardware in general. Firstly as soon as SS goes active it will shift in data until SS goes inactive. Given the PIC generates a continuous clock (as does any other normal SPI master) it is entirely down to the timing of SS to control the transaction correctly. The software I am referring to is that running on the PIC processor, I cannot see why you think any other software might be involved. |
|
|
|
|
|
我向你保证,我确实使用了DAC,顺便说一下,不,你可以随时降低SS,然后开始发送数据。只有在这个时候,SPI模块才会产生时钟脉冲,根据需要,发布你的代码,可能。
以上来自于百度翻译 以下为原文 I assure you I am I did use that DAC, by the way: and no, you can lower SS any time, then start sending data - and ONLY in this moment the SPI module will generate Clock pulses, as needed. Post your code, possibly. |
|
|
|
|
|
我的理解是,PICS只用于从属模式。你的PIC是主人,与奴隶DAC交谈,在SPI传输过程中确实需要一个“CS”活动。您的代码应该向DAC提供一个输出“CS”。在发送之前激活,当SPI完成时去激活。在你的控制下,而不是SPI模块。文斯
以上来自于百度翻译 以下为原文 It's my understanding that the PIC SS is only used in slave mode. Your PIC is the master, talking to the slave DAC, which does indeed need a 'CS' active during the SPI transfer. Your code should provide an output 'CS' to the DAC. Activate before transmit, de-activate when SPI complete. Under your control, not the SPI module. Vince |
|
|
|
|
|
我想你可能使用了一些C库代码!我只在程序中编程这些设备。我可以保证在主模式下,时钟继续运行,假设设备保持启用。(16)(1和lt;& Ct)(1和lt;lt;pRe0)(1和lt;& pLP0),W0;16位,MOV W0,SPI1CON1;DX ClNung,主,SEC pSAM2:1,PRI 16:1 MOV(1和lt;&Frman),W0;框架模式MOV W0,SPI1CON2 BSET SPI1STAT,πSPIN这是我的初始化代码MOV(1)&
以上来自于百度翻译 以下为原文 I think your probably using some C library code! I program these devices in assembly only. I can assure you in master mode the clock runs continuously assuming the device remains enabled. Here is my initialization code mov #(1< mov #(1< bset SPI1STAT,#SPIEN |
|
|
|
|
|
啊,框架模式!到目前为止我还没用过,你能试试“正常模式”吗?通常这会使生活变得更简单……(C或汇编程序没有区别)
以上来自于百度翻译 以下为原文 Ah, framed mode! I did not use it, so far: can you try "normal mode"? Usually that makes life easier... (C or assembler makes no difference) |
|
|
|
|
|
对不起,您能在这里回答并理解线程和MCP421数据表吗?
以上来自于百度翻译 以下为原文 Sorry but could you please read and understand the thread and MCP4921 data sheet before replying here |
|
|
|
|
|
在正常模式下根本就没有SS信号,所以我看不出这会有什么帮助?如果使用库代码,C可能会有所不同。
以上来自于百度翻译 以下为原文 In normal mode there would be no SS signal at all so I don't see how that would help ? C might make a difference if using library code |
|
|
|
|
|
不,是您未能理解PIC24数据表。请看PIC24家庭参考手册SP71页的DS7000 05185A页14“在主模式下,SPIX模块不控制SSX PIN。该引脚应该被配置为通用的I/O(GPIO),通过清除SSEN位(SPIXCON1和LT;7和gt)=0。你所看到的是帧同步脉冲输出在SS/FSYNC引脚在主模式。
以上来自于百度翻译 以下为原文 No, it is you who has failed to understand the PIC24 datasheet. Look at The SPI chapter of the PIC24 Family reference Manual DS70005185A page 14 "In Master mode, the SPIx module does not control the SSx pin. This pin should be configured as a General Purpose I/O (GPIO) by clearing the SSEN bit (SPIxCON1<7>) = 0." The Slave select function of the SS/FSYNC is only used in slave mode. What you are looking at is the frame sync pulse output on the SS/FSYNC pin in master mode. |
|
|
|
|
|
看一看框架模式,在FRM文件DS7000 05185:肯定的“框架模式”创建一个单一的脉冲在SS引脚,在硬件生成:我不知道哪些设备可能需要或需要它,但肯定的是,MCP421不在其中:),删除框架模式和手动驱动CS像VJasnSK-SUG(我也是)!
以上来自于百度翻译 以下为原文 Took a look at Framed mode, in FRM document DS70005185: Definitely the "framed mode" creates a single pulse at SS pin, generated in hardware: I don't know which devices may want or need it, but definitely MCP4921 is not among them :) So, remove the Framed mode and drive manually CS like vjasinski suggested (and me too!) |
|
|
|
|
|
SPI的FRM指示帧模式中的SS同步脉冲不封装整个消息。MCP421的数据表是指CS。看起来不像你可以使用框架模式和SS。
以上来自于百度翻译 以下为原文 The FRM for SPI indicates that the SS sync pulse in framed mode does not encapsulate the entire message. The Data sheet for the MCP4921 refers to a CS. Does not look like you can use the framed mode and SS. |
|
|
|
|
|
(框架模式类似于I2S或类似的音频协议…)
以上来自于百度翻译 以下为原文 (Framed mode resembles somehow I2S or alike audio protocols...) |
|
|
|
|
|
因此,当你正确地指出它是不兼容的,因为它显然无法在主模式下生成兼容的从属选择信号!
以上来自于百度翻译 以下为原文 And so as you correctly point out it is non-compliant because it is apparently unable to generate a compliant slave select signal in master mode! |
|
|
|
|
|
再次,如何同步与目前的1.25MHz时钟,我希望提高到5MHz。我想知道你从PIC SPI端口驱动DAC的最快速度是多少?
以上来自于百度翻译 以下为原文 Once again how to do that synchronously with a presently 1.25Mhz clock that I was hoping to raise to 5Mhz. I wonder what is that fastest you have driven a DAC from the PIC SPI port ? |
|
|
|
|
|
你把SS PIN写下到一个LAT寄存器,然后写入SSPBUF等,检查忙标志,重复发送所需的字节数,然后提高SS。完美地工作到许多兆赫,你只需要在一个和之前添加一个单写。
以上来自于百度翻译 以下为原文 You lower SS pin writing to a LAT register, then you write to SSPBUF etc and check for busy flag, repeat for as many bytes are needed to send, then raise SS. Perfectly working up to many megahertz, you only need to add a single Write to a pin before and after. |
|
|
|
|
|
我不得不嘲笑那一个!他们在哪里发现这些傲慢的小丑?
以上来自于百度翻译 以下为原文 I had to laugh at that one! Where do they find these arrogant clowns? |
|
|
|
|
|
我目前运行多个项目的SPI上运行的多个奴隶在高达12MHz。没有问题,正如达里奥所指出的。使用中断,设置/清除输出位,继续。采取所有1个指令周期。
以上来自于百度翻译 以下为原文 I currently run several projects with multiple slaves on SPI running at up to 12MHz. No problem as Dario indicates. Use interrupts , set/clear the output bit, continue. takes all of 1 instructions cycle. |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473 浏览 0 评论
5793 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1122浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1095浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
873浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-1 23:46 , Processed in 1.051028 second(s), Total 80, Slave 73 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1577