我现在用AM3352和ADS8634通过SPI口进行读写操作,发现如下问题(参考图):
1是clk
2.是mosi(读06寄存器,命令是0x0D)
3是miso
MISO数据本来第二个字节应该是0x08,在示波器上看到的也是0x08,但在AM335X这里读到的是0x04,好像是被右移了一位。
求解释,谢谢!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
你好,SPI有四种模式,不知道你当前配的什么模式?根据信号来看应该配成mode0,可以把相关配置寄存器打印出来看看
Table 24-5. Phase and Polarity Combinations
Polarity (POL) Phase (PHA) SPI Mode Comments
0 0 mode0 SPICLK active high and sampling occurs on the rising edge.
0 1 mode1 SPICLK active high and sampling occurs on the falling edge.
1 0 mode2 SPICLK active low and sampling occurs on the falling edge.
1 1 mode3 SPICLK active low and sampling occurs on the rising edge.
其中变量的定义如下:
#define MCSPI_IN_CLK 48000000u
#define MCSPI_OUT_FREQ 10000000u
unsigned int chNum = 1
其余的都是startware自身定义的
能否把片选的信号也测出来?
需要片选+CLK+输入 三个结合看一下时序
还可以改一下TCS 看看有没有变化
在0x08前面,输入信号上有0X0F,这个值能正确收到吗?
能否试试读读其他寄存器,写寄存器并读出来,看看错误是不是一样的?
0X0F一样右移了,变成了0X07
读了其他寄存器,情况是一样的
只是如果其他寄存器写入的值第一个位是1的话,读这个寄存器的时候这个寄存器的值是读不出来的,这是一个新的发现