CN108052094B - Expansion card identification method and device and frequency converter - Google Patents

Expansion card identification method and device and frequency converter Download PDF

Info

Publication number
CN108052094B
CN108052094B CN201711386166.1A CN201711386166A CN108052094B CN 108052094 B CN108052094 B CN 108052094B CN 201711386166 A CN201711386166 A CN 201711386166A CN 108052094 B CN108052094 B CN 108052094B
Authority
CN
China
Prior art keywords
expansion card
data
expansion
type
spi interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711386166.1A
Other languages
Chinese (zh)
Other versions
CN108052094A (en
Inventor
张献伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Invt Electric Co Ltd
Original Assignee
Shenzhen Invt Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Invt Electric Co Ltd filed Critical Shenzhen Invt Electric Co Ltd
Priority to CN201711386166.1A priority Critical patent/CN108052094B/en
Publication of CN108052094A publication Critical patent/CN108052094A/en
Application granted granted Critical
Publication of CN108052094B publication Critical patent/CN108052094B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B23/00Testing or monitoring of control systems or parts thereof
    • G05B23/02Electric testing or monitoring
    • G05B23/0205Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults
    • G05B23/0208Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults characterized by the configuration of the monitoring system
    • G05B23/0213Modular or universal configuration of the monitoring system, e.g. monitoring system having modules that may be combined to build monitoring program; monitoring system that can be applied to legacy systems; adaptable monitoring system; using different communication protocols
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/20Pc systems
    • G05B2219/24Pc safety
    • G05B2219/24065Real time diagnostics

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses an expansion card identification method, which is applied between a host and a slave of electronic equipment and comprises the following steps: after the master-slave machine of the electronic equipment successfully operates the handshake, the slave machine determines the expansion type of the expansion card inserted into the corresponding SPI interface according to the expansion card type data in the handshake data frame; calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data of the expansion type; sending the data processed by the protocol to the expansion card through the SPI interface; the type of the expansion card inserted into the SPI interface can be accurately identified through the identification process, and compared with the traditional expansion card insertion method, a user does not need to know which interface corresponds to which expansion card and only needs to insert the expansion card into any interface; the invention also discloses an expansion card identification device, a frequency converter and a computer readable storage medium, which have the beneficial effects.

Description

Expansion card identification method and device and frequency converter
Technical Field
The invention relates to the field of application control of frequency converters, in particular to an expansion card identification method, an expansion card identification device, a frequency converter and a computer readable storage medium.
Background
In the application of the frequency converter, an expansion card is taken as an optional part. The application range of the frequency converter can be expanded through the expansion card, for example, the input and output points of the frequency converter can be increased through the IO expansion card, the frequency converter can be accessed into an industrial field bus system through the communication expansion card, the PLC expansion card can facilitate the programming of a client to control the operation of the frequency converter, and the like.
Currently, an expansion card interface is arranged on a control board of a frequency converter and used for connecting a specific type of expansion card to realize expansion application. A plurality of expansion card interfaces are also arranged on a control panel of the frequency converter, and each interface is used for connecting an expansion card of a corresponding type to realize corresponding expansion application.
However, in the prior art, each expansion card interface can only be inserted with a corresponding type of expansion card, and the flexibility is not high. Therefore, how to solve the problem of low flexibility of the expansion card interface in the prior art is a technical problem to be solved by those skilled in the art.
Disclosure of Invention
The invention aims to provide an expansion card identification method, an expansion card identification device, a frequency converter and a computer readable storage medium, wherein an SPI interface of the expansion card identification method, the device, the frequency converter and the computer readable storage medium can be inserted into various types of expansion cards, and the flexibility is high.
In order to solve the above technical problem, the present invention provides an expansion card identification method, which is applied between a host and a slave of an electronic device, and the method includes:
after the master-slave machine of the electronic equipment successfully performs handshake operation, the slave machine determines the expansion type of an expansion card inserted into a corresponding SPI interface according to expansion card type data in a handshake data frame;
calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data of the expansion type;
and sending the data after the protocol processing to the expansion card through the SPI interface.
Optionally, the determining, according to the type data of the expansion card in the handshake data frame, the expansion type of the expansion card inserted into the corresponding SPI interface includes:
and assigning the expansion card type data in the handshake data frame to an expansion card type variable of the corresponding SPI interface.
Optionally, the invoking an expansion card processing program corresponding to the expansion type to perform protocol processing on the data of the expansion type includes:
receiving a data frame sent by the expansion card through the SPI interface, and storing data in the data frame into a received data structure body corresponding to the expansion type;
and calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data in the received data structure.
Optionally, the receiving the data frame sent by the extension card through the SPI interface and storing the data in the data frame in the received data structure corresponding to the extension type includes:
receiving a data frame issued by the expansion card through the SPI interface, and checking the data frame;
and if the verification is passed, storing the data in the data frame into a received data structure body corresponding to the numerical value of the expansion card type variable, and setting a data receiving completion flag bit of the SPI interface to be in a completion state.
Optionally, the invoking an expansion card processing program corresponding to the expansion type to perform protocol processing on the data in the received data structure includes:
when the data receiving completion flag bit is detected to be in a completion state, calling an expansion card processing program corresponding to the numerical value of the expansion card type variable to perform protocol processing on the data in the received data structure;
and storing the data after the protocol processing is finished into a sending data structure body corresponding to the numerical value of the expansion card type variable, and setting a sending enabling flag bit of the SPI interface to be in an enabling state.
Optionally, the sending the data after the protocol processing to the expansion card through the SPI interface includes:
and when the sending enabling flag bit is detected to be in an enabling state and no data exists in the FIFO of the SPI, assigning the data in the sending data structure body to a sending buffer area of the SPI for sending to the expansion card.
Optionally, the process of the handshake operation includes:
receiving a handshake data frame sent by an expansion card inserted into the SPI interface after being electrified and verifying the handshake data frame; the handshake data frame comprises a frame header, a handshake command, an expansion card type, handshake success times and a frame check sequence;
if the verification is passed, judging whether the handshake success times reach a preset value;
if yes, saving the expansion card type and jumping out of the handshake state to successfully handshake; if not, the head of the frame is transformed to send a response frame to the expansion card.
Optionally, the method further includes:
after the operation of the holding hand is successful, judging whether a data frame sent by the expansion card through the SPI interface is received within a preset timeout period;
and if not, prompting the communication overtime fault of the SPI interface.
Optionally, if the data frame sent by the extension card through the SPI interface is not received within a preset timeout period, invoking a reset pin in the SPI interface to reset the extension card, further including:
clearing data of the expansion card type variable, setting a data receiving completion flag bit to be in an incomplete state, setting a sending enabling flag bit to be in an un-enabled state, and clearing data in the received data structure body and the sent data structure body.
The invention also provides an expansion card identification device, which is applied between a host and a slave of electronic equipment, and comprises:
the expansion card type determining module is used for determining the expansion type of an expansion card inserted into a corresponding SPI interface by the slave according to expansion card type data in a handshake data frame after the master-slave machine of the electronic equipment successfully performs handshake operation;
the protocol processing module is used for calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data of the expansion type;
and the sending module is used for sending the data after the protocol processing to the expansion card through the SPI interface.
The present invention also provides a frequency converter, comprising:
the SPI interface is used for connecting the expansion card and the frequency converter control panel to realize communication between the frequency converter control panel and the expansion card;
the frequency converter control board is used for determining the expansion type of an expansion card inserted into a corresponding SPI interface according to the expansion card type data in a handshake data frame after the master-slave machine handshake operation of the frequency converter is successful; calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data of the expansion type; and sending the data after the protocol processing to the expansion card through the SPI interface.
The present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method for identification of an expansion card as described above.
The invention provides an expansion card identification method, which is applied between a master machine and a slave machine of electronic equipment and comprises the following steps: after the master-slave machine of the electronic equipment successfully performs handshake operation, determining the expansion type of an expansion card inserted into a corresponding SPI interface according to the expansion card type data in a handshake data frame; calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data of the expansion type; and sending the data processed by the protocol to the expansion card through the SPI interface.
Therefore, the method obtains the expansion card type of the SPI interface after the electric handshake operation of the master machine and the slave machine of the electronic equipment is successful. When entering a normal communication process, operating a corresponding expansion card processing program according to the expansion type of the corresponding interface, thereby realizing the function of the expansion card for mutually inserting any SPI interface, namely the SPI interface can be inserted into various types of expansion cards, and improving the flexibility; the invention also provides an expansion card identification device, a frequency converter and a computer readable storage medium, which have the beneficial effects and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of an expansion card identification method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a specific method for identifying an expansion card of a frequency converter according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a frequency converter provided in the embodiment of the present invention, which includes a plurality of SPI interfaces;
fig. 4 is a block diagram of an expansion card identification apparatus according to an embodiment of the present invention;
fig. 5 is a block diagram of a frequency converter according to an embodiment of the present invention.
Detailed Description
The core of the invention is to provide an expansion card identification method, an expansion card identification device, a frequency converter and a computer readable storage medium, wherein the SPI interface of the expansion card identification device can be inserted into various types of expansion cards, and the flexibility is high, so that the defect that each expansion card interface in the prior art can only be inserted into the corresponding type of expansion card is overcome.
In order to make the objects, 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 with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment is suitable for an application between a host and a slave of an electronic device which adopts an SPI communication interface and supports multiple expansion cards, and the slave is used as an execution main body, for example, when the electronic device is a frequency converter, the execution main body of the method is a frequency converter control board (where the frequency converter control board is an SPI slave). In the following embodiments, the frequency converter is taken as an example for explanation, but the electronic device is not limited to the frequency converter. The SPI (Serial Peripheral Interface) bus system is a synchronous Serial Peripheral Interface, and allows the MCU to communicate with various Peripheral devices in a Serial manner to exchange information. The electronic device in this embodiment uses the SPI interface to replace each type of dedicated expansion card interface in the prior art, thereby solving the problem of poor flexibility in the prior art, and how to identify the expansion card inserted into the SPI interface, specifically referring to fig. 1, where fig. 1 is a flowchart of an expansion card identification method provided in an embodiment of the present invention; the execution main body of the embodiment is a control board of the electronic device, that is, a slave (for example, a frequency converter control board), the following steps are executed without limitation to the types of the SPI master and the slave, the sequence of the SPI master and the SPI slave (for example, the expansion card MCU is the SPI master, the frequency converter control board is the SPI slave), and the data frame structure corresponding to the SPI, and a user may set and modify the SPI according to actual situations. The method can comprise the following steps:
s100, after the master-slave machine of the electronic equipment successfully operates the handshake, the slave machine determines the expansion type of the expansion card inserted into the corresponding SPI interface according to the expansion card type data in the handshake data frame.
Specifically, when the expansion card communicates with the control panel, the expansion card generally needs to be operated after the operation of the holding hand is successful. The present embodiment does not limit the specific process of the handshake operation. Optionally, the process of the handshake operation may include:
receiving a handshake data frame sent by an expansion card inserted into the SPI after being electrified and verifying the handshake data frame; the handshake data frame comprises a frame header, a handshake command, an expansion card type, handshake success times and a frame check sequence;
if the verification is passed, judging whether the handshake success times reach a preset value;
if yes, saving the expansion card type and jumping out of the handshake state to successfully handshake; if not, the head of the frame is transformed to send a response frame to the expansion card.
In general, the handshake data frames all have a uniform format, and this embodiment does not limit the specific content of the uniform format, nor the sequence of each data content included in the handshake data frames. It is generally necessary to include a header (for identifying the start of a frame), a handshake command (for performing a handshake operation), an expansion card type (for identifying the type of the expansion card inserted into the SPI interface, such as a communication expansion card or an IO expansion card), a handshake success number (for defining the number of successful handshakes between the control board and the expansion card), and a frame check sequence (for checking data). Of course, the software version number (used for version adaptation and ensuring the correct execution of the protocol) and other related information can also be contained.
The present embodiment does not limit the value of the specific preset value, and the value can be determined according to the actual requirement of the user. For example, it may be 4 times or 3 times. In this embodiment, the storage of the type of the expansion card may be performed when the final handshake is successful, or may be performed after any previous verification is successful.
Further, if the handshake operation is unsuccessful, the handshake state may be tripped out after a predetermined time delay. The present embodiment does not limit the value of the delay time predetermined time. The user can adjust according to the actual conditions. Therefore, in this embodiment, the handshake success flag bit of the SPI interface may be set to the success state after the handshake operation is successful. The present embodiment does not limit the setting form of the success status, and for example, the handshake success flag bit may be set to 0 or 1 or high level to indicate the success status.
An SPI communication interface is adopted between a frequency converter control panel (DSP) and an expansion card MCU, the expansion card MCU is used as an SPI host, and the frequency converter control panel is used as an SPI slave. And executing the power-on initialization handshake operation:
after power-on, the expansion card on the SPI interface sends a handshake data frame. The handshake data frame has a uniform data structure and can contain relevant information such as a frame header, a handshake command, an expansion card type, a software version number, handshake success times, a frame check sequence and the like. After receiving the handshake data frame sent by the host (e.g., MCU), the frequency converter control board (i.e., SPI slave, e.g., DSP) performs verification, and after the verification is passed, stores the received expansion card type information for identifying different expansion card types, and simultaneously converts the frame header and replies a response frame having the same data structure as the handshake data frame sent by the host. And the expansion card also checks after receiving the response frame, adds 1 to the value corresponding to the successful handshaking time after the checking is successful, and sends the handshaking data frame again. When the expansion card receives the value corresponding to the successful handshake time which is 3, the expansion card finishes handshake after sending once again, and automatically jumps out of the handshake state. And when the frequency converter control panel receives the 4 th successful data frame of handshake, if the verification is successful, the frequency converter control panel automatically jumps out of the handshake state, and if the verification is unsuccessful, the frequency converter control panel automatically jumps out of the handshake state after 20ms delay and enters normal data receiving and transmitting. After the scheme successfully handshakes for 4 times (namely, the handshake operation is successful), the handshake success corresponding to the SPI interface is marked in the flag position 1.
Step S100 executes an expansion card type (i.e., expansion type) acquisition operation after the handshake operation is successful. For example, the expansion card type obtaining operation is executed after the handshake success flag bit corresponding to the SPI interface is detected to be in a success state. For example, the extension type of the extension card inserted into the corresponding SPI interface is determined according to the extension card type data in the handshake data frame stored in the handshake operation. In this embodiment, the definition rule of the expansion card type data is not limited, for example, different expansion card types may be represented by numbers (1 represents an IO expansion card, and 2 represents a communication expansion card); but may be represented by other variable forms.
Further, for obtaining convenience, the stored expansion card type data can be directly assigned to the set variable. This makes it possible to acquire the expansion card type data directly by acquiring the change amount value. That is, optionally, the expansion card type data in the handshake data frame is assigned to the expansion card type variable of the corresponding SPI interface.
For example, step S100 may specifically be: and when judging whether the handshake success flag bit corresponding to the SPI interface is 1, if so, assigning the stored expansion card type data to an expansion card type variable of the SPI interface.
If the SPI interface is successfully operated by handshaking, the control panel enters a normal data communication process. In this process, the expansion card issues a data frame during normal communication, and the control board performs corresponding processing after receiving the data frame, where the specific processing process is from step S110 to step S120.
And S110, calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data of the expansion type.
Specifically, this embodiment invokes an expansion card processing program corresponding to the expansion type of the inserted expansion card identified in the above step to perform protocol processing on the data of the expansion type. The embodiment does not limit the specific content of each type of processing program of the expansion card, and can refer to the processing programs of the existing various types of expansion cards.
Further, the accuracy of the data is ensured when the processing is carried out by using the processing program of the expansion card. Preferably, the invoking of the processing program of the expansion card corresponding to the extension type to perform the protocol processing on the data of the extension type may include:
receiving a data frame sent by an expansion card through an SPI (serial peripheral interface), and storing data in the data frame into a received data structure body corresponding to the expansion type;
in this embodiment, it is not limited to the received data structure, and each type of expansion card has its corresponding received data structure. And after the control board receives the data frame, storing the data frame into a received data structure body corresponding to the extension type. Thereby ensuring the correct subsequent processing of the data frame. And data processing errors caused by different types of expansion card data structure bodies are avoided.
Since the control board receives the data frames one by one, the subsequent operations are performed only after the data frames are completely received. Therefore, in order to enable the subsequent program to process the data in the received data structure in time, the embodiment may set a data reception completion flag bit. When the data reception of one frame of data is completed, the data reception completion flag is set to a completion state, and when the data reception of one frame of data is not completed, the data reception completion flag is set to an uncompleted state. The present embodiment does not limit the setting form of the completion status, and for example, the data reception completion flag bit may be set to 0 or 1 or high level to indicate the completion status.
Further, in order to ensure the accuracy of the received data frame, the received data frame may be checked, and the data frame may be stored only after the check is passed. That is, optionally, receiving the data frame sent by the expansion card through the SPI interface, and storing the data in the data frame in the received data structure corresponding to the expansion type may include:
receiving a data frame issued by the expansion card through the SPI, and checking the data frame;
and if the verification is passed, storing the data in the data frame into a received data structure body corresponding to the numerical value of the expansion card type variable, and setting a data receiving completion flag bit of the SPI interface to be in a completion state.
The following illustrates the specific process of controlling board data reception in the above steps as follows:
if the SPI interface is successfully operated by handshaking, the control panel enters a normal data communication process. In this process, the expansion card issues a data frame during normal communication, the control board checks after receiving the data frame, and after the check is passed, the received data is stored in the received data structure of the corresponding expansion card according to the type of the expansion card into which the SPI interface is inserted, which is obtained in step S100, and the data reception completion flag bit of the SPI interface is set to a completion state, for example, 1.
And calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data in the received data structure.
Specifically, when the control board completes receiving one frame of data, the expansion card processing program corresponding to the expansion type may be called to perform protocol processing on the data in the received data structure.
Since the control board performs the protocol processing on the data frames one by one, the subsequent operations (such as transmission) are performed only after the protocol processing is completed on one frame of data. Therefore, in order to enable the subsequent program to process the data after the protocol processing in time, the embodiment may set a sending enable flag bit. When the protocol processing of one frame of data is finished, the sending enable flag bit is set to be in an enable state, and when the protocol processing of one frame of data is not finished, the sending enable flag bit is set to be in a non-enable state. The present embodiment does not limit the setting form of the enable state, and for example, the transmission enable flag bit may be set to 0 or 1 or a high level to indicate the enable state.
When the previous step has the data reception completion flag bit, optionally, invoking an expansion card processing program corresponding to the expansion type to perform protocol processing on the data in the received data structure may include:
when the data receiving completion flag bit is detected to be in a completion state, calling an expansion card processing program corresponding to the numerical value of the expansion card type variable to perform protocol processing on the data in the received data structure;
and storing the data (namely response frame data) after the protocol processing is finished into a sending data structure body corresponding to the numerical value of the expansion card type variable, and setting a sending enabling flag bit of the SPI interface to be in an enabling state.
The following illustrates a specific process of the above control board receiving data processing:
firstly, the type of the expansion card of the SPI interface is judged, and therefore a corresponding expansion card processing program is called. In the expansion card processing program, if it is detected that the data reception completion flag bit of the SPI interface is set to the completion state, for example, 1, protocol processing of data stored in the received data structure under the expansion card type is started. After the protocol processing is finished, the response frame data is stored in a transmission data structure body corresponding to the expansion card inserted into the SPI interface, and the transmission enabling flag bit of the SPI interface is set to be in an enabling state such as 1.
And S120, sending the data after the protocol processing to the expansion card through the SPI interface.
Specifically, the data after the protocol processing, that is, the response frame data, may be placed in the SPI interface (for example, in a buffer of the SPI interface), and sent to the expansion card by the SPI interface. The present embodiment does not limit the specific transmission form. Further, since the data frames are received frame by frame, the response frame data should be transmitted to the expansion card frame by frame in the order of reception. In order to ensure the reliability of the sequence, data capable of being transmitted can be stored in the FIFO; the FIFO is a (First Input First Output, First in First out queue), which is a conventional sequential execution method, in which an instruction that enters First completes and retires First, and then executes a second instruction.
When the previous step has the transmission enable flag, optionally, the sending the data after the protocol processing to the expansion card through the SPI interface may include:
and when the transmitting enabling flag bit is detected to be in an enabling state and no data exists in the FIFO of the SPI, assigning the data in the transmitting data structure body to a transmitting buffer area of the SPI for transmitting to the expansion card.
The following illustrates a specific process of the control board sending the response frame data as follows:
and if the transmission enabling flag bit of the SPI interface is in an enabling state, such as 1, and no data exists in the transmission FIFO of the SPI interface, assigning the data in the transmission data structure body corresponding to the expansion card inserted into the SPI interface to a transmission buffer area of the SPI interface for transmission.
Specifically, referring to fig. 2, a specific processing flow of the method for identifying the expansion card of the frequency converter is shown.
Based on the technical scheme, the expansion card identification method provided by the embodiment of the invention can accurately identify the type of the expansion card inserted into the SPI interface through the identification process, and compared with the traditional expansion card plugging method, a user does not need to know which interface corresponds to which expansion card, only needs to plug the expansion card into any interface, and the flexibility of the expansion function of the electronic equipment is improved.
In the prior art, if the expansion card interface has a problem, the expansion card cannot be used (for example, if the IO expansion card interface has a fault, the frequency converter does not have the IO expansion function), and the practicability is poor. In order to solve this problem, based on the above embodiment, the number of SPI interfaces provided in this embodiment is at least two, so that when one SPI interface fails, the other SPI interface can also operate. Certainly in order to make the converter can have multiple extended functionality simultaneously, can set up a plurality of SPI interfaces in electronic equipment (for example converter), and can be under the condition that guarantees that each extended functionality all has the SPI interface, additionally set up the redundant SPI interface of predetermined quantity to can improve electronic equipment extended functionality's real-time.
For example, an SPI communication interface is adopted between a frequency converter control panel (such as a DSP) and an expansion card MCU, the expansion card MCU is used as an SPI host, and the frequency converter control panel is used as an SPI slave. The frequency converter control panel in this scheme can be provided with 3 SPI interfaces, for example denominate SPIA, SPIB, SPIC, and the expansion card quantity that can work simultaneously this moment is 3 at most. And may be redundant SPI interfaces for each other. Specifically, referring to fig. 3, fig. 3 is a schematic structural diagram of a frequency converter including a plurality of SPI interfaces.
Based on the technical scheme, in the method for identifying the expansion card, the control board is provided with the plurality of SPI interfaces, so that the various expansion cards can be supported to be mutually inserted into any SPI interface, and the redundancy function is realized. Compared with the traditional expansion card plugging method, the scheme has the advantages that a user does not need to know which interface corresponds to which expansion card, and only needs to plug the expansion card into any interface. In addition, if one interface has problems, the user can insert the needed expansion card into other interfaces, so the invention has high flexibility and practicability.
Based on any of the above embodiments, the present embodiment adds disconnection judgment and processing in a normal communication process, and improves reliability of an extended function of an electronic device (for example, a frequency converter). Preferably, the method may further comprise:
after the handshake operation is successful, judging whether a data frame sent by the expansion card through the SPI interface is received within a preset timeout period;
if not, the communication overtime fault of the SPI interface is prompted.
The present embodiment does not limit the specific value of the preset timeout period. The user can set and modify according to actual requirements. When the electronic device has a plurality of SPI interfaces, a uniform preset timeout period can be set, and of course, a corresponding preset timeout period can be set for each SPI interface. This embodiment is not limited to this.
Specifically, the normal data transceiving process is entered after the handshake operation is successful. In the process, the control board can judge the continuity of the SPI interface data communication, and the host-slave machine communication disconnection (namely the communication between the control board and the expansion card MCU is interrupted) is prevented. The SPI interface communication disconnection overtime time can be set through the related function codes, namely, the preset overtime time is preset, and the default overtime time, namely, the default preset overtime time is 0, namely, communication disconnection overtime judgment is not carried out. If the preset overtime time is set to be a value other than 0, the control panel is in the preset overtime time, and if no data is received, the communication overtime fault of the SPI is reported.
Furthermore, in order to ensure the reliability of communication, the system can be stopped after the communication overtime fault of the SPI interface is prompted.
On the basis of any of the above embodiments, preferably, after the data frame sent by the expansion card through the SPI interface is not received within the preset timeout period, the method may further include:
clearing the data of the expansion card type variable, setting the data receiving completion flag bit to be in an incomplete state, setting the sending enabling flag bit to be in an un-enabled state, and clearing the data in the received data structure body and the sent data structure body.
Specifically, if a communication timeout fault occurs, the control board sets the handshake success flag bit, the expansion card type variable, the data reception completion flag bit, the transmission enable flag bit, and other related information of the SPI interface to an initial state, that is, the handshake success flag bit is set to an unsuccessful state, the data of the expansion card type variable is cleared, the data reception completion flag bit is set to an uncompleted state, and the transmission enable flag bit is set to an unenabled state, in addition to reporting the fault and stopping the communication. And clearing the data stored in the received data structure body and the sent data structure body corresponding to the expansion card inserted into the SPI interface.
On the basis of any of the above embodiments, preferably, after the data frame sent by the expansion card through the SPI interface is not received within the preset timeout period, the method may further include:
and calling a reset pin in the SPI interface to reset the expansion card.
Specifically, the control board resets the expansion card inserted into the SPI interface through a reset pin (e.g., IO pin) of the SPI interface, reinitializes the expansion card, and attempts to re-handshake operation and work.
Based on the technical scheme, the expansion card identification method provided by the embodiment of the invention has the advantages that the control board comprises all supported expansion card processing programs, and the type of the expansion card of the SPI interface is obtained after the operation of the power-on handshake is successful. When entering the normal communication process, the corresponding expansion card processing program (namely the corresponding protocol processing program) is operated according to the type of the expansion card of the corresponding interface, thereby realizing the function of the expansion card for mutually inserting any SPI interface. By providing the disconnection judging and processing function in the normal communication process, the reliability and the accuracy of the extended function are improved.
The following describes an expansion card identification device, a frequency converter, and a computer-readable storage medium according to embodiments of the present invention, and the expansion card identification device, the frequency converter, and the computer-readable storage medium described below may be referred to in correspondence with the expansion card identification method described above.
Referring to fig. 4, fig. 4 is a block diagram of an expansion card identification apparatus according to an embodiment of the present invention; the device is applied between a host and a slave of the electronic equipment, and can comprise:
the expansion card type determining module 100 is configured to, after a handshake operation of a master/slave machine of the electronic device is successful, determine, by the slave machine, an expansion type of an expansion card inserted into a corresponding SPI interface according to expansion card type data in a handshake data frame;
the protocol processing module 200 is configured to invoke an expansion card processing program corresponding to the expansion type to perform protocol processing on the data of the expansion type;
the sending module 300 is configured to send the data after the protocol processing to the expansion card through the SPI interface.
Based on the above embodiment, the apparatus may further include:
the disconnection judging and processing module is used for judging whether a data frame sent by the expansion card through the SPI interface is received within a preset timeout period after the operation of the holding hand is successful; and if not, prompting the communication overtime fault of the SPI interface.
It should be noted that, based on any of the above embodiments, the apparatus may be implemented based on a programmable logic device, where the programmable logic device includes an FPGA, a CPLD, a single chip, and the like.
Referring to fig. 5, fig. 5 is a block diagram of a frequency converter according to an embodiment of the present invention; the frequency converter may include:
the SPI interface 500 is used for connecting the expansion card and the frequency converter control panel and realizing communication between the frequency converter control panel and the expansion card;
the frequency converter control board 600 is used for determining the expansion type of the expansion card inserted into the corresponding SPI interface according to the expansion card type data in the handshake data frame after the master-slave handshake operation of the frequency converter is successful; calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data in the received data structure; and sending the data processed by the protocol to the expansion card through the SPI interface.
Based on the above embodiment, the number of SPI interfaces is at least 2. Thereby achieving redundancy.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for identifying an expansion card according to any of the above embodiments are implemented.
Wherein the computer-readable storage medium comprises: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The method, the device, the frequency converter and the computer readable storage medium for identifying the expansion card provided by the invention are described in detail above. The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.

Claims (12)

1. An expansion card identification method is applied between a host and a slave of electronic equipment, and the method comprises the following steps:
after the master-slave machine of the electronic equipment successfully performs handshake operation, the slave machine determines the expansion type of an expansion card inserted into a corresponding SPI interface according to expansion card type data in a handshake data frame;
calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data of the expansion type;
and sending the data after the protocol processing to the expansion card through the SPI interface.
2. The method according to claim 1, wherein the determining the extension type of the extension card inserted into the corresponding SPI interface according to the extension card type data in the handshake data frame includes:
and assigning the expansion card type data in the handshake data frame to an expansion card type variable of the corresponding SPI interface.
3. The method according to claim 1, wherein the invoking of the extended card handler corresponding to the extended type performs protocol processing on the data of the extended type, and includes:
receiving a data frame sent by the expansion card through the SPI interface, and storing data in the data frame into a received data structure body corresponding to the expansion type;
and calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data in the received data structure.
4. The method according to claim 3, wherein the receiving the data frame sent by the extension card through the SPI interface and storing the data in the data frame in a received data structure corresponding to the extension type includes:
receiving a data frame issued by the expansion card through the SPI interface, and checking the data frame;
and if the verification is passed, storing the data in the data frame into a received data structure body corresponding to the numerical value of the expansion card type variable, and setting a data receiving completion flag bit of the SPI interface to be in a completion state.
5. The method according to claim 4, wherein the invoking of the expansion card handler corresponding to the expansion type performs protocol processing on the data in the received data structure, and includes:
when the data receiving completion flag bit is detected to be in a completion state, calling an expansion card processing program corresponding to the numerical value of the expansion card type variable to perform protocol processing on the data in the received data structure;
and storing the data after the protocol processing is finished into a sending data structure body corresponding to the numerical value of the expansion card type variable, and setting a sending enabling flag bit of the SPI interface to be in an enabling state.
6. The method of claim 5, wherein sending the protocol-processed data to the expansion card through the SPI interface comprises:
and when the sending enabling flag bit is detected to be in an enabling state and no data exists in the FIFO of the SPI, assigning the data in the sending data structure body to a sending buffer area of the SPI for sending to the expansion card.
7. The method of claim 6, wherein the process of handshaking operation comprises:
receiving a handshake data frame sent by an expansion card inserted into the SPI interface after being electrified and verifying the handshake data frame; the handshake data frame comprises a frame header, a handshake command, an expansion card type, handshake success times and a frame check sequence;
if the verification is passed, judging whether the handshake success times reach a preset value;
if yes, saving the expansion card type and jumping out of the handshake state to successfully handshake; if not, the head of the frame is transformed to send a response frame to the expansion card.
8. The method of any one of claims 1-7, further comprising:
after the operation of the holding hand is successful, judging whether a data frame sent by the expansion card through the SPI interface is received within a preset timeout period;
and if not, prompting the communication overtime fault of the SPI interface.
9. The method of claim 8, wherein invoking a reset pin in the SPI interface to reset the expansion card if a data frame sent by the expansion card through the SPI interface is not received within a preset timeout period, further comprising:
clearing data of the expansion card type variable, setting a data receiving completion flag bit to be in an incomplete state, setting a sending enabling flag bit to be in an un-enabled state, and clearing data in the received data structure body and the sent data structure body.
10. An expansion card recognition device, applied between a master and a slave of an electronic apparatus, comprising:
the expansion card type determining module is used for determining the expansion type of an expansion card inserted into a corresponding SPI interface according to expansion card type data in a handshake data frame by the slave machine after the master machine and the slave machine of the electronic equipment successfully operate;
the protocol processing module is used for calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data of the expansion type;
and the sending module is used for sending the data after the protocol processing to the expansion card through the SPI interface.
11. A frequency converter, comprising:
the SPI interface is used for connecting the expansion card and the frequency converter control panel to realize communication between the frequency converter control panel and the expansion card;
the frequency converter control board is used for determining the expansion type of an expansion card inserted into a corresponding SPI interface according to the expansion card type data in a handshake data frame after the master-slave machine handshake operation of the frequency converter is successful; calling an expansion card processing program corresponding to the expansion type to perform protocol processing on the data of the expansion type; and sending the data after the protocol processing to the expansion card through the SPI interface.
12. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the expansion card identification method according to any one of claims 1 to 9.
CN201711386166.1A 2017-12-20 2017-12-20 Expansion card identification method and device and frequency converter Active CN108052094B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711386166.1A CN108052094B (en) 2017-12-20 2017-12-20 Expansion card identification method and device and frequency converter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711386166.1A CN108052094B (en) 2017-12-20 2017-12-20 Expansion card identification method and device and frequency converter

Publications (2)

Publication Number Publication Date
CN108052094A CN108052094A (en) 2018-05-18
CN108052094B true CN108052094B (en) 2021-01-15

Family

ID=62130338

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711386166.1A Active CN108052094B (en) 2017-12-20 2017-12-20 Expansion card identification method and device and frequency converter

Country Status (1)

Country Link
CN (1) CN108052094B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109164874B (en) * 2018-08-03 2021-09-14 联想(北京)有限公司 Information processing method and electronic equipment
CN110247936B (en) * 2019-08-01 2022-07-05 深圳市英威腾电气股份有限公司 Communication protocol conversion card and communication protocol conversion system
CN111983946A (en) * 2020-07-03 2020-11-24 杭州格米环境科技有限公司 Dehumidifier control panel, dehumidifier and use method of dehumidifier
CN114488871A (en) * 2021-12-23 2022-05-13 深圳市海浦蒙特科技有限公司 Control method, frequency converter and computer readable storage medium
CN114490476A (en) * 2021-12-30 2022-05-13 深圳市英威腾电气股份有限公司 Control assembly, method for automatically compatible with expansion card and embedded system
CN114780029B (en) * 2022-04-12 2023-05-09 荣耀终端有限公司 Device identification method and related device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5568610A (en) * 1995-05-15 1996-10-22 Dell Usa, L.P. Method and apparatus for detecting the insertion or removal of expansion cards using capacitive sensing
CN203276112U (en) * 2013-04-24 2013-11-06 索肯和平(上海)电气有限公司 Frequency converter with multipath data bus expansion port
CN204667101U (en) * 2015-05-28 2015-09-23 南车株洲电力机车研究所有限公司 A kind of frequency converter controller
CN105652852B (en) * 2015-12-21 2018-08-24 长沙奥托自动化技术有限公司 A kind of Inspection and monitoring system of high voltage transducer power unit and its mainboard
CN206323394U (en) * 2016-12-31 2017-07-11 重庆川仪自动化股份有限公司 Intelligent bus switching controller
CN106603363A (en) * 2016-12-31 2017-04-26 重庆川仪自动化股份有限公司 Intelligent bus switching controller

Also Published As

Publication number Publication date
CN108052094A (en) 2018-05-18

Similar Documents

Publication Publication Date Title
CN108052094B (en) Expansion card identification method and device and frequency converter
CN113364747B (en) Debugging method, device and system and data set generation method and device
CN111203869B (en) Robot system maintenance method and device, robot and readable storage medium
CN112699695B (en) RFID reader-writer software verification device and method and electronic equipment
CN114238127A (en) Interface test method, device, equipment and storage medium
CN110789580A (en) Communication detection method, equipment and system of train network control system
CN110990116B (en) Method, device and system for transmitting data between intelligent network card and virtual machine
CN112506675A (en) Task completion system
CN107885674B (en) Bluetooth device simulator, working method thereof and Bluetooth device operating system
US20030154288A1 (en) Server-client system and data transfer method used in the same system
CN106598599B (en) A kind of execution method and apparatus of program
CN102591839B (en) USB (universal serial bus) multiprotocol self-adaptive method
CN113556210B (en) Upper computer and method for establishing communication connection
CN115454896A (en) SMBUS-based SSD MCTP control message verification method and device, computer equipment and storage medium
DE102004050039B4 (en) Integrated circuit card, operating method and card system
CN113721994A (en) PCIe enumeration method, system, device and storage medium
CN112615739A (en) Method and system for adapting OCP3.0 network card in multi-host application environment
CN111722858A (en) Online upgrading method and terminal equipment
CN112241279A (en) Self-adaptive electronic control unit software upgrading method and system and automobile
CN113660057B (en) Method and device for transmitting monitored data
CN111083563B (en) Debugging method and device of television UI (user interface) control, television and storage medium
CN117632812A (en) Execution method of host command and related components
JP2000341386A (en) Communication terminal test device
CN115987449A (en) Real-time data transmission method, device and equipment and readable storage medium
CN117573447A (en) SAS bus fault injection method, device, equipment, medium and fault injection chip

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant