Interaction method and device for converting internal bus into SPI interface protocol and related equipment

By receiving ready commands of development tools in the SPI host and sending corresponding commands to the SPI slave, controlling the slave to perform data reading and configuration operations, the problem of low interaction efficiency between the SPI host and the slave is solved, and more efficient Data transmission.

CN119025462AInactive Publication Date: 2024-11-26HANGZHOU LIWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411018034.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-11-26
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The interaction efficiency between the SPI host and the SPI slave is low, resulting in low communication efficiency.

Method used

After receiving the ready command sent by the development tool, the module reading information command is sent to the SPI slave, the module information, process data length and configuration data length sent by the slave are received and processed, and the slave is controlled to perform related reading and configuration operations. Improve interaction efficiency.

Benefits of technology

Improve the interaction efficiency between the SPI host and the SPI slave, ensuring the accuracy and efficiency of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025462A_ABST
    Figure CN119025462A_ABST
Patent Text Reader

Abstract

The invention provides an interaction method and device for converting an internal bus into an SPI interface protocol and related equipment, and the method comprises the steps: receiving a ready command sent by a development tool based on a first communication protocol, the ready command being used for indicating that the development tool is powered on; under the condition that the first pin is at the high level, a module information reading command is sent to an SPI slave machine, and the module information reading command is used for notifying the SPI slave machine to read module type data; and receiving module information, process data length and configuration data length sent by the SPI slave based on the module information reading command. According to the embodiment of the invention, after the SPI host receives the ready command sent by the development tool based on the first communication protocol, the SPI slave is controlled to perform the command of the related reading module, and the related reading result is received, so that the interaction efficiency between the SPI host and the SPI slave is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of communications, and in particular to an interactive method, device and related equipment for converting an internal bus into an SPI interface protocol. Background Art

[0002] SPI (Serial Peripheral Interface) is a serial communication protocol, usually used for communication between digital integrated circuits. In SPI communication, there is a master device (master) and one or more slave devices (slave). The master device is responsible for controlling the timing of communication and data transmission, while the slave device passively responds to the instructions of the master device. In the prior art, due to connection problems, there is a problem of low interaction efficiency between the SPI master and the SPI slave. Summary of the invention

[0003] The embodiments of the present application provide an interaction method, device and related equipment for converting an internal bus into an SPI interface protocol, so as to solve the problem of low interaction efficiency between an SPI host and an SPI slave in the prior art.

[0004] To solve the above problems, this application is implemented as follows: In a first aspect, an embodiment of the present application provides an interactive method for converting an internal bus to an SPI interface protocol, which is applied to an SPI host, and the method includes: Receiving a ready command sent by a development tool based on a first communication protocol, wherein the ready command is used to indicate that the development tool has been powered on; When the first pin is at a high level, a module information read command is sent to the SPI slave, where the module information read command is used to notify the SPI slave to read module type data; Receive the module information, process data length and configuration data length sent by the SPI slave based on the read module information command.

[0005] Optionally, when the first pin is at a high level, before sending a read module information command to the SPI slave, the method further includes: Waiting for the first pin to be at a high level, sending a notification read module information command to the SPI slave, wherein the notification read module information command is used to notify the SPI slave to start reading the module type data; Receive the reply data frame sent by the SPI slave.

[0006] Optionally, after receiving the module information, process data length, and configuration data length sent by the SPI slave based on the read module information command, the method further includes: Receiving a configuration command sent by a development tool based on the first communication protocol, wherein the configuration command is used to instruct the SPI slave to prepare to write configuration data; Wait for the first pin to be at a high level, and send a module configuration data command to the SPI slave, where the module configuration data command is used to send configuration data to the SPI slave.

[0007] Optionally, after waiting for the first pin to be at a high level and sending a module configuration data command to the SPI slave, the method further includes: When the first pin is at a high level, the read module receives the configuration data status sent to the SPI slave, and reads the configuration status sent by the SPI slave; If the configuration is read successfully, a receive data valid command is sent to the development tool based on the first communication protocol; if the configuration is read unsuccessfully, a receive data invalid command is sent to the development tool based on the first communication protocol.

[0008] Optionally, after receiving the module information, process data length, and configuration data length sent by the SPI slave based on the read module information command, the method further includes: Receiving a read / write command sent by a development tool based on the first communication protocol, wherein the read / write command is used to instruct the SPI slave to prepare to read / write data; Wait for the first pin to be at a high level, and send a command to the SPI slave machine to notify the SPI slave machine to start reading and writing process data, where the command is used to notify the SPI slave machine to start reading input data.

