Method for synchronizing SPI operation modes between a SPI host and a SPI device, and SPI bus synchronizer
The SPI device detects and recovers from out-of-synchronization by using predefined values and mode-reset sequences, ensuring synchronization and preventing data loss in SPI communication systems.
Patent Information
- Application Number
- JP2023098526
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2022-06-21
- Filing Date
- 2023-06-15
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2043-06-15
AI Technical Summary
In SPI communication systems, misoperation occurs when the SPI host and SPI device are not in the same operating mode, leading to useless commands and data reading errors due to out-of-synchronization issues.
The method involves predefining values on the SPI bus to indicate out-of-synchronization, using pull-up devices on I/O lines and unique mode-reset sequences to detect and recover from lost synchronization.
Enables the SPI device to detect and recover from out-of-sync events, ensuring proper mode synchronization and preventing data loss by switching to the default mode.
Smart Images

Figure 0007571202000001 
Figure 0007571202000002 
Figure 0007571202000003
Abstract
Description
[Technical field]
[0001] The present invention relates to Serial-Peripheral Interface (SPI) buses, and more particularly to a method and system for detecting and recovering from out-of-sync in SPI communications. [Background technology]
[0002] An SPI communication system can be in one of several operating modes. In an SPI communication system, the SPI host typically sets the operating mode by sending appropriate commands to the SPI device. If the SPI host and SPI device are not in the same mode ("unsynchronized"), erroneous operation can occur. Summary of the Invention [Problem to be solved by the invention]
[0003] SPI (Serial-Peripheral Interface) is defined for duplex communication between SPI host and SPI device. Currently, SPI is widely used for communication between processors and flash memory devices, where the processor (acting as SPI master) sends commands to the flash memory (acting as SPI device) and the SPI device sends back data for some opcodes.
[0004] SPI was originally defined as single-bit (1-bit) SPI, which uses one wire to send all command phases (command, address, data), a mode called 1-1-1. To improve performance, SPI was then extended to 4-bit and 8-bit SPI, using 1 bit to send commands and 4 or 8 bits to send addresses and data (called 1-4-4 and 1-8-8 modes). Later, new bus modes were added, including the 4-bit peripheral interface (Quad Peripheral Interface, QPI) and the 8-bit peripheral interface (Octal Peripheral Interface, OPI). QPI also uses 4 bits to send all command phases (called 4-4-4 mode), and OPI also uses 8 bits to send all command phases (called 8-8-8 mode). It can also be used with the Execute-In-Place (XIP) operating mode, where the SPI host does not send an operation code (opcode) and the SPI device assumes that the opcode will not change based on the previous command. Typically, an SPI host or device that supports QPI or OPI also supports at least one SPI mode (e.g., either 1-1-1, 1-4-4, or 1-8-8 mode), and the SPI mode is usually configured as the default SPI operating mode.
[0005] In all cases, the SPI host and SPI device must operate using the same operating mode. If the SPI host and SPI device end up in different operating modes due to some error (e.g. the host is reset), the SPI device may execute useless commands and read data from the SPI device where the SPI host received an error. An out-of-sync condition is considered to occur when the SPI host changes its operating mode but the SPI device does not change its operating mode (or vice versa). [Means for solving the problem]
[0006] The present invention provides a method of SPI operating mode synchronization between a Serial-Peripheral Interface (SPI) host and an SPI device communicating over an SPI bus, the method including predefining, at the SPI device, one or more values on the SPI bus as indicating an SPI operating mode out of synchronization between the SPI host and the SPI device, and in response to receiving any of the predefined values at the SPI device, initiating a resynchronization of the SPI operating mode.
[0007] The present invention further provides an apparatus including a Serial-Peripheral Interface (SPI) host and an SPI device configured to communicate with the SPI host via an SPI bus and to initiate a resynchronization of the SPI operating mode in response to receiving on the SPI bus any of one or more values predefined in the SPI device as indicating an SPI operating mode between the SPI host and the SPI device becoming out of synchronization. Effect of the Invention
[0008] In an embodiment, by adding pull-up devices to the I / O lines and / or defining a unique Mode-Reset sequence, an SPI device can detect and recover from a Lost-Sync event. [Brief description of the drawings]
[0009] [Figure 1] FIG. 1 is a block diagram illustrating a SPI communication system with Lost-Sync detection and recovery according to one embodiment of the present invention. [Diagram 2] FIG. 2 is a waveform diagram illustrating detection and recovery from an out-of-sync event according to one embodiment of the present invention. [Diagram 3] FIG. 1 is a block diagram illustrating a SPI device according to one embodiment of the present invention. [Figure 4]FIG. 4 is a waveform diagram of a mode-reset sequence sent by an SPI host according to one embodiment of the present invention. [Diagram 5] 4 is a flow chart illustrating a method for detecting out-of-sync events by examining input data according to one embodiment of the present invention. [Figure 6] FIG. 4 is a state diagram illustrating states of a SPI device according to one embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0010] SPI communication between an SPI host and an SPI device can take place in multiple protocols and operating modes, which differ in the width of the data bus (at various phases of a command), the length of the addresses, and the Execute-In-Place (XIP) mode.
[0011] The SPI communication described in this application can support a bus width operation mode, an address width operation mode, and an XIP (Execute-In-Place) operation mode, which will be described in detail below.
[0012] The bus width operating modes may include:
[0013] (i) SPI mode uses one wire to send the command phase of a command and one, four, or eight wires to send the address and data phases of a command (referred to as 1-1-1 mode, 1-4-4 mode, and 1-8-8 mode, respectively).
[0014] (ii) QPI (Quad Peripheral Interface) mode uses four wires for every phase of a command (called 4-4-4 mode).
[0015] (iii) OPI (Octal Peripheral Interface) mode uses one of eight wires for every phase of a command (called 8-8-8 mode).
[0016] The address width operating mode must be either (i) 24-bit addresses, or (ii) 32-bit addresses.
[0017] The XIP operating mode must be either on or off.
[0018] In one embodiment of the present application, the default SPI operation mode can be defined as SPI mode (either 1-1-1 mode, 1-4-4 mode, or 1-8-8 mode), 24-bit address, and XIP off. Both the SPI host and the SPI device normally start in the default SPI operation mode after reset.
[0019] 1 is a block diagram illustrating an SPI communication system 100 with out-of-sync detection and recovery according to one embodiment of the present invention. An SPI host 101 (e.g., a processor) communicates with an SPI device 102 over an SPI link that includes a Chip-Select (CS) line 103, a Clock (CK) line 104, an Input-Output 0 (I / O0) line 106, and I / O1 through I / O7 lines 108.
[0020] The communication includes executing SPI commands, which may include sending an opcode, sending an address, and sending and / or receiving data.
[0021] Based on the embodiment shown in FIG. 1, the I / O0 line 106 is always used, and the I / O1-I / O7 lines 108 (dashed lines) may be used during some, all, or none of the phases of the command.
[0022] To allow for detection of out-of-sync events, the I / O lines 108 are coupled to Vdd (power supply-high voltage) through resistors 110. The resistors are designed so that when an SPI device (or SPI host) drives the corresponding line low, the SPI host or device has priority and sets the line low. Therefore, the resistors are "weak-pull-up" devices.
[0023] When the SPI host is in an SPI mode (either 1-1-1, 1-4-4, or 1-8-8 mode) and the SPI device is not driving the I / O bus, lines 108 I / O1 through I / O7 are driven high by pull-up devices during the opcode phase. If, based on the protocol, the SPI device is not expecting to receive a high level on I / O1 through I / O7, when the SPI device receives a high level on I / O1 through I / O7, it will interpret the received high level as detection of an out-of-sync event and take recovery action (e.g., switch to the default SPI operating mode).
[0024] Therefore, if the SPI host is unilaterally changed to SPI mode and the SPI device is still in a non-SPI mode (e.g., QPI or OPI mode) for some reason, the pull-up resistors coupled to I / O1 through I / O7 can drive I / O1 through I / O7 high during the opcode phase, allowing the SPI device to detect the out-of-sync event and recover to the default SPI operating mode.
[0025] In one embodiment, if the SPI device 102 supports a 4-bit bus instead of an 8-bit bus, the SPI communications device 100 can simply configure three pull-up devices. In another embodiment, the pull-up devices may be configured in the SPI host 101, and in another embodiment, the pull-up devices may be in the SPI device 102.
[0026] In an alternative embodiment, a pull-down device (e.g., a weak pull-down resistor) can be used instead of a pull-up device. Generally, a pull-up or pull-down device forces the associated SPI line to a defined logic state ("1" for pull-up and "0" for pull-down). Therefore, when a pull-down device is used, the value indicating out of sync must also be changed to "0". In yet another alternative embodiment, a pull-down device is used in combination with negative logic, where a low voltage level represents logic-high and a high voltage level represents logic-low.
[0027] In one embodiment, multiple SPI devices may be coupled to a single SPI host, and in another embodiment, multiple SPI hosts may be connected to one or more SPI devices.
[0028] 2 is a waveform diagram 200 illustrating out-of-sync event detection and recovery according to one embodiment of the present invention. Referring to FIG. 2, at time point 216, the SPI host sets CS low to indicate the start of a new command. The SPI host and SPI device are both in QPI mode (e.g., in response to a previous set-mode command). The SPI host begins sending opcodes at time point 216, then begins sending addresses at time point 218, and sends data at time point 220.
[0029] The command ends at time point 222 when the SPI host sets CS high and stops the clock. Then, at time point 224, the SPI host initiates an SPI mode command and the SPI device misses the mode transition and remains in QPI mode.
[0030] When in SPI mode, the SPI host does not drive I / O lines 1-3 in the opcode phase, but assumes that I / O lines 1-3 are high because the lines are coupled to pull-up device 110 (FIG. 1). The SPI device in the opcode phase receives a "1" on I / O lines 1-3. Assuming that the most significant two bits of the current opcode are 0, the SPI device gets a 0 from I / O0 (i.e., I0=0 and I4=0) and the resulting opcode is 11101110 (0xEE). The SPI device recognizes this opcode as an out-of-sync indication and at time point 226 switches to default mode to recover from the out-of-sync event.
[0031] In some embodiments, the bus width operating mode between time points 216 and 218 may be octal, and I / O lines 4-7 may be added. In one embodiment, the SPI device may instantly detect the out-of-sync event and revert to the default mode within the same clock cycle (thus merging time points 224 and 226). In this case, the time difference between time points 224 and 226 may be any suitable number of clock cycles.
[0032] In an embodiment, when the SPI device detects an out-of-sync event and reverts to the default mode, but the SPI host may have sent the first bit (or several first bits) of an SPI mode command, the SPI host and SPI device are not synchronized in time even though they are also in SPI mode (e.g., the second bit sent by the SPI host may be interpreted by the SPI device as the first bit of the command).
[0033] Therefore, to ensure time synchronization in case of loss of synchronization, the SPI device may further include parallel decode circuitry.
[0034] 3 is a block diagram illustrating an SPI device 300 according to one embodiment of the present invention. The SPI device 300 includes a configurable mode decoder 302, an out-of-sync detection circuit 304, a default-mode decoder 306, a selector 308, and a command execution unit 310.
[0035] In one embodiment, the configurable mode decoder 302 is coupled to I / O1 through I / O7 and configured to be able to decode SPI commands in a default SPI operating mode (either 1-1-1, 1-4-4, or 1-8-8) and in either a QPI mode (4-4-4) or an OPI mode (8-8-8). In some embodiments, the configurable mode decoder 302 is able to decode SPI commands in both QPI mode and OPI mode.
[0036] The out-of-sync detection circuit 304 is coupled to the configurable mode decoder 302 and is configured to detect a logic-high level on the I / O line when a logic-low level is expected, and interpret the detection result as an out-of-sync event.
[0037] The default-mode decoder 306 is coupled to I / O0 and configured to decode commands sent by the SPI host. The default-mode decoder 306 is also coupled to the out-of-sync detection circuit 304 and configured to stop outputting the decoded result when the out-of-sync detection circuit 304 fails to detect an out-of-sync event. Assuming that the SPI host and the SPI device are in a non-SPI mode (e.g., OPI mode or QPI mode), when the SPI host unilaterally switches to the SPI mode (e.g., due to a reset), the default-mode decoder 306 can correctly decode commands even though the SPI device is still in a non-SPI mode (e.g., OPI mode or QPI mode).
[0038] The selector 308 is coupled to the configurable mode decoder 302, the out-of-sync detection circuit 304, the default mode decoder 306, and the command execution unit 310. The selector 308 is configured to connect either the configurable mode decoder 302 or the default mode decoder 306 to the command execution unit 310 in response to whether the out-of-sync detection circuit 304 detects an out-of-sync event.
[0039] In the example of FIG. 3, the configurable mode decoder 302 and the default mode decoder 306 are depicted in different blocks, but the present invention is not limited thereto.
[0040] In one embodiment, the default mode decoder 306 is part of the configurable mode decoder 302 .
[0041] In particular, when the SPI host drives a command opcode while in SPI mode, the SPI host drives only the I / O0 line and does not drive the additional I / O lines used in the higher bus width modes.
[0042] Thus, pull-up device 110 (FIG. 1) sets the values of I / O1-I / O3 or I / O1-I / O7 to logic "1" when the SPI master drives the command opcode on I / O0.
[0043] At this time, if the SPI device is still in QPI or OPI mode and decodes the incoming command opcode accordingly, the SPI device assumes that all four (QPI) or eight (OPI) lines carry valid opcode bits. However, since I / O1-I / O3 or I / O1-I / O7 are now set to "1" by the pull-up device and only I / O0 is driven by the SPI host, the possible opcodes that the SPI device may receive and decode simply include 0xFF, 0xFE, 0xEF, 0xEE (the first two opcodes can be received in QPI and OPI modes, and the last two opcodes can only be received in QPI mode). Thus, in this embodiment, when the opcodes received are 0xFF, 0xFE, 0xEF, and 0xEE, the SPI device can interpret the opcodes as out-of-sync events.
[0044] The SPI device may perform out-of-sync recovery in response to detecting an out-of-sync event to place the SPI device in a default mode to properly decode further commands, and may selectively use a parallel default mode to decode, reconstruct and execute previous commands.
[0045] When the same command opcode is executed repeatedly, the SPI communication can open the XIP operation mode to save time. When the XIP operation mode is turned on, the SPI host can skip sending the command opcode phase and send only the address and data. When the XIP mode is turned on, the first byte of the command is the MS byte of the address. In one embodiment, the SPI host can enter the XIP operation mode by, for example, placing I / O0 in high logic in the first loop after sending the address associated with the command.
[0046] Most SPI devices only use a portion of the address space, so the MS bits of the address are expected to be 0. For example, when using a 32b addressing mode with a 256Mbit SPI device (32MB), the largest possible address is 0x01FFFFFF, with the 7 MS bits at logic 0.
[0047] In one embodiment, the pull-up device sets I / O1-I / O3 (or I / O1-I / O7) to logic 1 when the SPI host is in SPI mode. Thus, if the SPI device is still on in XIP mode, it expects to receive an address in OPI or QPI mode, with the most significant address byte being 0xFF, 0xFE, 0xEF, or 0xEE. In this embodiment, any address beginning with 0xFF, 0xFE, 0xEF, or 0xEE can be interpreted as an out-of-sync event. In one embodiment, it can be defined that the MS bit of the received address range must be 0, otherwise it is interpreted as an out-of-sync event. This limits the memory size to 8 MB in 24-bit address mode and 2 GB in 32-bit address mode.
[0048] In one embodiment, the SPI device can respond by detecting an out-of-sync event while in XIP mode by restoring the operating mode to the default mode, and can also selectively decode previous commands in parallel to ensure no commands are lost.
[0049] In some applications, it may not be possible to exclude address ranges beginning with FF, FE, EF, or EE bytes. In this embodiment, a unique mode-reset sequence can be sent by the SPI host, and upon receiving the mode-reset sequence, the SPI device will unconditionally switch to the default mode even without pull-up devices, and will also regain synchronization with the SPI host. In one embodiment, the mode-reset sequence is defined as a sequence of all ones on all available I / O lines for, for example, 16 consecutive clock cycles. SPI devices decode this command as opcode 0xFF followed by all ones address and data, regardless of the current interface operating mode.
[0050] Additionally, when XIP mode is on, SPI devices may define certain addresses as illegal and must interpret certain addresses as mode-reset sequences. For example, if the addressing mode is 24-bit, SPI devices may define 0xFFFFFF as a certain address, and if the addressing mode is 32-bit, SPI devices may define 0xFFFFFFFF as a certain address.
[0051] FIG. 4 is a waveform diagram 400 of sending a mode-reset sequence by an SPI host according to one embodiment of the present invention.
[0052] 4, the SPI host sets the CS line as a logic low level to indicate a command at time point 414. Then, for the next 16 clock cycles, the SPI host sets all I / O lines connected to the SPI devices as logic 1 to indicate a mode-reset sequence. At time point 416, the mode-reset ends and the SPI host sets the CS line as a logic high level.
[0053] At time point 414, the SPI device may be in any operational mode including, for example, QPI mode or OPI mode. At time point 416, after receiving logic 1 on all I / O lines for 16 consecutive clock cycles, the SPI device detects a mode-reset sequence and returns to the default mode.
[0054] The signal polarities described above are examples compatible with current SPI bus definitions and applications. However, the invention is not so limited. For example, in one embodiment, the CS line is active when at a logic high level. In another embodiment, when the I / O lines are configured as low voltage, a logic 1 carries negative logic (i.e., a logic 1 is represented by a low voltage and a logic 0 is represented by a high voltage), meaning that a pull-down device rather than a pull-up device is coupled to the I / O line.
[0055] Additionally, embodiments of the present invention support SPI variants where the bus width (number of I / O lines) is different than 1, 2, 4, or 8. For example, in one embodiment, the techniques of the present invention may be used, mutatis mutandis, with an SPI variant having 16 I / O lines.
[0056] 5 is a flow chart 500 of detecting an out-of-sync event by examining input data according to one embodiment of the present invention. Referring to FIG. 5, for example, an SPI device enters into operation 502 after power-on or reset (e.g., power-on reset). In operation 502, the SPI device executes in a default mode. Specifically, the SPI device decodes in a default SPI mode (either 1-1-1, 1-4-4, or 1-8-8) and executes the decoded SPI command.
[0057] Next, in operation 504, the SPI device checks whether the received SPI command is a switch-mode command (e.g., to switch to OPI mode), and if not, it re-enters operation 502 to decode and execute the next SPI command in the default mode.
[0058] Returning to operation 504, if the SPI device checks that the received command is a switch-mode command (e.g., checks for an OPI command), the SPI device enters operation 506, where the SPI device is in a default mode in parallel with the operating mode (e.g., OPI mode or QPI mode) indicated by the SPI command of the current operation 504, and decodes the SPI command. However, the SPI device only executes the decoded SPI command and saves the SPI command decoded by the default mode.
[0059] Next, in operation 508, the SPI device checks whether the received SPI command is a command to switch to the default SPI mode, and if so, the SPI device re-enters operation 502 to decode further SPI commands in the default mode.
[0060] Returning to operation 508, if the SPI device did not check for a command to switch to the default SPI mode, the SPI device enters operation 510, where the SPI device checks whether a mode-reset sequence has been received. If so, the SPI device enters operation 512, where it executes the last command decoded by the default mode (i.e., the command saved after the parallel decoding by the default mode in operation 506), and returns to operation 502. Thus, the SPI device can re-enter operation 502 after operation 512 and decode other commands in the default mode without losing any commands. Returning to operation 510, if the SPI device did not receive a mode-reset sequence, the SPI device enters operation 514, where the SPI device checks whether the SPI host has instructed it to open the XIP mode.
[0061] In one embodiment, the SPI host can set I / O0=1 on the first clock cycle following sending the address to indicate that XIP mode is on. If the SPI host does not indicate that XIP mode is on in operation 514, the SPI device re-enters operation 506 to decode the next command in OPI mode.
[0062] Returning to operation 514, if the SPI host indicates that XIP mode is on, the SPI device enters operation 516, where the SPI device decodes and executes the received SPI command (which contains only address and data, and execution is the use of the last opcode to send) in the current mode (QPI or OPI mode), and in parallel decodes it in the default mode and saves the SPI command decoded by the default mode.
[0063] Next, in operation 518, the SPI device checks whether an out-of-sync event is detected. For example, the SPI device can define an address that starts with FF or FE as an illegal address and interpret it as an out-of-sync event. At this time, the SPI device can check whether the MS byte of the received address is FF or FE. If the SPI device does not detect an out-of-sync event, the SPI device re-enters operation 615 and continues decoding in parallel.
[0064] Returning to operation 518, if an out-of-sync event is checked by the SPI device, the SPI device enters operation 520 where the SPI device executes the last default-SPI command that was decoded (i.e., the command that was decoded in default mode and stored in parallel in operation 516) and returns to operation 502. Thus, the SPI device can re-enter operation 502 after operation 512 in the default mode without losing any commands and decode and execute further SPI commands in the default mode.
[0065] 6 is a state diagram 600 illustrating states of an SPI device according to one embodiment of the present invention. Each state in FIG. 6 represents an SPI, QPI, or OPI mode of operation.
[0066] 1. State 602, default mode, e.g., either single (1-1-1), quad (1-4-4), or octal (1-8-8) SPI mode.
[0067] 2. State 604 (SPI-XIP), turn on XIP mode in the default mode.
[0068] 3. State 608, QPI mode (4-4-4).
[0069] 4. State 610 (QPI-XIP), turn on XIP mode in QPI mode.
[0070] 5. State 612, OPI mode (8-8-8).
[0071] 6. State 614 (OPI-XIP), turn on XIP mode in OPI mode.
[0072] According to an embodiment, first the "normal" transitions between these states are described, and then the transitions in the out-of-sync case are described.
[0073] Following a reset signal, the SPI device is in SPI state 602. In response to an XIP-on instruction (e.g., setting I / O0=1 in the first clock following the address), the SPI device transitions to SPI-XIP state 604, and in response to an XIP-off instruction (e.g., setting I / O0=0 in the first clock loop following the address and receiving an illegal address or specific sequence), the SPI device transitions from SPI-XIP state 604 back to state 602.
[0074] If the SPI device receives a set-mode-QPI or set-mode-OPI command while in default-SPI state 602, the SPI device transitions to state 608 (QPI) or state 610 (OPI), respectively. When in state 608 or state 612, the SPI device transitions back to state 602 in response to receiving a set-mode-SPI command.
[0075] When in either state 608 or state 612, the SPI device can receive an XIP-on indication and transition to state 610 (QPI-XIP) or state 614 (QPI-XIP), respectively. When in either state 610 or state 614, the SPI device responds to an XIP-off indication by transitioning back to state 608 or state 612, respectively.
[0076] In embodiments, additional state transitions may be provided to allow recovery from an out-of-sync event: If the SPI device is in the SPI-XIP state and the SPI host is in the SPI (non-XIP) state, the SPI device receives and, in response, transitions back to state 602 with at least three MS bits set (driven to logic high by pull-up resistor 110).
[0077] If the SPI device is in QPI state 608 and the SPI host is in SPI (non-XIP) mode, the SPI device receives an opcode with bits 5-6-7 and 3-2-1 at a logic high level (opcodes FF, FE, EF, or EE - all defined as illegal, based on the embodiment) and in response returns to state 602.
[0078] If the SPI device is in OPI state 612 and the SPI host is in SPI (non-XIP) mode, the SPI device receives an opcode having bits 1-7 at a logic high level (one of opcodes FF, FE) and in response transitions back to state 602.
[0079] If the SPI device loses synchronization while in OPI-XIP state 614, the SPI device gets an address whose MS byte is equal to FF, FE, EF, or EE, and in response returns to the default state 602. If the SPI device loses synchronization while in SPI-XIP state 604, the SPI device gets an address starting with FF or FE (for OPI), or FF, FE, EF, EE (for QPI), and in response returns to the default SPI mode 602 (this method does not work for recovery from loss of synchronization in a single SPI-XIP).
[0080] Additionally, the SPI device transitions to state 602 from any state upon detecting a mode-reset sequence (described above).
[0081] The different subunits of SPI host 101, SPI device 102, pull-up device 110, and SPI device 300 can be implemented using suitable hardware, for example one or more Application-Specific Integrated Circuits (ASICs) or Field-Programmable Gate Arrays (FPGAs), using software, using hardware, or using a combination of the hardware and software mentioned above.
[0082] The SPI host 101 and / or SPI device (FIG. 1) and / or SPI device 300 (FIG. 3) may include one or more general-purpose processors that are programmed in software to perform the functions described herein. The software may be downloaded to the processor in electronic form, for example, over a network or from a host, or may alternatively or additionally be provided and / or stored on a non-transitory, tangible medium, such as magnetic, optical, or electronic memory.
[0083] Thus, in one embodiment of the present invention, the SPI device is configured to detect whether the SPI host has unilaterally switched to SPI mode. In this embodiment, for example, a weak pull-up device (e.g., a resistor connected to a positive power supply) can be connected to some of the data lines. When the SPI host is changed to SPI mode, the SPI device receives a logic high level on the unused lines (e.g., I / O1-I / O7).
[0084] In one embodiment, not using an opcode that starts with one or more placed logic high bits can be defined as an out-of-sync event. As a result, if the SPI device receives an opcode that starts with a logic high bit placed as the MS byte in QPI mode or OPI mode, it is considered to have detected an out-of-sync with the SPI host and to recover to a default mode. In another embodiment, an address that starts with one or more logic highs can be defined as illegal. As a result, if the SPI device receives an address that starts with one or more logic highs when it expects to receive a legal address (e.g., when XIP mode is turned on), it is considered to have detected an out-of-sync with the SPI host and to recover to a default mode. If the SPI device detects an out-of-sync when XIP mode is turned on, it will abort the current XIP operation if it is not compatible with the SPI host, thereby avoiding possible bus contention.
[0085] In one embodiment, to avoid losing data of the first command of the SPI host sent after the SPI host changes modes, the SPI device includes a parallel decode circuit that decodes SPI communication in parallel in a currently set operation mode (e.g., QPI or OPI) and a default mode. When the SPI device detects an out-of-sync event, the SPI device executes the decoded command in the default mode.
[0086] In another embodiment, a unique mode-reset sequence can be defined, for example placing all I / O lines of the SPI bus at logic "1" for a longer cycle period (e.g., 16 clock pulses). In this embodiment, this type of sequence cannot be used as a signal for proper operation and therefore can be interpreted by SPI devices as a command to reset the operating mode to the default mode.
[0087] As a result, in this embodiment, by adding pull-up devices to the I / O lines, performing parallel decoding, and / or defining a unique mode-reset sequence, the SPI device is able to detect and recover from an out-of-sync event. [Industrial Applicability]
[0088] The SPI synchronization method and system according to embodiments of the present invention may be applied to out-of-sync detection and recovery in SPI communications. [Explanation of symbols]
[0089] 100 SPI communication system 101 SPI Host 102, 300 SPI devices 103 Chip Select (CS) Line 104 Clock (CK) line 106 Input-Output 0 (I / O0) line 108 I / O1~I / O7 lines 110 Pull-up Device 202, 204, 206, 208, 210, 212, 214, 402, 404, 406, 408, 410, 412 waveform 216, 218, 220, 222, 224, 226, 414, 416 time points 302 Configurable Mode Decoder 304 Out-of-sync detection circuit 306 Default-Mode Decoder 308 Selector 310 Command Execution Unit 602, 604, 608, 610, 612, 614 Status
Claims
1. 1. A method of Serial Peripheral Interface (SPI) operating mode synchronization between an SPI host and an SPI device communicating over an SPI bus, comprising: predefining, at the SPI device, one or more values on the SPI bus as indicating an out-of-sync SPI mode of operation between the SPI host and the SPI device; initiating a resynchronization of the SPI mode of operation in response to receiving any of the predefined values at the SPI device; The method includes:
2. 2. The method of claim 1, wherein one or more lines of the SPI bus are connected to pull-up or pull-down devices that force the one or more lines to a defined logic state, and the one or more values indicating the out-of-sync include the one or more values where the one or more lines are in the defined logic state.
3. 2. The method of claim 1, wherein the one or more values indicating the loss of synchronization comprises a predefined sequence of values pre-agreed between the SPI host and the SPI device.
4. 2. The method of claim 1, further comprising sending one or more of the predefined values by the SPI host to cause the SPI device to initiate the resynchronization.
5. 2. The one or more predefined values include one or more SPI command opcodes in which predefined groups of bits are in defined logic states. The method according to
6. The one or more predefined values include one or more SPI address opcodes in which predefined groups of bits are in defined logic states. Item 1. The method according to item 1.
7. 2. The method of claim 1, further comprising: upon detecting the loss of synchronization when an Execute-In-Place (XIP) operation mode is turned on in the SPI device, aborting a current operation without responding to the SPI host.
8. 2. The method of claim 1, wherein initiating the resynchronization includes returning to a default SPI mode of operation at the SPI device.
9. 9. The method of claim 8, wherein the default SPI operating mode is a single-wire, 24-bit address, non-Execute-In-Place (XIP) operating mode.
10. 2. The method of claim 1, further comprising: decoding, in the SPI device, an SPI command simultaneously in a default operating mode and in a current operating mode; and initiating the resynchronization comprises returning to the default operating mode upon receipt of any of the predefined values.
11. a Serial Peripheral Interface (SPI) host; An SPI device; wherein the SPI device comprises: communicating with the SPI host via an SPI bus; initiating a resynchronization of the SPI operating mode in response to receiving on the SPI bus any of one or more values predefined in the SPI device as indicating an out-of-synchronization of the SPI operating mode between the SPI host and the SPI device; 23. An apparatus configured to:
12. 12. The apparatus of claim 11, wherein one or more lines of the SPI bus are connected to pull-up or pull-down devices that force the one or more lines to a defined logic state, and the one or more values indicating the out-of-sync include the one or more values where the one or more lines are in the defined logic state.
13. 12. The apparatus of claim 11, wherein the one or more values indicating the loss of synchronization comprises a predefined sequence of values pre-agreed between the SPI host and the SPI device.
14. 12. The apparatus of claim 11, wherein the SPI host is configured to send one or more of the predefined values to cause the SPI device to initiate the resynchronization.
15. 12. The apparatus of claim 11, wherein the one or more predefined values comprise one or more SPI command opcodes having predefined groups of bits in defined logic states.
16. 12. The apparatus of claim 11, wherein the one or more predefined values comprise one or more SPI address opcodes in which predefined groups of bits are in defined logic states.
17. 12. The apparatus of claim 11, wherein the SPI device is configured to abort a current operation without responding to the SPI host if the SPI device detects the loss of synchronization when an Execute-In-Place (XIP) operation mode is turned on.
18. The apparatus of claim 11 , wherein the SPI device is configured to initiate the resynchronization by returning to a default mode of operation.
19. 20. The apparatus of claim 18, wherein the default mode of operation is a single wire, 24-bit address, non-XIP mode of operation.
20. 12. The apparatus of claim 11, wherein the SPI device is configured to decode SPI commands simultaneously in a default operating mode and in a current operating mode, and initiates the resynchronization by returning to the default operating mode upon receiving any of the predefined values.
Citation Information
Patent Citations
Serial memory control system, method and program
JP2012008630A
Interface circuit and control method of interface circuit
JP2021174051A
Multi-I / O serial peripheral interface for precision converters
US11256652B2
Electronic apparatus and device control method
WO2014068760A1
