完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嘿,正如标题所暗示的,我的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个回答
|
|
对不起,没有包括在文本中的图像。服务器对着我大喊大叫。
以上来自于百度翻译 以下为原文 Sorry for not including the images IN the text. The server was yelling at me. |
|
|
|
不是这样。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. |
|
|
|
在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. |
|
|
|
更基本的问题是:如果没有什么连接到数据线(SDA),那么为什么它会切换呢?有东西在切换SDA。这是你的照片吗?还是别的什么?好的,对不起,今天下午脑死亡了。正如下面指出的(DUH),这是发送地址的主机。
以上来自于百度翻译 以下为原文 OK, sorry, brain dead this afternoon. As pointed out below (duh) this is the master sending the address. |
|
|
|
在张贴的图像中,它是主发送从地址字节,它在第九时钟周期中得到一个NAK,正如您所期望的。
以上来自于百度翻译 以下为原文 In the image posted, it is the Master sending the slave address byte, which gets a NAK in the 9th clock cycle, as you would expect. |
|
|
|
苏珊,你怎么知道它是在拿一个ACK?你在用调试器看吗?(你没有提到)你是输出一些东西来回应一些代码测试吗?(您没有发布任何代码)
以上来自于百度翻译 以下为原文 Sousanator, how do you know it is getting an ACK? Are you looking with a debugger? (you didn't mention) Are you outputting something in response to some code testing it? (you have not posted any of your code) |
|
|
|
我对删除有用的信息表示歉意。我正在使用一个带断点的PICIT 3调试器,它在我的函数之后立即生成消息(在任何停止条件之前)。ACKSTAT位绝对是0,并且当我接收和ACK(接通)时,我有一个LED接通。电路(在这个测试中)只是在SDA和SCL上具有上拉电阻的PIC。
以上来自于百度翻译 以下为原文 My apologies for leaving out useful information. I am using a Pickit 3 debugger with a breakpoint immediately after my function which generates the message (before any stop condition). The ACKSTAT bit is most definitely 0, and I have an LED turn on when I receive and ACK (which turns on). The circuit (in this test) is just the PIC with the pullup resistors on SDA and SCL. |
|
|
|
|
|
|
|
我没有我的代码,但功能如下:BoL I2CfDebug从属(ByTeTyt地址,BytEyt dir){SEN=1;//启动启动条件,同时(!)SPIF;SSPIF=0;SSPBUF=(地址和0xFE)dir;而(!)SPIF;SPIF=0;if(ACKSTAT)/ACKSTAT主动低返回假;否则如果(!)ACKSTAT)返回true;否则返回false;}如果函数返回true,则打开一个LED,但我也用调试器检查寄存器值。
以上来自于百度翻译 以下为原文 I dont have my code with me but the function goes like: bool i2cFindSlave(byte_t address, byte_t dir) { SEN = 1; //initiate start condition while(!SPIF); SSPIF = 0; SSPBUF = (address & 0xFE) | dir; while(!SPIF); SPIF = 0; if(ACKSTAT) //ACKSTAT active low return false; else if(!ACKSTAT) return true; else return false; } if the function returns true I turn on an LED, but I also check the register values with a debugger. |
|
|
|
|
|
|
|
好吧,我希望我现在有了芯片。我不确定它是属于哪一个版本的,但是关于这个问题,我找不到的是什么呢?
以上来自于百度翻译 以下为原文 Well I wish I had the chip with me now. Im not sure which revision it falls under, but nothing about this issue was in the errata that I could find? |
|
|
|
我的意思是真正困扰我的是,PIC显然是断言SDA后的第九时钟脉冲为绝对小于波特计数。该数据表没有提到在该地区掌握SDA的主人。
以上来自于百度翻译 以下为原文 I mean what really bothers me is that the PIC is obviously asserting SDA immediately AFTER the 9th clock pulse for what is definitely less than a baud count. The datasheet makes no mention of the master asserting SDA in that region. |
|
|
|
我想知道关于A1硅的勘误表38(我想,无论如何,I2C引脚的东西)。
以上来自于百度翻译 以下为原文 I was wondering about Errata 38 (I think, the I2C pin thing in any case) for the A1 silicon. |
|
|
|
有趣。我一定要尝试一下,因为我当前的init例程将TISC位设置为输入。谢谢你的观察。
以上来自于百度翻译 以下为原文 Interesting. Ill definitely have to try that, cause my current init routine sets TRISC bits as inputs right away. Thanks for the observation. |
|
|
|
这是正常的。主机需要控制SDA以发送停止条件。
以上来自于百度翻译 以下为原文 That's normal. The Master needs control of SDA to be able to send a STOP condition. |
|
|
|
我相信PIC18F420硅偏振器A1中关于第38号的工作已经成功。我得到相同的波形,但ACK似乎工作正常。谢谢大家的帮助!
以上来自于百度翻译 以下为原文 I do believe that the work around for issue #38 in the PIC18F4420 silicon errata A1 has worked. I am getting the same waveforms, yet ACK seems to be working correctly. Thank you all for your help! |
|
|
|
只有小组成员才能发言,加入小组>>
5248 浏览 9 评论
2036 浏览 8 评论
1956 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3218 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2264 浏览 5 评论
787浏览 1评论
678浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
604浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
685浏览 0评论
582浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 18:32 , Processed in 1.542723 second(s), Total 74, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号