[0009] Optionally, after waiting for the first pin to be at a high level and sending a command to the SPI slave to notify the start of reading and writing process data, the method further includes: When the first pin is at a high level, a read data status command is sent to the SPI slave, wherein the read data status command is used to determine whether the SPI slave receives output data correctly; When the SPI slave correctly receives the output data, a valid read / write data command is sent to the development tool based on the first communication protocol; when the SPI slave incorrectly receives the output data, an invalid read / write data command is sent to the development tool based on the first communication protocol.

[0010] In a second aspect, an embodiment of the present application further provides an interactive device for converting an internal bus into an SPI interface protocol, which is applied to an SPI host, and the device includes: A receiving module, used for receiving a ready command sent by a development tool based on a first communication protocol, wherein the ready command is used for indicating that the development tool has been powered on; A sending module, used for sending a module information read command to the SPI slave when the first pin is at a high level, wherein the module information read command is used for notifying the SPI slave to read module type data; The receiving module is also used to receive the module information, process data length and configuration data length sent by the SPI slave based on the read module information command.

[0011] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a transceiver, a memory, a processor, and a program stored in the memory and executable on the processor; the processor is used to read the program in the memory to implement the steps of the method described in the first aspect above.

[0012] In a fourth aspect, an embodiment of the present application further provides a readable storage medium for storing a program, which, when executed by a processor, implements the steps in the method described in the first aspect above.

[0013] In a fifth aspect, an embodiment of the present application further provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps in the method described in the first aspect.

[0014] The present application provides an interactive method, device and related equipment for converting an internal bus into an SPI interface protocol, the method comprising: receiving a ready command sent by a development tool based on a first communication protocol, the ready command being used to indicate that the development tool has been powered on; when a first pin is at a high level, sending a read module information command to an SPI slave, the read module information command being used to notify the SPI slave to read module type data; receiving module information, process data length and configuration data length sent by the SPI slave based on the read module information command. In the embodiment of the present application, after the SPI host receives the ready command sent by the development tool based on the first communication protocol, the SPI slave is controlled to perform commands for related read modules and receive related read results, thereby improving the interaction efficiency between the SPI host and the SPI slave. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0016] Figure 1 It is a flow chart of an interactive method for converting an internal bus into an SPI interface protocol provided in an embodiment of the present application; Figure 2 It is a structural diagram of the SPI communication system provided in an embodiment of the present application; Figure 3 It is a structural schematic diagram of an interactive device for converting an internal bus into an SPI interface protocol provided in an embodiment of the present application; Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0017] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0018] The terms "first", "second" etc. in the embodiments of the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. In addition, the terms "include" and "have" and any variation thereof are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units need not be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment. In addition, "and / or" is used in the present application to represent at least one of connected objects, such as A and / or B and / or C, representing the inclusion of separate A, separate B, separate C, and A and B all exist, B and C all exist, A and C all exist, and 7 situations that A, B and C all exist.

[0019] See also Figure 1 , Figure 1 1 is a flow chart of an interactive method for converting an internal bus into an SPI interface protocol provided by an embodiment of the present application. Figure 1 As shown, the interactive method applied to the SPI host, where the internal bus is converted into the SPI interface protocol, may include the following steps: Step 101: Receive a ready command sent by a development tool based on a first communication protocol, where the ready command is used to indicate that the development tool has been powered on.

[0020] In this embodiment, if Figure 2 As shown, Figure 2The figure is a schematic diagram of the SPI communication system, in which the master device controls the timing of data transmission through the clock signal (SCLK) and sends and receives data through two data lines (MOSI: Master Out Slave In and MISO: Master In Slave Out). The working mode of SPI communication is as follows: the master device selects a slave device for communication through the chip select line. The master device drives the data transmission through the clock signal, sends the data to the MOSI line of the slave device, and the slave device sends the data back to the master device through the MISO line. After receiving the data, the slave device can perform the corresponding operation and send the result back to the master device.

[0021] The development tool is CodeSys, which is a development tool for industrial automation that provides a programming environment for PLCs (Programmable Logic Controllers) and other automation devices. CodeSys allows engineers to use standardized programming languages ​​(such as IEC 61131-3) to develop control logic, monitor processes, and perform other automation tasks. CodeSys also provides a wealth of libraries and function modules to help engineers quickly develop complex automation systems.

