Multi-channel sensor device and asynchronous data reading method
By setting a storage location flag and dual storage locations in the multi-channel sensor, the problem of asynchronous data time in serial communication is solved, enabling synchronous and asynchronous data reading, reducing power consumption, and making it suitable for various application scenarios.
Patent Information
- Application Number
- CN202511923106.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2045-12-19
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. Sensing data is stored and output in different storage locations by trigger signals and read commands, ensuring synchronous and asynchronous reading of data from each channel.
It achieves time synchronization of multi-channel sensors under serial bus communication, ensuring that data collected by each channel at the same time can be output asynchronously, avoiding data overwriting, reducing power consumption, and is suitable for data reading needs in various scenarios.
Smart Images

Figure CN121349541A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of MEMS sensor, and particularly relates to a multi-channel sensor device and an asynchronous reading method of data. BACKGROUND
[0002] A multi-channel sensor is a sensor with multiple independent acquisition channels. The acquisition actions of multiple channels are completed at the same time, realizing time-aligned synchronous acquisition. For example, each channel of the multi-channel sensor includes a sensitive unit and a register, and each sensitive unit synchronously acquires sensing data and writes the sensing data into the corresponding register in real time. When writing into the register, old data is overwritten to ensure that the register always stores the current latest sensing data.
[0003] The multi-channel sensor is usually in a serial communication mode, that is, the data stored in the registers of the channels can be output asynchronously in time division. For example, when the multi-channel sensor reads and outputs only single-axis data, the output is usually the current time data updated in real time on the axis. However, for some application scenarios, the host computer requires to read the multi-axis data of the sensor at the same time. For example, when detecting the collision of a vehicle, the X-axis and Y-axis data at the same time are read and checked with each other to avoid the output of incorrect data caused by the single-point failure of the sensor, so that the airbag is misfired. Since the data of each channel is output asynchronously in time division in the serial communication mode, after the data of the first channel is output, the data of the other channels has been updated in real time, resulting in that the data of the other channels output subsequently is not synchronized with the data of the first channel. SUMMARY
[0004] Embodiments of the present application provide a multi-channel sensor device and an asynchronous reading method of data, to solve the problem of time asynchronization of the data of each channel output in time division by the multi-channel sensor in the serial bus communication.
[0005] In a first aspect, embodiments of the present application provide a multi-channel sensor device, which is provided with a storage position flag bit having a first state and a second state. When the first state is indicated, a first storage position is written into, and a second storage position is taken as a target data output position. When the second state is indicated, the second storage position is written into, and the first storage position is taken as the target data output position. The multi-channel sensor device stores current first-channel sensing data in a third storage position in response to a trigger signal, and stores current second-channel sensing data in the storage position indicated by the current state of the storage position flag bit. The multi-channel sensor device outputs the first-channel sensing data stored in the third storage position in response to a first reading instruction, and switches the current state of the storage position flag bit to another state. The multi-channel sensor device outputs the second-channel sensing data stored in the target data output position in response to a second reading instruction.
[0006] In a possible implementation, the multi-channel sensor device, after switching the current state of the storage location flag bit to another state, stores the current second channel sensing data in the storage location indicated by the state of the storage location flag bit after switching in response to a trigger signal, and outputs the current second channel sensing data in response to a third read instruction.
[0007] In a possible implementation, the multi-channel sensor device further comprises a lock controller, and the storage location flag bit is arranged in the lock controller; and the lock controller switches the current state of the storage location flag bit to another state in response to a first read instruction.
[0008] In a possible implementation, the multi-channel sensor device further comprises 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 outputs the first channel sensing data stored in the third storage location in response to a first read instruction, and outputs the second channel sensing data stored in the target data output location in response to a second read instruction.
[0009] In a possible implementation, the second channel is multiple. Each second channel is provided with a first storage location and a second storage location; and the storage location flag bit is shared by the second channels.
[0010] In a possible implementation, the first storage location and the second storage location are registers.
[0011] In a possible implementation, the number of second channels is one; and the multi-channel sensor is a dual-axis MEMS acceleration sensor.
[0012] In a second aspect, an embodiment of the present application provides an asynchronous reading method of multi-channel sensing data, a storage location flag bit is arranged, and the storage location flag bit has a first state and a second state; when the first state is indicated, the first storage location is written, and the second storage location is used as a target data output location; when the second state is indicated, the second storage location is written, and the first storage location is used as a target data output location. The method comprises: In response to a trigger signal, current first channel sensing data is stored in a third storage location, and current second channel sensing data is stored in a storage location indicated by the current state of the storage location flag bit; In response to a first read instruction, the first channel sensing data stored in the third storage location is output, and the current state of the storage location flag bit is switched to another state; output the second channel sensing data stored in the target data output position in response to the second read instruction.
[0013] In a possible implementation, after switching the current state of the storage position flag bit to another state, the method further comprises: storing the current second channel sensing data in the storage position indicated by the state of the storage position flag bit after switching in response to the trigger signal; outputting the current second channel sensing data in response to the third read instruction.
[0014] In a possible implementation, the second channel is multiple; each second channel is provided with a first storage position and a second storage position; the second channels share the storage position flag bit; and the outputting the second channel sensing data stored in the target data output position in response to the second read instruction comprises: obtaining preset priorities of the second channels in response to the second read instruction; outputting the second channel sensing data stored in the target data output position of each second channel in the order of the preset priorities of the second channels.
[0015] The embodiment of the present application provides a multi-channel sensor device and an asynchronous reading method of data, by setting a storage position flag bit and two storage positions in the second channel, when one storage position stores real-time collected second channel sensing data, the other storage position latches data as target data output position. When a collection trigger signal is triggered, a third storage position stores first channel data, and the storage position indicated by the current flag bit stores second channel data. When synchronous collection data of two channels needs to be output, in response to a first read instruction, the first channel data in the third storage position is output, and the state of the flag bit is switched, so that one storage position of the second channel is switched to latch target data, and the other storage position is switched to store real-time second channel sensing data. When second channel data needs to be output subsequently, in response to a second read instruction, the latched target data is output. The embodiment of the present application sets two storage positions with opposite states in the second channel, and only triggers state switching and changes the function of the storage position at the first read instruction. One storage position stores newly collected data in real time, without interrupting collection, and the other storage position retains target data collected synchronously with the first channel for subsequent output. The output process of the latched target data is not disturbed by newly collected data, and the latched target data is not covered. The embodiment of the present application ensures that each channel can store real-time updated collected data, realizes synchronous multi-channel collection, ensures that data collected at the same historical moment can be output asynchronously, and realizes time synchronization of data collection of each channel in the multi-channel sensor output by serial bus communication. BRIEF DESCRIPTION OF DRAWINGS
[0016] Figure 1This is a schematic diagram of the structure of a multi-channel sensor device provided in an embodiment of the present invention; 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 of the data reading process when Y_LOCK is 1, provided in an embodiment of the present invention. Figure 4 This is a waveform diagram of data reading provided in an embodiment of the present invention; 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
[0017] 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.
[0018] 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.
[0019] The implementation of the present invention will be described in detail below with reference to the accompanying drawings: 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.
[0020] 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.
[0021] 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.
[0022] 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.
[0023] 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.
[0024] For example, the channel includes a first channel and a second channel. For example, the number of second channels is at least one.
[0025] In some embodiments, the multichannel sensor includes a multichannel sensing unit and an ASIC circuit.
[0026] For example, a multi-channel sensing unit can be a MEMS (Micro-Electro-Mechanical System) based sensing unit.
[0027] 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.
[0028] 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.
[0029] 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.
[0030] For example, the second channel has a first storage location and a second storage location.
[0031] 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?
[0032] 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.
[0033] 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.
[0034] 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.
[0035] 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.
[0036] 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.
[0037] 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.
[0038] 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. 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.
[0039] 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.
[0040] 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.
[0041] 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.
[0042] 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.
[0043] 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.
[0044] 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.
[0045] The above describes the synchronous storage in response to the trigger signal; the following describes the reading and output of data.
[0046] 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.
[0047] 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.
[0048] 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.
[0049] 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.
[0050] 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.
[0051] 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.
[0052] 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.
[0053] 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.
[0054] 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.
[0055] 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.
[0056] 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.
[0057] 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.
[0058] 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.
[0059] 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.
[0060] 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.
[0061] 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.
[0062] 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.
[0063] 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.
[0064] 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.
[0065] 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.
[0066] 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.
[0067] 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.
[0068] 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.
[0069] 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.
[0070] 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.
[0071] 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.
[0072] 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.
[0073] 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.
[0074] 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.
[0075] In one possible implementation, both the first and second storage locations are registers.
[0076] 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.
[0077] In one possible implementation, the number of the second channel is one; the multi-channel sensor is a dual-axis MEMS accelerometer.
[0078] The following uses a dual-axis MEMS accelerometer as an example to illustrate the concept of an embodiment of the present invention.
[0079] 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.
[0080] 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.
[0081] 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.
[0082] 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.
[0083] 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.
[0084] The specific operation process is as follows: 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 4 This 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.
[0085] 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.
[0086] 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.
[0087] 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.
[0088] 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: 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; 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; Step 503: In response to the second read command, output the second channel sensing data stored at the target data output location.
[0089] 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.
[0090] 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.
[0091] 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.
[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; 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.
[0093] 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.
[0094] 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.
[0095] 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.
[0096] 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, A storage location flag is set, which has a first state and a second state; in the first state, it indicates that the data is written to the 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 the second storage location and the first storage location is used 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, A storage location flag is set, which has a first state and a second state; in the first state, it indicates that the data should be written to the first storage location and the second storage location should be used 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 used 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
Water measurement LiDAR multichannel high-speed real-time synchronous acquisition and storage system
CN115902830A
Multi-channel communication method and system
CN116545922A
Multi-channel differential pressure real-time measurement method and system
CN120800645A