打印
[ZLG-ARM]

AD芯片一次送出5BYTE,2103通过SPI只收到1个字节,怎么办?

[复制链接]
2192|6
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
yyf196|  楼主 | 2007-1-17 10:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
沙发
yyf196|  楼主 | 2007-1-17 10:08 | 只看该作者

在用SPI0之前,用I/O扣模拟SPI能把5个字节一次全读上来,为什么SPI数据寄存器不行呢?

使用特权

评论回复
板凳
lcyong| | 2007-1-17 11:11 | 只看该作者

应该是时序问题

不知道你AD的读写时序是什么样的,但估计问题是出在AD读写时序和SPI读写时序不批配上.比如,AD需要连续读5个字节,AD时序要求是CS使能端一直为低,还是读一个字节,CS都要有变化?SPI读的时候,CPU要注意控制AD的使能端时序.

使用特权

评论回复
地板
yyf196|  楼主 | 2007-1-17 11:51 | 只看该作者

tanks lcyong

Data is shifted into the ADE7759 at the
DIN logic input on the falling edge of SCLK. Data is shifted out
of the ADE7759 at the DOUT logic output on a rising edge of
SCLK.The CS input should be driven low for
the entire data transfer operation.

使用特权

评论回复
5
yyf196|  楼主 | 2007-1-17 11:56 | 只看该作者

tanks lcyong

AD的使能端时序:a falling edge on CS, the
ADE7759 is placed in communications mode

使用特权

评论回复
6
william47| | 2007-1-17 19:32 | 只看该作者

SPI不停地发0xff就能收到所有的数据

使用特权

评论回复
7
yyf196|  楼主 | 2007-1-18 09:06 | 只看该作者

re: thanks william47

如您所述,确可收到数据,但不正确,。。。

您说的方法是在应和2103SPI上说的:“During a data transfer the master always sends 8 to 16 bit of data to the slave, and the slave always sends a byte of data to the master.”

  但ADE775X在上传数据时是一次把5BYTE的数据全部转移到SPI口,而不是一BTYE一BYTE传的原文:“When an ADE7759 register is addressed for a read operation,the entire contents of that register are transferred to the serial port.” 

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

6

帖子

0

粉丝