[0022] The first communication protocol is RPMsg. RPMsg (Remote Processor Messaging) is a protocol used for communication in multi-core systems. RPMsg is often used in embedded systems, especially in systems with multiple processor cores (such as ARM Cortex-A and Cortex-M). RPMsg allows low-latency and high-efficiency communication between different processor cores, thereby achieving the function of collaborative work and data exchange in multi-core systems.

[0023] Specifically, when the system is powered on and codesys is ready, rpmsg sends the ready command CMD_Notice_CodeSysReady. The SPI host is powered on and waits for CodeSys to send a ready notice. After receiving it, rpmsg replies with CMD_Notice_CodeSysReady. After the SPI slave module is initialized, it prepares the data length and CMD_Wait reply data frame, and immediately pulls up IO_Ready_ON after starting TX-DMA to notify the host that the module initialization is complete and wait for the host to read the module information.

[0024] Step 102: When the first pin is at a high level, a read module information command is sent to the SPI slave, where the read module information command is used to notify the SPI slave to read module type data.

[0025] In this embodiment, the first pin is IO_Ready_State, and the command to read module information is CMD_ReadModuleInfor. Specifically, the SPI host determines that "IO_Ready_State is high level", and the SPI host sends "CMD_ReadModuleInfor". After the SPI host receives the module information, if the M4F side already has module information, it will reply with CMD_ReportModuleInfo module information. If the M4F side does not have module information, it will reply that CMD_ReportModuleInfo data is empty. If CodeSys needs to read module information, rpmsg sends CMD_ReportModuleInfo to read module information. Every time CodeSys reads module information, it is recommended to update related operations and re-issue configuration data.

[0026] Step 103: Receive the module information, process data length, and configuration data length sent by the SPI slave based on the read module information command.

[0027] In this embodiment, for the SPI slave, the data frame RX-DMA completion interrupt immediately pulls down IO_Ready_ON, the SPI slave replies with module information, process data length and configuration data length, prepares the data length and CMD_Wait reply data frame, and immediately pulls up IO_Ready_ON after starting TX-DMA.

[0028] The present application provides an interactive method for converting an internal bus to an SPI interface protocol, the method comprising: receiving a ready command sent by a development tool based on a first communication protocol, the ready command being used to indicate that the development tool has been powered on; when a first pin is at a high level, sending a read module information command to an SPI slave, the read module information command being used to notify the SPI slave to read module type data; receiving module information, process data length, and configuration data length sent by the SPI slave based on the read module information command. In an embodiment of the present application, after the SPI host receives the ready command sent by the development tool based on the first communication protocol, the SPI slave is controlled to perform commands for related read modules, and related read results are received, thereby improving the interaction efficiency between the SPI host and the SPI slave.

[0029] Optionally, when the first pin is at a high level, before sending a read module information command to the SPI slave, the method further includes: Waiting for the first pin to be at a high level, sending a notification read module information command to the SPI slave, wherein the notification read module information command is used to notify the SPI slave to start reading the module type data; Receive the reply data frame sent by the SPI slave.

[0030] In this embodiment, the SPI host queries and waits for "IO_Ready_State to be high", and the SPI host sends "CMD_Notice_ReadModuleInfor" to notify the slave to start reading the module type data. The SPI host receives and prepares the CMD_Wait reply data frame. For the SPI slave, the data frame RX-DMA completion interrupt immediately pulls down IO_Ready_ON, and the SPI slave receives the "CMD_Notice_ReadModuleInfor" instruction, prepares the data length and module information data, and immediately pulls up IO_Ready_ON after starting TX-DMA.

[0031] Optionally, after receiving the module information, process data length, and configuration data length sent by the SPI slave based on the read module information command, the method further includes: Receiving a configuration command sent by a development tool based on the first communication protocol, wherein the configuration command is used to instruct the SPI slave to prepare to write configuration data; Wait for the first pin to be at a high level, and send a module configuration data command to the SPI slave, where the module configuration data command is used to send configuration data to the SPI slave.

