Chip and starting method thereof, storage medium and program product
By reading the four-wire enable status of the external memory and selecting the startup method according to the signal level, the problem of low off-chip startup efficiency is solved and a more efficient data transmission and startup process is achieved.
Patent Information
- Application Number
- CN202410490980.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-22
- Publication Date
- 2024-08-30
AI Technical Summary
When the existing chip is started off-chip, the startup efficiency is low due to the single-line reading method of nor-flash memory, and the multi-line transmission capability of the external memory cannot be fully utilized, resulting in long data reading time.
By reading the four-wire enable status of the external memory and selecting single-wire startup or four-wire startup according to the levels of the first signal and the second signal, the peripheral circuit configuration is used to realize four-wire transmission of data and improve startup efficiency.
The startup efficiency of the chip is improved, and the startup time is significantly shortened by using four wires to transmit data when supporting four wire transmission.
Smart Images

Figure CN118568045A
Abstract
Description
Technical Field
[0001] The present application relates to the field of chip technology, and in particular to a chip and a startup method thereof, a storage medium, and a program product. Background Art
[0002] The chip can be started in two ways: on-chip startup and off-chip startup. When off-chip startup is selected, the chip will read startup data from the external memory to achieve off-chip startup.
[0003] Take nor-flash as an external memory as an example. Because nor-flash generally works at a clock frequency of tens of megahertz (M), if a large amount of data needs to be read during startup, a lot of time will be consumed in the process of fetching data from nor-flash. nor-flash usually supports single-line, dual-line, and quad-line transmission. Some advanced nor-flash can support eight-line transmission mode at the same time. However, the current off-chip startup method only supports single-line data reading, and the startup efficiency is low. Summary of the invention
[0004] To solve the above problems, the present application provides a chip and its startup method, storage medium, and program product, which can improve the efficiency of chip startup.
[0005] A technical solution adopted in the present application is: providing a chip startup method, the chip startup method comprising: reading the four-line enable state of an external memory; obtaining a first signal of a first interface, and obtaining a second signal of a second interface; wherein the first signal and the second signal are provided by a peripheral circuit, the first signal is configured to determine whether to read the four-line enable state of the external memory through four lines, and the second signal is configured to determine whether to start through four lines; according to the four-line enable state, the level of the first signal and the level of the second signal, selecting single-line startup or four-line startup through the external memory.
[0006] In one embodiment, reading the four-line enable state of an external memory includes: sending a first state read command to the external memory via a single line to read the first four-line enable state of the external memory; in response to a first signal being a preset first level, sending a second state read command to the external memory via four lines to read the second four-line enable state of the external memory.
[0007] In one embodiment, single-line startup or four-line startup is selected through an external memory according to a four-line enable state, a level of a first signal, and a level of a second signal, including: single-line startup or four-line startup is selected through an external memory according to a first four-line enable state, a second four-line enable state, a level of the first signal, and a level of the second signal.
[0008] In one embodiment, according to the first four-line enable state, the second four-line enable state, the level of the first signal and the level of the second signal, single-line startup or four-line startup is selected through the external memory, including: in response to the first signal being a preset second level and the second signal being a preset second level, single-line startup is performed through the external memory; or in response to the first signal being a preset second level, the second signal being a preset first level, and the first four-line enable state being bit 1, four-line startup is performed through the external memory; or in response to the first signal being a preset second level, the second signal being a preset first level, and the first four-line enable state being bit 0, the four-line enable state of the external memory is set to bit 1 to perform four-line startup through the external memory.
[0009] In one embodiment, the four-line enable state of the external memory is set to bit 1 to perform four-line startup through the external memory, including: sending a write enable command to the external memory through a single line; sending a write status command to the external memory through a single line to set the four-line enable state of the external memory to bit 1; and performing four-line startup through the external memory.
[0010] In one embodiment, single-line startup or four-line startup is selected through an external memory according to a four-line enable state, a level of a first signal, and a level of a second signal, including: in response to the first signal being a preset first level, the second four-line enable state being bit 1, and the second signal being a preset first level, four-line startup is performed through the external memory; or in response to the first signal being a preset second level, the second four-line enable state being bit 1, and the second signal being a preset first level, the external memory is switched to a single-line startup mode to perform a single-line startup through the external memory.
[0011] In one embodiment, the external memory is switched to a single-line boot mode to perform a single-line boot through the external memory, including: sending a mode switching instruction to the external memory through four lines to switch the external memory to a single-line boot mode; and performing a single-line boot through the external memory.
[0012] In one embodiment, according to the four-line enable state, the level of the first signal and the level of the second signal, single-line startup or four-line startup is selected through the external memory, including: in response to the first signal being a preset first level, the second four-line enable state being bit 0, the second signal being a preset first level, and the first four-line enable state being bit 1, the external memory is switched to a four-line startup mode to perform four-line startup through the external memory; or in response to the first signal being a preset first level, the second four-line enable state being bit 0, the second signal being a preset first level, and the first four-line enable state being bit 0, the four-line enable state of the external memory is set to bit 1, and the external memory is switched to a four-line startup mode to perform four-line startup through the external memory; or in response to the first signal being a preset first level, the second four-line enable state being bit 0, the second signal being a preset first level, and the first four-line enable state being bit 0, a single-line startup is performed through the external memory.
[0013] In one embodiment, the external memory is switched to a four-line startup mode to perform four-line startup through the external memory, including: sending a mode switching instruction through a single line to switch the external memory to the four-line startup mode; and performing four-line startup through the external memory.
[0014] In one embodiment, the four-line enable state of the external memory is set to bit 1, and the external memory is switched to a four-line startup mode to perform a four-line startup through the external memory, including: sending a write enable command to the external memory through a single line; sending a write status command to the external memory through a single line to set the four-line enable state of the external memory to bit 1; sending a mode switching instruction through a single line to switch the external memory to a four-line startup mode; and performing a four-line startup through the external memory.
[0015] In one embodiment, before reading the four-line enable state of the external memory, it also includes: obtaining a third signal of the third interface; wherein the third signal is configured to determine off-chip startup or on-chip startup; in response to the third signal being a preset first level, obtaining configuration information of the external memory; or in response to the third signal being a preset second level, obtaining startup data of the internal memory for on-chip startup.
[0016] In one embodiment, obtaining the configuration information of the external memory includes: sending a first information read command through a single line to read the configuration information of the external memory; and sending a second information read command through four lines to read the configuration information of the external memory.
[0017] Another technical solution adopted by the present application is: to provide a chip, the chip includes a controller and a memory, the memory is used to store program data, and the controller is used to execute the program data to implement the chip startup method as described above.
[0018] Another technical solution adopted by the present application is to provide a computer-readable storage medium, in which program data is stored. When the program data is executed by the controller, it is used to implement the chip startup method as described above.
[0019] Another technical solution adopted by the present application is to provide a computer program product, which, when executed by the controller, is used to implement the chip startup method as described above.
[0020] The chip startup method provided by the present application includes: reading the four-line enable state of the external memory; obtaining the first signal of the first interface, and obtaining the second signal of the second interface; wherein the first signal and the second signal are provided by the peripheral circuit, the first signal is configured to determine whether to read the four-line enable state of the external memory through the four lines, and the second signal is configured to determine whether to start through the four lines; according to the four-line enable state, the level of the first signal and the level of the second signal, select single-line startup or four-line startup through the external memory. Through the above method, this embodiment provides the first signal and the second signal through the peripheral circuit according to the enable state supported by the external memory, so that the chip can realize the switching of the startup mode according to the level of the first signal and the second signal. For example, when the external memory only supports the single-line mode, the single-line transmission data is used to realize the off-chip startup. When the external memory supports the four-line startup, the four-line transmission data can be used through the configuration of the peripheral circuit, which improves the data transmission rate, thereby improving the efficiency of the chip startup. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0022] Figure 1 is a schematic structural diagram of the first embodiment of the chip provided by the present application;
[0023] Figure 2 It is a flowchart of the first embodiment of the chip startup method provided by the present application;
[0024] Figure 3 is a first flow chart of step 23 in one embodiment;
[0025] Figure 4 is a second flow chart of step 23 in one embodiment;
[0026] Figure 5 is a third flow chart of step 23 in one embodiment;
[0027] Figure 6 It is a flowchart of the second embodiment of the chip startup method provided by the present application;
[0028] Figure 7 It is a flowchart of the third embodiment of the chip startup method provided by the present application;
[0029] Figure 8 is a schematic structural diagram of a second embodiment of a chip provided by the present application;
[0030] Fig. 9 It is a structural diagram of an embodiment of a computer storage medium provided by the present application. DETAILED DESCRIPTION
[0031] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It will be appreciated that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only some but not all structures related to the present application are shown in the drawings. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the art without making creative work are within the scope of protection of the present application.
[0032] The terms "first", "second", etc. in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0033] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0034] See also Figure 1 , Figure 11 is a schematic diagram of the structure of the first embodiment of the chip provided by the present application. The chip 100 includes a processor 11 and a QSPI controller 12. The QSPI (Quad-SPI, i.e., four-wire SPI) has more data lines than the standard SPI interface and supports up to four data lines for simultaneous transmission. The QSPI has a total of 6 control lines: QCS (CS of QSPI) is the chip select, and QSCK (SCK of QSPI) is the clock signal line. IO0~IO3 are data lines that can send and receive data.
[0035] The QSPI controller 12 includes an encryption module 121, a QSPI transmission control module 122, a register module 123 and a power-on mode selection module 124. The encryption module 121 is connected to the processor 11, and the QSPI transmission control module 122 is connected to the external memory through the interface PAD. The startup method of the embodiment of the present application is implemented by the power-on mode selection module 124.
[0036] See also Figure 2 , Figure 2 1 is a flow chart of a first embodiment of a chip startup method provided by the present application. The chip startup method includes:
[0037] Step 21: Read the four-line enable status of the external memory.
[0038] Among them, the four-line enable state, namely QE (Quad Enable) bit, QE bit is stored in the status register of the external memory. When QE bit=1, the external memory is in QPI mode, and when QE bit=0, the external memory is not in QPI mode.
[0039] Step 22: Obtain a first signal from the first interface, and obtain a second signal from the second interface; wherein the first signal and the second signal are provided by a peripheral circuit, the first signal is configured to determine whether to read a four-line enable state of an external memory through four lines, and the second signal is configured to determine whether to start through four lines.
[0040] The first interface and the second interface may be GPIO (General-purpose input / output) ports of the chip, and the levels of the first interface and the second interface are provided by a peripheral circuit.
[0041] Specifically, since the first signal is configured to determine whether to read the four-line enable state of the external memory through four lines, the second signal is configured to determine whether to start through four lines. For example, when the first signal is a preset first level (such as a high level / bit 1), it is determined that the four-line enable state of the external memory is read through four lines, and when the first signal is a preset second level (such as a low level / bit 0), it is determined that the four-line enable state of the external memory is not read through four lines; for example, when the second signal is a preset first level (such as a high level / bit 1), it is determined to start through four lines, and when the first signal is a preset second level (such as a low level / bit 0), it is determined not to start through four lines.
[0042] Optionally, in one embodiment, step 21 may include: sending a first state read command to the external memory via a single line to read a first four-line enable state of the external memory; in response to the first signal being a preset first level, sending a second state read command to the external memory via four lines to read a second four-line enable state of the external memory.
[0043] Specifically, the status register of the external memory is read by sending the first status read command (05 command / 35 command / 15 command) through a single line. The purpose of this step is to read the QE bit status of the external memory. The specific command sent is one of the 05 command, 35 command, and 15 command, which needs to be based on the specific status register information in the configuration information of the corresponding external memory. When the external memory is in QPI mode, the first status read command of the single line will not be parsed, and the data read back will be all 0 (generally, the data line of the single line is pulled down).
[0044] Then, read the level of the first signal of the first interface. When the first signal is at a low level (bit 1), send the second state read command (05 command / 35 command / 15 command) through four lines to read the status register of the external memory. The purpose of this step is to read the QE bit state of the external memory. The specific command sent is one of the 05 command, 35 command, and 15 command, which needs to be based on the specific status register information in the configuration information of the corresponding external memory. When the external memory is not in QPI mode, the second state read command of the four lines will not be parsed, and the data read back will be full CC (generally, MISO and MOSI are pulled down, and WP and HOLD are pulled up).
[0045] It can be understood that in some embodiments of the present application, the first level is by default a high level (bit 1) and the second level is by default a low level (bit 0). In other embodiments, the first level can also be determined to be a low level and the second level to be a high level. There is no limitation here.
[0046] Step 23: According to the four-line enable state, the level of the first signal and the level of the second signal, select single-line startup or four-line startup through the external memory.
[0047] It can be understood that in the above step 21, a first state read command is sent to the external memory via a single line to read the first four-line enable state of the external memory. Since the level of the first signal determines whether it is necessary to read the second four-line enable state of the external memory via four lines, that is, in response to the first signal being a preset first level, a second state read command is sent to the external memory via four lines to read the second four-line enable state of the external memory. Therefore, step 23 includes the following situations:
[0048] Case 1: The second four-line enable state is not read through the four lines: According to the first four-line enable state, the level of the first signal and the level of the second signal, single-line startup or four-line startup is selected through the external memory.
[0049] Case 2: The second four-line enable state is read through four lines, and the second four-line enable state is bit 1: According to the first four-line enable state, the second four-line enable state, the level of the first signal and the level of the second signal, select single-line startup or four-line startup through the external memory.
[0050] Case 3: The second four-line enable state is read through four lines and is bit 0: According to the first four-line enable state, the second four-line enable state, the level of the first signal and the level of the second signal, single-line startup or four-line startup is selected through the external memory.
[0051] The following is the first case, which includes:
[0052] In response to the first signal being a preset second level and the second signal being a preset second level, a single-line startup is performed through an external memory; or in response to the first signal being a preset second level, the second signal being a preset first level, and the first four-line enable state being bit 1, a four-line startup is performed through an external memory; or in response to the first signal being a preset second level, the second signal being a preset first level, and the first four-line enable state being bit 0, the four-line enable state of the external memory is set to bit 1 to perform a four-line startup through the external memory.
[0053] like Figure 3 As shown, Figure 3 This is a first flow chart of step 23 in an embodiment. Step 23 may include:
[0054] Step 23a1: Determine whether it is a four-line start according to the second signal.
[0055] In this embodiment, when the second signal is the preset second level (low level / bit 0), it is determined that four-line startup is not adopted, and step 23a2 is executed. When the second signal is the preset first level (high level / bit 1), it is determined that four-line startup is adopted, and step 23a3 is executed.
[0056] Step 23a2: Single-wire boot from external memory.
[0057] Specifically, when the first signal of the first interface is bit 0 and the second signal of the second interface is bit 0, four-line startup is not required and single-line startup is performed directly. That is, in response to the first signal being the preset second level and the second signal being the preset second level, single-line startup is performed through the external memory.
[0058] Step 23a3: Determine whether the first four-line enable state is bit 1.
[0059] Among them, the first four-line enable state is read from the above step 21. When the first four-line enable state is bit 1, it is determined that the external memory is not in QPI mode, and step 23a4 is executed. When the first four-line enable state is bit 0, it is determined that the external memory is in QPI mode, and step 23a5 is executed.
[0060] Step 23a4: Quad boot from external memory.
[0061] Specifically, when the first signal of the first interface is bit 0 and the second signal of the second interface is bit 1, it is determined to adopt four-line startup, and if the single line detects that the first four-line enable state (QE bit) is already bit 1, the four-line startup is directly performed. That is, in response to the first signal being a preset first level, the second four-line enable state being bit 1, and the second signal being a preset first level, the four-line startup is performed through the external memory.
[0062] Step 23a5: Set the four-line enable state of the external memory to bit 1.
[0063] Among them, after step 23a5 is executed, step 23a4 is executed.
[0064] Specifically, if the single-line detects that the first four-line enable state (QE bit) is bit 0, the QE bit needs to be configured.
[0065] Optionally, a write enable command is sent to the external memory via a single line; a write status command is sent to the external memory via a single line to set the four-line enable state of the external memory to bit 1; and four-line startup is performed via the external memory.
[0066] Specifically, by sending the 50 command / 06 command (write enable command) through a single line, the external memory needs to set the write enable position of the external memory to 1 first, whether it is burning the address of the storage data or writing the status register to modify the configuration. The difference between the 06 command and the 50 command is that after the 06 command sets the write enable to high, it is necessary to wait for tW (write status register waiting time) when writing the status register, which is generally in the order of ms. The 50 command can directly change the configuration of the write status register after setting the write enable to high, without waiting time. In specific applications, the choice of the 06 command and the 50 command can be determined according to the configuration parameters of the external memory, which is not limited here.
[0067] The following is the second case, which includes:
[0068] In response to the first signal being a preset second level and the second signal being a preset second level, a single-line startup is performed through an external memory; or in response to the first signal being a preset second level, the second signal being a preset first level, and the first four-line enable state being bit 1, a four-line startup is performed through an external memory; or in response to the first signal being a preset second level, the second signal being a preset first level, and the first four-line enable state being bit 0, the four-line enable state of the external memory is set to bit 1 to perform a four-line startup through the external memory.
[0069] The following is the second case, which includes:
[0070] In response to the first signal being a preset first level, the second four-line enable state being bit 1, and the second signal being a preset first level, four-line startup is performed through the external memory; or in response to the first signal being a preset second level, the second four-line enable state being bit 1, and the second signal being a preset first level, the external memory is switched to a single-line startup mode to perform a single-line startup through the external memory.
[0071] like Figure 4 As shown, Figure 4 This is a second flow chart of step 23 in an embodiment. Step 23 may include:
[0072] Step 23b1: Determine whether it is a four-line start according to the second signal.
[0073] In this embodiment, when the second signal is the preset second level (low level / bit 0), it is determined that four-line startup is not adopted, and step 23b2 is executed. When the second signal is the preset first level (high level / bit 1), it is determined that four-line startup is adopted, and step 23b4 is executed.
[0074] Step 23b2: Switch the external memory to single-line boot mode.
[0075] Optionally, step 23b2 may include: sending a mode switching instruction to the external memory via four lines, so that the external memory switches to a single-line startup mode; and performing a single-line startup via the external memory.
[0076] Specifically, when the second four-line enable state (QE bit) of the four-line read is 1, it indicates that the external memory is in the QPI mode, but does not need four-line startup, and needs to restore the non-QPI mode to perform single-line startup, so the f5 / ff command can be sent to the external memory to make the external memory exit the QPI mode, so as to perform single-line startup through the external memory. That is, in response to the first signal being the preset second level, the second four-line enable state being bit 1, and the second signal being the preset first level, the external memory is switched to the single-line startup mode, so as to perform single-line startup through the external memory.
[0077] Step 23b3: Single-wire boot from external memory.
[0078] Step 23b4: Quad boot from external memory.
[0079] Specifically, when the first signal of the first interface is bit 1 and the second signal of the second interface is bit 1, it is determined that four-line startup is adopted, and if the four-line detects that the second four-line enable state (QE bit) is already bit 1, the four-line startup is directly performed. That is, in response to the first signal being a preset first level, the second four-line enable state being bit 1, and the second signal being a preset first level, the four-line startup is performed through the external memory.
[0080] The following is the third case, which includes:
[0081] In response to the first signal being a preset first level, the second four-line enable state being bit 0, the second signal being a preset first level, and the first four-line enable state being bit 1, the external memory is switched to a four-line startup mode to perform four-line startup through the external memory; or in response to the first signal being a preset first level, the second four-line enable state being bit 0, the second signal being a preset first level, and the first four-line enable state being bit 0, the four-line enable state of the external memory is set to bit 1, and the external memory is switched to a four-line startup mode to perform four-line startup through the external memory; or in response to the first signal being a preset first level, the second four-line enable state being bit 0, and the second signal being a preset second level, a single-line startup is performed through the external memory.
[0082] like Figure 5 As shown, Figure 5 2 is a third flow chart of step 23 in an embodiment. Step 23 may include:
[0083] Step 23c1: Determine whether it is a four-line start according to the second signal.
[0084] In this embodiment, when the second signal is the preset second level (low level / bit 0), it is determined that four-line startup is not adopted, and step 23c2 is executed. When the second signal is the preset first level (high level / bit 1), it is determined that four-line startup is adopted, and step 23c3 is executed.
[0085] Step 23c2: Single-wire boot from external memory.
[0086] It can be understood that when the first signal of the first interface is bit 1, the second four-line enable state read through the four lines is bit 0, and the second signal of the second interface is bit 0, it is determined to adopt single-line startup and directly perform four-line startup. That is, in response to the first signal being a preset first level, the second four-line enable state being bit 0, and the second signal being a preset second level, single-line startup is performed through the external memory.
[0087] Step 23c3: Determine whether the first four-line enable state is bit 1.
[0088] Among them, the first four-line enable state is read from the above step 21. When the first four-line enable state is bit 1, it is determined that the external memory is not in QPI mode, and step 23c4 is executed. When the first four-line enable state is bit 0, it is determined that the external memory is in QPI mode, and step 23c5 is executed.
[0089] Step 23c4: Switch the external memory to four-wire boot mode.
[0090] Optionally, step 23c4 may include: sending a mode switching instruction via a single line to switch the external memory to a four-line startup mode.
[0091] Specifically, the 35 command / 38 command can be sent on a single line to make the external memory enter the QPI mode. The 35 command / 38 command will make the external memory supporting the QPI mode enter the QPI mode. In the QPI mode, the command address data will be transmitted in the form of four lines.
[0092] It can be understood that when the first signal of the first interface is bit 1, the second four-line enable state read through the four-line is bit 0, the second signal of the second interface is bit 1, and the first four-line enable state read through the single line is bit 1, it is determined to adopt four-line startup, and the external memory is switched to the four-line startup mode to perform four-line startup through the external memory. That is, in response to the first signal being a preset first level, the second four-line enable state being bit 0, the second signal being a preset first level, and the first four-line enable state being bit 1, the external memory is switched to the four-line startup mode to perform four-line startup through the external memory.
[0093] Step 23c5: Set the four-line enable state of the external memory to bit 1, and switch the external memory to the four-line startup mode.
[0094] Optionally, step 23c5 may include: sending a write enable command to the external memory via a single line; sending a write status command to the external memory via a single line to set the four-line enable state of the external memory to bit 1; sending a mode switching instruction via a single line to switch the external memory to a four-line startup mode.
[0095] Specifically, by sending the 50 command / 06 command (write enable command) through a single line, the external memory needs to set the write enable position of the external memory to 1 first, whether it is burning the address of the storage data or writing the status register to modify the configuration. The difference between the 06 command and the 50 command is that after the 06 command sets the write enable to high, it is necessary to wait for tW (write status register waiting time) when writing the status register, which is generally in the order of ms. The 50 command can directly change the configuration of the write status register after setting the write enable to high, without waiting time. In specific applications, the choice of 06 command and 50 command can be determined according to the configuration parameters of the external memory, which is not limited here. Then, the 35 command / 38 command can be sent on a single line to make the external memory enter the QPI mode. The 35 command / 38 command will make the external memory that supports the QPI mode enter the QPI mode. In the QPI mode, the command address data will be transmitted in the form of four lines.
[0096] It can be understood that when the first signal of the first interface is bit 1, the second four-line enable state read through four lines is bit 0, the second signal of the second interface is bit 1, and the first four-line enable state read through a single line is bit 0, it is determined to adopt four-line startup, the four-line enable state of the external memory is set to bit 1, and the external memory is switched to a four-line startup mode, so as to perform four-line startup through the external memory. That is, in response to the first signal being a preset first level, the second four-line enable state being bit 0, the second signal being a preset first level, and the first four-line enable state being bit 0, the four-line enable state of the external memory is set to bit 1, and the external memory is switched to a four-line startup mode, so as to perform four-line startup through the external memory.
[0097] Step 23c6: Quad boot from external memory.
[0098] It can be understood that step 23c6 is executed after step 23c4 and step 23c5.
[0099] See also Figure 6 , Figure 6 : is a flow chart of a second embodiment of a chip startup method provided by the present application, and the chip startup method includes:
[0100] Step 61: Obtain a third signal of a third interface, and determine whether it is an off-chip startup according to the third signal; wherein the third signal is configured to determine an off-chip startup or an on-chip startup.
[0101] It can be understood that the third interface can be a dedicated IO port different from the first interface and the second interface, and the dedicated IO does not occupy the position of the GPIO.
[0102] It can be understood that if the third signal is the preset second level (low level / bit 0), step 62 is executed, and if the third signal is the preset first level (high level / bit 1), step 63 is executed.
[0103] Step 62: Obtain the startup data of the internal memory to perform on-chip startup.
[0104] Optionally, before step 63, the process may further include: the QSPI controller performs a clock reset.
[0105] Step 63: Send a first information read command via a single line to read the configuration information of the external memory.
[0106] Optionally, a 9f command can be sent on a single line. The purpose of sending a 9f command is to read some information of the external memory. For all external memories, the 9f command can read its manufacturer ID, capacity and a device ID. For the manufacturer ID, basically each manufacturer's ID is different. The capacity records the capacity information of the external memory, such as 64m, 128m, etc. The meaning of the device ID defined by different manufacturers is different, and some manufacturers may not have it. The read information will be stored in the register of the QSPI controller and used as a judgment later. When the external memory is in QPI mode, the single-line 9f command will not be parsed, and the data read back will be all 0 (generally, the single-line data line is pulled down).
[0107] Step 64: Send a second information read command through four lines to read the configuration information of the external memory.
[0108] Optionally, a 9f command can be sent via four lines. When a four-line 9f command is sent, only a four-line 9f command can be correctly parsed by the external memory when the external memory is in QPI mode, and the correct value can be returned. The read information will be stored in the register of the QSPI controller for subsequent judgment. When the external memory is not in QPI mode, the four-line 9f command cannot be parsed, and the data read back will be cc (generally, miso and mosi are pulled down, and wp and hold are pulled up), and cc will not correspond to the ID of any flash manufacturer.
[0109] It can be understood that the above-mentioned steps 63 and 64 are not limited to their execution order, and one of the two 9f commands sent will definitely read back the data correctly.
[0110] In this embodiment, the information read out in the first two stages is processed. If some external memory model information can confirm that it does not support the QPI startup mode, you can choose to directly start the single line or enter the judgment. The basis for judging whether to choose to directly start the single line or enter the judgment is: the write status register of some manufacturers must be implemented through the 06 command. When the QE bit is configured using the 06 command, it is necessary to poll for WIP (a parameter of the status register of the external memory, used to determine whether the write process is completed) detection. This time may reach tens of milliseconds (ms), and it is necessary to weigh the startup time to choose. Otherwise, it will enter the next round of judgment logic.
[0111] See also Figure 7 , Figure 7 : is a flow chart of a third embodiment of a chip startup method provided by the present application. The chip startup method includes:
[0112] S1. Obtain a third signal from a third interface, and determine whether it is an off-chip startup according to the third signal.
[0113] If the judgment result of S1 is no, execute S2; if the judgment result of S1 is yes, execute S3.
[0114] S2. Get the startup data of the internal memory to perform on-chip startup.
[0115] S3. Send a first information read command through a single line to read configuration information of the external memory.
[0116] S4. Send a second information read command through four lines to read the configuration information of the external memory.
[0117] S5. Process the configuration information.
[0118] S6, single-line reading of the first four-line enable status.
[0119] S7. Determine whether to read the four-line enable state through the four lines according to the first signal.
[0120] If the judgment result of S7 is no, execute S8; if the judgment result of S7 is yes, execute S12.
[0121] S8. Determine whether to start through four lines according to the second signal.
[0122] If the judgment result of S8 is no, single-line startup is performed through the external memory. If the judgment result of S8 is yes, S9 is executed.
[0123] S9: Whether the first four-line enable state is bit 1.
[0124] If the determination result of S9 is yes, four-wire startup is performed through the external memory. If the determination result of S9 is no, S10 is executed.
[0125] S10, send a write enable command on a single line.
[0126] S11, send write status command on single line.
[0127] After S11 is executed, four-wire startup is performed through the external memory.
[0128] S12, four-line read second four-line enable status.
[0129] S13: Whether the second four-line enable state is bit 1.
[0130] If the judgment result of S13 is yes, execute S14; if the judgment result of S13 is no, execute S16.
[0131] S14, determining whether to start through four lines according to the second signal.
[0132] If the judgment result of S14 is yes, four-line startup is performed through the external memory, and if the judgment result of S14 is no, S15 is executed.
[0133] S15: Send a mode exit command to exit the QPI mode.
[0134] After S15 is executed, a single-line startup is performed through the external memory.
[0135] S16: Determine whether to start through four lines according to the second signal.
[0136] When the judgment result of S16 is yes, S17 is executed, and when the judgment result of S16 is no, single-line startup is performed through the external memory.
[0137] S17: Whether the first four-line enable state is bit 1.
[0138] When the judgment result of S17 is yes, S18 is executed, and when the judgment result of S17 is no, S19 is executed.
[0139] S18: Single-line sending mode switching command.
[0140] After S18 is executed, four-wire startup is performed through the external memory.
[0141] S19: Send write enable command on single line.
[0142] S20: Send write status command via single line.
[0143] After S20 is completed, S18 is executed.
[0144] It can be understood that this embodiment combines the first and second embodiments mentioned above, and the implementation principles and specific processes of each step are similar, which will not be repeated here.
[0145] The chip startup method provided in this embodiment includes: reading the four-line enable state of the external memory; obtaining the first signal of the first interface, and obtaining the second signal of the second interface; wherein the first signal and the second signal are provided by the peripheral circuit, the first signal is configured to determine whether to read the four-line enable state of the external memory through the four lines, and the second signal is configured to determine whether to start through the four lines; according to the four-line enable state, the level of the first signal and the level of the second signal, select single-line startup or four-line startup through the external memory. In the above manner, this embodiment provides the first signal and the second signal through the peripheral circuit according to the enable state supported by the external memory, so that the chip can switch the startup mode according to the level of the first signal and the second signal. For example, when the external memory only supports the single-line mode, the single-line data transmission is used to realize the off-chip startup. When the external memory supports the four-line startup, the four-line data transmission can be used through the configuration of the peripheral circuit, which improves the data transmission rate, thereby improving the efficiency of chip startup.
[0146] See also Figure 8 , Figure 8 8 is a schematic diagram of the structure of the second embodiment of the chip provided by the present application. The chip 800 includes a controller 81 and a memory 82. The memory 82 is used to store program data. The controller 81 is used to execute the program data to implement the following chip startup method:
[0147] Read the four-line enable state of the external memory; obtain a first signal of the first interface, and obtain a second signal of the second interface; wherein the first signal and the second signal are provided by a peripheral circuit, the first signal is configured to determine whether to read the four-line enable state of the external memory through four lines, and the second signal is configured to determine whether to start through four lines; according to the four-line enable state, the level of the first signal and the level of the second signal, select single-line startup or four-line startup through the external memory.
[0148] See also Fig. 9 , Fig. 9 1 is a schematic diagram of a computer storage medium according to an embodiment of the present application. The computer readable storage medium 900 stores program data 91. When the program data 91 is executed by the controller, it is used to implement the following chip startup method:
[0149] Read the four-line enable state of the external memory; obtain a first signal of the first interface, and obtain a second signal of the second interface; wherein the first signal and the second signal are provided by a peripheral circuit, the first signal is configured to determine whether to read the four-line enable state of the external memory through four lines, and the second signal is configured to determine whether to start through four lines; according to the four-line enable state, the level of the first signal and the level of the second signal, select single-line startup or four-line startup through the external memory.
[0150] In addition, an embodiment of the present application further provides a computer program product, which, when executed by a controller, is used to implement the following chip startup method:
[0151] Read the four-line enable state of the external memory; obtain a first signal of the first interface, and obtain a second signal of the second interface; wherein the first signal and the second signal are provided by a peripheral circuit, the first signal is configured to determine whether to read the four-line enable state of the external memory through four lines, and the second signal is configured to determine whether to start through four lines; according to the four-line enable state, the level of the first signal and the level of the second signal, select single-line startup or four-line startup through the external memory.
[0152] It is understandable that the computer program product may be a computer program product contained in a tangible computer-readable medium, and the computer program product includes a program code for executing the above-mentioned interface testing method. In some embodiments, the computer program product can be downloaded and installed from the network, or copied, transferred, and installed between different computer hardware. Its wireless transmission method may include the Internet, Bluetooth, WIFI, etc., and its wired transmission method may include USB, lighting, type-C, etc.
[0153] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only illustrative, for example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0154] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0155] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0156] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A chip startup method, characterized in that: The chip startup method includes: Read the four-line enable status of the external memory; Acquire a first signal of a first interface, and acquire a second signal of a second interface; wherein the first signal and the second signal are provided by a peripheral circuit, the first signal is configured to determine whether to read the four-line enable state of the external memory through four lines, and the second signal is configured to determine whether to start through four lines; Single-line startup or four-line startup is selected through the external memory according to the four-line enable state, the level of the first signal, and the level of the second signal.
2. The chip startup method according to claim 1, characterized in that: The four-line enable state of reading the external memory includes: Sending a first state read command to the external memory via a single line to read a first four-line enable state of the external memory; In response to the first signal being at a preset first level, a second state read command is sent to the external memory through four lines to read a second four-line enable state of the external memory.
3. The chip startup method according to claim 2, characterized in that: The selecting, according to the four-line enable state, the level of the first signal, and the level of the second signal, to perform single-line startup or four-line startup through the external memory comprises: Single-line startup or four-line startup is selected through the external memory according to the first four-line enable state, the second four-line enable state, the level of the first signal, and the level of the second signal.
4. The chip startup method according to claim 3, characterized in that: The selecting, according to the first four-line enable state, the second four-line enable state, the level of the first signal, and the level of the second signal, to perform single-line startup or four-line startup through the external memory comprises: In response to the first signal being at a preset second level and the second signal being at a preset second level, single-line startup is performed through the external memory; or In response to the first signal being at a preset second level, the second signal being at a preset first level, and the first four-line enable state being bit 1, four-line startup is performed through the external memory; or In response to the first signal being a preset second level, the second signal being a preset first level, and the first four-line enable state being bit 0, the four-line enable state of the external memory is set to bit 1 to perform four-line startup through the external memory.
5. The chip startup method according to claim 4, characterized in that: The step of setting the four-line enable state of the external memory to bit 1 to perform four-line startup through the external memory includes: Sending a write enable command to the external memory via a single line; Sending a write status command to the external memory via a single line to set the four-line enable state of the external memory to bit 1; Four-wire boot is performed through the external memory.
6. The chip startup method according to claim 3, characterized in that: The selecting, according to the four-line enable state, the level of the first signal, and the level of the second signal, to perform single-line startup or four-line startup through the external memory comprises: In response to the first signal being at a preset first level, the second four-line enable state being bit 1, and the second signal being at a preset first level, four-line startup is performed through the external memory; or In response to the first signal being at a preset second level, the second four-line enable state being bit 1, and the second signal being at a preset first level, the external memory is switched to a single-line startup mode to perform single-line startup through the external memory.
7. The chip startup method according to claim 6, characterized in that: The step of switching the external memory to a single-line startup mode to perform single-line startup through the external memory includes: Sending a mode switching instruction to the external memory via four lines, so that the external memory switches to a single-line startup mode; Single wire boot is performed through the external memory.
8. The chip startup method according to claim 3, characterized in that: The selecting, according to the four-line enable state, the level of the first signal, and the level of the second signal, to perform single-line startup or four-line startup through the external memory comprises: In response to the first signal being a preset first level, the second four-line enable state being bit 0, the second signal being a preset first level, and the first four-line enable state being bit 1, switching the external memory to a four-line startup mode to perform four-line startup through the external memory; or In response to the first signal being a preset first level, the second four-line enable state being bit 0, the second signal being a preset first level, and the first four-line enable state being bit 0, the four-line enable state of the external memory is set to bit 1, and the external memory is switched to a four-line startup mode, so as to perform four-line startup through the external memory; or In response to the first signal being at a preset first level, the second four-line enable state being bit 0, and the second signal being at a preset second level, single-line startup is performed through the external memory.
9. The chip startup method according to claim 8, characterized in that: The step of switching the external memory to a four-line boot mode to perform four-line booting through the external memory includes: Sending a mode switching instruction via a single line so as to switch the external memory to a four-line startup mode; Four-wire boot is performed through the external memory.
10. The chip startup method according to claim 8, characterized in that: The step of setting the four-line enable state of the external memory to bit 1 and switching the external memory to a four-line startup mode to perform four-line startup through the external memory includes: Sending a write enable command to the external memory via a single line; Sending a write status command to the external memory via a single line to set the four-line enable state of the external memory to bit 1; Sending a mode switching instruction via a single line so as to switch the external memory to a four-line startup mode; Four-wire boot is performed through the external memory.
11. The chip startup method according to claim 1, characterized in that: Before reading the four-line enable state of the external memory, the method further includes: Acquire a third signal of a third interface; wherein the third signal is configured to determine off-chip startup or on-chip startup; In response to the third signal being at a preset first level, acquiring configuration information of the external memory; or In response to the third signal being at the preset second level, the startup data of the internal memory is acquired to perform on-chip startup.
12. The chip startup method according to claim 11, characterized in that: The obtaining of the configuration information of the external memory includes: Sending a first information read command via a single line to read configuration information of the external memory; and A second information read command is sent through four lines to read the configuration information of the external memory.
13. A chip, characterized in that: The chip includes a controller and a memory, the memory is used to store program data, and the controller is used to execute the program data to implement the chip startup method according to any one of claims 1 to 12.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program data, and when the program data is executed by the controller, it is used to implement the chip startup method according to any one of claims 1 to 12.
15. A computer program product, characterized in that When the computer program product is executed by the controller, it is used to implement the chip startup method according to any one of claims 1 to 12.
Citation Information
Cited By
High-reliability chip starting method and chip
CN119829163A
