System and method for configuring FPGA, device, and storage medium
By controlling the data transmission link between the MCU and FPGA through the analog switch, real-time monitoring and matching of FPGA configuration information is realized, which solves the problems of loading failure and configuration package update in the existing technology, and improves the efficiency and convenience of FPGA configuration.
Patent Information
- Application Number
- PCT/CN2024/082369
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-21
- Filing Date
- 2024-03-19
- Publication Date
- 2024-10-24
AI Technical Summary
In the existing MCU-based loading of FPGA configuration technology, the FPGA configuration loading process is subject to logic restrictions, which may cause loading failure, affecting the success rate and efficiency, and the MCU needs to be rewritten when the configuration package is updated.
The analog switch controls the on and off of the data transmission link between the MCU and FPGA to avoid redundant data writing, realize real-time monitoring of configuration information matching and loading process, and use the MCU to detect the consistency of the data number and configuration information to ensure the integrity of the configuration package. sex.
It improves the efficiency and success rate of FPGA configuration, supports instant response and efficient switching of different configuration packages, reduces the frequency of MCU modification, and facilitates the modification and addition of configuration packages.
Smart Images

Figure CN2024082369_24102024_PF_FP_ABST
Abstract
Description
A system, method, device and storage medium for configuring FPGA Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a system, method, device and storage medium for configuring FPGA. Background Art
[0002] FPGAs are a type of semi-custom circuit within application-specific integrated circuits (ASICs). They are programmable logic arrays that effectively address the limited gate count of existing devices. The basic structure of an FPGA includes programmable input and output units, configurable logic blocks, a digital clock management module, embedded block RAM, routing resources, an embedded dedicated hard core, and underlying embedded functional units. FPGAs are widely used in digital circuit design due to their rich routing resources, reprogrammability, high integration, and low investment.
[0003] Loading FPGA configuration based on an MCU is a passive configuration method. During the implementation of the present invention, the applicant discovered that existing technologies for loading FPGA configuration based on an MCU, such as the dual-chip loading method based on an MCU and an FPGA disclosed in Chinese Patent Publication No. CN109117205A, are subject to limitations in the FPGA configuration logic during the FPGA configuration loading process. This may result in loading failures, thus affecting the success rate of FPGA configuration loading. Summary of the Invention
[0004] The present invention aims to provide a system, method, device, and storage medium for configuring an FPGA to solve the above-mentioned technical problems existing in the prior art. The present invention mainly includes the following four aspects:
[0005] A first aspect of the present application provides a system for configuring an FPGA, including:
[0006] MCU, the MCU is used to obtain trigger signals and configure feature information;
[0007] FLASH, which is used to store FPGA configuration packages and corresponding configuration information;
[0008] FPGA, wherein the configuration mode of the FPGA is a slave serial mode;
[0009] An analog switch, wherein the analog switch, FPGA, and FLASH are respectively connected to the MCU. The MCU is also used to match the configuration feature information with the configuration information in the FLASH. The FPGA is connected to the data transmission line between the MCU and the FPGA via the analog switch. The analog switch is used to control the on and off of the data transmission link between the MCU and the FPGA. The analog switch is controlled to be in an off state under normal circumstances. After the MCU successfully matches the configuration feature information, the analog switch is controlled to connect the data transmission link between the MCU and the FPGA, so as to configure the FPGA using the matching FPGA configuration package.
[0010] Furthermore, the configuration information stores a plurality of FPGA configuration packages and corresponding configuration information.
[0011] Furthermore, the configuration information includes the starting position information, length information, pre-stored check code and characteristic information of the FPGA configuration package. The starting position information of the FPGA configuration package is 4 bytes, the length information of the FPGA configuration package is 4 bytes, the pre-stored check code of the FPGA configuration package is set to 4 bytes, and the characteristic information of the FPGA configuration package is 1012 bytes.
[0012] Furthermore, the FLASH includes a first storage module and a second storage module, the first storage module is used to store the FPGA configuration package, and the second storage module is used to store the configuration information.
[0013] Furthermore, the configuration information includes a pre-stored verification code of the configuration package corresponding to the FPGA configuration package. The MCU is used to read back the data of the FPGA configuration package in the FLASH during the configuration loading process of the FPGA, and generate a configuration package verification code by calculation based on the data, and compare it with the pre-stored verification code of the configuration package corresponding to the FPGA configuration package in the FLASH to verify whether the configuration loading process is successfully completed.
[0014] Furthermore, the MCU includes a third storage module, and the third storage module is used to store the MCU program.
[0015] Furthermore, the MCU is also used to monitor the process of configuring the FPGA using the matching FPGA configuration package, so as to control the analog control switch to the disconnected state after the configuration is completed.
[0016] Furthermore, the M0, M1, and M2 pins of the FPGA are pulled up respectively, the DIN pin of the FPGA is connected to the SPI_MISO pin of the MCU and the QD1 pin of the FLASH respectively, the CCLK pin of the FPGA is connected to the D1 pin of the analog switch, the S1A pin of the analog switch is connected to the SPI_CLOCK pin of the MCU and the CK pin of the FLASH respectively, and the S1B pin of the analog switch is connected to the The pin is grounded, the SEL pin of the analog switch is connected to the general IO port of the MCU, and the SEL pin of the analog switch is pulled down at the same time; the PROGRAM_B pin, INIT pin, and DONE pin of the FPGA are respectively connected to the general IO port of the MCU, and the PROGRAM_B pin, INIT pin, and DONE pin of the FPGA are respectively pulled up; the CK pin of the FLASH is connected to the SPI_CLOCK pin of the MCU, the DQ0 pin of the FLASH is connected to the SPI_MOSI pin of the MCU, the DQ1 pin of the FLASH is connected to the SPI_MOSO pin of the MCU, the WP pin, RESET pin, and CS pin of the FLASH are respectively pulled up, and the CS pin of the FLASH is connected to the SPI_CS pin of the MCU.
[0017] A second aspect of the present application provides a method for configuring an FPGA, which is configured based on the above system and specifically includes the following steps:
[0018] S100 obtains the trigger signal and configuration feature information;
[0019] S200. Match the acquired configuration feature information with the configuration information in the FLASH. After the match is successful, control the analog switch to connect the data transmission link between the MCU and the FPGA to configure the FPGA using the matching FPGA configuration package.
[0020] A third aspect of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement the above method.
[0021] A fourth aspect of the present application provides a readable storage medium, which stores a computer program, and implements the above method when the computer program is executed.
[0022] Compared with the prior art, the present invention has at least the following technical effects:
[0023] The present invention connects the FPGA to the data transmission line between the MCU and the FPGA through an analog switch, uses the analog switch to control the on / off of the data transmission link between the MCU and the FPGA, and controls the analog switch to be in an off state under normal circumstances, thereby avoiding the problem of redundant data being written into the FPGA during the feature matching process. After a successful match, the MCU controls the analog switch to connect the data transmission link between the MCU and the FPGA. The MCU can detect whether the number of data generated by the FLASH is consistent with the length information in the corresponding configuration information, thereby achieving real-time monitoring of whether the FPGA configuration package has been loaded, facilitating and quickly entering the next FPGA configuration preparation action. The entire FPGA configuration process responds instantly, effectively improving the FPGA configuration efficiency and configuration effect, and also facilitating efficient switching between different FPGA configuration packages, improving ease of use, and avoiding modifications to the MCU when changing or adding a new FPGA configuration package. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments of the present invention or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0025] FIG1 is a circuit diagram of an FPGA system configured according to the present invention;
[0026] FIG2 is a circuit diagram of an analog switch according to the present invention;
[0027] FIG3 is a circuit diagram of an FPGA connection configuration mode of the present invention;
[0028] FIG4 is a schematic diagram of FLASH memory allocation according to the present invention;
[0029] FIG5 is a flow chart of a method for configuring an FPGA according to the present invention. DETAILED DESCRIPTION
[0030] The following description provides many different embodiments or examples for implementing different features of the present invention. The components and arrangements described in the following specific examples are only used to simplify the present invention and are only used as examples, not to limit the present invention.
[0031] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention for which protection is sought, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0032] Based on the role of the FPGA in the configuration circuit, the configuration methods can be divided into three categories: active, JTAG, and passive. The active method is to load the configuration from the off-chip non-volatile memory, and the required clock signal is generated by the FPGA. In the active mode, after the FPGA is powered on, it automatically reads the configuration data from the corresponding external memory to the SRAM to achieve internal structure mapping. The passive method requires an external processor to download the data to the FPGA. Its biggest advantage is that the FPGA configuration data can be placed in any storage location in the system, such as flash, hard disk, network, etc. JTAG mode is a debugging mode that can download the bitstream file from the PC to the FPGA, which will be lost when the power is off. In JTAG mode, the clock for communication between the PC and the FPGA is the clk of the JTAG interface, and the data enters the FPGA directly from the TDI to complete the corresponding functional configuration.
[0033] The states of the FPGA's M2, M1, and M0 pins are used to select the configuration mode. Compared to the JTAG mode, which is inconvenient for future updates and maintenance, the active mode requires dedicated storage chips for loading and is not easy to load multiple FPGA configurations. Loading FPGA configurations through the MCU is a passive method, which has the advantages of facilitating multiple FPGA configurations and reducing configuration costs. However, it also has the drawback of requiring the MCU to be reprogrammed when recompiling and packaging the FPGA configuration package or when adding a new FPGA configuration package.
[0034] Example 1:
[0035] The present application provides a system for configuring an FPGA, as shown in FIG1 to FIG4 , including:
[0036] MCU, the MCU is used to obtain trigger signals and configure feature information;
[0037] FLASH, which is used to store FPGA configuration packages and corresponding configuration information;
[0038] FPGA, wherein the configuration mode of the FPGA is a slave serial mode;
[0039] An analog switch, wherein the analog switch, FPGA, and FLASH are respectively connected to the MCU. The MCU is also used to match the configuration feature information with the configuration information in the FLASH. The FPGA is connected to the data transmission line between the MCU and the FPGA via the analog switch. The analog switch is used to control the on and off of the data transmission link between the MCU and the FPGA. The analog switch is controlled to be in an off state under normal circumstances. After the MCU successfully matches the configuration feature information, the analog switch is controlled to connect the data transmission link between the MCU and the FPGA, so as to configure the FPGA using the matching FPGA configuration package.
[0040] In existing MCU-based FPGA configuration loading technologies, such as the dual-chip loading method based on MCU and FPGA disclosed in Chinese Patent Publication No. CN109117205A, in order to facilitate the MCU to write the configuration package in the firmware program storage device into the FPGA for configuration loading, the same communication transmission line is used between the MCU, FPGA and firmware program storage device. As a result, when the MCU interacts with the firmware program storage device, the MCU's operations on the firmware program storage device are limited by the FPGA configuration logic. The FPGA will be written with redundant data before configuration. The redundant data may affect the subsequent FPGA configuration package loading process and may even cause configuration failure, affecting the FPGA configuration loading success rate and configuration efficiency. In this embodiment, the FPGA is connected to the data transmission line between the MCU and the FPGA through an analog switch, and the analog switch is used to control the on and off of the data transmission link between the MCU and the FPGA. The analog switch is controlled to be in the off state under normal conditions. During the process of loading and configuring the FPGA, the MCU is first used to receive a trigger signal and configuration feature information, and the MCU reads the configuration in the FLASH. The MCU then controls the analog switch to disconnect, preventing unnecessary data from being written to the FPGA during the feature matching process. After a successful match, the MCU controls the analog switch to connect the data transmission link between the MCU and FPGA. The MCU then guides the transfer of the matching FPGA configuration package from the FLASH to the FPGA for configuration. During the configuration process, since the MCU, FPGA, and FLASH share the same communication transmission line, the MCU can detect whether the number of data transmitted by the FLASH matches the length of the corresponding configuration information, thereby enabling real-time monitoring of whether the FPGA configuration package has been loaded. Once the FPGA configuration is loaded, the analog switch is disconnected, facilitating quick entry into the next FPGA configuration preparation step. This allows for instant response throughout the FPGA configuration process, effectively improving FPGA configuration efficiency and effectiveness. This also facilitates efficient switching between different FPGA configuration packages, enhancing ease of use and avoiding the need to modify the MCU when modifying or adding new FPGA configuration packages.
[0041] Specifically, to improve ease of use, multiple FPGA configuration packages and corresponding configuration information can be stored in the configuration information, so that the MCU can select a specific FPGA configuration package to load based on the external feature information obtained. It also facilitates the FPGA to load different FPGA configuration packages to realize the switching operation of different FPGA programs.
[0042] Specifically, the configuration information includes the starting position information, length information, pre-stored check code and feature information of the FPGA configuration package. To facilitate the rational use of the FLASH memory space, based on the FLASH memory space and the memory size of the FPGA configuration package, the starting position information of the FPGA configuration package can be set to 4 bytes, the length information of the FPGA configuration package can be set to 4 bytes, the pre-stored check code of the FPGA configuration package can be set to 4 bytes, and the feature information of the FPGA configuration package can be set to 1012 bytes. This can not only achieve effective and reasonable storage of the configuration information, but also reserve more memory margin for the feature information (the feature information will not completely occupy 1012 bytes), so as to facilitate subsequent design improvements.
[0043] In some embodiments, a FLASH chip with a memory size of 32M bytes may be used, so that eight different FPGA configuration packages can be stored in the FLASH chip, providing more options for FPGA configuration.
[0044] Specifically, in the prior art, when the FPGA configuration is loaded abnormally, it is necessary to read the FPGA-related register data after the FPGA is running to determine the cause of the configuration abnormality. In order to facilitate rapid analysis and finding of the cause when the FPGA configuration is loaded abnormally, the configuration information can be set to include a pre-stored verification code of the configuration package corresponding to the FPGA configuration package. The MCU is used to read back the data of the FPGA configuration package in the FLASH during the configuration loading process of the FPGA, and generate a configuration package verification code through calculation based on the data, and compare it with the pre-stored verification code of the configuration package corresponding to the FPGA configuration package in the FLASH to verify whether the configuration loading process is successfully completed. Specifically during use, after the matching is successful, when the FPGA is configured and loaded, the MCU reads back the data of the FPGA configuration package in the FLASH, and generates a configuration package verification code based on this through calculation (calculating and generating the configuration package verification code is an existing technology and will not be repeated here), and compares it with the configuration package pre-stored verification code corresponding to the FPGA configuration package in the FLASH, so as to judge the integrity and accuracy of the FPGA configuration package. If the configuration package verification code is consistent with the configuration package pre-stored verification code corresponding to the FPGA configuration package in the FLASH, it is judged that the configuration loading is successful. If the configuration package verification code is inconsistent with the configuration package pre-stored verification code corresponding to the FPGA configuration package in the FLASH, the reason for the configuration loading failure can be directly analyzed based on the inconsistency of the verification code, which can help users quickly solve the problem of abnormal FPGA configuration loading.
[0045] It should be noted that the configuration package verification code is the data of the FPGA configuration package in the FLASH read back by the MCU and accumulated and calculated by single byte, and the 4-byte result is saved. The pre-stored verification code is the data of the FPGA configuration file accumulated and calculated by single byte before pre-burning the FLASH, and the 4-byte result is saved.
[0046] Specifically, in order to facilitate the rapid completion of feature information matching, the FLASH can be set to include a first storage module and a second storage module. The first storage module is used to save the FPGA configuration package, and the second storage module is used to save the configuration information. Based on this, after obtaining the trigger signal and configuration feature information, the MCU can directly read the saved configuration information in the second storage module and match it with the obtained configuration feature information. The amount of information read at a single time is small, and the feature information matching work can be completed quickly in a short time; after the matching is completed, the MCU can first control the FPGA reset to let the FPGA enter the configuration mode, and then connect the analog switch to accurately send the matched FPGA configuration package in the first storage module of FLASH to the MCU and FPGA to load the FPGA configuration package.
[0047] Specifically, in order to provide more FPGA configuration packages for configuration loading selection, the MCU can be set to include a third storage module, which is used to save the MCU program, avoid the MCU program occupying the FLASH storage space, and avoid modifications to the MCU when changing or adding a new FPGA configuration package.
[0048] Specifically, to facilitate instant and efficient switching control of feature matching and configuration loading, the MCU can be set to monitor the process of configuring the FPGA using a matching FPGA configuration package, so as to control the analog control switch to the disconnected state after the configuration is completed.
[0049] Specifically, the M0 pin, M1 pin, and M2 pin of the FPGA are pulled up respectively, the DIN pin of the FPGA is connected to the SPI_MISO pin of the MCU and the QD1 pin of the FLASH respectively, the CCLK pin of the FPGA is connected to the D1 pin of the analog switch, the S1A pin of the analog switch is connected to the SPI_CLOCK pin of the MCU and the CK pin of the FLASH respectively, and the S1B pin, The pin is grounded, the SEL pin of the analog switch is connected to the general IO port of the MCU, and the SEL pin of the analog switch is pulled down at the same time; the PROGRAM_B pin, INIT pin, and DONE pin of the FPGA are respectively connected to the general IO port of the MCU, and the PROGRAM_B pin, INIT pin, and DONE pin of the FPGA are respectively pulled up; the CK pin of the FLASH is connected to the SPI_CLOCK pin of the MCU, the DQ0 pin of the FLASH is connected to the SPI_MOSI pin of the MCU, the DQ1 pin of the FLASH is connected to the SPI_MOSO pin of the MCU, the WP pin, RESET pin, and CS pin of the FLASH are respectively pulled up, and the CS pin of the FLASH is connected to the SPI_CS pin of the MCU.
[0050] Example 2:
[0051] This embodiment of the present application provides a method for configuring an FPGA, as shown in FIG5 , based on the system in Example 1, specifically including the following steps:
[0052] S100 obtains the trigger signal and configuration feature information;
[0053] S200. Match the acquired configuration feature information with the configuration information in the FLASH. After the match is successful, control the analog switch to connect the data transmission link between the MCU and the FPGA to configure the FPGA using the matching FPGA configuration package.
[0054] By controlling the analog switch to be in the disconnected state under normal conditions, during the process of loading and configuring the FPGA, the MCU is first used to receive the trigger signal and configuration feature information. The MCU reads the configuration information in the FLASH and matches the acquired configuration feature information with the configuration information in the FLASH. Since the analog switch is controlled in the disconnected state, the interaction between the MCU and the FLASH will not be written to the FPGA, thereby avoiding the problem of writing redundant data into the FPGA during the feature matching process. After the match is successful, the MCU controls the analog switch to connect the data transmission link between the MCU and the FPGA. At this time, the MCU guides the transfer of the matched FPGA configuration package from the FLASH to the FPGA for configuration. During the configuration process, since the MCU, FPGA and FLASH share the same communication transmission line, the MCU can detect whether the number of data generated by the FLASH is consistent with the length information in the corresponding configuration information, thereby realizing real-time monitoring of whether the FPGA configuration package is loaded. After the FPGA configuration is loaded, the analog switch can be controlled to switch to the disconnected state, which is convenient for quickly entering the next FPGA configuration preparation action. The entire FPGA configuration process responds instantly, effectively improving the FPGA configuration efficiency and configuration effect. At the same time, it also helps to realize efficient switching of different FPGA configuration packages, improves ease of use, and avoids modifications to the MCU when changing or adding new FPGA configuration packages.
[0055] In some embodiments, after the match is successful, the FLASH read address is set first and the specific FPGA configuration package of the FLASH is read. After the FLASH read address and the specific FPGA configuration package of the FLASH are set, the analog switch is controlled to connect the data transmission link between the MCU and the FPGA, thereby avoiding writing the data to the FPGA when setting the FLASH read address, further ensuring accurate and stable implementation during the FPGA configuration loading process. Furthermore, to ensure the accuracy of configuration loading, a FLASH read address can be set to read the preset byte content. For example, one read address corresponds to one byte content. After the match is successful, the FLASH read address is set first, and then the analog switch is controlled to connect the data transmission link between the MCU and the FPGA. The MCU reads the FPGA configuration package with one byte content in the corresponding FLASH and loads it into the FPGA. After the reading and loading is completed, the analog switch is controlled to disconnect. The MCU sets the second FLASH read address. After the setting is completed, the analog switch is controlled to connect. The MCU reads the FPGA configuration package with one byte content in the FLASH corresponding to the second FLASH read address and loads it into the FPGA. After the reading and loading is completed, the analog switch is controlled to disconnect. This cycle continues until the FPGA configuration package is loaded. In some examples, a read address can also be set to correspond to two bytes or four bytes, which is not specifically limited here.
[0056] In some embodiments, in order to improve configuration efficiency, a read address can also be set during an FPGA configuration loading process, and then the analog switch can be controlled to be connected. The MCU continuously reads the corresponding FPGA configuration package in the corresponding FLASH and loads it into the FPGA until the FPGA configuration package is loaded.
[0057] In some embodiments, to implement the use of an MCU to load multiple configurations of an FPGA, a method including the following steps may be used:
[0058] Pull up M0, M1, and M2 of the FPGA respectively and set the FPGA configuration mode to slave serial mode;
[0059] Connect the FPGA's DIN to the MCU's SPI_MISO and the FLASH's DQ1, respectively, so that the FLASH data read by the MCU can be directly downloaded to the FPGA; connect the FPGA's CCLK to the analog switch's D1, connect the analog switch's S1A to the MCU's SPI_CLOCK and the FLASH's CK, respectively, connect the analog switch's S1B and EN to ground, and connect the analog switch's SEL to the MCU's general IO port so that the MCU can control whether the FPGA's CCLK is synchronized with the MCU's SPI_CLOCK and the FLASH's CK. Pull SEL down at the same time so that the FPGA's CCLK, the MCU's SPI_CLOCK, and the FLASH's CK signals are synchronized initially;
[0060] Connect the FPGA's PROGRAM_B, INIT, and DONE configuration pins to the MCU's general-purpose I / O ports so that the MCU can control the FPGA's configuration process. Pull up the FPGA's PROGRAM_B, INIT, and DONE configuration pins to ensure that the FPGA's power-on configuration process proceeds normally.
[0061] Connect the CK of FLASH to the SPI_CLOCK of MCU, the DQ0 of FLASH to the SPI_MOSI of MCU, the DQ1 of FLASH to the SPI_MISO of MCU respectively, and pull up the WP, RESET and CS of FLASH respectively. By default, FLASH is not chip selected. At the same time, the CS of FLASH is connected to the SPI_CS of MCU to ensure that the MCU can normally exchange data with FLASH.
[0062] Burn each FPGA configuration package and configuration information into FLASH;
[0063] After the MCU obtains the external trigger signal and data, it extracts the configuration feature information, then reads the FPGA package configuration information of the FLASH in sequence and matches it with the configuration feature information. If the match is successful, the FPGA configuration package adapted to the configuration feature information is used to configure the FPGA.
[0064] It should be noted that after the MCU is powered on, it does not process the FLASH, FPGA, and analog switches.
[0065] In addition, after the MCU receives the external trigger signal and data, it extracts the configuration feature information, then reads the FPGA package configuration information of the FLASH in sequence, and matches it with the configuration feature information. If the match is not successful, the MCU continues to wait for the external trigger signal and data; if the match is successful, it executes the subsequent steps.
[0066] After the configuration feature information is successfully matched, the MCU controls PROGRAM_B to generate a low pulse, and then the FPGA's INIT_B generates a low pulse; specifically, the MCU pulls down PROGRAM_B to reset the FPGA, and then the FPGA's INT_B generates a low pulse, and the FPGA enters the configuration mode initialization. After that, the FPGA's INIT_B low pulse is sent, and the FPGA configuration mode is initialized. After the FPGA recognizes the configuration mode, it enters the corresponding configuration mode and the configuration proceeds normally.
[0067] After the FPGA enters configuration mode, the MCU pulls down MUX_EN to turn the analog switch to the connected state, so that the FPGA's CCLK is connected to the MCU's SPI_CLOCK and the FLASH's CK, and the clock signals are synchronized; the MCU starts to read the FLASH data, and the starting address is the starting position in the successfully matched FPGA package configuration information; the MCU's read instruction is sent to the FLASH through SPI_MOSI, and the FLASH's target data is sent to the MCU and the FPGA through SPI_MISO (the MCU does not process the data in any way); when the MCU detects that the number of data sent by the FLASH reaches the length in the successfully matched FPGA package configuration information, the MCU pulls up MUX_EN to disconnect the analog switch, so that the FPGA's CCLK is disconnected from the MCU's SPI_CLOCK and the FLASH's CK. At the same time, the MCU no longer sends read instructions to the FLASH.
[0068] Then, the FPGA pulls up the DONE pin, the FPGA configuration and loading are completed, and the startup is successful.
[0069] Example 3:
[0070] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement the method in Example 2.
[0071] Example 4:
[0072] An embodiment of the present application provides a readable storage medium, which stores a computer program. When the computer program is executed, the method described in Example 2 is implemented.
[0073] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A system for configuring an FPGA, characterized in that: include: MCU, the MCU is used to obtain trigger signals and configure feature information; FLASH, the FLASH is used to store FPGA configuration packages and corresponding configuration information; FPGA, wherein the configuration mode of the FPGA is a slave serial mode; The analog switch, FPGA, and FLASH are connected to the MCU respectively. The MCU is also used to match the configuration feature information with the configuration information in the FLASH. The FPGA is connected to the data transmission line between the MCU and the FPGA through the analog switch. The analog switch is used to control the on and off of the data transmission link between the MCU and the FPGA. The analog switch is controlled to be in an off state under normal conditions. After the MCU successfully matches the configuration feature information, the analog switch is controlled to connect the data transmission link between the MCU and the FPGA, so as to configure the FPGA using a matching FPGA configuration package.
2. The system according to claim 1, characterized in that The FLASH stores a plurality of FPGA configuration packages and corresponding configuration information.
3. The system according to claim 2, characterized in that The FLASH includes a first storage module and a second storage module, the first storage module is used to store the FPGA configuration package, and the second storage module is used to store the configuration information.
4. The system according to claim 2, characterized in that The configuration information includes a pre-stored verification code of the configuration package corresponding to the FPGA configuration package. The MCU is used to read back the data of the FPGA configuration package in the FLASH during the configuration loading process of the FPGA, and generate a configuration package verification code by calculation based on the data, and compare it with the pre-stored verification code of the configuration package corresponding to the FPGA configuration package in the FLASH to verify whether the configuration loading process is successfully completed.
5. The system according to any one of claims 1 to 4, characterized in that: The MCU includes a third storage module, and the third storage module is used to store the MCU program.
6. The system according to claim 5, characterized in that The MCU is also used to monitor the process of configuring the FPGA using a matching FPGA configuration package, so as to control the analog control switch to a disconnected state after the configuration is completed.
7. The system according to claim 5, characterized in that The M0, M1, and M2 pins of the FPGA are pulled up respectively, the DIN pin of the FPGA is connected to the SPI_MISO pin of the MCU and the QD1 pin of the FLASH respectively, the CCLK pin of the FPGA is connected to the D1 pin of the analog switch, the S1A pin of the analog switch is connected to the SPI_CLOCK pin of the MCU and the CK pin of the FLASH respectively, the S1B pin, The pin is grounded, the SEL pin of the analog switch is connected to the general IO port of the MCU, and the SEL pin of the analog switch is pulled down at the same time; the PROGRAM_B pin, INIT pin, and DONE pin of the FPGA are respectively connected to the general IO port of the MCU, and the PROGRAM_B pin, INIT pin, and DONE pin of the FPGA are respectively pulled up; the CK pin of FLASH is connected to the SPI_CLOCK pin of the MCU, the DQ0 pin of FLASH is connected to the SPI_MOSI pin of the MCU, the DQ1 pin of FLASH is connected to the SPI_MOSO pin of the MCU, the WP pin, RESET pin, and CS pin of FLASH are respectively pulled up, and the CS pin of FLASH is connected to the SPI_CS pin of the MCU.
8. A method for configuring an FPGA, characterized in that: The configuration is based on the system according to any one of claims 1 to 7, and specifically includes the following steps: S100. Obtaining trigger signal and configuration feature information; S200. Match the acquired configuration feature information with the configuration information in FLASH. After the match is successful, control the analog switch to connect the data transmission link between the MCU and the FPGA, so as to configure the FPGA using the matching FPGA configuration package.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement the method according to claim 8.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed, the method according to claim 8 is implemented.
Citation Information
Patent Citations
FPGA logical code online updating method and device
CN103617056A
MCU-based FPGA property right protection and remote updating system and method
CN108875318A
A system and method for updating configuration data of an FPGA control unit
CN109086068A
MCU + FPGA control platform suitable for standardized feeder terminal
CN114328365A
Device and method for online upgrading FPGA program of MCU or processor
CN115794181A
Cited By
Chip configuration circuit
CN121092237A
A chip configuration circuit
CN121092237B