[0032] In this embodiment, if CodeSys needs to configure the module, rpmsg sends the configuration data to notify the read module information command CMD_Issue_ConfigData. The SPI host waits for CodeSys's rpmsg to send the configuration data, and waits for "IO_Ready_State to be high". The SPI host sends "CMD_Notice_WriteConFigData" to notify the slave to start writing the configuration data. The SPI host receives and prepares to reply to the CMD_Wait data frame. For the SPI slave, the data frame RX-DMA completion interrupt immediately pulls down IO_Ready_ON. The SPI slave receives the "CMD_Notice_WriteConFigData" instruction, prepares to receive the length and data, and immediately pulls up IO_Ready_ON after starting TX-DMA. The SPI host waits for "IO_Ready_State to be high". The SPI host sends "CMD_WriteConFigData" to send the configuration data to the slave. For the SPI slave, the data frame RX-DMA completion interrupt immediately pulls down IO_Ready_ON. The SPI slave receives the configuration data, and after successful verification, starts the internal bus to send the configuration data to the card. It tries several times until the card configuration is successful (it may also fail). According to the actual configuration, it gets CMD_DataVaild / CMD_DataInVaild, prepares to receive the length and data, and immediately pulls up IO_Ready_ON after starting TX-DMA.

[0033] Optionally, after waiting for the first pin to be at a high level and sending a module configuration data command to the SPI slave, the method further includes: When the first pin is at a high level, the read module receives the configuration data status sent to the SPI slave, and reads the configuration status sent by the SPI slave; If the configuration is read successfully, a receive data valid command is sent to the development tool based on the first communication protocol; if the configuration is read unsuccessfully, a receive data invalid command is sent to the development tool based on the first communication protocol.

[0034] In this embodiment, the SPI host waits for "IO_Ready_State to be high", the SPI host sends "CMD_ReadConFigDataState", reads the slave configuration, and returns CMD_DataVaild to indicate a successful configuration. rpmsg replies CMD_Issue_ConfigData to indicate a successful configuration. Returning CMD_DataInVaild indicates a configuration failure, and rpmsg replies CMD_Issue_ConfigData to indicate a configuration error. For the SPI slave, the data frame RX-DMA completion interrupt immediately pulls down IO_Ready_ON. The SPI slave receives the "CMD_ReadConFigDataState" instruction, prepares the data length and CMD_Wait reply data frame, and immediately pulls up IO_Ready_ON after starting TX-DMA. When a configuration fails, CodeSys can check the correctness of the configuration data and continue to initiate the configuration.

[0035] Optionally, after receiving the module information, process data length, and configuration data length sent by the SPI slave based on the read module information command, the method further includes: Receiving a read / write command sent by a development tool based on the first communication protocol, wherein the read / write command is used to instruct the SPI slave to prepare to read / write data; Wait for the first pin to be at a high level, and send a command to the SPI slave machine to notify the SPI slave machine to start reading and writing process data, where the command is used to notify the SPI slave machine to start reading input data.

[0036] In this embodiment, if CodeSys needs to read and write module data and is ready to output data, rpmsg sends process data read and write CMD_RwProData. The SPI host waits for CodeSys's rpmsg to send new process data (output data). If the internal bus is not in the process data read and write step (has not been successfully configured), rpmsg replies that CMD_RwProData is not ready. If the internal bus is ready, it waits for "IO_Ready_State to be high". The SPI host sends "CMD_Notice_ReadWriteProData" to notify the slave to start reading input data. The SPI host receives the CMD_Wait reply data frame. For the SPI slave, the data frame RX-DMA completion interrupt immediately pulls down IO_Ready_ON. The SPI slave receives the "CMD_Notice_ReadWriteProData" instruction, prepares the data length and the data to be read (including module communication status and input data), and immediately pulls up IO_Ready_ON after starting TX-DMA. The SPI host waits for "IO_Ready_State to be high", and the SPI host sends "CMD_ReadWriteProData", that is, sends output data and reads back data (including module communication status and input data). The SPI host verifies the input data read, and if the verification passes, the read data is placed in the corresponding buffer. For the SPI slave, the data frame RX-DMA completion interrupt immediately pulls down IO_Ready_ON, and the SPI slave replies with data (including module communication status and input data). The output data content is received and verified, and CMD_DataVaild / CMD_DataInVail is obtained, and the length and data are ready to be received. After starting TX-DMA, IO_Ready_ON is immediately pulled up to start an internal bus interaction.

