CN1996275A - Bulk memory accessing method for I2C controller in 10-site addressing mode - Google Patents
Bulk memory accessing method for I2C controller in 10-site addressing mode Download PDFInfo
- Publication number
- CN1996275A CN1996275A CN 200610138576 CN200610138576A CN1996275A CN 1996275 A CN1996275 A CN 1996275A CN 200610138576 CN200610138576 CN 200610138576 CN 200610138576 A CN200610138576 A CN 200610138576A CN 1996275 A CN1996275 A CN 1996275A
- Authority
- CN
- China
- Prior art keywords
- data
- byte
- controller
- mass storage
- address
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Landscapes
- Communication Control (AREA)
Abstract
本发明提供了一种采用10位寻址模式的I2C控制器访问大容量存储器的方法,其中上述I2C控制器从大容量存储器中随机读取数据的操作至少包括以下步骤:I2C控制器发送一个开始信号;发送写操作命令,等待回传ACK;发送上述数据的地址的高8位,等待回传ACK;发送上述数据的地址的低8位,等待回传ACK;发送一个开始信号;发送读操作命令,等待回传ACK;读取上述数据的一个字节,等待回传ACK;如果读取的数据大小为一个字节,则直接转到下一步;如果读取的数据大于一个字节,重复该步骤,直到指定长度的数据全部读取完毕;发送停止命令。采用本发明的方法可以简单高效的实现标准I2C控制器访问更大空间的I2C存储介质。
The present invention provides a method for an I2C controller using a 10-bit addressing mode to access a large-capacity storage, wherein the operation of the above-mentioned I2C controller to randomly read data from the large-capacity storage at least includes the following steps: the I2C controller sends a start Signal; send a write operation command, wait for the return ACK; send the upper 8 bits of the address of the above data, wait for the return ACK; send the lower 8 bits of the address of the above data, wait for the return ACK; send a start signal; send a read operation command, wait for ACK to be returned; read one byte of the above data, wait for ACK to be returned; if the size of the read data is one byte, go directly to the next step; if the read data is larger than one byte, repeat In this step, until the data of the specified length are all read; send a stop command. By adopting the method of the present invention, the access of the standard I2C controller to the I2C storage medium with a larger space can be realized simply and efficiently.
Description
技术领域technical field
本发明涉及电讯设备、电子设备和计算机设备的通讯领域,尤其涉及利用I2C控制器访问大容量存储器的方法。The invention relates to the communication field of telecommunication equipment, electronic equipment and computer equipment, in particular to a method for using an I2C controller to access a large-capacity memory.
背景技术Background technique
目前,在数控消费电器、电讯设备、电子设备和计算机设备等领域中,广泛地利用I2C总线及其他设备来实现设备之间的相互通讯。At present, in the fields of numerically controlled consumer appliances, telecommunication equipment, electronic equipment, and computer equipment, I2C buses and other equipment are widely used to realize mutual communication between equipment.
I2C(Inter-Integrated Circuit)总线是一种双线串行总线,由双向数据线SDA和时钟线SCL构成,通过这两条线,系统元器件之间可以相互通讯。I2C总线从传输速率上划分,有标准模式(100Kbit/s),快速模式(400Kbit/s),高速模式(3.4Mbit/s);从寻址范围上划分有7位地址模式和10位地址模式。I2C总线连接I2C主控制器(bus master)和I2C辅助设备(bus slave),一般来说,I2C主控制器通常是微处理器,I2C辅助设备包括许多连接在I2C总线上的设备,比如存储器、传感器等待。通常,I2C主控制器能与I2C辅助设备直接通讯并提供时钟信号;I2C辅助设备能从I2C主控制器接收数据或者为主控制器提供数据。在任何时候都只能有一个I2C主控制器存在,但可以有多个I2C辅助设备同时存在。The I2C (Inter-Integrated Circuit) bus is a two-wire serial bus consisting of a bidirectional data line SDA and a clock line SCL. Through these two lines, system components can communicate with each other. The I2C bus is divided from the transmission rate, there are standard mode (100Kbit/s), fast mode (400Kbit/s), high-speed mode (3.4Mbit/s); from the addressing range, there are 7-bit address mode and 10-bit address mode . The I2C bus connects the I2C master controller (bus master) and the I2C auxiliary device (bus slave). Generally speaking, the I2C master controller is usually a microprocessor, and the I2C auxiliary device includes many devices connected to the I2C bus, such as memory, The sensor waits. Usually, the I2C master controller can directly communicate with the I2C auxiliary device and provide a clock signal; the I2C auxiliary device can receive data from the I2C master controller or provide data to the main controller. Only one I2C master can be present at any one time, but multiple I2C slaves can be present at the same time.
数据只能以字节方式在I2C总线上传输,数据传输单位便是字节。传输通常是以最重要的位(most significant bit,以下简称MSB)作为第一位,后边紧跟8位数据,每个字节传输结束以后,都会从对方传出一个响应位(Acknowledge bit,以下简称ACK)。图1表示I2C总线上数据传输的格式。Data can only be transmitted on the I2C bus in bytes, and the unit of data transmission is bytes. The transmission usually takes the most significant bit (MSB for short) as the first bit, followed by 8 bits of data. After each byte transmission is completed, an Acknowledge bit (Acknowledge bit, below) will be sent from the other party. ACK for short). Figure 1 shows the format of data transfer on the I2C bus.
I2C主控制器向I2C辅助设备发出一个命令时,软件需要作以下设置:设置辅助设备地址(Slave Address)、操作属性是读或是写、命令字(Command Code)、数据(Data),然后将控制寄存器开启(start)。如果所有的参数都正确,则在写操作完成数据的传送时,或者读操作完成数据的接收时,I2C主控制器就会产生一个SMI#信号或者产生中断。When the I2C master controller sends a command to the I2C auxiliary device, the software needs to make the following settings: set the auxiliary device address (Slave Address), the operation attribute is read or write, command word (Command Code), data (Data), and then set The control register is turned on (start). If all the parameters are correct, the I2C master controller will generate an SMI# signal or generate an interrupt when the write operation completes the data transmission, or the read operation completes the data reception.
I2C总线支持7种操作方式:快速命令(Quick Command)、发送字节、接收字节、写字节、读字节、过程调用和数据块的读/写。下边列出了其中最常用的几种操作方式:The I2C bus supports 7 operation modes: Quick Command, Send Byte, Receive Byte, Write Byte, Read Byte, Procedure Call and Data Block Read/Write. Some of the most commonly used modes of operation are listed below:
1)从当前地址读一个字节(Byte)/字(Word):1) Read a byte (Byte)/word (Word) from the current address:
属于I2C辅助设备的存储器内部有一个地址指针计数器用于记录当前的访问地址的指针,每一次存储器读/写操作之后,该指针就会自动移动并保存下来。接收字节就能实现简单地获取当前指针所指地址位存放的数据。该操作在双向数据线SDA上的数据流如图2所示。存储器从当前地址读取一个数据块操作,也就是读取一个字的操作相对于读取一个字节操作而言,其不同之处在于传输一个字节的数据后不发送STOP命令,而是继续读取下一个字节的数据,直到读取完所有的数据,再发送STOP命令,操作数据流如图6所示。There is an address pointer counter inside the memory belonging to the I2C auxiliary device to record the pointer of the current access address. After each memory read/write operation, the pointer will be automatically moved and saved. Receiving bytes can simply obtain the data stored in the address bit pointed by the current pointer. The data flow of this operation on the bidirectional data line SDA is shown in FIG. 2 . The memory reads a data block operation from the current address, that is, the operation of reading a word is different from the operation of reading a byte. The difference is that the STOP command is not sent after transferring a byte of data, but continues Read the data of the next byte until all the data is read, and then send the STOP command. The operation data flow is shown in Figure 6.
2)向当前地址写一个字节:2) Write a byte to the current address:
写一个字节与读一个字节的协议很相似,唯一的不同就是数据的传送方向:读一个字节的数据是从I2C辅助设备传向I2C主控制器;而写一个字节的数据是从I2C主控制器传向I2C辅助设备。该操作在双向数据线SDA上的数据流与图2相似,只是将图2的第一个字节的第8位改为“0”。The protocol for writing a byte is very similar to reading a byte, the only difference is the direction of data transfer: reading a byte of data is transmitted from the I2C auxiliary device to the I2C master controller; writing a byte of data is from the The I2C master controller passes to the I2C slave device. The data flow of this operation on the bidirectional data line SDA is similar to that in Figure 2, except that the eighth bit of the first byte in Figure 2 is changed to "0".
3)向存储器的指定地址写一个字节/字:3) Write a byte/word to the specified address of the memory:
该命令格式要求首先传送一个I2C辅助设备的地址,并在命令字的最后一位标明是一个写操作,等待I2C辅助设备响应,然后传送长度为一个字节的数据地址(Word Address)和要写入的那一个字节的值,后面再发送一个STOP命令。该操作在双向数据线SDA上的数据流如图3所示。写入一个字(buffer写)的操作相对于写一个字节(字节写)操作而言,其不同之处在于传输一个字节的数据后不发送STOP命令,而是继续写入下一个字节的数据,直到写完所有的数据,再发送STOP命令,操作数据流如图4所示。The command format requires to first transmit the address of an I2C auxiliary device, and mark a write operation in the last bit of the command word, wait for the response of the I2C auxiliary device, and then transmit the data address (Word Address) with a length of one byte and the address to be written. Enter the value of the byte, and then send a STOP command later. The data flow of this operation on the bidirectional data line SDA is shown in FIG. 3 . The difference between the operation of writing a word (buffer write) and the operation of writing a byte (byte write) is that the STOP command is not sent after transferring a byte of data, but continues to write the next word Section data, until all the data is written, and then send the STOP command, the operation data flow is shown in Figure 4.
4)从存储器的指定地址读一个字节/字:4) Read a byte/word from the specified address of the memory:
读操作与写操作不太一样,要读取一个指定地址,必须先用写命令告诉存储器要读取的地址,然后再执行读操作,接收到字节后再发送STOP命令,操作的数据流如图5所示。如果想从指定地址读取一个字的数据,STOP命令之前的操作都不变,只是在接收到第一个字节后,并不发送STOP命令,而是再读取一个字节,直到接收所有的数据,才发送STOP命令。The read operation is not the same as the write operation. To read a specified address, you must first use the write command to tell the memory the address to be read, and then perform the read operation. After receiving the byte, send the STOP command. The data flow of the operation is as follows: Figure 5 shows. If you want to read a word of data from the specified address, the operation before the STOP command remains unchanged, but after receiving the first byte, the STOP command is not sent, but another byte is read until all bytes are received. data before sending the STOP command.
目前,采用10位寻址模式的I2C总线为辅助设备提供了10位地址线,最多只能访问1K字节的物理空间。随着I2C总线应用的增加,对存储器的空间也提出了更大的要求,目前市面上已经有很多存储空间大于1K字节的存储器,而由于其数据的地址位已经超过了10位,因此用正常的I2C总线操作流程已经不能正常完成数据的随机访问。Currently, the I2C bus with 10-bit addressing mode provides 10-bit address lines for auxiliary devices, which can only access up to 1K bytes of physical space. With the increase of I2C bus applications, greater requirements are put forward for the memory space. At present, there are many memories with a storage space larger than 1K bytes on the market, and because the address bits of the data have exceeded 10 bits, so use The normal I2C bus operation process can no longer complete the random access of data normally.
发明内容Contents of the invention
鉴于上述,本发明要解决采用10位寻址模式的I2C控制器因寻址空间不足而无法寻址存储空间大于1K字节的存储设备的技术问题,以提高系统的存储空间,为系统提供更强大的功能。In view of the above, the present invention will solve the technical problem that the I2C controller adopting the 10-bit addressing mode cannot address the storage device with a storage space larger than 1K bytes due to insufficient addressing space, so as to improve the storage space of the system and provide more storage space for the system. powerful functions.
为了解决上述技术问题,本发明提出一种采用10位寻址模式的I2C控制器访问大容量存储器的方法,其中上述I2C控制器从大容量存储器中随机读取数据的操作至少包括以下步骤:In order to solve the above-mentioned technical problems, the present invention proposes a method for accessing a large-capacity memory by an I2C controller using a 10-bit addressing mode, wherein the above-mentioned I2C controller randomly reads data from the large-capacity memory at least including the following steps:
步骤1,I2C控制器发送一个开始(start)信号;Step 1, the I2C controller sends a start (start) signal;
步骤2,I2C控制器向大容量存储器发送写操作命令,并等待其回传ACK;Step 2, the I2C controller sends a write operation command to the mass storage, and waits for an ACK to be returned;
步骤3,收到ACK后,I2C控制器向大容量存储器发送上述数据的地址的高8位,并等待其回传ACK;Step 3, after receiving the ACK, the I2C controller sends the upper 8 bits of the address of the above data to the mass storage, and waits for the ACK to be returned;
步骤4,收到ACK后,I2C控制器向大容量存储器发送上述数据的地址的低8位,并等待其回传ACK;Step 4, after receiving the ACK, the I2C controller sends the lower 8 bits of the address of the above data to the mass storage, and waits for the ACK to be returned;
步骤5,收到ACK后,I2C控制器再发送一个start信号;Step 5, after receiving the ACK, the I2C controller sends another start signal;
步骤6,I2C控制器向大容量存储器发送读操作命令,并等待其回传ACK;Step 6, the I2C controller sends a read operation command to the mass storage, and waits for an ACK to be returned;
步骤7,收到ACK后,I2C控制器从大容量存储器中读取上述数据的一个字节,并等待其回传ACK;Step 7, after receiving the ACK, the I2C controller reads one byte of the above data from the mass storage, and waits for the ACK to be returned;
步骤7′,如果读取的数据大小为一个字节,则直接转到步骤8;如果读取的数据大于一个字节,重复步骤7,直到指定长度的数据全部读取完毕,转到步骤8;Step 7', if the size of the read data is one byte, go directly to step 8; if the read data is larger than one byte, repeat step 7 until all the data of the specified length is read, go to step 8 ;
步骤8,收到ACK后,发送停止(stop)命令。Step 8, after receiving the ACK, send a stop (stop) command.
其中,步骤2中的写操作命令为一个字节,其第1-7位用于决定这次操作所选择的从控制器,也就是上述大容量存储器的地址,其第8位为0,表示用于决定这次操作是写操作;步骤6中的读操作命令为一个字节,其第1-7位用于决定这次操作所选择的从控制器,也就是上述大容量存储器的地址,其第8位为1,表示用于决定这次操作是读操作。Among them, the write operation command in step 2 is a byte, and its 1-7 bits are used to determine the slave controller selected for this operation, that is, the address of the above-mentioned large-capacity storage, and its 8th bit is 0, indicating It is used to determine that this operation is a write operation; the read operation command in step 6 is a byte, and its 1-7 bits are used to determine the slave controller selected for this operation, that is, the address of the above-mentioned large-capacity storage, Its 8th bit is 1, indicating that it is used to determine that this operation is a read operation.
采用10位寻址模式的I2C控制器向大容量存储器写入随机读取数据的操作至少包括以下步骤:The operation of writing random read data to mass memory by using the I2C controller in 10-bit addressing mode includes at least the following steps:
步骤1,I2C控制器发送一个start信号;Step 1, the I2C controller sends a start signal;
步骤2,I2C控制器向大容量存储器发送写操作命令,并等待其回传ACK;Step 2, the I2C controller sends a write operation command to the mass storage, and waits for an ACK to be returned;
步骤3,收到ACK后,I2C控制器向大容量存储器发送将要写入上述数据的地址的高8位,并等待其回传ACK;Step 3, after receiving the ACK, the I2C controller sends the upper 8 bits of the address where the above data will be written to the mass storage, and waits for the ACK to be returned;
步骤4,收到ACK后,I2C控制器向大容量存储器发送将要写入上述数据的地址的低8位,并等待其回传ACK;Step 4, after receiving the ACK, the I2C controller sends the lower 8 bits of the address where the above data will be written to the mass storage, and waits for the ACK to be returned;
步骤5,收到ACK后,I2C控制器向大容量存储器发送需要写入的数据的一个字节,并等待其回传ACK;Step 5, after receiving the ACK, the I2C controller sends a byte of data to be written to the mass storage, and waits for the ACK to be returned;
步骤5′,如果需要写入的数据的大小为一个字节,则直接转到步骤6;如果需要写入的数据大于一个字节,重复步骤5,直到指定长度的数据全部写入,转到步骤6;Step 5', if the size of the data to be written is one byte, then go directly to step 6; if the data to be written is larger than one byte, repeat step 5 until all the data of the specified length is written, go to Step 6;
步骤6,收到ACK后,发送stop命令。Step 6, after receiving the ACK, send the stop command.
其中,步骤2中的写操作命令为一个字节,其第1-7位用于决定这次操作所选择的从控制器,也就是上述大容量存储器的地址,其第8位为0,表示用于决定这次操作是写操作。上述可写入的数据最多为15个字节。Among them, the write operation command in step 2 is a byte, and its 1-7 bits are used to determine the slave controller selected for this operation, that is, the address of the above-mentioned large-capacity storage, and its 8th bit is 0, indicating Used to determine that this operation is a write operation. The data that can be written above is up to 15 bytes.
采用本发明所述方法可以简单高效的实现标准I2C控制器访问更大空间的存储介质,有效的扩大I2C辅助设备的可用地址空间,为I2C辅助设备提供更强大的功能。它的优点如下:不更改已有的I2C控制器,电路不作任何改动,完全由软件来实现,保证硬件的兼容性。The method of the invention can simply and efficiently realize the access of the standard I2C controller to a storage medium with a larger space, effectively expand the available address space of the I2C auxiliary equipment, and provide more powerful functions for the I2C auxiliary equipment. Its advantages are as follows: the existing I2C controller is not changed, the circuit is not changed in any way, it is completely realized by software, and the compatibility of hardware is guaranteed.
下面结合附图,对本发明的具体实施作进一步的详细说明。对于熟悉本技术领域的人员而言,从对本发明方法的详细说明中,本发明的上述和其他目的、特征和优点将显而易见。The specific implementation of the present invention will be further described in detail below in conjunction with the accompanying drawings. The above and other objects, features and advantages of the present invention will be apparent to those skilled in the art from the detailed description of the method of the present invention.
附图说明Description of drawings
图1为I2C总线上数据传输的格式。Figure 1 shows the format of data transmission on the I2C bus.
图2为从当前地址读一个字节的操作的数据流。Figure 2 shows the data flow for the operation of reading a byte from the current address.
图3为I2C控制器向指定的地址写一个字节的操作的数据流。Figure 3 is the data flow of the I2C controller to write a byte operation to the specified address.
图4为I2C控制器向指定的地址写一个连续数据块的操作的数据流。Figure 4 is the data flow for the operation of the I2C controller to write a continuous data block to the specified address.
图5为I2C控制器从指定地址读取一个字节的操作的数据流。Figure 5 is the data flow of the operation of the I2C controller to read a byte from the specified address.
图6为I2C控制器从当前地址读取一个连续数据块的操作的数据流。Figure 6 is the data flow for the operation of the I2C controller to read a continuous data block from the current address.
图7为大于1K字节的存储空间的存储器字节读操作的数据流。FIG. 7 is a data flow of a memory byte read operation for a storage space larger than 1K bytes.
图8为大于1K字节的存储空间的存储器字节写操作的数据流。FIG. 8 is a data flow of a memory byte write operation for a storage space larger than 1K bytes.
图9为大于1K字节的存储空间的存储器读取一个连续数据块的操作的数据流。FIG. 9 is a data flow of an operation of reading a continuous data block from a memory with a storage space larger than 1K bytes.
具体实施方式Detailed ways
下面结合附图和具体实施例对本发明所述的方法作进一步的详细说明。The method described in the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
一些大容量存储器,特别是大于1K字节的存储空间的存储器,提供了一些与采用10位寻址模式的I2C控制器的操作兼容的操作,包括:按字节写、按页写、当前地址读/写、随机读、按页读等。下面讨论几种常用操作方式。Some large-capacity memories, especially memories larger than 1K bytes of storage space, provide some operations compatible with the operation of the I2C controller using 10-bit addressing mode, including: write by byte, write by page, current address Read/write, random read, page-by-page read, etc. Several common modes of operation are discussed below.
(1)从当前地址读一个字节:此操作方式与背景技术中提到的从当前地址读一个字节的操作方式是完全一样的,在此不再讨论。(1) Read a byte from the current address: This operation mode is exactly the same as the operation mode of reading a byte from the current address mentioned in the background technology, and will not be discussed here.
(2)向当前地址写一个字节:此操作方式与背景技术中提到的向当前地址写一个字节的操作方式是完全一样的,在此不再讨论。(2) Write a byte to the current address: This operation mode is exactly the same as the operation mode of writing a byte to the current address mentioned in the background technology, and will not be discussed here.
(3)从指定的地址读一个字节:随机读方式允许采用10位寻址模式的I2C控制器随机访问整个空间内任意地址,在读数据之前必须先执行一个空写操作,将要读取的字节的地址传给双向数据线SDA,然后执行一次当前地址的读操作。(3) Read a byte from the specified address: The random read method allows the I2C controller with 10-bit addressing mode to randomly access any address in the entire space. Before reading data, a null write operation must be performed first, and the word to be read The address of the section is passed to the bidirectional data line SDA, and then a read operation of the current address is performed.
图7表示了从大于1K字节的存储空间的存储器随机读取一个字节的流程,该流程与采用10位寻址模式的I2C控制器的流程差别很大,没有一个单独的流程能独立完成此功能。本方法将多个标准的操作流程组合起来,实现从大容量存储器随机读取一个字节的功能。基本思想是利用如图3所示的采用10位寻址模式的I2C控制器的向指定地址写一个字节的操作和如图2所示的从当前地址读一个字节的操作组合起来实现此功能。具体的步骤至少包括:Figure 7 shows the process of randomly reading a byte from a memory larger than 1K bytes of storage space. This process is very different from the process of the I2C controller using 10-bit addressing mode, and no single process can be completed independently. this function. The method combines a plurality of standard operation processes to realize the function of randomly reading a byte from a large-capacity memory. The basic idea is to use the I2C controller using 10-bit addressing mode as shown in Figure 3 to combine the operation of writing a byte to the specified address and the operation of reading a byte from the current address as shown in Figure 2 to achieve this. Function. Specific steps include at least:
第一步:I2C控制器发送一个Start信号;Step 1: The I2C controller sends a Start signal;
第二步:I2C控制器发送写操作命令,并等待存储器回应ACK;Step 2: The I2C controller sends a write operation command and waits for the memory to respond with ACK;
第三步:收到ACK后,I2C控制器向存储器发送指定地址的高8位,并等待存储器回应ACK;Step 3: After receiving the ACK, the I2C controller sends the upper 8 bits of the specified address to the memory, and waits for the memory to respond to the ACK;
第四步:收到ACK后,I2C控制器向存储器发送指定地址的低8位,并等待存储器回应ACK;Step 4: After receiving the ACK, the I2C controller sends the lower 8 bits of the specified address to the memory, and waits for the memory to respond with ACK;
第五步:收到ACK后,发送一个Start信号;Step 5: After receiving ACK, send a Start signal;
第六步:I2C控制器向存储器发送读操作命令,并等待存储器回应ACK;Step 6: The I2C controller sends a read operation command to the memory, and waits for the memory to respond with ACK;
第七步:收到ACK后,I2C控制器从存储器中读取数据的一个字节,并等待存储器回应ACK;Step 7: After receiving the ACK, the I2C controller reads a byte of data from the memory and waits for the memory to respond with an ACK;
第八步:发送STOP命令。Step 8: Send STOP command.
图9表示了了从大于1K字节的存储空间的存储器随机读取一个连续数据块的操作。从大容量存储器中随机读取一个连续数据块的流程与从大容量存储器随机读取一个字节的流程的主要区别是:在采用10位寻址模式的I2C控制器成功读取第一个字节后,不立即结束读取操作,而是继续等待大容量存储器向采用10位寻址模式的I2C控制器发送数据,读指定的数据长度后才结束本次读操作。本方法将多个标准的操作流程组合起来,完成从大容量存储器随机读取一个连续数据块的功能。具体的步骤至少包括:FIG. 9 shows the operation of randomly reading a continuous data block from a memory with a storage space larger than 1K bytes. The main difference between the flow of randomly reading a contiguous block of data from mass storage and the flow of randomly reading a byte from mass storage is that after the first word is successfully read by the I2C controller using 10-bit addressing mode After the section, do not end the read operation immediately, but continue to wait for the large-capacity storage to send data to the I2C controller using the 10-bit addressing mode, and end the read operation after reading the specified data length. The method combines a plurality of standard operating procedures to complete the function of randomly reading a continuous data block from a large-capacity storage. Specific steps include at least:
第一步:I2C控制器发送一个Start信号;Step 1: The I2C controller sends a Start signal;
第二步:I2C控制器发送写操作命令,并等待存储器回应ACK;Step 2: The I2C controller sends a write operation command and waits for the memory to respond with ACK;
第三步:收到ACK后,I2C控制器向存储器发送指定地址的高8位,并等待存储器回应ACK;Step 3: After receiving the ACK, the I2C controller sends the upper 8 bits of the specified address to the memory, and waits for the memory to respond to the ACK;
第四步:收到ACK后,I2C控制器向存储器发送指定地址的低8位,并等待存储器回应ACK;Step 4: After receiving the ACK, the I2C controller sends the lower 8 bits of the specified address to the memory, and waits for the memory to respond with ACK;
第五步:收到ACK后,发送一个Start信号;Step 5: After receiving ACK, send a Start signal;
第六步:发送读操作命令,并等待存储器回应ACK;Step 6: Send a read operation command and wait for the memory to respond with ACK;
第七步:收到ACK后,I2C控制器从存储器中读取数据的一个字节,并等待存储器回应ACK;Step 7: After receiving the ACK, the I2C controller reads a byte of data from the memory and waits for the memory to respond with an ACK;
第八步:重复第七步操作,直到读取完所有要求的数据,每个字节的数据读取操作都要等待存储器回应ACK;Step 8: Repeat step 7 until all required data is read, and each byte of data read operation must wait for the memory to respond to ACK;
第九步:发送STOP命令。Step 9: Send STOP command.
(4)向指定地址写入一个字节:这个操作与背景技术中提到的向存储器的指定地址写一个字节的操作相比较而言,多了一个字节的地址,其它地方都是完全一样,如图8所示。(4) Write a byte to the specified address: this operation is compared with the operation of writing a byte to the specified address of the memory mentioned in the background technology, and there is an address of one byte more, and other places are completely Same, as shown in Figure 8.
仔细对比图4和图8,不难发现图4的处理流程在发出写命令后,只送出了一个字节的存储器地址,后边可以连续写入1-16个字节的数据;图8处理流程要求在写命令后发送两个字节的存储器地址,后边再一个字节的数据。对于存储器来说,数据和字节都只是一些字节流,它不可能也没有必要区分。所以本方法就利用这些特点,使用采用10位寻址模式的I2C控制器以图4的处理流程向指定存储器地址写入两个字节,来实现向大容量存储器随机写入一个字节的功能。写操作的步骤至少包括:Comparing Figure 4 and Figure 8 carefully, it is not difficult to find that the processing flow in Figure 4 only sends a memory address of one byte after issuing the write command, and 1-16 bytes of data can be continuously written later; the processing flow in Figure 8 It is required to send two bytes of memory address after the write command, followed by one byte of data. For memory, both data and bytes are just byte streams, and it is impossible and unnecessary to distinguish. Therefore, this method takes advantage of these characteristics and uses the I2C controller using 10-bit addressing mode to write two bytes to the specified memory address with the processing flow shown in Figure 4, so as to realize the function of randomly writing one byte to the large-capacity memory . The steps of the write operation include at least:
第一步:I2C控制器发送一个Start信号;Step 1: The I2C controller sends a Start signal;
第二步:I2C控制器发送写操作命令,并等待存储器回应ACK;Step 2: The I2C controller sends a write operation command and waits for the memory to respond with ACK;
第三步:收到ACK后,I2C控制器向存储器发送将要写入上述数据的存储器地址的高8位,并等待存储器回应ACK;Step 3: After receiving the ACK, the I2C controller sends the upper 8 bits of the memory address to which the above data will be written to the memory, and waits for the memory to respond with ACK;
第四步:收到ACK后,I2C控制器向存储器发送将要写入上述数据的存储器地址的低8位,并等待存储器回应ACK;Step 4: After receiving the ACK, the I2C controller sends the lower 8 bits of the memory address to which the above data will be written to the memory, and waits for the memory to respond with ACK;
第五步:收到ACK后,I2C控制器向存储器发送要写入的数据,并等待存储器回应ACK;Step 5: After receiving the ACK, the I2C controller sends the data to be written to the memory, and waits for the memory to respond with an ACK;
第六步:收到ACK后,I2C控制器发送STOP命令。Step 6: After receiving the ACK, the I2C controller sends a STOP command.
采用10位寻址模式的I2C控制器向大容量存储器随机地址写入一连续数据块(buffer写)和写入一个字节(字节写)的主要区别在于,在一个字节的数据发送成功后,并不结束本次写操作,而连续发送多个字节,成功后才发送写结束命令。所以这样的操作流,可以利用采用10位寻址模式的I2C控制器的buffer写流程来实现。仔细分析图4可以发现,可以利用图4的流程,稍作改动即能实现大容量存储器的buffer写功能。由于两种设备的限制,这种方法实现的buffer写的单次写操作最多可以写入15个字节。具体的步骤为:The main difference between the I2C controller using 10-bit addressing mode to write a continuous data block (buffer write) and write a byte (byte write) to the random address of the mass storage is that the data of a byte is successfully sent After that, the write operation is not ended, but multiple bytes are sent continuously, and the write end command is sent only after success. Therefore, such an operation flow can be realized by using the buffer writing process of the I2C controller using the 10-bit addressing mode. After careful analysis of Figure 4, it can be found that the buffer writing function of the large-capacity memory can be realized by using the process of Figure 4 and making slight changes. Due to the limitation of the two devices, a single write operation of buffer writing implemented by this method can write up to 15 bytes. The specific steps are:
第一步:I2C控制器发送一个Start信号;Step 1: The I2C controller sends a Start signal;
第二步:I2C控制器发送写操作命令,并等待存储器回应ACK;Step 2: The I2C controller sends a write operation command and waits for the memory to respond with ACK;
第三步:收到ACK后,I2C控制器向存储器发送将要写入上述数据的存储器地址的高8位,并等待存储器回应ACK;Step 3: After receiving the ACK, the I2C controller sends the upper 8 bits of the memory address to which the above data will be written to the memory, and waits for the memory to respond with ACK;
第四步:收到ACK后,I2C控制器向存储器发送将要写入上述数据的存储器地址的低8位,并等待存储器回应ACK;Step 4: After receiving the ACK, the I2C controller sends the lower 8 bits of the memory address to which the above data will be written to the memory, and waits for the memory to respond with ACK;
第五步:收到ACK后,I2C控制器向存储器发送要写入的数据的第一个字节,并等待存储器回应ACK;Step 5: After receiving the ACK, the I2C controller sends the first byte of the data to be written to the memory, and waits for the memory to respond with an ACK;
第六步:重复第五步操作,直到发送完所有要求写入的数据,每个数据字节发送操作都要等待存储器回应ACK;Step 6: Repeat step 5 until all the data required to be written is sent, and each data byte sending operation must wait for the memory to respond to ACK;
第七步:收到ACK后,I2C控制器发送STOP命令。Step 7: After receiving the ACK, the I2C controller sends a STOP command.
在不背离发明精神及其实质的情况下,熟悉本领域的技术人员当可根据本发明作出各种相应的改变,但这些相应的改变都应属于本发明的权利要求的保护范围。Without departing from the spirit and essence of the invention, those skilled in the art can make various corresponding changes according to the present invention, but these corresponding changes should all belong to the protection scope of the claims of the present invention.
Claims (6)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB200610138576XA CN100416536C (en) | 2006-11-09 | 2006-11-09 | Method of 10-bit addressing mode I2C controller accessing large-capacity memory |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB200610138576XA CN100416536C (en) | 2006-11-09 | 2006-11-09 | Method of 10-bit addressing mode I2C controller accessing large-capacity memory |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN1996275A true CN1996275A (en) | 2007-07-11 |
| CN100416536C CN100416536C (en) | 2008-09-03 |
Family
ID=38251372
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CNB200610138576XA Expired - Fee Related CN100416536C (en) | 2006-11-09 | 2006-11-09 | Method of 10-bit addressing mode I2C controller accessing large-capacity memory |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN100416536C (en) |
Cited By (14)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101937413A (en) * | 2010-10-21 | 2011-01-05 | 成都优博创技术有限公司 | Communication method of I2C bus |
| CN102623053A (en) * | 2011-01-26 | 2012-08-01 | 晨星软件研发(深圳)有限公司 | Memory controller, memory control method and memory system |
| WO2013060266A1 (en) * | 2011-10-25 | 2013-05-02 | International Business Machines Corporation | High performance virtual converged enhanced ethernet with persistent state flow control |
| CN105117365A (en) * | 2015-07-16 | 2015-12-02 | 上海斐讯数据通信技术有限公司 | Data reading method based on Mpc837x framework |
| CN105530155A (en) * | 2015-12-11 | 2016-04-27 | 中国航空工业集团公司西安航空计算技术研究所 | 1553B bus universe message triggering control method |
| CN108228520A (en) * | 2018-01-10 | 2018-06-29 | 郑州云海信息技术有限公司 | A kind of rapid transmission method of I2C controllers towards BMC |
| CN108694140A (en) * | 2017-04-12 | 2018-10-23 | 意法半导体(鲁塞)公司 | For addressing I2The method of nonvolatile memory in C buses and corresponding memory devices |
| CN109471814A (en) * | 2018-10-31 | 2019-03-15 | 龙迅半导体(合肥)股份有限公司 | A kind of method, apparatus and main control end of data transmission |
| CN109857688A (en) * | 2019-01-21 | 2019-06-07 | 飞依诺科技(苏州)有限公司 | The data transmission method and system of I2C bus interface applied to Medical Devices |
| CN110825572A (en) * | 2019-10-29 | 2020-02-21 | 青岛歌尔智能传感器有限公司 | Method, device and system for detecting I2C equipment address and electronic equipment |
| CN111078604A (en) * | 2019-11-15 | 2020-04-28 | 苏州浪潮智能科技有限公司 | A method and device for reading and writing I2C bus devices |
| CN112463662A (en) * | 2020-12-16 | 2021-03-09 | 福州创实讯联信息技术有限公司 | Method and terminal for controlling I2C equipment by user mode |
| CN113312217A (en) * | 2020-02-26 | 2021-08-27 | 瑞昱半导体股份有限公司 | Method for testing slave device of internal integrated circuit bus |
| CN114328358A (en) * | 2022-03-04 | 2022-04-12 | 山东华翼微电子技术股份有限公司 | Method for accessing random-capacity memory by 7-bit addressing mode I2C controller |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106201944A (en) * | 2016-06-27 | 2016-12-07 | 武汉电信器件有限公司 | A kind of method realizing I2C and the conversion of MDIO communication interface protocol |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5404556A (en) * | 1992-06-15 | 1995-04-04 | California Institute Of Technology | Apparatus for carrying out asynchronous communication among integrated circuits |
| US5897663A (en) * | 1996-12-24 | 1999-04-27 | Compaq Computer Corporation | Host I2 C controller for selectively executing current address reads to I2 C EEPROMs |
| US7313136B2 (en) * | 2003-06-26 | 2007-12-25 | Nokia Corporation | Method and system establishing a data link layer protocol on a I2C™ physical layer connection |
| JP4791696B2 (en) * | 2004-03-02 | 2011-10-12 | オンセミコンダクター・トレーディング・リミテッド | Data transfer memory and module |
| CN100363918C (en) * | 2004-12-04 | 2008-01-23 | 鸿富锦精密工业(深圳)有限公司 | System and method for dynamically distributing I2C address |
| CN100459612C (en) * | 2004-12-31 | 2009-02-04 | 北京中星微电子有限公司 | A communication transmission control device and method for implementing communication protocol control |
-
2006
- 2006-11-09 CN CNB200610138576XA patent/CN100416536C/en not_active Expired - Fee Related
Cited By (22)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101937413A (en) * | 2010-10-21 | 2011-01-05 | 成都优博创技术有限公司 | Communication method of I2C bus |
| CN101937413B (en) * | 2010-10-21 | 2012-07-04 | 成都优博创技术有限公司 | Communication method of I2C bus |
| CN102623053A (en) * | 2011-01-26 | 2012-08-01 | 晨星软件研发(深圳)有限公司 | Memory controller, memory control method and memory system |
| CN102623053B (en) * | 2011-01-26 | 2015-11-25 | 晨星软件研发(深圳)有限公司 | Memory Controller Hub, internal memory control method and memory system |
| WO2013060266A1 (en) * | 2011-10-25 | 2013-05-02 | International Business Machines Corporation | High performance virtual converged enhanced ethernet with persistent state flow control |
| CN103890750A (en) * | 2011-10-25 | 2014-06-25 | 国际商业机器公司 | High performance virtual converged enhanced ethernet with persistent state flow control |
| CN103890750B (en) * | 2011-10-25 | 2016-08-31 | 国际商业机器公司 | High Performance Virtual Converged Enhanced Ethernet with Persistent Stateful Flow Control |
| CN105117365A (en) * | 2015-07-16 | 2015-12-02 | 上海斐讯数据通信技术有限公司 | Data reading method based on Mpc837x framework |
| CN105530155A (en) * | 2015-12-11 | 2016-04-27 | 中国航空工业集团公司西安航空计算技术研究所 | 1553B bus universe message triggering control method |
| CN105530155B (en) * | 2015-12-11 | 2019-04-05 | 中国航空工业集团公司西安航空计算技术研究所 | A kind of 1553B bus universe message trigger control method |
| CN108694140A (en) * | 2017-04-12 | 2018-10-23 | 意法半导体(鲁塞)公司 | For addressing I2The method of nonvolatile memory in C buses and corresponding memory devices |
| US11127468B2 (en) | 2017-04-12 | 2021-09-21 | Stmicroelectronics (Rousset) Sas | Method for addressing a non-volatile memory on I2C bus and corresponding memory device |
| CN108694140B (en) * | 2017-04-12 | 2022-02-15 | 意法半导体(鲁塞)公司 | For addressing I2Method for non-volatile memory on a C bus and corresponding memory device |
| CN108228520A (en) * | 2018-01-10 | 2018-06-29 | 郑州云海信息技术有限公司 | A kind of rapid transmission method of I2C controllers towards BMC |
| CN109471814A (en) * | 2018-10-31 | 2019-03-15 | 龙迅半导体(合肥)股份有限公司 | A kind of method, apparatus and main control end of data transmission |
| CN109857688A (en) * | 2019-01-21 | 2019-06-07 | 飞依诺科技(苏州)有限公司 | The data transmission method and system of I2C bus interface applied to Medical Devices |
| CN110825572A (en) * | 2019-10-29 | 2020-02-21 | 青岛歌尔智能传感器有限公司 | Method, device and system for detecting I2C equipment address and electronic equipment |
| CN111078604A (en) * | 2019-11-15 | 2020-04-28 | 苏州浪潮智能科技有限公司 | A method and device for reading and writing I2C bus devices |
| CN113312217A (en) * | 2020-02-26 | 2021-08-27 | 瑞昱半导体股份有限公司 | Method for testing slave device of internal integrated circuit bus |
| CN112463662A (en) * | 2020-12-16 | 2021-03-09 | 福州创实讯联信息技术有限公司 | Method and terminal for controlling I2C equipment by user mode |
| CN112463662B (en) * | 2020-12-16 | 2024-04-05 | 福州创实讯联信息技术有限公司 | Method and terminal for user mode control of I2C equipment |
| CN114328358A (en) * | 2022-03-04 | 2022-04-12 | 山东华翼微电子技术股份有限公司 | Method for accessing random-capacity memory by 7-bit addressing mode I2C controller |
Also Published As
| Publication number | Publication date |
|---|---|
| CN100416536C (en) | 2008-09-03 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN100416536C (en) | Method of 10-bit addressing mode I2C controller accessing large-capacity memory | |
| CN105468563B (en) | SPI slave devices, SPI communication system and SPI communication method | |
| US5905885A (en) | Method and apparatus for interfacing between peripherals of multiple formats and a single system bus | |
| CN101681326B (en) | Data transmission method between master and slave devices | |
| KR101932920B1 (en) | Host for controlling non-volatile memory crad, system including the same and operating method there-of | |
| EP1764703B1 (en) | A system for providing access to multiple data buffers of a data retaining and processing device | |
| CN100440187C (en) | Method and data structure for random access via a bus connection | |
| JP6517243B2 (en) | Link Layer / Physical Layer (PHY) Serial Interface | |
| CN101118525A (en) | Data transmission control device with endian conversion circuit | |
| CN101273413A (en) | Portable data memory using single layer unit and multi-layer unit flash memory | |
| KR20110010707A (en) | How to transfer data directly between slave devices | |
| CN109902042B (en) | Method and system for realizing high-speed data transmission between DSP and ZYNQ | |
| US10866736B2 (en) | Memory controller and data processing circuit with improved system efficiency | |
| US7562172B2 (en) | I2C Slave/master interface enhancement using state machines | |
| KR101081301B1 (en) | Cooperative writes over the address channel of a bus | |
| CN108268414A (en) | SD card driver and its control method based on SPI mode | |
| CN110325974B (en) | Single communication interface and method with internal/external addressing mode | |
| CN102073611B (en) | I2C bus control system and method | |
| CN113722261A (en) | Method for expanding chip selection number and enhancing flexibility of read-write response time by SPI | |
| CN101561790B (en) | Method, system and device for communication between main control computer and slave computers | |
| US20080270654A1 (en) | Bus System for Selectively Controlling a Plurality of Identical Slave Circuits Connected to the Bus and Method Therefore | |
| CN1983230A (en) | Serial Peripheral Interface Device | |
| US9678904B2 (en) | PCI express data transmission | |
| US20070250652A1 (en) | High speed dual-wire communications device requiring no passive pullup components | |
| US20090138673A1 (en) | Internal memory mapped external memory interface |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20080903 Termination date: 20171109 |