Microchip
直播中

李新美

7年用户 197经验值
私信 关注
[问答]

Microchip PIC SPI不兼容wrt slave select

我刚刚开始使用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)

张娜

2018-12-17 16:56:18
嗯,不太可能-那件事通常是有效的。你到底是什么意思?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
举报

李慧芳

2018-12-17 17:03:15
这是完全正确的,如果你检查一个典型的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.
举报

张娜

2018-12-17 17:18:57
我明白了,你是指哪个软件?正如我所说的,在主模式下的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.
举报

李慧芳

2018-12-17 17:30:39
“而且,通常不需要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.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分