[0037] Optionally, after waiting for the first pin to be at a high level and sending a command to the SPI slave to notify the start of reading and writing process data, the method further includes: When the first pin is at a high level, a read data status command is sent to the SPI slave, wherein the read data status command is used to determine whether the SPI slave receives output data correctly; When the SPI slave correctly receives the output data, a valid read / write data command is sent to the development tool based on the first communication protocol; when the SPI slave incorrectly receives the output data, an invalid read / write data command is sent to the development tool based on the first communication protocol.

[0038] In this embodiment, the SPI host waits for "IO_Ready_State to be high level", and the SPI host sends "CMD_ReadWriteProDataState" to read whether the slave receives the output data correctly. The SPI host replies to the CMD_RwProData process data through rpmsg according to the read-back situation. If an error occurs, Rpmsg replies to the corresponding error. For the SPI slave, the data frame RX-DMA completion interrupt immediately pulls down IO_Ready_ON. The SPI slave returns CMD_DataVaild / CMD_DataInVaild during the SPI process, prepares the data length and CMD_Wait reply data frame, and immediately pulls up IO_Ready_ON after starting TX-DMA.

[0039] It should be noted that during the reading and writing process, the reading and writing operation is initiated by CodeSys. CodeSys initiates a reading and writing operation: first send the output data instruction to M4F, M4F initiates SPI communication, reads back the module input data, writes the output data to AT32, and then transmits the input data back to CodeSys. The reading and writing of process data appear in pairs, first write and then read. Once CodeSys stops the reading and writing operation, M4F will also stop SPI, then AT32 will also stop the internal bus. If the module does not interact with the internal bus for a long time, the output will be set to the configured preset output.

[0040] During operation, CodeSys not only needs to read and write process data periodically, but also needs to configure the module. After a certain reading and writing of data is completed, if the module needs to be configured, the configuration data is prepared and sent through step B1. The full amount of configuration data must be sent, and the configuration data of all modules must be sent.

[0041] In the embodiment of the present application, after the SPI host receives the ready command sent by the development tool based on the first communication protocol, the SPI slave is controlled to execute the command of the relevant reading module and receive the relevant reading result, thereby improving the interaction efficiency between the SPI host and the SPI slave.

[0042] See also Figure 3 , Figure 3 1 is a structural diagram of an interactive device for converting an internal bus into an SPI interface protocol provided in an embodiment of the present application. Figure 3 As shown, the interactive device 300 for converting the internal bus into the SPI interface protocol includes: The receiving module 310 is used to receive a ready command sent by the development tool based on the first communication protocol, wherein the ready command is used to indicate that the development tool has been powered on; A sending module 320, configured to send a read module information command to the SPI slave when the first pin is at a high level, wherein the read module information command is used to notify the SPI slave to read module type data; The receiving module 310 is further configured to receive the module information, process data length and configuration data length sent by the SPI slave based on the read module information command.

[0043] Optionally, when the first pin is at a high level, before sending a read module information command to the SPI slave, the method further includes: Waiting for the first pin to be at a high level, sending a notification read module information command to the SPI slave, wherein the notification read module information command is used to notify the SPI slave to start reading the module type data; Receive the reply data frame sent by the SPI slave.

[0044] Optionally, after receiving the module information, process data length, and configuration data length sent by the SPI slave based on the read module information command, the method further includes: Receiving a configuration command sent by a development tool based on the first communication protocol, wherein the configuration command is used to instruct the SPI slave to prepare to write configuration data; Wait for the first pin to be at a high level, and send a module configuration data command to the SPI slave, where the module configuration data command is used to send configuration data to the SPI slave.

[0045] Optionally, after waiting for the first pin to be at a high level and sending a module configuration data command to the SPI slave, the method further includes: When the first pin is at a high level, the read module receives the configuration data status sent to the SPI slave, and reads the configuration status sent by the SPI slave; If the configuration is read successfully, a receive data valid command is sent to the development tool based on the first communication protocol; if the configuration is read unsuccessfully, a receive data invalid command is sent to the development tool based on the first communication protocol.

[0046] Optionally, after receiving the module information, process data length, and configuration data length sent by the SPI slave based on the read module information command, the method further includes: Receiving a read / write command sent by a development tool based on the first communication protocol, wherein the read / write command is used to instruct the SPI slave to prepare to read / write data; Wait for the first pin to be at a high level, and send a command to the SPI slave machine to notify the SPI slave machine to start reading and writing process data, where the command is used to notify the SPI slave machine to start reading input data.

