CN107766280A - Terminal communicating method and device - Google Patents
Terminal communicating method and device Download PDFInfo
- Publication number
- CN107766280A CN107766280A CN201610709861.6A CN201610709861A CN107766280A CN 107766280 A CN107766280 A CN 107766280A CN 201610709861 A CN201610709861 A CN 201610709861A CN 107766280 A CN107766280 A CN 107766280A
- Authority
- CN
- China
- Prior art keywords
- mcu
- spi
- instruction
- flash
- data
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 36
- 238000004891 communication Methods 0.000 claims abstract description 84
- 230000002093 peripheral effect Effects 0.000 claims abstract description 11
- 238000005516 engineering process Methods 0.000 abstract description 9
- 230000000694 effects Effects 0.000 abstract description 8
- 230000006870 function Effects 0.000 description 16
- 238000010586 diagram Methods 0.000 description 8
- 230000003287 optical effect Effects 0.000 description 4
- 230000005236 sound signal Effects 0.000 description 4
- 230000001133 acceleration Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 241000904454 Thespis Species 0.000 description 1
- 230000009471 action Effects 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephone Function (AREA)
- Telephonic Communication Services (AREA)
Abstract
The disclosure belongs to electronic technology field on a kind of terminal communicating method and device.The terminal communicating method includes:First microcontroller sends the first instruction by the first serial peripheral equipment interface SPI to the 2nd MCU, and described first instructs for the 4th SPI of the 2nd MCU to be switched into idle condition by working condition;First MCU sends the second instruction, and described second instructs for the 2nd SPI of the first MCU to be switched into working condition by idle condition;First MCU passes through the 2nd SPI and flash memory Flash communication;Wherein, the 2nd SPI and the 4th SPI are connected with the Flash respectively, for entering row data communication with the Flash.The terminal communicating method of the disclosure can share the data in Flash by two MCU, solve MCU and read data in Flash, the problem of can not sharing the data in Flash, reach the effect for improving the utilization rate of data in Flash.
Description
Technical Field
The present disclosure relates to the field of electronic technologies, and in particular, to a terminal communication method and apparatus.
Background
A terminal such as an electric toy has a limited storage space, and thus, the terminal generally stores voice data in a Flash (Flash memory) connected to an MCU (micro controller Unit).
In the related art, an MCU in a terminal is connected to a Flash through an SPI (Serial Peripheral Interface), and the MCU reads voice data in the Flash through the SPI, and the voice data in the Flash cannot be shared.
Disclosure of Invention
In order to solve the problems in the related art, the present disclosure provides a terminal communication method and apparatus.
According to a first aspect of the embodiments of the present disclosure, there is provided a terminal communication method, applied to a voice terminal, the method including:
the method comprises the following steps that a first microcontroller MCU sends a first instruction to a second MCU through a first Serial Peripheral Interface (SPI), and the first instruction is used for switching a fourth SPI of the second MCU from a working state to an idle state;
the first MCU sends a second instruction, and the second instruction is used for switching a second SPI of the first MCU from the idle state to a working state;
the first MCU is communicated with a Flash memory Flash through the second SPI;
the second SPI and the fourth SPI are respectively connected with the Flash and used for carrying out data communication with the Flash.
Optionally, the method further includes:
after the communication is finished, the first MCU sends a third instruction, wherein the third instruction is used for switching the second SPI from the working state to the idle state;
and the first MCU sends a fourth instruction to the second MCU through the first SPI, and the fourth instruction is used for switching the fourth SPI from the idle state to the working state.
Optionally, the first MCU communicates with the Flash memory Flash through the second SPI, including:
the first MCU reads the data in the Flash through the second SPI and forwards the data to other terminals through a universal asynchronous receiving and transmitting UART interface of the first MCU; or,
and the first MCU receives data from other terminals through the UART interface and forwards the data to the Flash through the second SPI.
Optionally, the method further includes:
starting the voice terminal;
the first MCU sends a fifth instruction and a sixth instruction, wherein the fifth instruction is used for setting the first SPI to be in the working state, and the sixth instruction is used for setting the second SPI to be in the idle state;
the second MCU sends a seventh instruction and an eighth instruction, wherein the seventh instruction is used for setting a third SPI of the second MCU to be in the working state, and the eighth instruction is used for setting a fourth SPI to be in the working state;
and the second MCU sends a ninth instruction to the Flash through the fourth SPI, and the ninth instruction is used for setting the SPI of the Flash to be in the working state.
Optionally, the first MCU is a master MCU, and the second MCU is a slave MCU;
the master MCU is used for updating data in the Flash, and the slave MCU is used for executing voice operation on the Flash.
According to a second aspect of the embodiments of the present disclosure, there is provided a terminal communication apparatus, the apparatus including:
the first sending module is configured to control the first microcontroller MCU to send a first instruction to the second MCU through the first serial peripheral interface SPI, and the first instruction is used for switching the fourth SPI of the second MCU from the working state to the idle state;
the second sending module is configured to control the first MCU to send a second instruction, and the second instruction is used for switching a second SPI of the first MCU from the idle state to a working state;
the communication module is configured to control the first MCU to communicate with a Flash memory Flash through the second SPI;
the second SPI and the fourth SPI are respectively connected with the Flash and used for carrying out data communication with the Flash.
Optionally, the apparatus further comprises:
a third sending module, configured to control the first MCU to send a third instruction after communication is finished, where the third instruction is used to switch the second SPI from the working state to the idle state;
and the fourth sending module is configured to control the first MCU to send a fourth instruction to the second MCU through the first SPI, where the fourth instruction is used to switch the fourth SPI from the idle state to the working state.
Optionally, the communication module includes:
the first communication sub-module is configured to control the first MCU to read data in the Flash through the second SPI and forward the data to other terminals through a universal asynchronous receiver/transmitter (UART) interface of the first MCU; or,
and the second communication submodule is configured to control the first MCU to receive data from other terminals through the UART interface and forward the data to the Flash through the second SPI.
Optionally, the apparatus further comprises:
a starting module configured to start the voice terminal;
a first setting module configured to control the first MCU to transmit a fifth instruction and a sixth instruction, wherein the fifth instruction is used to set the first SPI to the working state, and the sixth instruction is used to set the second SPI to the idle state;
a second setting module configured to control the second MCU to transmit a seventh instruction and an eighth instruction, wherein the seventh instruction is used to set the third SPI to the operating state, and the eighth instruction is used to set the fourth SPI to the operating state;
and the third setting module is configured to control the second MCU to send a ninth instruction to the Flash through the fourth SPI, and the ninth instruction is used for setting the SPI of the Flash to be in the working state.
Optionally, the first MCU is a master MCU, and the second MCU is a slave MCU;
the master MCU is used for updating data in the Flash, and the slave MCU is used for executing voice operation on the Flash.
According to a third aspect of the embodiments of the present disclosure, there is provided a terminal communication apparatus, the apparatus including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
the method comprises the following steps that a first microcontroller MCU sends a first instruction to a second MCU through a first Serial Peripheral Interface (SPI), and the first instruction is used for switching a fourth SPI of the second MCU from a working state to an idle state;
the first MCU sends a second instruction, and the second instruction is used for switching a second SPI of the first MCU from the idle state to a working state;
and the first MCU is communicated with a Flash memory Flash through the second SPI.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
the first MCU sends a first instruction to the second MCU through the first SPI; the first instruction is used for switching the fourth SPI of the second MCU from a working state to an idle state; the first MCU sends a second instruction, and the second instruction is used for switching the second SPI of the first MCU from an idle state to a working state; the first MCU is communicated with the Flash memory Flash through the second SPI; the second SPI and the fourth SPI are respectively connected with the Flash and used for carrying out data communication with the Flash, so that data in the Flash can be shared by the two MCUs, the problem that the data in the Flash cannot be shared when one MCU reads the data in the Flash is solved, and the effect of improving the utilization rate of the data in the Flash is achieved.
The second SPI of the first MCU is communicated with Flash, and the UART interface of the first MCU is connected with other terminals, so that the voice terminal can forward data in Flash to other terminals through the first MCU, and can also forward data in other terminals to Flash to update the data in Flash.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a schematic diagram illustrating a voice terminal structure according to an exemplary embodiment.
Fig. 2 is a flow chart illustrating a method of terminal communication according to an example embodiment.
Fig. 3 is a flow chart illustrating a method of terminal communication according to an example embodiment.
Fig. 4 is a block diagram illustrating a terminal communication device according to an example embodiment.
Fig. 5 is a block diagram illustrating a terminal communication device according to an example embodiment.
Fig. 6 is a block diagram illustrating an apparatus for terminal communication in accordance with an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Fig. 1 is a schematic structural diagram illustrating a voice terminal according to an exemplary embodiment, and as shown in fig. 1, the voice terminal includes a first MCU110, a second MCU120 and a Flash 130.
The first MCU110 is generally a chip in a voice terminal, which has a clock circuit, a power circuit, etc., a memory space, and peripheral interfaces such as UART, SPI, etc. The second MCU120 is typically a chip in the voice terminal, which has a clock circuit, a power circuit, etc., a memory space, and peripheral interfaces such as UART, SPI, etc. The MCU is not limited in this embodiment.
The first SPI140 of the first MCU110 is connected to the third SPI160 of the second MCU120, and the second SPI150 of the first MCU110 and the fourth SPI170 of the second MCU120 are connected to the SPIs 180 of the Flash130, respectively.
The SPI includes four pins, namely, SCK (Serial Clock), MISO (Master Input Slave Output), MOSI (Master Output Slave Input), and CS (chip select). In this embodiment, the first MCU110 includes the first SPI140 and the second SPI150, the second MCU120 includes the third SPI160 and the fourth SPI170, the Flash130 includes the SPI180, the four pins of the first SPI140 are respectively connected to the four pins of the third SPI160, and the four pins of the second SPI150 are respectively connected to the four pins of the fourth SPI 170. Four pins of second SPI150 are correspondingly connected to four pins of SPI180, respectively, and four pins of fourth SPI170 are correspondingly connected to four pins of SPI180, respectively.
In this embodiment, the states of the SPI include an idle state and a working state, and when the state of the SPI is the idle state, the SPI cannot transmit data, that is, does not work; when the state of the SPI is working, the SPI can transmit data.
In this embodiment, the first SPI140 and the third SPI160 are both in a working state, so that real-time communication between the first MCU110 and the second MCU120 can be realized.
Because Flash only has one SPI, Flash can only communicate with one MCU at the same time. Namely, the SPI180 and the second SPI150 can both be in a working state, and the fourth SPI170 is in an idle state, so that the Flash130 and the first MCU110 can communicate with each other; or, both the SPI180 and the fourth SPI170 are in a working state, and the second SPI150 is in an idle state, so that the Flash130 and the second MCU120 are communicated.
In this embodiment, the UART interface 190 of the first MCU110 is connected to the communication interfaces of other terminals to realize the communication between the other terminals and the Flash 130. For example, the first MCU110 may read data from other terminals and forward the voice data to the Flash 130; or read data from Flash130 and forward the data to other terminals.
In this embodiment, the data stored in Flash130 includes at least one of a voice function, a voice recognition library, a voice playing library, recording data, MIDI (Musical Instrument Digital Interface) data, a firmware library, and description information.
The voice function refers to some function that may be called by the first MCU110 or the second MCU120 to perform a voice operation. For example, the voice function may include a play function PlaySound () or a record function WaveIn ().
The voice recognition library is a library file containing voice recognition instructions, and the voice recognition instructions are used for instructing the voice terminal to execute corresponding operations. For example, the voice recognition instruction includes a forward instruction, a backward instruction, a left turn instruction, a right turn instruction, a stop instruction, and the like, and when the forward instruction is received by Flash, the voice instruction is controlled to move forward.
The voice playing library contains voice data to be played. For example, the voice playing library may include a welcome language when the voice terminal is started, an end language when the voice terminal is turned off, and the like, which is not limited in this embodiment.
The recording data includes data obtained by recording.
MIDI data is sound effect data. For example, MIDI data are "Duo", "Rui", "Mi", and the like.
The firmware library contains drivers such as an operating system and the like. The first MCU and the second MCU can call programs in the firmware library.
The description information includes information describing the firmware library, for example, the description information includes a version number, and the like, which is not limited in this embodiment.
In this embodiment, the first MCU110 and the second MCU120 may be the same MCU, that is, the first MCU110 and the second MCU120 control the Flash130 in the same operation; or, the first MCU110 is a master MCU, and the second MCU120 is a slave MCU; the master MCU is used for updating data in the Flash130, and the slave MCU is used for executing voice operation on the Flash 130.
When the first MCU110 is a master MCU and the second MCU120 is a slave MCU, the running speed of the first MCU110 is higher than that of the second MCU120, so that the first MCU110 with high running speed updates data in the Flash130 to improve the updating efficiency; and performing voice operation on the Flash130 through the second MCU120 with a slow operation speed.
Fig. 2 is a flowchart illustrating a terminal communication method according to an exemplary embodiment, the terminal being applied to the voice terminal shown in fig. 1, and the terminal communication method including the following steps, as shown in fig. 2.
In step 201, the first MCU sends a first command to the second MCU through the first SPI, where the first command is used to switch the fourth SPI of the second MCU from the working state to the idle state.
In step 202, the first MCU sends a second command, where the second command is used to switch the second SPI of the first MCU from the idle state to the working state.
In step 203, the first MCU communicates with Flash via the second SPI.
In summary, in the terminal communication method provided by the present disclosure, the first MCU sends the first instruction to the second MCU through the first SPI; the first instruction is used for switching the fourth SPI of the second MCU from a working state to an idle state; the first MCU sends a second instruction, and the second instruction is used for switching the second SPI of the first MCU from an idle state to a working state; the first MCU is communicated with the Flash memory Flash through the second SPI; the second SPI and the fourth SPI are respectively connected with the Flash and used for carrying out data communication with the Flash, so that data in the Flash can be shared by the two MCUs, the problem that the data in the Flash cannot be shared when one MCU reads the data in the Flash is solved, and the effect of improving the utilization rate of the data in the Flash is achieved.
Fig. 3 is a flowchart illustrating a terminal communication method applied to the voice terminal shown in fig. 1 according to an exemplary embodiment, and the terminal communication method includes the following steps, as shown in fig. 3.
In step 301, a voice terminal is started.
When the voice terminal is started, the voice terminal may need to play voice such as welcome, and therefore the second MCU needs to communicate with Flash first, and at this time, the voice terminal needs to set the third SPI to a working state through the second MCU and set the SPI of Flash to a working state through Flash. Since Flash can only communicate with one MCU at the same time, the voice terminal also needs to set the second SPI to an idle state through the first MCU, i.e., steps 302 and 303 are performed.
In step 302, the first MCU transmits a fifth command and a sixth command, where the fifth command is used to set the first SPI to the working state, and the sixth command is used to set the second SPI to the idle state.
Since the first MCU may need to communicate with the second MCU, in order to improve the real-time performance and success rate of communication, the voice terminal may set the first SPI to an operating state through the first MCU during initialization.
In step 303, the second MCU transmits a seventh command and an eighth command, where the seventh command is used to set the third SPI of the second MCU to the working state, and the eighth command is used to set the fourth SPI to the working state.
Since the second MCU may need to communicate with the first MCU, the second MCU sets the third SPI to an operating state at this time.
In step 304, the second MCU sends a ninth instruction to Flash through the fourth SPI, and the ninth instruction is used to set the SPI of Flash to a working state.
Step 302, step 303 and step 304 may be executed simultaneously, or step 302 may be executed first, step 303 is executed, and step 304 is executed finally, and the order of executing step 302, step 303 and step 304 is not limited in this embodiment.
The descriptions of the states of the first MCU, the second MCU, Flash, and SPI are detailed in the description of the embodiment shown in fig. 1, and are not described herein again.
In step 305, the first MCU sends a first command to the second MCU through the first SPI, where the first command is used to switch the fourth SPI of the second MCU from the working state to the idle state.
When the first MCU needs to communicate with the Flash, the first MCU sends a first instruction to the second MCU to instruct the second MCU to switch the working state of the fourth SPI into an idle state.
The related technology for changing the SPI from the working state to the idle state is already mature, and is not described in detail in this embodiment.
In step 306, the first MCU sends a second command, where the second command is used to switch the second SPI of the first MCU from the idle state to the working state.
After the second MCU switches the working state of the fourth SPI into the idle state, the second MCU releases SPI resources, at the moment, the first MCU switches the idle state of the second SPI into the working state, and communication with Flash is achieved.
In this embodiment, the data stored in Flash includes at least one of a voice function, a voice recognition library, a voice playing library, recording data, MIDI data, a firmware library, and description information. Wherein the voice function refers to some functions that the first MCU or the second MCU may call for performing voice operation. For example, the voice function may include a play function PlaySound () or a record function wave (). The voice recognition library is a library file containing voice recognition instructions, and the voice recognition instructions are used for instructing the voice terminal to execute corresponding operations. For example, the voice recognition instruction includes a forward instruction, a backward instruction, a left turn instruction, a right turn instruction, a stop instruction, and the like, and when the forward instruction is received by Flash, the voice instruction is controlled to move forward. The voice playing library contains voice data to be played. For example, the voice playing library may include a welcome language when the voice terminal is started, an end language when the voice terminal is turned off, and the like, which is not limited in this embodiment. The recording data includes data obtained by recording. MIDI data is sound effect data. For example, MIDI data are "Duo", "Rui", "Mi", and the like. The firmware library contains drivers such as an operating system and the like. The first MCU and the second MCU can call programs in the firmware library. The description information includes information describing the firmware library, for example, the description information includes a version number, and the like, which is not limited in this embodiment.
In this embodiment, the first MCU and the second MCU may be the same MCU, that is, the first MCU and the second MCU have the same control operation on Flash. At this time, the first MCU may perform a voice operation on Flash. For example, the first MCU controls Flash to play MIDI data, at this time, the first MCU sends a control instruction to Flash, where the control instruction at least includes an identifier of a play function and an identifier of MIDI data to be played, and after receiving the control instruction, Flash calls the play function according to the identifier of the play function and plays MIDI data indicated by the identifier of MIDI data using the play function. Or,
the first MCU is a master MCU, and the second MCU is a slave MCU; the master MCU is used for updating data in the Flash, and the slave MCU is used for executing voice operation on the Flash. For example, the first MCU updates the operating system in Flash, at this time, the first MCU sends update data to Flash, and Flash updates the operating system in the firmware library and version information in the description information according to the update data.
When the first MCU is a master MCU and the second MCU is a slave MCU, the running speed of the first MCU is higher than that of the second MCU, so that the data are updated into Flash through the first MCU with high running speed, and the updating efficiency is improved; and executing voice operation on the Flash through the second MCU with low running speed.
In this embodiment, the first MCU may also communicate with other terminals to implement communication between the other terminals and Flash. For example, the first MCU may read data from other terminals, and forward the voice data to Flash, at this time, step 308 is executed; or may read data from Flash and forward the data to another terminal, where step 307 is executed.
In step 307, the first MCU reads the data in the Flash through the second SPI, and forwards the data to other terminals through the UART interface of the first MCU.
The UART interface may transmit data with a communication interface of another terminal in a bluetooth mode, a data line mode, a WiFi (wireless fidelity) mode, and the like, which is not limited in this embodiment.
In step 308, the first MCU receives data from other terminals through the UART interface and forwards the data to Flash through the second SPI.
In step 309, after the communication is ended, the first MCU transmits a third command, where the third command is used to switch the second SPI from the working state to the idle state.
In this embodiment, the third command may be the same as the sixth command in step 302, and is used to set the second SPI to the idle state. For example, the third instruction and the sixth instruction are both high or low.
In step 310, the first MCU sends a fourth command to the second MCU through the first SPI, where the fourth command is used to switch the fourth SPI from the idle state to the working state.
In this embodiment, the fourth command may be the same as the eighth command in step 303, and is used to set the state of the fourth SPI to the working state. For example, the fourth instruction and the eighth instruction are both high or low.
After the first MCU is communicated with the Flash, the second MCU possibly needs to be communicated with the Flash, so that the first MCU needs to switch the second SPI of the first MCU into an idle state from a working state. The related technology for changing the SPI from the idle state to the working state is well-established, and is not described in detail in this embodiment.
After first MCU switches second SPI into idle state by operating condition, first MCU has released the SPI resource, and at this moment, first MCU sends the second instruction to fourth SPI through first SPI, and the second instruction is used for instructing second MCU to switch fourth SPI into operating condition by idle state.
And after the second MCU switches the fourth SPI from the idle state to the working state, the second MCU can be connected with the SPI of the Flash through the second SPI of the second MCU per se to execute voice operation on the Flash.
In summary, in the terminal communication method provided by the present disclosure, the first MCU sends the first instruction to the second MCU through the first SPI; the first instruction is used for switching the fourth SPI of the second MCU from a working state to an idle state; the first MCU sends a second instruction, and the second instruction is used for switching the second SPI of the first MCU from an idle state to a working state; the first MCU is communicated with the Flash memory Flash through the second SPI; the second SPI and the fourth SPI are respectively connected with the Flash and used for carrying out data communication with the Flash, so that data in the Flash can be shared by the two MCUs, the problem that the data in the Flash cannot be shared when one MCU reads the data in the Flash is solved, and the effect of improving the utilization rate of the data in the Flash is achieved.
The first MCU is communicated with the Flash through the second SPI, and the first MCU is connected with other terminals through UART interfaces, so that the voice terminal can forward data in the Flash to other terminals through the first MCU, and can also forward data in other terminals to the Flash to update the data in the Flash.
Fig. 4 is a block diagram illustrating a terminal communication apparatus according to an exemplary embodiment, which is applied to the voice terminal shown in fig. 1, and as shown in fig. 4, the terminal communication apparatus includes: a first transmitting module 410, a second transmitting module 420, and a communication module 430;
the first sending module 410 is configured to control the first MCU to send a first instruction to the first SPI of the second MCU through the first SPI, where the first instruction is used to switch the fourth SPI of the second MCU from the working state to the idle state;
the second sending module 420 is configured to control the first MCU to send a second instruction, where the second instruction is used to switch the second SPI of the first MCU from the idle state to the working state;
the communication module 430 is configured to control the first MCU to communicate with the Flash memory Flash through the second SPI.
In summary, in the terminal communication device provided by the present disclosure, the first MCU sends the first instruction to the second MCU through the first SPI; the first instruction is used for switching the fourth SPI of the second MCU from a working state to an idle state; the first MCU sends a second instruction, and the second instruction is used for switching the second SPI of the first MCU from an idle state to a working state; the first MCU is communicated with the Flash memory Flash through the second SPI; the second SPI and the fourth SPI are respectively connected with the Flash and used for carrying out data communication with the Flash, so that data in the Flash can be shared by the two MCUs, the problem that the data in the Flash cannot be shared when one MCU reads the data in the Flash is solved, and the effect of improving the utilization rate of the data in the Flash is achieved.
Fig. 5 is a block diagram illustrating a terminal communication apparatus according to an exemplary embodiment, which is applied to the voice terminal shown in fig. 1, and as shown in fig. 5, the voice terminal communication apparatus includes: a first transmission module 510, a first transmission module 520, and a communication module 530;
the first sending module 510 is configured to control the first MCU to send a first instruction to the second MCU through the first SPI, where the first instruction is used to switch the fourth SPI of the second MCU from the working state to the idle state;
the second sending module 520 is configured to control the first MCU to send a second instruction, where the second instruction is used to switch the second SPI of the first MCU from the idle state to the working state;
the communication module 530 is configured to control the first MCU to communicate with Flash through the second SPI;
and the second SPI and the fourth SPI are respectively connected with Flash and used for carrying out data communication with the Flash.
Optionally, the apparatus further comprises:
the third sending module 540 is configured to control the first MCU to send a third instruction after the communication is finished, where the third instruction is used to switch the second SPI from the working state to the idle state;
the fourth sending module 550 controls the first MCU to send a fourth command to the second MCU through the first SPI, and the fourth command is used to switch the fourth SPI from the idle state to the operating state.
Optionally, the communication module 530 includes: a first communication submodule 531 and a second communication submodule 532;
the first communication sub-module 531 is configured to control the first MCU to read data in Flash through the second SPI, and forward the data to other terminals through the universal asynchronous receiver/transmitter UART interface of the first MCU; or,
the second communication sub-module 532 is configured to control the first MCU to receive data from other terminals through the UART interface and forward the data to Flash through the second SPI.
Optionally, the apparatus further comprises: a start module 560, a first setup module 570, a second setup module 580, and a third setup module 590;
the starting module 560 is configured to start the voice terminal;
the first setting module 570 is configured to control the first MCU to transmit a fifth instruction and a sixth instruction, where the fifth instruction is used to set the first SPI in the working state, and the sixth instruction is used to set the second SPI in the idle state;
the second setting module 580 is configured to control the second MCU to transmit a seventh instruction and an eighth instruction, where the seventh instruction is used to set the third SPI of the second MCU to the working state, and the eighth instruction is used to set the fourth SPI to the working state;
the third setting module 590 is configured to control the second MCU to send a ninth instruction to the Flash through the fourth SPI, where the ninth instruction is used to set the SPI of the Flash to a working state.
Optionally, the first MCU is a master MCU, and the second MCU is a slave MCU; the master MCU is used for updating data in the Flash, and the slave MCU is used for executing voice operation on the Flash.
In summary, in the terminal communication device provided by the present disclosure, the first MCU sends the first instruction to the second MCU through the first SPI; the first instruction is used for switching the fourth SPI of the second MCU from a working state to an idle state; the first MCU sends a second instruction, and the second instruction is used for switching the second SPI of the first MCU from an idle state to a working state; the first MCU is communicated with the Flash memory Flash through the second SPI; because the second SPI and the fourth SPI are respectively connected with the Flash and used for carrying out data communication with the Flash, the data in the Flash can be shared by the two MCUs, the problem that one MCU reads the data in the Flash and cannot share the data in the Flash is solved, and the effect of improving the utilization rate of the data in the Flash is achieved.
The first MCU is communicated with the Flash through the second SPI, and the first MCU is connected with other terminals through UART interfaces, so that the voice terminal can forward data in the Flash to other terminals through the first MCU, and can also forward data in other terminals to the Flash to update the data in the Flash.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
An exemplary embodiment of the present disclosure provides a terminal communication device capable of implementing a terminal communication method provided by the present disclosure, the voice terminal communication device including: a processor, a memory for storing processor-executable instructions;
wherein the processor is configured to:
the first MCU sends a first instruction to the second MCU through the first SPI, and the first instruction is used for switching the fourth SPI of the second MCU from a working state to an idle state;
the first MCU sends a second instruction, and the second instruction is used for switching the second SPI of the first MCU from an idle state to a working state;
the first MCU is communicated with the Flash memory Flash through the second SPI;
and the second SPI and the fourth SPI are respectively connected with Flash and used for carrying out data communication with the Flash.
Fig. 6 is a block diagram illustrating an apparatus 600 for terminal communication in accordance with an example embodiment. For example, the apparatus 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 6, apparatus 600 may include one or more of the following components: processing component 602, memory 604, power component 606, multimedia component 608, audio component 610, input/output (I/O) interface 612, sensor component 614, and communication component 616.
The processing component 602 generally controls overall operation of the device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 602 may include one or more processors 618 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 can include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
The memory 604 is configured to store various types of data to support operations at the apparatus 600. Examples of such data include instructions for any application or method operating on device 600, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 604 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power supply component 606 provides power to the various components of device 600. The power components 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the apparatus 600.
The multimedia component 608 includes a screen that provides an output interface between the device 600 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 600 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 610 is configured to output and/or input audio signals. For example, audio component 610 includes a Microphone (MIC) configured to receive external audio signals when apparatus 600 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 further includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 614 includes one or more sensors for providing status assessment of various aspects of the apparatus 600. For example, the sensor component 614 may detect an open/closed state of the device 600, the relative positioning of components, such as a display and keypad of the device 600, the sensor component 614 may also detect a change in position of the device 600 or a component of the device 600, the presence or absence of user contact with the device 600, orientation or acceleration/deceleration of the device 600, and a change in temperature of the device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is configured to facilitate communications between the apparatus 600 and other devices in a wired or wireless manner. The apparatus 600 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 604 comprising instructions, executable by the processor 618 of the apparatus 600 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (11)
1. A terminal communication method is applied to a voice terminal, and the method comprises the following steps:
the method comprises the following steps that a first microcontroller MCU sends a first instruction to a second MCU through a first Serial Peripheral Interface (SPI), and the first instruction is used for switching a fourth SPI of the second MCU from a working state to an idle state;
the first MCU sends a second instruction, and the second instruction is used for switching a second SPI of the first MCU from an idle state to a working state;
the first MCU is communicated with a Flash memory Flash through the second SPI;
the second SPI and the fourth SPI are respectively connected with the Flash and used for carrying out data communication with the Flash.
2. The method of claim 1, further comprising:
after the communication is finished, the first MCU sends a third instruction, wherein the third instruction is used for switching the second SPI from the working state to the idle state;
and the first MCU sends a fourth instruction to the second MCU through the first SPI, and the fourth instruction is used for switching the fourth SPI from the idle state to the working state.
3. The method according to claim 1, wherein the first MCU communicates with a Flash through the second SPI, comprising:
the first MCU reads the data in the Flash through the second SPI and forwards the data to other terminals through a universal asynchronous receiving and transmitting UART interface of the first MCU; or,
and the first MCU receives data from other terminals through the UART interface and forwards the data to the Flash through the second SPI.
4. The method of claim 1, further comprising:
starting the voice terminal;
the first MCU sends a fifth instruction and a sixth instruction, wherein the fifth instruction is used for setting the first SPI to be in the working state, and the sixth instruction is used for setting the second SPI to be in the idle state;
the second MCU sends a seventh instruction and an eighth instruction, wherein the seventh instruction is used for setting a third SPI of the second MCU to be in the working state, and the eighth instruction is used for setting a fourth SPI to be in the working state;
and the second MCU sends a ninth instruction to the Flash through the fourth SPI, and the ninth instruction is used for setting the SPI of the Flash to be in the working state.
5. The method according to any one of claims 1 to 4, wherein the first MCU is a master MCU and the second MCU is a slave MCU;
the master MCU is used for updating data in the Flash, and the slave MCU is used for executing voice operation on the Flash.
6. A terminal communication device, for use in a voice terminal, the device comprising:
the first sending module is configured to control the first microcontroller MCU to send a first instruction to the second MCU through the first serial peripheral interface SPI, and the first instruction is used for switching the fourth SPI of the second MCU from the working state to the idle state;
the second sending module is configured to control the first MCU to send a second instruction, and the second instruction is used for switching a second SPI of the first MCU from the idle state to a working state;
the communication module is configured to control the first MCU to communicate with a Flash memory Flash through the second SPI;
the second SPI and the fourth SPI are respectively connected with the Flash and used for carrying out data communication with the Flash.
7. The apparatus of claim 6, further comprising:
a third sending module, configured to control the first MCU to send a third instruction after communication is finished, where the third instruction is used to switch the second SPI from the working state to the idle state;
and the fourth sending module is configured to control the first MCU to send a fourth instruction to the second MCU through the first SPI, where the fourth instruction is used to switch the fourth SPI from the idle state to the working state.
8. The apparatus of claim 6, wherein the communication module comprises:
the first communication sub-module is configured to control the first MCU to read data in the Flash through the second SPI and forward the data to other terminals through a universal asynchronous receiver/transmitter (UART) interface of the first MCU; or,
and the second communication submodule is configured to control the first MCU to receive data from other terminals through the UART interface and forward the data to the Flash through the second SPI.
9. The apparatus of claim 6, further comprising:
a starting module configured to start the voice terminal;
a first setting module configured to control the first MCU to transmit a fifth instruction and a sixth instruction, wherein the fifth instruction is used to set the first SPI to the working state, and the sixth instruction is used to set the second SPI to the idle state;
a second setting module configured to control the second MCU to transmit a seventh instruction and an eighth instruction, wherein the seventh instruction is used to set a third SPI of the second MCU to the working state, and the eighth instruction is used to set the fourth SPI to the working state;
and the third setting module is configured to control the second MCU to send a ninth instruction to the Flash through the fourth SPI, and the ninth instruction is used for setting the SPI of the Flash to be in the working state.
10. The device according to any one of claims 6 to 9, wherein the first MCU is a master MCU and the second MCU is a slave MCU;
the master MCU is used for updating data in the Flash, and the slave MCU is used for executing voice operation on the Flash.
11. A terminal communication apparatus, characterized in that the apparatus comprises:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
the method comprises the following steps that a first microcontroller MCU sends a first instruction to a second MCU through a first Serial Peripheral Interface (SPI), and the first instruction is used for switching a fourth SPI of the second MCU from a working state to an idle state;
the first MCU sends a second instruction, and the second instruction is used for switching a second SPI of the first MCU from an idle state to a working state;
the first MCU communicates with the Flash memory Flash through the second SPI,
the second SPI and the fourth SPI are respectively connected with the Flash and used for carrying out data communication with the Flash.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610709861.6A CN107766280B (en) | 2016-08-23 | 2016-08-23 | Terminal communication method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610709861.6A CN107766280B (en) | 2016-08-23 | 2016-08-23 | Terminal communication method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107766280A true CN107766280A (en) | 2018-03-06 |
CN107766280B CN107766280B (en) | 2022-05-17 |
Family
ID=61264258
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610709861.6A Active CN107766280B (en) | 2016-08-23 | 2016-08-23 | Terminal communication method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107766280B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111159077A (en) * | 2019-12-20 | 2020-05-15 | 深圳星康医疗科技有限公司 | Cooperative method and system for SPI double-master device to access same slave device |
CN112416832A (en) * | 2020-11-06 | 2021-02-26 | 光华临港工程应用技术研发(上海)有限公司 | Communication system based on MIPS framework processor |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101286144A (en) * | 2007-04-11 | 2008-10-15 | 三星电子株式会社 | Multipath accessible semiconductor memory device |
CN101847043A (en) * | 2009-03-25 | 2010-09-29 | 联想(北京)有限公司 | Method for sharing storage equipment and mobile terminal |
US20130054879A1 (en) * | 2011-08-24 | 2013-02-28 | IP Goal Microelectronics (SiChuan) Co., Ltd. | Data Storage device based on SPI and its controlling method |
CN103150262A (en) * | 2013-04-02 | 2013-06-12 | 无锡江南计算技术研究所 | Pipeline type serial interface flash memory access device |
CN105094541A (en) * | 2015-06-30 | 2015-11-25 | 小米科技有限责任公司 | Method, device and system for terminal control |
CN105323314A (en) * | 2015-10-15 | 2016-02-10 | 珠海格力电器股份有限公司 | Voice updating method and system |
CN105721015A (en) * | 2016-01-29 | 2016-06-29 | 努比亚技术有限公司 | Dual-channel mobile terminal capable of multiplexing Flash ROM |
-
2016
- 2016-08-23 CN CN201610709861.6A patent/CN107766280B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101286144A (en) * | 2007-04-11 | 2008-10-15 | 三星电子株式会社 | Multipath accessible semiconductor memory device |
CN101847043A (en) * | 2009-03-25 | 2010-09-29 | 联想(北京)有限公司 | Method for sharing storage equipment and mobile terminal |
US20130054879A1 (en) * | 2011-08-24 | 2013-02-28 | IP Goal Microelectronics (SiChuan) Co., Ltd. | Data Storage device based on SPI and its controlling method |
CN103150262A (en) * | 2013-04-02 | 2013-06-12 | 无锡江南计算技术研究所 | Pipeline type serial interface flash memory access device |
CN105094541A (en) * | 2015-06-30 | 2015-11-25 | 小米科技有限责任公司 | Method, device and system for terminal control |
CN105323314A (en) * | 2015-10-15 | 2016-02-10 | 珠海格力电器股份有限公司 | Voice updating method and system |
CN105721015A (en) * | 2016-01-29 | 2016-06-29 | 努比亚技术有限公司 | Dual-channel mobile terminal capable of multiplexing Flash ROM |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111159077A (en) * | 2019-12-20 | 2020-05-15 | 深圳星康医疗科技有限公司 | Cooperative method and system for SPI double-master device to access same slave device |
CN111159077B (en) * | 2019-12-20 | 2021-06-29 | 深圳星康医疗科技有限公司 | Cooperative method and system for SPI double-master device to access same slave device |
CN112416832A (en) * | 2020-11-06 | 2021-02-26 | 光华临港工程应用技术研发(上海)有限公司 | Communication system based on MIPS framework processor |
Also Published As
Publication number | Publication date |
---|---|
CN107766280B (en) | 2022-05-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20170322709A1 (en) | Split-screen display method, apparatus and medium | |
CN111314768A (en) | Screen projection method, screen projection device, electronic equipment and computer readable storage medium | |
CN105183276A (en) | Method and apparatus for realizing game in chat interface, and and terminal device | |
CN105451369A (en) | Method and apparatus for updating connection parameter of Bluetooth device with low power consumption | |
CN105204894A (en) | Method and device for installing plug-in of intelligent equipment | |
CN106454644B (en) | Audio playing method and device | |
US11457479B2 (en) | Method and apparatus for configuring random access occasion, method and apparatus for random access | |
US11146854B2 (en) | Method for playing videos and electronic device | |
CN109525881A (en) | Sound draws synchronous method, device and equipment | |
CN104958898A (en) | Method, apparatus and system for controlling video games | |
CN107329727B (en) | Volume control method and device and computer storage readable storage medium | |
CN103997669A (en) | Equipment control method, equipment control device and equipment control system | |
EP4050604A1 (en) | Method for splicing audio file and computer device | |
CN112492095B (en) | System, terminal, method, apparatus and storage medium for controlling terminal | |
CN107272896B (en) | Method and device for switching between VR mode and non-VR mode | |
CN111123716B (en) | Remote control method, remote control device, and computer-readable storage medium | |
CN107766280B (en) | Terminal communication method and device | |
JP2019525267A (en) | Smart home initialization method, apparatus, program, and recording medium | |
CN114513571A (en) | Device connection method and device, electronic device and readable storage medium | |
CN111246401B (en) | Frequency changing method and device | |
CN109474744B (en) | Alarm clock processing method, device and storage medium | |
CN113692067B (en) | Device connection method and device and readable storage medium | |
CN109408025B (en) | Audio playing method, device and storage medium | |
CN114029949A (en) | Robot action editing method and device, electronic equipment and storage medium | |
CN110308779B (en) | Intelligent terminal, intelligent terminal control device and method |
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 |