A multi-channel sensor device and an asynchronous data reading method
By setting a storage location flag and dual storage locations in the multi-channel sensor, time-synchronous acquisition and asynchronous output of the multi-channel sensor under serial bus communication are realized, solving the problem of data time asynchrony, reducing power consumption, and making it suitable for scenarios such as airbags that require synchronous data verification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MT MICROSYST
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-14
AI Technical Summary
In serial communication mode, the time-division output data of each channel of a multi-channel sensor is not synchronized, making it impossible to achieve synchronous acquisition of multi-axis data at the same time, which leads to erroneous data output in applications such as airbags.
A storage location flag is set in the multi-channel sensor, which has a first state and a second state. The state switching between the two storage locations is realized by triggering signals and reading commands, so as to ensure that the data of each channel is stored and output in different states, namely real-time data and synchronous data.
It enables time-synchronous acquisition of multi-channel sensors under serial bus communication, ensuring real-time updates of data from each channel and asynchronous output of the same historical moment, reducing power consumption, and is suitable for scenarios such as airbags that require synchronous data verification.
Smart Images

Figure CN121349541B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of MEMS sensor technology, and in particular to a multi-channel sensor device and an asynchronous data reading method. Background Technology
[0002] A multi-channel sensor is a sensor with multiple independent acquisition channels. The acquisition actions of multiple channels are completed simultaneously, achieving time-aligned synchronous acquisition. For example, each channel of a multi-channel sensor includes a sensing element and a register. Each sensing element synchronously acquires sensing data and writes it to the corresponding register in real time. When writing to the register, old data is overwritten to ensure that the register always stores the latest sensing data.
[0003] Multi-channel sensors typically use serial communication, meaning they can only output data stored in the registers of each channel asynchronously in a time-sharing manner. For example, when a multi-channel sensor only reads and outputs data for a single axis, the output is usually the real-time updated data for that axis. However, in some applications, the host computer requires reading data from multiple axes of the sensor at the same time. For instance, in detecting vehicle collisions, reading the X-axis and Y-axis data at the same time for cross-verification is necessary to prevent incorrect data output due to single-point sensor failure, which could lead to false airbag deployment. Because serial communication outputs data asynchronously in a time-sharing manner, after the first channel's data is output, the data from other channels has already been updated in real time, causing subsequent outputs from other channels to be out of sync with the first channel. Summary of the Invention
[0004] This invention provides an asynchronous reading method for a multi-channel sensor device and its data to solve the problem of asynchronous data output from different channels of a multi-channel sensor using serial bus communication.
[0005] In a first aspect, embodiments of the present invention provide a multi-channel sensor device, which is provided with a storage location flag bit, having a first state and a second state; in the first state, it indicates writing to a first storage location and using the second storage location as the target data output location; in the second state, it indicates writing to a second storage location and using the first storage location as the target data output location.
[0006] The multi-channel sensor device, in response to a trigger signal, stores the current first channel sensing data in a third storage location and stores the current second channel sensing data in the storage location indicated by the state of the current storage location flag bit.
[0007] The multi-channel sensor device responds to the first read command by outputting the first channel sensing data stored in the third storage location, and switches the current state of the storage location flag bit to another state;
[0008] The multi-channel sensor device responds to the second read command by outputting the second channel sensing data stored at the target data output location.
[0009] In one possible implementation, after the multi-channel sensor device switches the current state of the storage location flag to another state, it stores the current second channel sensing data at the storage location indicated by the state after the storage location flag is switched, in response to a trigger signal, and outputs the current second channel sensing data in response to a third read instruction.
[0010] In one possible implementation, it further includes: a locking controller; the locking controller is configured with a storage location flag; the locking controller, in response to a first read instruction, switches the current state of the storage location flag to another state.
[0011] One possible implementation also includes an output module;
[0012] The output module is connected to the first storage location, the second storage location, and the third storage location;
[0013] The output module responds to a first read command by outputting the first channel sensing data stored in the third storage location, and responds to a second read command by outputting the second channel sensing data stored in the target data output location.
[0014] In one possible implementation, there are multiple second channels;
[0015] Each second channel has a first storage location and a second storage location; each second channel shares the storage location flag bit.
[0016] In one possible implementation, both the first and second storage locations are registers.
[0017] In one possible implementation, the number of the second channel is one; the multi-channel sensor is a dual-axis MEMS accelerometer.
[0018] Secondly, embodiments of the present invention provide an asynchronous reading method for multi-channel sensor data, which includes a storage location flag bit having a first state and a second state; in the first state, it indicates writing to a first storage location and using the second storage location as the target data output location; in the second state, it indicates writing to a second storage location and using the first storage location as the target data output location.
[0019] The method includes:
[0020] In response to the trigger signal, the current first channel sensing data is stored in the third storage location, and the current second channel sensing data is stored in the storage location indicated by the state of the current storage location flag bit.
[0021] In response to the first read command, the first channel sensing data stored in the third storage location is output, and the current state of the storage location flag is switched to another state;
[0022] In response to a second read command, the second channel sensor data stored at the target data output location is output.
[0023] In one possible implementation, after switching the current state of the storage location flag to another state, the method further includes:
[0024] In response to the trigger signal, the current second channel sensing data is stored at the storage location indicated by the state after the storage location flag is switched;
[0025] In response to the third read command, the current second channel sensor data is output.
[0026] In one possible implementation, there are multiple second channels; each second channel has a first storage location and a second storage location; each second channel shares the storage location flag bit; the second channel sensing data stored at the target data output location is output in response to the second read command, including:
[0027] In response to the second read command, the preset priority of each second channel is obtained;
[0028] According to the preset priority order of each second channel, the second channel sensing data stored at the target data output position of each second channel is output sequentially.
[0029] This invention provides an asynchronous data reading method for a multi-channel sensor device. By setting a storage location flag and two storage locations in the second channel, when one storage location stores real-time acquired second-channel sensor data, the other storage location latches data as the target data output location. When a acquisition signal is triggered, the third storage location stores first-channel data, and the storage location indicated by the current flag stores second-channel data. When it is necessary to output synchronously acquired data from both channels, in response to a first read command, the first-channel data in the third storage location is output, and the flag state is switched, causing one storage location in the second channel to latch the target data and the other to store real-time second-channel sensor data. When it is necessary to output second-channel data subsequently, in response to a second read command, the latched target data is output. This invention provides a method by setting two storage locations with opposite states in the second channel and triggering the state switching and storage location change function only during the first read command. One storage location stores newly acquired data in real-time without interrupting acquisition, while the other storage location retains the target data acquired synchronously with the first channel for subsequent output. The output process of the latched target data is not interfered with by newly acquired data, avoiding overwriting. It ensures that each channel can store real-time updated acquisition data, achieving multi-channel acquisition synchronization, and also ensures that data acquired at the same historical moment can be output asynchronously, achieving time synchronization of data acquisition from each channel of the multi-channel sensor with serial bus communication in time-division output. Attached Figure Description
[0030] Figure 1 This is a schematic diagram of the structure of a multi-channel sensor device provided in an embodiment of the present invention;
[0031] Figure 2 This is a flowchart illustrating the data reading process when Y_LOCK is 0, as provided in an embodiment of the present invention.
[0032] Figure 3 This is a flowchart of the data reading process when Y_LOCK is 1, provided in an embodiment of the present invention.
[0033] Figure 4 This is a waveform diagram of data reading provided in an embodiment of the present invention;
[0034] Figure 5 This is a flowchart illustrating the implementation of an asynchronous reading method for multi-channel sensor data provided in an embodiment of the present invention. Detailed Implementation
[0035] To enable those skilled in the art to better understand this solution, the technical solutions in the embodiments of this solution will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this solution, not all of them. Based on the embodiments of this solution, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this solution.
[0036] The term "comprising" and any other variations thereof in the specification, claims, and accompanying drawings of this invention mean "including but not limited to," and are intended to cover a non-exclusive inclusion, not limited to the examples listed herein. Furthermore, the terms "first" and "second," etc., are used to distinguish different objects, not to describe a specific order.
[0037] The implementation of the present invention will be described in detail below with reference to the accompanying drawings:
[0038] Multichannel sensors simultaneously acquire sensing data from multiple channels. Data acquired by each channel can be temporarily stored in a specific memory location. Multichannel sensors typically employ serial communication, a low-cost method with fewer transmission lines. Serial communication is a data transmission method that transmits data bit-by-bit, time-division multiplexed, from one device to another via one or a few shared transmission lines.
[0039] To ensure the timeliness of sensor data, data acquisition for each channel is performed in real time. This means that the data in each channel's register is typically updated in real-time, with each register storing only data acquired from a single channel, and the latest acquired data continuously overwriting older data. Multi-channel sensors use serial communication, which means they usually only have a single output port. Serial communication can only transmit data from one channel at a time. Therefore, if the first channel is read at one moment, and the second channel is read at another moment, the data in the second channel has already changed. When the interval between two reads is short, the data acquisition time between the two channels is also short, and in ordinary application scenarios, it can be considered as acquired at the same moment, with minimal impact on the application. However, in special scenarios, it is necessary to cross-verify multiple synchronously acquired data points, and the existing method can no longer meet the requirements.
[0040] This invention, through setting a storage location flag and two storage locations in the second channel, and changing the storage location by switching the flag state, enables asynchronous reading of multi-channel data collected at the same time, thus solving the problem of asynchronous data output from different channels of a multi-channel sensor using serial bus communication.
[0041] This invention provides a multi-channel sensor device with a storage location flag having a first state and a second state. In the first state, it indicates writing to a first storage location and designates a second storage location as the target data output location. In the second state, it indicates writing to a second storage location and designates the first storage location as the target data output location. The multi-channel sensor device, in response to a trigger signal, stores the current first-channel sensing data in a third storage location and stores the current second-channel sensing data in the storage location indicated by the current storage location flag's state. In response to a first read command, the multi-channel sensor device outputs the first-channel sensing data stored in the third storage location and switches the current state of the storage location flag to another state. In response to a second read command, the multi-channel sensor device outputs the second-channel sensing data stored in the target data output location.
[0042] In some embodiments, the multi-channel sensor can simultaneously acquire multiple independent sensing data through multiple parallel acquisition channels. For example, it can simultaneously measure multiple physical quantities, such as temperature, humidity, and pressure; or it can measure the same physical quantity at multiple measurement points, such as temperatures at multiple different locations, or multiple dimensions of the same physical quantity, such as X / Y / Z triaxial acceleration.
[0043] For example, the channel includes a first channel and a second channel. For example, the number of second channels is at least one.
[0044] In some embodiments, the multichannel sensor includes a multichannel sensing unit and an ASIC circuit.
[0045] For example, a multi-channel sensing unit can be a MEMS (Micro-Electro-Mechanical System) based sensing unit.
[0046] For example, an ASIC (Application-Specific Integrated Circuit) circuit includes a memory cell, which may include multiple memory locations. For instance, a memory cell may include multiple registers.
[0047] In some embodiments, a storage location flag is provided, which has a first state and a second state; in the first state, it indicates that the data is written to a first storage location and the second storage location is used as the target data output location; in the second state, it indicates that the data is written to a second storage location and the first storage location is used as the target data output location.
[0048] For example, an ASIC circuit may include a storage location flag bit with a first state and a second state. For instance, the ASIC circuit may use a register to store the storage location flag bit. Alternatively, a single bit can represent both states: 0 for the first state and 1 for the second state. Furthermore, the storage location flag bit can also be a variable in software code, meaning it can be implemented in either hardware or software.
[0049] For example, the second channel has a first storage location and a second storage location.
[0050] It should be noted that the storage location flag indicates under what circumstances the second channel sensor data will be stored in which of the first and second storage locations?
[0051] First, let's describe the first state. For example, in the first state, it is instructed to write to the first storage location and use the second storage location as the target data output location. For example, in the first state, it is instructed to write the real-time acquired second-channel sensor data to the first storage location; that is, the first storage location is in an unlocked state, and new data acquired by the second channel continuously overwrites the old data in the first storage location.
[0052] For example, in the first state, the second storage location is designated as the target data output location. It should be noted that the target data is the sensor data from the second channel among the synchronously acquired data from all channels. In the first state, the target data is stored in the second storage location, which serves as the target data output location. That is, the second memory is in a locked state; while the first storage location is updating data in real time, the second memory latches the target data and does not update. When synchronously acquired data needs to be read, the host computer can read it from the second storage location at any time.
[0053] Next, let's describe the second state. For example, in the second state, it is instructed to write to the second storage location, and the first storage location is used as the target data output location. For example, in the first state, it is instructed to write the real-time acquired second-channel sensor data to the second storage location; that is, the second storage location is in an unlocked state, and new data acquired by the second channel continuously overwrites the old data in the second storage.
[0054] For example, in the first state, the instruction is to use the first storage location as the target data output location. It should be noted that the target data is the sensor data of the second channel among the synchronously acquired data from all channels that needs to be read. In the first state, the target data is stored in the first storage location, which serves as the target data output location. That is, the first memory is in a locked state; while the second storage location is updating data in real time, the first memory latches the target data and does not update. When it is necessary to read the synchronously acquired data, the host computer can read it from the first storage location at any time.
[0055] The first and second states have been explained above. The following explains under what circumstances the multi-channel sensor switches states and stores and outputs data.
[0056] The text above mentions that multi-channel sensor devices can include ASIC circuits. Here, ASIC circuits can be one method of hardware-based state switching, data storage, and output. Alternatively, they can be implemented using software combined with physical storage. This is not a limitation; the focus here is on the switching logic.
[0057] In some embodiments, the multi-channel sensor device stores the current first channel sensing data in a third storage location in response to a trigger signal, and stores the current second channel sensing data in the storage location indicated by the state of the current storage location flag bit.
[0058] For example, the trigger signal can be a clock pulse with a fixed sampling period or an external command issued by a host computer. The trigger signal is used to trigger a synchronous storage operation, simultaneously storing the sensing data of the first and second channels.
[0059] For example, the current data of the first channel is simultaneously stored in a dedicated third storage location, and the current data of the second channel is stored in the storage location specified by the flag bit, which could be either the first or the second storage location. The storage actions of all channels are triggered by the same trigger signal to ensure that the storage of data across multiple channels is synchronized.
[0060] The third storage location is a dedicated storage area for the first channel, storing only data from the first channel. It's important to note that the first channel can contain only one storage location (the third storage location) or two storage locations, such as a third and a fourth storage location. In other words, the first channel can have a different or the same structure as the second channel. When the first channel can have a different structure than the second channel, the definitions of the first and second channels within each channel are predetermined. When the first channel can have the same structure as the second channel, any channel can be designated as the first channel, and the others as the second channels. The specific number of storage locations included in the first channel is not limited here; this example only illustrates the inclusion of a third storage location.
[0061] The storage location flag is a switch that controls the storage target location of the second channel. It has two states: the first state can be high, indicating that the real-time acquired second channel data is stored in the first storage location; the second state can be low, indicating that the second channel data is stored in the second storage location.
[0062] For example, the current data includes the current first channel sensor data and the current second channel sensor data. The current data represents the latest sensor data that each channel has just acquired at the moment the trigger signal arrives.
[0063] When the trigger signal arrives, the sensor performs two storage operations simultaneously: the current data of the first channel is directly written to the third storage location without checking the flag bit; the current data of the second channel is first checked for the current state of the storage location flag bit, and then written to the storage location indicated by the flag bit. For example, if the flag bit is in the first state, the second channel data is stored in the first storage location, and the second state is stored in the second storage location.
[0064] The flag indicates the storage location of the second channel. Subsequently, by switching the flag, the two storage locations can take turns to store new data and output old data, thus preventing the old data from being overwritten by the new data during output.
[0065] The above describes the synchronous storage in response to the trigger signal; the following describes the reading and output of data.
[0066] In some embodiments, the multi-channel sensor device responds to a first read command by outputting the first channel sensing data stored in the third storage location and switching the current state of the storage location flag to another state.
[0067] The first read command indicates that data synchronously acquired from each channel needs to be read. The first read command triggers two core actions: outputting the data of the first channel and switching the state of the flag bit of the storage location of the second channel. This completes the reading of the data of the first channel and prepares for the storage and output of the data of the second channel in the next step.
[0068] When the first read command arrives, the sensor simultaneously outputs the first channel data and switches the flag state. The third storage location stores the first channel data synchronously acquired when the last trigger signal arrived. For example, outputting the first channel data means reading the first channel data cached in the third storage location and transmitting it to the host computer through the output port, ensuring that the host computer obtains the first channel data at the moment of synchronous acquisition.
[0069] The current state of the storage location flag is flipped, transitioning from the first state to the second state, or vice versa. It's important to note that, on one hand, before the state transition, a storage location in the second channel already stores data synchronously acquired with the first channel—the target data. At this time, this storage location is unlocked. After the state transition, this storage location switches to a locked state, meaning it latches the target data, doesn't update it, and awaits subsequent reading. On the other hand, storage locations that were previously locked before the state transition become unlocked after the transition, preparing for the next trigger signal sampling, continuing to respond to subsequent trigger signals, and allowing new data from the second channel to be stored in unlocked storage locations.
[0070] The above describes the output of the first channel data, as well as the state transition and latching of the second channel data. The following describes the output latching of the second channel data.
[0071] In some embodiments, the multichannel sensor device outputs second channel sensing data stored at the target data output location in response to a second read command.
[0072] The second read instruction is specifically used to extract the latched synchronous second channel data, i.e., the target data. At this time, the target data output position is the storage position indicated by the switching of the storage position flag bit, which stores the second channel data acquired in this round of synchronous acquisition.
[0073] It should be noted that the second read instruction follows the first read instruction. Typically, the second read instruction is executed in the next cycle after the first read instruction. Furthermore, the second read instruction may be executed one or more read / write pulse cycles after the first read instruction.
[0074] This invention embodiment sets a storage location flag and two storage locations in the second channel. When one storage location stores real-time acquired second-channel sensor data, the other storage location latches data as the target data output location. When a acquisition signal is triggered, the third storage location stores first-channel data, and the storage location indicated by the current flag stores second-channel data. When it is necessary to output synchronously acquired data from both channels, the first channel data in the third storage location is output in response to the first read command. Simultaneously, the flag state is switched, causing one storage location in the second channel to latch the target data and the other storage location to store real-time second-channel sensor data. When it is necessary to output second-channel data subsequently, the latched target data is output in response to the second read command. This invention embodiment sets two storage locations with opposite states in the second channel and triggers the state switching and storage location change function only during the first read command. One storage location stores newly acquired data in real time without interrupting acquisition, while the other storage location retains the target data acquired synchronously with the first channel for subsequent output. The output process of the latched target data is not affected by newly acquired data, avoiding overwriting. It ensures that each channel can store real-time updated acquisition data, achieving multi-channel acquisition synchronization, and also ensures that data acquired at the same historical moment can be output asynchronously, achieving time synchronization of data acquisition from each channel of the multi-channel sensor with serial bus communication in time-division output.
[0075] In serial communication data output scenarios of multi-channel sensors, traditional techniques often employ a main register and auxiliary register scheme to achieve asynchronous output of synchronously acquired data. Two registers are used to handle data acquisition and storage, and data output, respectively, with the acquired data copied from the main register to the auxiliary register for output. However, this scheme suffers from significant power consumption waste: during data transfer, the memory read / write circuitry and bus transmission circuitry need to operate continuously. Migrating data from one storage unit to another consumes a large amount of energy to drive transistor switching, while simultaneously maintaining the stability of the bus transmission signal, resulting in high power consumption during data switching and output phases. Especially for multi-channel sensors, where multiple channels need to perform the aforementioned data transfer operation, power consumption increases exponentially with the number of channels, limiting the sensor's application in power-sensitive scenarios.
[0076] To address the power consumption drawbacks of the traditional solutions, this invention significantly reduces power consumption by switching between the dual storage locations of the second channel and switching between states where no data is being transferred.
[0077] The dual storage states are mutually exclusive, eliminating the need for data transfer. For each second channel, this invention configures two mutually exclusive storage locations. Each memory has only two operating modes: locked and unlocked. At any given time, the states of the two memories are mutually exclusive. When switching between storage and output roles is required, a state machine can control the state flipping of the two memories. The unlocked memory, which stores data from the synchronization point, is switched to a locked state to prevent the target data from being overwritten for subsequent output. Simultaneously, the previously idle locked memory is switched to an unlocked state to store new data acquired in real-time.
[0078] The aforementioned state switching process only changes the logical operating state of the memory, essentially involving register-level signal toggling. It does not involve data copying, migration, or bus transmission operations. At the target time, data does not need to be transferred from one memory to another; it can be retained in the original memory cell simply through state locking until a read command is executed and output is completed. In this embodiment of the invention, state switching only requires triggering the internal state control logic of the memory. Its energy consumption mainly comes from the level toggling of logic gates, and the energy consumption of logic state switching in digital circuits is far lower than the energy consumption of data transport.
[0079] In one possible implementation, after the multi-channel sensor device switches the current state of the storage location flag to another state, it stores the current second channel sensing data at the storage location indicated by the state after the storage location flag is switched, in response to a trigger signal, and outputs the current second channel sensing data in response to a third read instruction.
[0080] The multi-channel sensor device of the present invention can store new data in response to a trigger signal and output real-time data in response to a third read command after the flag bit is switched, thus simultaneously meeting the requirements of synchronous data reading and asynchronous data reading.
[0081] The multi-channel sensor device is pre-configured with three read commands. The first read command triggers the synchronous data output and storage location flag switching of the first channel; the second read command triggers the historical synchronous data output of the second channel; and the third read command triggers the real-time asynchronous data output. The first and second read commands work together to achieve synchronous data reading, applicable to a few high-precision scenarios such as fault diagnosis and status calibration. The third read command enables asynchronous data reading, applicable to most routine scenarios such as general status monitoring.
[0082] Once the storage location flag has switched states, each subsequent trigger signal received by the sensor will store the newly acquired second-channel data in the storage location indicated by the flag switch. This storage location is currently unlocked, allowing it to receive and update the latest acquired data in real time without overwriting previously latched synchronous data. When only real-time second-channel data needs to be read, the host computer issues a third read command. Upon responding to this command, the sensor directly outputs the current second-channel sensor data stored in the storage location indicated by the flag switch.
[0083] Furthermore, each time a trigger signal is received, the sensor stores the newly acquired data from the second channel to the storage location indicated by the current state of the storage location flag. When synchronous data needs to be read again, new synchronous data from the first channel can be output via the first read command, and the flag state can be switched. For example, the second storage location can latch the new synchronous data, while the first storage location switches to storing real-time data, thus achieving cyclical coordination between synchronous and asynchronous data.
[0084] This invention locks the historical synchronous data storage location and clarifies the new data storage location by switching flag bits. This ensures the reading of synchronous data while simultaneously enabling real-time asynchronous data reading on the second channel through trigger signals to store new data and third reading commands to read new data. Synchronous data reading is suitable for a few high-precision analysis scenarios, while asynchronous data reading is suitable for most conventional monitoring scenarios. The two reading modes do not interfere with each other. While ensuring data timeliness and synchronization, it also boasts the advantage of low power consumption without data transfer, thus improving the sensor's scenario adaptability.
[0085] In one possible implementation, it further includes: a locking controller; the locking controller is configured with a storage location flag; the locking controller, in response to a first read instruction, switches the current state of the storage location flag to another state.
[0086] It should be noted that the lock controller is the physical carrier that stores the position flag bit. It is specifically used to store the current state of the flag bit and to complete the state switch in response to the first read command. For example, the lock controller can be a single-bit register.
[0087] The input terminal of the locking controller receives the first read command, such as a level pulse signal sent by the host computer; the output terminal sends the current status signal of the flag bit to the first storage location and the second storage location to control the mutual exclusion switching of the locked / unlocked states of the two.
[0088] For example, when the first read instruction is triggered, the lock controller switches the flag state, synchronously controls the dual storage location function to switch roles, and executes in parallel with the first channel data output action.
[0089] In one possible implementation, an output module is further included; the output module is connected to a first storage location, a second storage location, and a third storage location; the output module responds to a first read instruction by outputting the first channel sensing data stored in the third storage location, and responds to a second read instruction by outputting the second channel sensing data stored in the target data output location.
[0090] For example, the input terminals of the output module are connected to the output terminals of the first storage location, the second storage location, and the third storage location, respectively. The output terminal of the output module is connected to the serial communication port of the sensor, meaning that the sensing data from all channels must be aggregated by the output module before being transmitted to the host computer via the serial port.
[0091] The output module parses various read commands issued by the host computer, such as the first, second, and third read commands, extracts the target data from the corresponding storage location according to the command type, and transmits the data to the host computer in a time-division manner according to the timing requirements of the serial communication protocol.
[0092] In one possible implementation, there are multiple second channels; each second channel has a first storage location and a second storage location; each second channel shares the storage location flag bit.
[0093] For example, the number of second channels is greater than or equal to 2, meaning the multi-channel sensor has greater than or equal to 3 channels. Each second channel is independently configured with a dedicated first storage location and a second storage location. The two storage locations of each second channel form a group. In each group of storage locations, at any given time, one is in an unlocked state, storing real-time data, while the other is in a locked state, latching synchronous data.
[0094] Furthermore, all second channels share a storage location flag. The state of the flag directly and synchronously controls the storage location function of all second channels: when the flag is in the first state, the first storage location of all second channels switches to the unlocked state, storing real-time data, and the second storage location switches to the locked state, latching synchronous data; when the flag is in the second state, the first storage location of all second channels switches to the locked state, latching synchronous data, and the second storage location switches to the unlocked state, storing real-time data. Although all second channels share the flag, each set of storage locations is channel-specific, ensuring that data storage does not interfere with each other and guaranteeing data integrity.
[0095] In one possible implementation, both the first and second storage locations are registers.
[0096] Registers are basic logic units in digital circuits used to temporarily store binary data, and they are characterized by high-speed read / write and simple structure.
[0097] In one possible implementation, the number of the second channel is one; the multi-channel sensor is a dual-axis MEMS accelerometer.
[0098] The following uses a dual-axis MEMS accelerometer as an example to illustrate the concept of an embodiment of the present invention.
[0099] Figure 1 This is a schematic diagram of the structure of a multi-channel sensor device provided in an embodiment of the present invention; see reference. Figure 1 It includes a dual-axis sensing unit, a locking controller, registers, an A / D conversion filter, and I / O outputs.
[0100] This invention, through the implementation of a locking controller (state machine) and a set of registers, enables low-cost and low-power reading of multi-axis sensor data at the same time and the current time. When the registers sample data, the locked registers remain unchanged, with only two sets of registers experiencing data flipping, thus reducing dynamic power consumption.
[0101] Taking a dual-axis sensor using the SPI intra-frame protocol as an example, the output control circuit refers to... Figure 1 CS is the chip select signal. When this signal is low, the DATA register samples the sensor data. Y_LOCK is the lock controller, used to lock the sensor's Y-axis sampled data. Y_LOCK changes when a command to read the X-axis is received from the host computer. When Y_LOCK is 0, only DATA_Y1 is allowed to sample data, while DATA_Y0 remains locked. When Y_LOCK is 1, only DATA_Y0 is allowed to sample data, while DATA_Y1 remains locked. The locked DATA_Y data is the Y-axis data at the same moment when the X-axis is read; the unlocked DATA_Y is the Y-axis data at the current moment.
[0102] As the X-axis data is read, Y_LOCK changes dynamically, and DATA_Y0 and DATA_Y1 repeatedly switch between the Y-axis data at the same moment when the X-axis is being read and the current Y-axis data.
[0103] When outputting Y-axis data, the IO output module obtains the corresponding data and completes the output based on the data type requested by the host computer and Y_LOCK as the data type flag.
[0104] The specific operation process is as follows:
[0105] Figure 2 This is a flowchart illustrating the data reading process when Y_LOCK is 0, as provided in an embodiment of the present invention. Figure 3 This is a flowchart illustrating the data reading process when Y_LOCK is 1, provided in an embodiment of the present invention. Figure 4This is a waveform diagram of data reading provided in an embodiment of the present invention; see reference. Figure 2 , Figure 3 , Figure 4 When Y_LOCK is 0, DATA_Y0 is locked and represents the target data to be captured, while DATA_Y1 is unlocked and represents the currently acquired real-time data. During communication, the chip select signal CS is pulled low, and data sampling of the signal chain is completed on the falling edge. That is, register DATA_X samples data from channel CHN_X, DATA_Y1 samples data from channel CHN_Y, and DATA_Y0 remains unchanged.
[0106] Under these conditions, if the sensor subsequently receives an instruction from the host computer to read the current output of the Y channel, Y_LOCK remains unchanged, and the sensor outputs data DATA_Y1; if the sensor receives an instruction from the host computer to read the captured data of the Y channel, Y_LOCK remains unchanged, and the sensor outputs data DATA_Y0; if the sensor receives an instruction from the host computer to read the current data of the X channel, Y_LOCK becomes 1, and the sensor outputs data DATA_X. At this time, DATA_Y1 is locked and is captured data, which is the same data as the currently output DATA_X at the same moment. DATA_Y0 is unlocked and updated when CS is pulled low next time.
[0107] When Y_LOCK is 1, DATA_Y1 is locked and contains captured data, while DATA_Y0 is unlocked and contains current data. During communication, the chip select signal CS is pulled low, and data sampling of the signal chain is completed on the falling edge. That is, register DATA_X samples data from channel CHN_X, DATA_Y0 samples data from channel CHN_Y, and DATA_Y1 remains unchanged.
[0108] Under these conditions, if the sensor subsequently receives an instruction from the host computer to read the current output of the Y channel, Y_LOCK remains unchanged, and the sensor outputs DATA_Y0 data; if the sensor receives an instruction from the host computer to read the captured data of the Y channel, Y_LOCK remains unchanged, and the sensor outputs DATA_Y1 data; if the sensor receives an instruction from the host computer to read the current data of the X channel, Y_LOCK becomes 0, and the sensor outputs DATA_X data. At this time, DATA_Y0 is locked and is captured data, which is the same data as the currently output DATA_X at the same moment. DATA_Y1 is unlocked and updated when CS is pulled low next time.
[0109] Figure 5 This is a flowchart illustrating the implementation of an asynchronous reading method for multi-channel sensor data provided in an embodiment of the present invention; see also... Figure 5This invention provides an asynchronous reading method for multi-channel sensor data, which includes a storage location flag bit having a first state and a second state. In the first state, it indicates writing to a first storage location and using a second storage location as the target data output location. In the second state, it indicates writing to a second storage location and using the first storage location as the target data output location. The method includes:
[0110] Step 501: In response to the trigger signal, store the current first channel sensing data in the third storage location, and store the current second channel sensing data in the storage location indicated by the state of the current storage location flag bit;
[0111] Step 502: In response to the first read instruction, output the first channel sensing data stored in the third storage location, and switch the current state of the storage location flag bit to another state;
[0112] Step 503: In response to the second read command, output the second channel sensing data stored at the target data output location.
[0113] This invention embodiment sets a storage location flag and two storage locations in the second channel. When one storage location stores real-time acquired second-channel sensor data, the other storage location latches data as the target data output location. When a acquisition signal is triggered, the third storage location stores first-channel data, and the storage location indicated by the current flag stores second-channel data. When it is necessary to output synchronously acquired data from both channels, the first channel data in the third storage location is output in response to the first read command. Simultaneously, the flag state is switched, causing one storage location in the second channel to latch the target data and the other storage location to store real-time second-channel sensor data. When it is necessary to output second-channel data subsequently, the latched target data is output in response to the second read command. This invention embodiment sets two storage locations with opposite states in the second channel and triggers the state switching and storage location change function only during the first read command. One storage location stores newly acquired data in real time without interrupting acquisition, while the other storage location retains the target data acquired synchronously with the first channel for subsequent output. The output process of the latched target data is not affected by newly acquired data, avoiding overwriting. It ensures that each channel can store real-time updated acquisition data, achieving multi-channel acquisition synchronization, and also ensures that data acquired at the same historical moment can be output asynchronously, achieving time synchronization of data acquisition from each channel of the multi-channel sensor with serial bus communication in time-division output.
[0114] In one possible implementation, after switching the current state of the storage location flag to another state, the method further includes: in response to a trigger signal, storing the current second channel sensing data at the storage location indicated by the state after the storage location flag is switched; and outputting the current second channel sensing data in response to a third read instruction.
[0115] In practical applications, the host computer often has different processing priorities for multi-channel data. For example, in industrial equipment monitoring, key physical quantities such as vibration and pressure need to be analyzed first, while auxiliary quantities such as temperature and humidity can be processed later.
[0116] In one possible implementation, there are multiple second channels; each second channel has a first storage location and a second storage location; each second channel shares the storage location flag bit; the step of outputting the second channel sensing data stored at the target data output location in response to the second read instruction includes: in response to the second read instruction, obtaining the preset priority of each second channel; and sequentially outputting the second channel sensing data stored at the target data output location of each second channel according to the preset priority order of each second channel.
[0117] For example, a preset priority is set for each second channel. For example, the priority can be modified through register configuration or communication protocol instructions. For instance, the host computer can set priorities based on the urgency or importance of the channel data. For example, a channel monitoring the acceleration of core components of the equipment has a higher priority than an ambient temperature channel, and a fault diagnosis-related channel has a higher priority than a regular monitoring channel.
[0118] For example, the second read instruction triggers the output module to extract all the synchronization data latched at the target data output position of the second channel in batches according to priority.
[0119] Based on the shared storage location flag of multiple second channels, this embodiment of the invention outputs the synchronization data of each second channel in order of priority by preset channel priority, which not only ensures the synchronization and integrity of multi-channel data, but also adapts to the different processing needs of the host computer for different channel data.
[0120] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multi-channel sensor device, characterized in that, It includes a first channel and a second channel; the second channel is provided with a first storage location and a second storage location with opposite states; the second channel is provided with a storage location flag bit, which has a first state and a second state; in the first state, it indicates writing to the first storage location and latches the second storage location as the target data output location; in the second state, it indicates writing to the second storage location and latches the first storage location as the target data output location. The multi-channel sensor device, in response to a trigger signal, stores the current first channel sensing data in the third storage location and stores the current second channel sensing data in the storage location indicated by the state of the current storage location flag bit. The multi-channel sensor device responds to the first read command by outputting the first channel sensing data stored in the third storage location, and switches the current state of the storage location flag bit to another state; The multi-channel sensor device responds to the second read command by outputting the second channel sensing data stored at the target data output location.
2. The multi-channel sensor device as described in claim 1, characterized in that, After the multi-channel sensor device switches the current state of the storage location flag bit to another state, it stores the current second channel sensing data at the storage location indicated by the state after the storage location flag bit is switched, in response to a trigger signal, and outputs the current second channel sensing data in response to a third read command.
3. The multi-channel sensor device as described in claim 1, characterized in that, It also includes: a locking controller; the locking controller is equipped with a storage location flag; In response to the first read command, the locking controller switches the current state of the storage location flag to another state.
4. The multi-channel sensor device as described in claim 1, characterized in that, It also includes an output module; The output module is connected to the first storage location, the second storage location, and the third storage location; The output module responds to a first read command by outputting the first channel sensing data stored in the third storage location, and responds to a second read command by outputting the second channel sensing data stored in the target data output location.
5. The multi-channel sensor device as described in claim 1, characterized in that, The second channel has multiple channels; Each second channel has a first storage location and a second storage location; each second channel shares the storage location flag bit.
6. The multi-channel sensor device as described in claim 1, characterized in that, Both the first and second storage locations are registers.
7. The multi-channel sensor device as described in claim 1, characterized in that, The second channel has one unit. The multi-channel sensor is a dual-axis MEMS accelerometer.
8. An asynchronous reading method for multi-channel sensor data, characterized in that, The multi-channel sensor device includes a first channel and a second channel; the second channel is provided with a first storage location and a second storage location with opposite states; the second channel is provided with a storage location flag bit, which has a first state and a second state; in the first state, it indicates writing to the first storage location and latches the second storage location as the target data output location; In the second state, it indicates that the data should be written to the second storage location, and the first storage location is latched as the target data output location. The method includes: In response to the trigger signal, the current first channel sensing data is stored in the third storage location, and the current second channel sensing data is stored in the storage location indicated by the state of the current storage location flag bit. In response to the first read command, the first channel sensing data stored in the third storage location is output, and the current state of the storage location flag is switched to another state; In response to a second read command, the second channel sensor data stored at the target data output location is output.
9. The asynchronous reading method for multi-channel sensor data as described in claim 8, characterized in that, After switching the current state of the storage location flag to another state, the method further includes: In response to the trigger signal, the current second channel sensing data is stored at the storage location indicated by the state after the storage location flag is switched; In response to the third read command, the current second channel sensor data is output.
10. The asynchronous reading method for multi-channel sensor data as described in claim 8, characterized in that, There are multiple second channels; each second channel has a first storage location and a second storage location. Each second channel shares the aforementioned storage location flag bit; The second channel sensing data stored at the target data output location in response to the second read command includes: In response to the second read command, the preset priority of each second channel is obtained; According to the preset priority order of each second channel, the second channel sensing data stored at the target data output position of each second channel is output sequentially.
Citation Information
Patent Citations
Multi-beam sonar multi-channel seabed echo and movement attitude and position simulator
CN104360340A
Double-channel signal generator and waveform synchronous tracking method thereof
CN106443094A