[0047] Optionally, after waiting for the first pin to be at a high level and sending a command to the SPI slave to notify the start of reading and writing process data, the method further includes: When the first pin is at a high level, a read data status command is sent to the SPI slave, wherein the read data status command is used to determine whether the SPI slave receives output data correctly; When the SPI slave correctly receives the output data, a valid read / write data command is sent to the development tool based on the first communication protocol; when the SPI slave incorrectly receives the output data, an invalid read / write data command is sent to the development tool based on the first communication protocol.

[0048] In the embodiment of the present application, after the SPI host receives the ready command sent by the development tool based on the first communication protocol, the SPI slave is controlled to execute the command of the relevant reading module and receive the relevant reading result, thereby improving the interaction efficiency between the SPI host and the SPI slave.

[0049] The present application also provides an electronic device. Figure 4 , the electronic device may include a processor 401, a memory 402, and a program 4021 stored in the memory 402 and executable on the processor 401.

[0050] When the program 4021 is executed by the processor 401, it can achieve Figure 1 Any step in the corresponding method embodiment: Receiving a ready command sent by a development tool based on a first communication protocol, wherein the ready command is used to indicate that the development tool has been powered on; When the first pin is at a high level, a module information read command is sent to the SPI slave, where the module information read command is used to notify the SPI slave to read module type data; Receive the module information, process data length and configuration data length sent by the SPI slave based on the read module information command.

[0051] Optionally, when the first pin is at a high level, before sending a read module information command to the SPI slave, the method further includes: Waiting for the first pin to be at a high level, sending a notification read module information command to the SPI slave, wherein the notification read module information command is used to notify the SPI slave to start reading the module type data; Receive the reply data frame sent by the SPI slave.

[0052] Optionally, after receiving the module information, process data length, and configuration data length sent by the SPI slave based on the read module information command, the method further includes: Receiving a configuration command sent by a development tool based on the first communication protocol, wherein the configuration command is used to instruct the SPI slave to prepare to write configuration data; Wait for the first pin to be at a high level, and send a module configuration data command to the SPI slave, where the module configuration data command is used to send configuration data to the SPI slave.

[0053] Optionally, after waiting for the first pin to be at a high level and sending a module configuration data command to the SPI slave, the method further includes: When the first pin is at a high level, the read module receives the configuration data status sent to the SPI slave, and reads the configuration status sent by the SPI slave; If the configuration is read successfully, a receive data valid command is sent to the development tool based on the first communication protocol; if the configuration is read unsuccessfully, a receive data invalid command is sent to the development tool based on the first communication protocol.

[0054] Optionally, after receiving the module information, process data length, and configuration data length sent by the SPI slave based on the read module information command, the method further includes: Receiving a read / write command sent by a development tool based on the first communication protocol, wherein the read / write command is used to instruct the SPI slave to prepare to read / write data; Wait for the first pin to be at a high level, and send a command to the SPI slave machine to notify the SPI slave machine to start reading and writing process data, where the command is used to notify the SPI slave machine to start reading input data.

[0055] Optionally, after waiting for the first pin to be at a high level and sending a command to the SPI slave to notify the start of reading and writing process data, the method further includes: When the first pin is at a high level, a read data status command is sent to the SPI slave, wherein the read data status command is used to determine whether the SPI slave receives output data correctly; When the SPI slave correctly receives the output data, a valid read / write data command is sent to the development tool based on the first communication protocol; when the SPI slave incorrectly receives the output data, an invalid read / write data command is sent to the development tool based on the first communication protocol.

[0056] In a second aspect, an embodiment of the present application further provides an interactive device for converting an internal bus into an SPI interface protocol, which is applied to an SPI host, and the device includes: A receiving module, used for receiving a ready command sent by a development tool based on a first communication protocol, wherein the ready command is used for indicating that the development tool has been powered on; A sending module, used for sending a module information read command to the SPI slave when the first pin is at a high level, wherein the module information read command is used for notifying the SPI slave to read module type data; The receiving module is also used to receive the module information, process data length and configuration data length sent by the SPI slave based on the read module information command.

[0057] In the embodiment of the present application, after the SPI host receives the ready command sent by the development tool based on the first communication protocol, the SPI slave is controlled to execute the command of the relevant reading module and receive the relevant reading result, thereby improving the interaction efficiency between the SPI host and the SPI slave.

