Microchip
直播中

李建设

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

PIC18 I2C主器件始终接收ACK:即使没有连接从器件

嘿,正如标题所暗示的,我的PIC18F44 20 I2C主机总是接收ACK,即使SDA线是打开的(不包括上拉电阻)。检查波形:图1:一个地址传输与SDA上的唯一连接是4.7K拉出。数据表说,ACK位应该在第九SCL高时间采样,在下降沿后保持一个小的时间。这里的保持时间大约是8US,而数据表不要求最大的100kHz和0.9MSMAX为400 kHz模式。图2:第九SCL的下降沿与SDACLARED SDA的下降沿是高的,但是在SSPCON2中的AkStAT位被清除。如果我没有从奴隶那里接收数据,主人是否应该在第八SCL之后声明SDA?当连接到一个从属设备并且地址匹配发生时,一切似乎都正常。目前正在初始化:SSPSTAT=0x00 SSPCON1= 0x28 SSPCON2= 0x00 SCL运行在25KHZONE思想?谢谢。编辑:0.9US -0.9MS的400 kHz保持时间

以上来自于百度翻译


      以下为原文

    Hey all, as the title suggests, my PIC18F4420 I2C master is always receiving an ACK even if the SDA line is open (not including the pullup resistor). Check out the waveform:

Fig 1: One address transmission with the only connection on SDA being a 4.7k pullup.

The datasheet says the ACK bit should be sampled during the 9th SCL high time with a small hold time after the falling edge. Here the hold time is around 8us while the datasheet claims no max for 100kHz and 0.9ms max for 400kHz mode.

Fig 2: Falling edge of 9th SCL related to falling edge of SDA

Clearly SDA is high, yet the ACKSTAT bit in SSPCON2 is cleared. Should the master even be asserting SDA after the 8th SCL if I am not receiving data from a slave?

When a slave is connected and an address match occurs everything SEEMS to work okay.
Currently for initialization:
SSPSTAT = 0x00
SSPCON1 = 0x28
SSPCON2 = 0x00
SCL running at 25kHz

Any ideas? Thanks.

Edit: 0.9us -> 0.9ms for 400kHz hold time
   Attached Image(s)

回帖(16)

宋玉红

2018-8-31 17:41:55
对不起,没有包括在文本中的图像。服务器对着我大喊大叫。

以上来自于百度翻译


      以下为原文

    Sorry for not including the images IN the text. The server was yelling at me.
举报

吴键洪

2018-8-31 17:57:59
不是这样。SDA是高的,因为主机不驱动它,所以上拉它拉起来。这就是NAK通常是如何产生的,也就是说,没有什么驱动SDA低。不能帮助您的问题抱歉。将建议SDA处于模拟模式,即总是读取低,但SDA/RC4不是模拟能力引脚上的A。PIC18F420.

以上来自于百度翻译


      以下为原文

   
It's not. SDA is high because the Master is NOT driving it, so the pullup pulls it up.
That is how a NAK is normally generated, i.e. by nothing driving SDA low.
 
Can't help with your problem sorry.
Was going to suggest SDA was in analog mode, i.e. always reading low, but SDA/RC4 is not an analog capable pin on a PIC18F4420.
 
举报

李天竹

2018-8-31 18:17:19
在ACK/NACK期间,我可以看到这条线很高。所以,你的PIC坏了,或者你读错了。

以上来自于百度翻译


      以下为原文

    I can see the line is high during the ACK/NACK period. So, either your PIC is broken, or you read the register incorrectly.
举报

周润艺

2018-8-31 18:24:51
更基本的问题是:如果没有什么连接到数据线(SDA),那么为什么它会切换呢?有东西在切换SDA。这是你的照片吗?还是别的什么?好的,对不起,今天下午脑死亡了。正如下面指出的(DUH),这是发送地址的主机。

以上来自于百度翻译


      以下为原文

    The more basic question is: If nothing is connected to the data line (SDA) then why is it toggling at all?
 
Something is toggling SDA.  Is it your PIC?  Or something else?
 
OK, sorry, brain dead this afternoon.  As pointed out below (duh) this is the master sending the address.
 
举报

更多回帖

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