完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
IIC是最通用的系列总线之一。
它可用于配置具有IIC总线的设备。 最近,我正在学习使用microblaze IIC来配置设备。 我使用VC707板并尝试BIST。 有一个演示代码,它使用IIC从EEPROM写入和读取数据。 我运行设计并阅读代码,有些问题让我感到困惑。 我列举如下: 1.当我们使用IIC访问器件时,如EEPROM或PCA9548(IIC开关),IIC中有该器件的地址。 基于我的unerstanding,EEPROM或PCA9548,它们都是MicroBlaze IIC的IIC从站。 但这些从站的地址只能是7位。 但是对于EEPROM的读写或读取,地址可以是8位甚至16位。 所以我的问题是两个操作都通过IIC完成,为什么一个只能有7位地址而另一个可以是8位甚至16位? 2.根据我的理解,IIC每次可以传输8位。 如果EEPROM有16位地址,并且我想将16位值写入特定地址,则此操作需要4个字节才能完成。 前两个字节将传输addree,而剩下的2个字节将写入值,对吗? 非常感谢。 以上来自于谷歌翻译 以下为原文 IIC is one the most comman series bus. It can be used to configured the device which has IIC bus. Recently, I am learning use microblaze IIC to configure the device. I use VC707 board and try BIST. There is a demo code which use IIC to write and read datas from EEPROM. I run the design and read the codes, there are some questions which confuse me. I listed as following: 1. When we use IIC to access a device, like EEPROM or PCA9548(IIC switch), there is an address for this device in IIC. Based on my unerstanding, EEPROM or PCA9548, they are both IIC slaves of MicroBlaze IIC. But the address of these slaves can only 7 bits. But for write to or read from EEPROM, the address can be 8 bits even 16 bits. So my question is both operations are done through IIC, why one can only 7 bits address while another can be 8 bits even 16bits? 2. Based on my understanding, IIC can transfer 8 bits each time. If EEPROM has 16 bits address, and I want to write a 16bits value to a specific address, this operation need to take 4 bytes to complete. The first 2 bytes will transfer addrees, while left 2 bytes will write the value, right? Thanks very much. |
|
相关推荐
8个回答
|
|
我将通过说我从未使用过IIC总线开关来限定(或者更确切地说,不合格)我的答案。
此外,我个人发现Xilinx IIC API如此深不可测,以至于我放弃并编写了自己的,所以我无法就IIC API函数调用提出建议。 无论如何,我从IIC温度传感器获取数据就好了。 原则上,正如你所说的那样,地址的第8位是Read Not Write位。 从设备使用它来确定它应该处于什么模式。但是,在像EEPROM这样的情况下(如我们所讨论的)寻址和数据传输稍微复杂一些,通常需要写入设备 在您阅读之前告诉它您想要的地址。 因此,对IIC EEPROM的读操作可能需要写入然后读取。 这有点令人困惑,但设备的数据表应告诉您所有需要知道的信息。 根据你所说的开关(我既没有时间也没有倾向于查看并阅读它),似乎一旦你选择了通道(大概是通过在IIC上写入它),它就完全了 透明,您接近实际的从设备,就像它直接连接在总线上一样。 我承认这不是直接回答你的问题,但我希望它有所帮助。 问候, 霍华德 ----------“我们必须学会做的事情,我们从实践中学习。” - 亚里士多德 在原帖中查看解决方案 以上来自于谷歌翻译 以下为原文 I will qualify (or rather, unqualify) my answers by saying that I have never used a IIC bus switch. Further, I personally found the Xilinx IIC API so unfathomable that I gave up and wrote my own, so I cannot advise you on the IIC API function calls. Anyway, I get my data from an IIC temperature sensor just fine. In principle, the 8th bit of the address is, as you rightly say, the Read Not Write bit. This is used by the slave device to determine what mode it should be in. However, in cases like EEPROMs, where (as we have discussed) addressing and data transfer is a little more complex, it is common to have to WRITE to the device to tell it what address you want before you READ from it. Therefore a read operation to an IIC EEPROM can require a write and then a read. This is a bit confusing but the datasheet for the device should tell you all you need to know. From what you have said about the switch (I have neither the time nor the inclination to look it up and read about it), it seems like once youhave selected the channel (presumably by writing to it on the IIC), it is then completely transparent and you approach the actual slave device as if it were directly connected on the bus. I admit this is not directly answering your queries but I hope it helps a little. Regards, Howard ---------- "That which we must learn to do, we learn by doing." - AristotleView solution in original post |
|
|
|
1.不要将IIC总线上的器件地址与器件的内部地址结构混淆。
例如,IIC总线上的EEPROM的地址是0x34,但EEPROM中的数据地址可以是0x128(取决于PROM的大小)。 是的。 有点。 更准确地说,将有1个字节的数据访问总线上的设备,2个字节的设备地址和2个字节的数据要写入。 EEPROM的数据表应该为您提供有关它如何响应IIC活动的更多信息。 特别是,请查看时序图。 问候, 霍华德 附: 一些IIC设备可能具有10位地址。 XPS IIC IP可以处理这个问题。 如果您的设备没有10位IIC地址,请不要担心。 ----------“我们必须学会做的事情,我们从实践中学习。” - 亚里士多德 以上来自于谷歌翻译 以下为原文 1. Don't confuse the address of the device on the IIC bus with the internal address structure of the device. For instance, the address of the EEPROM ON THE IIC BUS is 0x34 but an address of data in the EEPROM may be 0x128 (depending of the size of the PROM). 2. Yes. Sort of. More correctly there will be 1 byte of data to access the device on the bus, 2 bytes of device address and 2 bytes of data to be written. The datasheet of the EEPROM should give you more information on how it responds to IIC activity. Look at the timing diagrams, in particular. Regards, Howard P.S. Some IIC devices may have 10 bit addresses. The XPS IIC IP can handle this. If your device does not have a 10 bit capable IIC address, don't worry about it. ---------- "That which we must learn to do, we learn by doing." - Aristotle |
|
|
|
谢谢hgleamon1。
我现在明白了。在VC707 BIST中,并非所有的IIC设备都直接连接到IIC总线。 相反,它们连接到IIC交换机(PCA9548)。 PCA9548连接到MicroBlaze的IIC总线。 (1)这就是为什么我们需要首先访问PCA9548,写入其控制寄存器以决定我们想要访问哪个通道,然后我们可以通过其IIC地址访问该设备(例如EEPROM是0x34),对吧?(2) 实际上,在启用PCA9548的右通道后,该通道的设备连接到IIC总线,我们可以用它的IIC总线地址访问它,对吧? (3)最后一个问题是IIC总线上的器件地址是7位。 除了这7位之外,最后一位(第8位)决定写或读。 但我对这个位的使用感到困惑。 在VC707 BIST设计中,对于eeprom的写入和读取,代码似乎只设置了7位地址,它不限制进一步的操作是写入还是读取。 然后我查了代码,发现有两个功能: 1. int XIic_MasterSend(XIic * InstancePtr,u8 * TxMsgPtr,int ByteCount)2。 int XIic_MasterRecv(XIic * InstancePtr,u8 * RxMsgPtr,int ByteCount) 根据我的理解,它们分别为IIC总线写入(MasterSend)和读取(MasterRecv)函数。基于IIC协议,它需要7位地址和1位来指示方向是写入还是读取。 当我使用这两个功能时。 我只需要使用函数“XIic_SetAddress”设置7位从机地址,然后“XIic_MasterSend”或“XIic_MasterRecv”将处理第8位,以确保方向是我们想要的(写或读),对吧? 非常感谢。 以上来自于谷歌翻译 以下为原文 Thanks hgleamon1. I understood better now. In VC707 BIST, not all the IIC devices connect to IIC bus dirrectly. Instead, they connect to a IIC switch (PCA9548). PCA9548 is connected to IIC bus of MicroBlaze. (1)So this is why we need firstly access the PCA9548, write to its control register to decide which channel we want to access, then we can access that device through its IIC address (e.g. EEPROM is 0x34), right? (2)Actually, after the right channel of PCA9548 is enabled, the device of that channel is connected to IIC bus, and we can access it with its IIC bus address, right? (3)The final question is the device address on IIC bus is 7 bits. Beside this 7 bits, the last bit (8th bit) is deciding write or read. But I am confused by what this bit is used. In VC707 BIST design, for eeprom write and read, the code seems only sets a 7 bits address, it does not restrict further operation is write or read. Then I checked the code, and I found there are two functions: 1. int XIic_MasterSend(XIic *InstancePtr, u8 *TxMsgPtr, int ByteCount) 2. int XIic_MasterRecv(XIic *InstancePtr, u8 *RxMsgPtr, int ByteCount) Based on my understanding, they are write (MasterSend) and read (MasterRecv) functions for IIC bus individually. Based on IIC protocal, it needs 7bits address and 1bit to indicate the direction is write or read. When I use these two functions. I only need use the function "XIic_SetAddress" to set the 7 bits slave address, then "XIic_MasterSend" or "XIic_MasterRecv" will handle the the 8th bit, to make sure the direction is what we want (write or read), right? Thanks very much. |
|
|
|
我将通过说我从未使用过IIC总线开关来限定(或者更确切地说,不合格)我的答案。
此外,我个人发现Xilinx IIC API如此深不可测,以至于我放弃并编写了自己的,所以我无法就IIC API函数调用提出建议。 无论如何,我从IIC温度传感器获取数据就好了。 原则上,正如你所说的那样,地址的第8位是Read Not Write位。 从设备使用它来确定它应该处于什么模式。但是,在像EEPROM这样的情况下(如我们所讨论的)寻址和数据传输稍微复杂一些,通常需要写入设备 在您阅读之前告诉它您想要的地址。 因此,对IIC EEPROM的读操作可能需要写入然后读取。 这有点令人困惑,但设备的数据表应告诉您所有需要知道的信息。 根据你所说的开关(我既没有时间也没有倾向于查看并阅读它),似乎一旦你选择了通道(大概是通过在IIC上写入它),它就完全了 透明,您接近实际的从设备,就像它直接连接在总线上一样。 我承认这不是直接回答你的问题,但我希望它有所帮助。 问候, 霍华德 ----------“我们必须学会做的事情,我们从实践中学习。” - 亚里士多德 以上来自于谷歌翻译 以下为原文 I will qualify (or rather, unqualify) my answers by saying that I have never used a IIC bus switch. Further, I personally found the Xilinx IIC API so unfathomable that I gave up and wrote my own, so I cannot advise you on the IIC API function calls. Anyway, I get my data from an IIC temperature sensor just fine. In principle, the 8th bit of the address is, as you rightly say, the Read Not Write bit. This is used by the slave device to determine what mode it should be in. However, in cases like EEPROMs, where (as we have discussed) addressing and data transfer is a little more complex, it is common to have to WRITE to the device to tell it what address you want before you READ from it. Therefore a read operation to an IIC EEPROM can require a write and then a read. This is a bit confusing but the datasheet for the device should tell you all you need to know. From what you have said about the switch (I have neither the time nor the inclination to look it up and read about it), it seems like once youhave selected the channel (presumably by writing to it on the IIC), it is then completely transparent and you approach the actual slave device as if it were directly connected on the bus. I admit this is not directly answering your queries but I hope it helps a little. Regards, Howard ---------- "That which we must learn to do, we learn by doing." - Aristotle |
|
|
|
非常感谢,霍华德。
你的回答对我很有帮助。 以上来自于谷歌翻译 以下为原文 Thanks so much, Howard. Your answer helped me a lot. |
|
|
|
回答你的问题1&
2,你是对的。 您写入IIC总线开关(多路复用器)以访问您感兴趣的IIC设备的通道,然后直接通过其IIC地址写入该设备,该IIC地址主要由设备本身决定。 通常,器件将具有地址引脚,当它们在电路板原理图中上拉或下拉时会影响其地址。 以上来自于谷歌翻译 以下为原文 To answer your questions 1 & 2, you are correct. You write to the IIC bus switch (a mux) to access the channel of the IIC device you're interested in, then you write to that device directly via its IIC address, which is largely determined by the device itself. Usually, a device will have address pins that effect its address when they are pulled up or down on the board schematics. |
|
|
|
|
|
|
|
你好
我有xilinx zc702板,我想与eeprom 2408进行通信,并且在通道2上的i2c IO交换机PCA9548上连接。我在/ sysfs以及/ dev“/ dev / i2c-3”中也得到了eeprom。 但每当我打算在eeprom中写它时,我就会出现错误失败事务。 你能指导一下我可以用来从用户空间访问eeprom的地址吗? devicetree.dts: - i2c0:i2c @ e0004000 {compatible =“xlnx,ps7-i2c-1.00.a”; reg =; 中断=; interrupt-parent =; bus-id =; input-clk =; i2c-clk =; #address-cells =; #size-cells =; i2cswitch @ 74 {compatible =“nxp,pca9548”; #address-cells =; #size-cells =; reg =; i2c @ 0 {#dress-cells =; #size-cells =; reg =; osc @ 5d {compatible =“si570”; reg =; factory-fout =; initial-fout =; }; }; i2c @ 2 {#address-cells =; #size-cells =; reg =; eeprom @ 54 {compatible =“at,24c08”; reg =; }; }; i2c @ 3 {#address-cells =; #size-cells =; reg =; gpio @ 21 {compatible =“ti,tca6416”; reg =; GPIO控制器; #gpio-cells =; }; }; i2c @ 4 {#address-cells =; #size-cells =; reg =; rtc @ 54 {compatible =“nxp,pcf8563”; reg =; }; }; i2c @ 7 {#address-cells =; #size-cells =; reg =; hwmon @ 52 {compatible =“pmbus,ucd9248”; reg =; }; hwmon @ 53 {compatible =“pmbus,ucd9248”; reg =; }; hwmon @ 54 {compatible =“pmbus,ucd9248”; reg =; }; }; }; }; 请建议我如何访问eeprom地址? 以上来自于谷歌翻译 以下为原文 Hi I have xilinx zc702 board , I want to communicate with eeprom 2408 with is connected on i2c IO switch PCA9548 on channel 2. I am getting eeprom in /sysfs as well as /dev "/dev/i2c-3" also. But whenever I am going to write in eeprom its show me error fail transaction. Could you guide me which address i can use to access eeprom from user space? devicetree.dts :- i2c0: i2c@e0004000 { compatible = "xlnx,ps7-i2c-1.00.a"; reg = <0xE0004000 0x1000>; interrupts = <0 25 4>; interrupt-parent = <&gic>; bus-id = <0>; input-clk = <111111111>; i2c-clk = <100000>; #address-cells = <1>; #size-cells = <0>; i2cswitch@74 { compatible = "nxp,pca9548"; #address-cells = <1>; #size-cells = <0>; reg = <0x74>; i2c@0 { #address-cells = <1>; #size-cells = <0>; reg = <0>; osc@5d { compatible = "si570"; reg = <0x5d>; factory-fout = <156250000>; initial-fout = <148500000>; }; }; i2c@2 { #address-cells = <1>; #size-cells = <0>; reg = <2>; eeprom@54 { compatible = "at,24c08"; reg = <0x54>; }; }; i2c@3 { #address-cells = <1>; #size-cells = <0>; reg = <3>; gpio@21 { compatible = "ti,tca6416"; reg = <0x21>; gpio-controller; #gpio-cells = <2>; }; }; i2c@4 { #address-cells = <1>; #size-cells = <0>; reg = <4>; rtc@54 { compatible = "nxp,pcf8563"; reg = <0x51>; }; }; i2c@7 { #address-cells = <1>; #size-cells = <0>; reg = <7>; hwmon@52{ compatible = "pmbus,ucd9248"; reg = <52>; }; hwmon@53{ compatible = "pmbus,ucd9248"; reg = <53>; }; hwmon@54{ compatible = "pmbus,ucd9248"; reg = <54>; }; }; }; }; Please suggest me how access eeprom address ? |
|
|
|
只有小组成员才能发言,加入小组>>
2415 浏览 7 评论
2821 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2292 浏览 9 评论
3372 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
2458 浏览 15 评论
有输入,但是LVDS_25的FPGA内部接收不到数据,为什么?
1085浏览 1评论
请问vc707的电源线是如何连接的,我这边可能出现了缺失元件的情况导致无法供电
579浏览 1评论
求一块XILINX开发板KC705,VC707,KC105和KCU1500
441浏览 1评论
2000浏览 0评论
723浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-20 15:46 , Processed in 1.489532 second(s), Total 62, Slave 56 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号