[0058] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the embodiment of the interactive method for converting the internal bus to the SPI interface protocol is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0059] An embodiment of the present application further provides a computer program product, which is stored in a storage medium. The computer program product is executed by at least one processor to implement the various processes of the above-mentioned internal bus conversion to SPI interface protocol interaction method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0060] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0061] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0062] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. An interactive method for converting an internal bus into an SPI interface protocol, characterized in that: Applied to an SPI host, the method comprises: Receiving a ready command sent by a development tool based on a first communication protocol, wherein the ready command is used to indicate that the development tool has been powered on; When the first pin is at a high level, a module information read command is sent to the SPI slave, where the module information read command is used to notify the SPI slave to read module type data; Receive the module information, process data length and configuration data length sent by the SPI slave based on the read module information command.

2. The method according to claim 1, characterized in that When the first pin is at a high level, before sending a module information read command to the SPI slave, the method further includes: Waiting for the first pin to be at a high level, sending a notification read module information command to the SPI slave, wherein the notification read module information command is used to notify the SPI slave to start reading the module type data; Receive the reply data frame sent by the SPI slave.

3. The method according to claim 1, characterized in that: After receiving the module information, process data length and configuration data length sent by the SPI slave based on the read module information command, the method further includes: Receiving a configuration command sent by a development tool based on the first communication protocol, wherein the configuration command is used to instruct the SPI slave to prepare to write configuration data; Wait for the first pin to be at a high level, and send a module configuration data command to the SPI slave, where the module configuration data command is used to send configuration data to the SPI slave.

4. The method according to claim 3, characterized in that After waiting for the first pin to be at a high level and sending a module configuration data command to the SPI slave, the method further includes: When the first pin is at a high level, the read module receives the configuration data status sent to the SPI slave, and reads the configuration status sent by the SPI slave; If the configuration is read successfully, a receive data valid command is sent to the development tool based on the first communication protocol; if the configuration is read unsuccessfully, a receive data invalid command is sent to the development tool based on the first communication protocol.

5. The method according to claim 1, characterized in that After receiving the module information, process data length and configuration data length sent by the SPI slave based on the read module information command, the method further includes: Receiving a read / write command sent by a development tool based on the first communication protocol, wherein the read / write command is used to instruct the SPI slave to prepare to read / write data; Wait for the first pin to be at a high level, and send a command to the SPI slave to notify the start of reading and writing process data, where the command is used to notify the SPI slave to start reading input data.

6. The method according to claim 5, characterized in that After waiting for the first pin to be at a high level and sending a command to the SPI slave to notify the start of reading and writing process data, the method further includes: When the first pin is at a high level, a read data status command is sent to the SPI slave, wherein the read data status command is used to determine whether the SPI slave receives output data correctly; When the SPI slave correctly receives the output data, a valid read / write data command is sent to the development tool based on the first communication protocol; when the SPI slave incorrectly receives the output data, an invalid read / write data command is sent to the development tool based on the first communication protocol.

7. An interactive device for converting an internal bus into an SPI interface protocol, characterized in that: Applied to a SPI host, the device comprises: A receiving module, used for receiving a ready command sent by a development tool based on a first communication protocol, wherein the ready command is used for indicating that the development tool has been powered on; A sending module, used for sending a module information read command to the SPI slave when the first pin is at a high level, wherein the module information read command is used for notifying the SPI slave to read module type data; The receiving module is also used to receive the module information, process data length and configuration data length sent by the SPI slave based on the read module information command.

8. An electronic device comprising: A memory, a processor, and a program stored in the memory and executable on the processor; wherein the processor is used to read the program in the memory to implement the steps in the interactive method for converting an internal bus into an SPI interface protocol as described in any one of claims 1 to 6.

9. A readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps in the interactive method for converting an internal bus to an SPI interface protocol as described in any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The computer program product is stored in a storage medium, and the computer program product is executed by at least one processor to implement the steps in the interactive method for converting an internal bus into an SPI interface protocol according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Node discovery and configuration in daisy chain networks

    CN116529720A

  • IO expansion system and method based on SPI bus

    CN116860689A

  • System and Method for Development Environment HostingService on Internet

    KR1020040055908A

  • System for storing and updating configuration information about I / O card and using stored configuration information to configure newly installed I / O card when compatible with old card

    US6065068A