A multi-lead sleep monitor lower computer data acquisition and synchronous control system and method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-29
- Publication Date
- 2026-08-11
AI Technical Summary
2、解决不同采样率、不同接口来源的生理信号之间的高精度时间同步问题,保证后续数据分析的准确性;
Smart Images

Figure CN122536931A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical device technology, and in particular to a lower-level data acquisition and synchronization control system and method for a polysomnography monitor. Background Technology
[0002] Polysomnography (PSG) is the "gold standard" for sleep medicine diagnosis. It is used to record and analyze various physiological signals during sleep, including electroencephalography (EEG), electrooculography (EOG), electromyography (EMG), electrocardiography (ECG), blood oxygen saturation, airflow through the mouth and nose, chest and abdominal respiratory movements, body position, and snoring. Accurate time synchronization is the foundation for subsequent sleep staging, respiratory event assessment, and diagnostic conclusions.
[0003] Currently, most polysomnography (PSG) devices used in clinical practice adopt a split design, with sensors connected to the main unit via cables. The main unit is relatively large and must be located close to the bedside. The collected data is typically transmitted to a host computer via wired connections (such as USB or Ethernet). In terms of data acquisition, each sensor operates independently, and the host computer reads the data separately through different interfaces. Time synchronization relies on the host computer software to perform a rough alignment based on the received data. Existing technology has the following drawbacks: 1. Disruption to natural sleep: Numerous cables restrict the subjects' movement, and the strong presence of the main unit makes it difficult for them to enter a natural sleep state, affecting the accuracy of the monitoring results.
[0004] 2. Low data synchronization accuracy: The sampling rates of different sensors vary greatly (e.g., EEG is as high as 250Hz or more, while blood oxygen is usually 1Hz), and there is an uncertain delay in the host computer reading data from each channel. Relying solely on software to receive the time alignment is insufficient to guarantee microsecond or millisecond-level time accuracy, leading to deviations in subsequent sleep staging and respiratory event judgment.
[0005] 3. Poor system scalability: Traditional designs often equip each sensor with an independent interface and driver. Adding a new sensor or changing the sampling parameters requires modifying a lot of low-level code, resulting in high maintenance costs.
[0006] 4. Insufficient data security: Wired transmission is prone to data loss when disconnected, and the activity of subjects is restricted, making it unsuitable for home sleep monitoring scenarios.
[0007] Therefore, there is an urgent need for a lower-level machine system and method that can achieve wireless, high-precision time synchronization, and high-reliability data acquisition. Summary of the Invention
[0008] The technical problem to be solved by this invention is: 1. To achieve miniaturization and wireless operation of polysomnography devices, eliminating cable constraints and improving subject comfort; 2. Solve the problem of high-precision time synchronization between physiological signals from different sampling rates and different interface sources to ensure the accuracy of subsequent data analysis; 3. Simplify system design and improve the reliability and scalability of data acquisition; 4. Ensure data integrity when the network is unstable to avoid data loss due to wireless interruption.
[0009] The technical solution of the present invention is as follows: According to a first aspect of the present invention, a lower-level data acquisition and synchronization control system for a polysomnography monitor is provided, comprising at least: The main control module is used to control data acquisition, timestamp marking, and data transmission. The bioelectric acquisition module includes at least two bioelectric analog front-end chips for synchronously acquiring at least one bioelectric signal from electroencephalography (EEG), electrocardiography (ECG), electrooculography (EOG), and electromyography (EMG). The auxiliary signal acquisition module includes at least one bioelectric analog front-end chip, which is used to simultaneously acquire at least one auxiliary physiological signal from chest and abdominal breathing signals, oral and nasal airflow, nasal pressure, body position and snoring. The real-time clock module, connected to the main control module, is used to provide a reference time. The wireless communication module, connected to the main control module, is used to wirelessly transmit the collected data to the host computer. The local storage module, connected to the main control module, is used for real-time backup of collected data.
[0010] Thus, through modular hardware design, the miniaturization and wireless nature of polysomnography monitoring devices have been achieved, providing a hardware foundation for high-precision time synchronization and dual-channel data backup, improving the system's integration and portability, and allowing subjects to be free from cable constraints and more closely resemble their natural sleep state.
[0011] In some implementations, multiple bioelectric analog front-end chips are connected in a daisy chain manner. The daisy chain connection is as follows: the data output pin of each bioelectric analog front-end chip is connected to the data input pin of the next bioelectric analog front-end chip. The data input pin of the first bioelectric analog front-end chip is driven by the SPI master output of the main control module. The data output pin of the last bioelectric analog front-end chip is connected to the SPI master input of the main control module. The clock pin, chip select pin, and data ready pin of all bioelectric analog front-end chips are connected in parallel.
[0012] Therefore, by utilizing the daisy-chain topology, multiple bioelectric simulation front-end chips can be controlled with only one SPI interface, which greatly reduces the pin occupancy of the main control module, simplifies circuit design, reduces power consumption and size, and at the same time ensures hardware-level synchronous acquisition of multi-channel physiological signals, avoiding time deviation between channels.
[0013] In some implementations, all the bioelectric analog front-end chips in the bioelectric acquisition module form a first daisy chain, which is connected to the main control module through a first SPI interface. The auxiliary signal acquisition module includes multiple bioelectric analog front-end chips, and all the bioelectric analog front-end chips in the auxiliary signal acquisition module form a second daisy chain, which is connected to the main control module through a second SPI interface. The two daisy chains have independent chip select signals. Alternatively, all the bioelectric analog front-end chips in the bioelectric acquisition module and all the bioelectric analog front-end chips in the auxiliary signal acquisition module together form a total daisy chain, which is connected to an SPI interface of the main control module.
[0014] This provides a flexible system architecture option: two independent daisy chains support different sampling rate configurations (such as high sampling rate for bioelectricity and low sampling rate for auxiliary signals), and the program implementation is simple; a single daisy chain saves SPI pin resources and reduces hardware costs; users can choose the optimal solution according to clinical needs and cost budgets, enhancing the system's adaptability and scalability.
[0015] In some implementations, the lower-level data acquisition and synchronization control system of the polysomnography monitor further includes: The blood oxygen acquisition module, connected to the main control module, is used to acquire blood oxygen saturation and pulse rate.
[0016] This increases the ability to collect blood oxygen saturation and pulse rate, enabling the system to monitor blood oxygen parameters simultaneously, meeting the clinical standards for polysomnography, providing more comprehensive physiological indicators for the diagnosis of diseases such as sleep apnea syndrome, and improving the system's clinical applicability.
[0017] In some implementations, the main control module is also used to: simultaneously send the acquired and encapsulated data frames to the host computer via the wireless communication module and write them to the local storage medium via the local storage module, thereby achieving dual-channel parallel processing.
[0018] This enables parallel processing of real-time data monitoring and local backup, satisfying technicians' need for real-time waveform observation while ensuring data integrity. It fundamentally solves the technical challenge of the incompatibility between data integrity and real-time monitoring in traditional solutions, achieving a balance between "zero data loss" and "real-time visibility."
[0019] According to a second aspect of the present invention, a method for data acquisition and synchronization control of a lower-level device in a polysomnography monitor is provided, which can be applied to the aforementioned data acquisition and synchronization control system for a lower-level device in a polysomnography monitor. Specifically, the method includes the following steps: S1. System Initialization: Initialize the peripherals of the main control module, the bioelectric acquisition module, the auxiliary signal acquisition module, the wireless communication module, and the local storage module; S2. Data Acquisition and Timestamp Encapsulation: Collect bioelectric signals and auxiliary signals according to the preset sampling rate. After each acquisition, obtain the current absolute time from the real-time clock module as the timestamp, and package the raw data and timestamp into a data frame. S3, Dual-channel parallel processing: Data frames are simultaneously sent to the host computer via the wireless communication module and written to the local storage medium for real-time backup via the local storage module; S4. Monitoring End and Data Export: After monitoring ends, the backed-up data in the local storage module is uploaded to the host computer to supplement the missing data segments in the wireless transmission.
[0020] Thus, through the closed-loop design of the methodology, the entire process from system initialization to data fusion is automated, which improves the usability and reliability of the system, ensures the integrity and continuity of monitoring data, and reduces the training costs and risk of operator errors.
[0021] In some implementations, the encapsulation format of the data frame in step S2 includes: frame header, timestamp, total number of channels, channel number of each channel, and data payload; the timestamp is the absolute time read from the real-time clock module, accurate to milliseconds.
[0022] Therefore, the unified data frame structure enables the host computer to accurately reconstruct the time sequence of each signal based on the timestamp, without relying on the receiving time for alignment. This provides a standardized input for subsequent data fusion and waveform reconstruction, improving data parsing efficiency and cross-platform compatibility.
[0023] In some implementations, when acquiring bioelectric signals and auxiliary signals in step S2, after an interrupt is triggered by the data-ready pin of the daisy chain, all channel data of all chips in the daisy chain are immediately read at once via SPI DMA, and the current time of the real-time clock module is read as the reference timestamp T_frame for the acquisition cycle at the same time as the DMA transfer is started.
[0024] Therefore, by capturing the synchronization operation of data readiness signals and timestamps at the hardware level, the time error caused by software delays and interrupt response uncertainties is eliminated, achieving high-precision time synchronization at the microsecond level. This ensures the accurate alignment of signals with different sampling rates, such as EEG (250Hz) and blood oxygen (1Hz), and significantly improves the accuracy of sleep stage and respiratory event judgment.
[0025] In some implementations, the dual-channel parallel processing in step S3 adopts a DMA double-buffering mechanism: independent DMA channels are set up for wireless transmission and local storage medium writing respectively. After the data frame is written to two different memory buffers at the same time, DMA transmission is started respectively, without the CPU waiting for the transmission to complete.
[0026] Thus, the DMA double-buffering mechanism enables pipelined parallel processing of data acquisition, wireless transmission, and local writing, eliminating the need for the CPU to wait for transmission completion. This greatly improves the system's data throughput, meets the real-time requirements under high sampling rates in multi-channel environments, and reduces CPU load, reserving processing resources for other tasks (such as waveform display and user interaction).
[0027] In some implementations, when the depth of the wireless communication module's transmission queue exceeds a preset threshold, writing new data frames to the wireless transmission channel is stopped. Instead, data frames are written to the local storage module and the offline period is marked. Wireless transmission is automatically resumed after the network is restored.
[0028] Therefore, the system proactively senses the network health status and dynamically adjusts the data diversion strategy. When the network is unstable or interrupted, local storage is prioritized to completely avoid data loss. After the network is restored, the system automatically retransmits the marked offline data, achieving zero data loss and intelligent resume transmission. This enhances the robustness and reliability of the system in complex clinical environments and avoids repeated patient monitoring due to network fluctuations.
[0029] The beneficial effects of this invention are: 1. High-precision data synchronization: By capturing a unified reference timestamp at the hardware level (reading the absolute time of RTC at the moment of DRDY interrupt trigger), the time error caused by the reading delay of different interfaces is eliminated, enabling microsecond-level precise alignment of signals with different sampling rates such as EEG (250Hz) and blood oxygen (1Hz), which significantly improves the accuracy of sleep stage and respiratory event judgment.
[0030] 2. Wireless connectivity and comfort: Wireless communication modules are used to achieve wireless data transmission, freeing subjects from the constraints of cables and allowing them to move freely in the bedroom environment, which is closer to the real sleep state and improves the reliability of monitoring results.
[0031] 3. High system integration: Utilizing daisy-chain technology, a single SPI interface can manage multiple bioelectric analog front-end chips, supporting the synchronous acquisition of dozens of channels of physiological signals, simplifying circuit design, and reducing power consumption and size.
[0032] 4. Zero data loss: Through dual-channel parallel processing (real-time wireless transmission + local storage media backup), data is still completely written to the local storage media when the network is interrupted, and can be automatically retransmitted after the monitoring ends, fundamentally eliminating data loss caused by network fluctuations.
[0033] 5. Achieving both real-time performance and completeness: The high performance of the main control module, combined with SPI DMA transmission, enables high-speed reading and real-time forwarding of multi-channel data. This not only meets the clinical requirements for real-time waveform display (such as technicians monitoring patient waveforms in real time), but also ensures 100% integrity of the final data, achieving a balance between clinical operational convenience and diagnostic accuracy.
[0034] 6. Strong system robustness: The DMA double buffering mechanism and network status monitoring dynamic traffic distribution strategy enable the system to cope with complex network environments with ease, improving the reliability and stability of the product.
[0035] In summary, this invention discloses a lower-level data acquisition and synchronization control system and method for a polysomnography (PSG) monitor. The system includes a main control module, a bioelectrical signal acquisition module, an auxiliary signal acquisition module, a real-time clock module, a wireless communication module, and a local storage module. Multiple bioelectrical analog front-end chips are connected in a daisy-chain configuration to achieve synchronous acquisition of multi-channel physiological signals. The method includes: system initialization; acquisition of bioelectrical and auxiliary signals, obtaining absolute time from the real-time clock module as a timestamp, and packaging it into data frames; simultaneous transmission of the data frames to the upper-level computer via the wireless communication module and writing them to the local storage medium to achieve dual-channel parallel processing; and uploading backup data to the upper-level computer after monitoring to supplement missing wireless segments. This invention achieves high-precision synchronization by capturing a reference timestamp at the hardware level, and combines dual-channel parallel processing to ensure zero data loss, solving the problems of low synchronization accuracy and easy data loss in traditional devices, and is suitable for clinical sleep monitoring. Attached Figure Description
[0036] Figure 1 This is a structural block diagram of the lower-level data acquisition and synchronization control system of a polysomnography monitor according to one embodiment of the present invention.
[0037] Figure 2 This is a structural block diagram of the first daisy chain according to one embodiment of the present invention.
[0038] Figure 3 This is a flowchart illustrating the operation of a lower-level data acquisition and synchronization control method for a polysomnography monitor according to one embodiment of the present invention. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.
[0040] Example 1 like Figure 1 As shown, this invention discloses a lower-level data acquisition and synchronization control system for a polysomnography monitor. The system includes: a main control module, a bioelectric acquisition module, an auxiliary signal acquisition module, a blood oxygen acquisition module, a wireless communication module, a real-time clock module, and a local storage module.
[0041] The main control module is used to control data acquisition, timestamp marking, and data transmission; The bioelectric acquisition module includes at least two bioelectric analog front-end chips for synchronously acquiring at least one bioelectric signal from electroencephalography (EEG), electrocardiography (ECG), electrooculography (EOG), and electromyography (EMG). The auxiliary signal acquisition module includes at least one bioelectric analog front-end chip, which is used to simultaneously acquire at least one auxiliary physiological signal from chest and abdominal breathing signals, oral and nasal airflow, nasal pressure, body position, and snoring. The blood oxygen acquisition module, connected to the main control module, is used to acquire blood oxygen saturation and pulse rate; The real-time clock module is connected to the main control module and is used to provide a reference time; The wireless communication module is connected to the main control module and is used to wirelessly transmit the collected data to the host computer. The local storage module is connected to the main control module and is used for real-time backup of collected data.
[0042] The multiple bioelectric analog front-end chips of the present invention can be connected in a daisy chain manner. The daisy chain connection method is as follows: the data output pin of each bioelectric analog front-end chip is connected to the data input pin of the next bioelectric analog front-end chip. The data input pin of the first bioelectric analog front-end chip is driven by the SPI host output of the main control module. The data output pin of the last bioelectric analog front-end chip is connected to the SPI host input of the main control module. The clock pin, chip select pin and data ready pin of all bioelectric analog front-end chips are connected in parallel.
[0043] In this embodiment, all the bioelectric analog front-end chips in the bioelectric acquisition module form a first daisy chain, which is connected to the main control module through a first SPI interface; the auxiliary signal acquisition module includes multiple bioelectric analog front-end chips, and all the bioelectric analog front-end chips in the auxiliary signal acquisition module form a second daisy chain, which is connected to the main control module through a second SPI interface. The two daisy chains have independent chip select signals. like Figure 2As shown, taking the bioelectric acquisition module as an example, assuming that the bioelectric acquisition module of this invention uses four bioelectric analog front-end chips (such as ADS1299), connected in a first daisy chain, for synchronous acquisition of bioelectric signals such as EEG (e.g., 8-channel), ECG, EEG, and EMG. The connection method of the first daisy chain is as follows: the DIN of the first bioelectric analog front-end chip is driven by the SPI1_MOSI of the main control module; the DOUT of each bioelectric analog front-end chip is connected to the DIN of the next bioelectric analog front-end chip; and the DOUT of the last bioelectric analog front-end chip is connected to the SPI1_MISO of the main control module. The SCLK, CS1, and DRDY1 pins of all bioelectric analog front-end chips are connected in parallel. CS1 is controlled by a GPIO of the main control module, and DRDY1 is used as an interrupt input. The connection method of the second daisy chain is similar. The two daisy chains use independent SPI interfaces (SPI1 and SPI2) and independent chip select signals, and the DRDY signal is connected to two different external interrupt pins respectively. This scheme is simple to implement, easy to debug, and the sampling rate of the two daisy chains can be configured independently.
[0044] The table below shows one typical channel configuration example of the present invention (taking two independent daisy chains as an example):
[0045] Preferably, the main control module is also used to: simultaneously send the acquired and encapsulated data frames to the host computer via the wireless communication module and write them to the local storage medium via the local storage module, thereby achieving dual-channel parallel processing.
[0046] As a preferred option, the main control module uses an STM32H743 microcontroller. Of course, in addition to the STM32H743, other MCUs with rich peripherals (such as the STM32F7 series, NXTi.MXRT series, and domestic GD32F4 series) can also achieve similar functions.
[0047] As a preferred option, the Texas Instruments ADS1299 is used as the bioelectric analog front-end chip. This chip is an 8-channel, 24-bit Δ-Σ analog-to-digital converter. In addition to the ADS1299, TI's ADS1298, ADS1299-4 series, or Maxim's MAX3000X series can also be used, all of which support multi-channel synchronous acquisition.
[0048] Preferably, the wireless communication module is BW16. In addition to BW16, wireless transmission can be achieved by using ESP32 (via SPI or SDIO), WiFi module (such as ESP8266), or Bluetooth module (such as nRF52832) in combination with a gateway.
[0049] Preferably, in this embodiment, the real-time clock module is connected to the main control module via the IIC bus to provide high-precision, continuous absolute time (Unix timestamp, accurate to milliseconds). After each interrupt is triggered by the DRDY pin of the bioelectric simulation front-end chip, the main control module immediately reads the current time of the real-time clock module via IIC, uses it as the reference timestamp T_frame for this acquisition cycle, and appends it to all data frames acquired in this cycle. This timestamp is used for the accurate alignment of signals with different sampling rates and the fusion of dual-channel data.
[0050] As a further preferred option, the real-time clock module can use a high-precision clock chip with temperature compensation (such as DS3231), or it can use an RTC unit with battery backup inside the main controller, as long as the time error is less than 1 second during the entire night's monitoring.
[0051] Example 2 As an alternative, all bioelectric analog front-end chips in the bioelectric acquisition module and auxiliary signal acquisition module can be connected in a daisy chain via an SPI interface of the main control module. For example, eight ADS1299 chips can be connected in series, with the first chip's DIN driven by SPI_MOSI and the last chip's DOUT connected to SPI_MISO. The CS, SCLK, and DRDY pins of all ADS1299 chips are connected in parallel. This solution only uses one SPI interface, but requires reading all channel data at once, resulting in slightly higher program complexity, and all channels must have the same sampling rate.
[0052] Example 3 like Figure 3 As shown in the figure, this embodiment discloses a method for data acquisition and synchronization control of a lower-level device in a polysomnography system. The method includes the following detailed steps: Step S1, System Initialization: After power-on, the system clock is initialized, the PLL is configured to make the system main frequency reach 400MHz, all peripherals are initialized: SPI1 (first daisy chain), SPI2 (second daisy chain), UART (blood oxygen), IIC (RTC), SDIO (local storage medium) and GPIO interrupt, the RTC chip is initialized, the current time is read, the wireless communication module is initialized, and the host computer is connected.
[0053] Step S2, Data Acquisition and Hardware Timestamp Encapsulation: The main program enters an infinite loop, waiting for a DRDY interrupt (first or second daisy chain) or UART data; When the DRDY interrupt is triggered (indicating that all channels in the corresponding daisy chain have completed conversion), the absolute time of the real-time clock module is immediately read through IIC as the reference timestamp T_frame, and then the DMA transfer of the corresponding SPI is started. All channel data of all chips in the daisy chain are read at once, and T_frame and channel data are packaged into a data frame. When the UART receive interrupt is triggered, for each complete frame of blood oxygen data received, the timer (such as TIM2) count value is read as a timestamp, and the blood oxygen data and timestamp are stored in the circular buffer.
[0054] Step S3, Dual-channel parallel processing: The controller uses a DMA double-buffering mechanism to copy the generated data frames to two different buffers simultaneously: First channel: Sends data to the wireless communication module (such as BW16) via SPI DMA, and uploads it to the host computer for real-time display.
[0055] Second channel: Write to local storage media (such as TF card) via SDIO DMA for local real-time backup.
[0056] Step S4: Network Status Monitoring and Dynamic Adjustment The main control module periodically checks the depth of the wireless transmission queue. If the queue depth continuously exceeds the preset threshold, it determines that the network is abnormal, stops writing new data frames to the wireless transmission channel, and only writes to the local storage medium and marks the offline period. Transmission will automatically resume after the network is restored.
[0057] Specifically, the preset threshold can be set to 50 frames. When the queue depth is greater than 50 frames for 5 consecutive checks, the system determines that the network is abnormal, suspends writing new data frames to the wireless transmission channel, and only writes data frames to the local storage of the TF card, and records the offline start timestamp. The recovery threshold is set to 10 frames. When the queue depth drops to below 10 frames, the system determines that the network has recovered and automatically resumes dual-channel parallel transmission.
[0058] The above values (50 frames, 10 frames, 5 consecutive times) are preferred examples. Those skilled in the art can adjust them according to the actual network environment, data sampling rate and buffer size. For example, in a high sampling rate (such as 500Hz) scenario, the threshold can be appropriately increased to 100 frames, and in a low sampling rate scenario, it can be reduced to 30 frames. These adjustments are all within the protection scope of this invention.
[0059] Step S5: Monitoring Ends and Data Export After monitoring is completed, the lower-level machine connects with the upper-level machine and uploads complete data to the local storage medium. The upper-level machine then merges the real-time data and backup data based on the timestamp to generate a complete report.
[0060] As a preferred choice, a circular buffer, also known as a circular queue or ring queue, is a commonly used data structure for buffering data streams. Its core features include: 1. Fixed size: A contiguous block of memory is pre-allocated, with a capacity of N data units.
[0061] 2. Separate read and write pointers: Maintain a write pointer (the producer writes to) and a read pointer (the consumer reads from). The write pointer points to the next writable free unit, and the read pointer points to the next readable valid data unit.
[0062] 3. Circular utilization: When the write pointer reaches the end of the buffer, it automatically wraps back to the beginning position; similarly, when the read pointer reaches the end, it also wraps back to the beginning position, and the loop is achieved through modulo operation (index = (index + 1) % N).
[0063] 4. Empty / Full Judgment: Usually, it is determined to be empty by whether the read pointer and write pointer are equal; it is determined to be full by the write pointer + 1 equal to the read pointer (mod N). A counter or reserving an empty space can also be used to distinguish them.
[0064] In the UART receive interrupt service routine of this invention, whenever a complete frame of data (including blood oxygen saturation and pulse rate) is received from the blood oxygen module, the interrupt service routine immediately reads the current TIM2 count value as the arrival timestamp of the frame of data, and then pushes "data + timestamp" as a data unit into the circular buffer. Since the interrupt service routine needs to exit quickly and cannot perform time-consuming operations (such as file writing or network transmission), the circular buffer provides a "producer-consumer" mode: Producer: UART interrupt service routine, responsible for quickly storing newly arrived blood oxygen data into the circular buffer.
[0065] Consumer: The main task (main loop) is responsible for retrieving data from the circular buffer, performing time alignment, encapsulation, and subsequent processing.
[0066] Advantages: Decoupling interrupt services from main task processing avoids the loss of subsequent interrupts due to excessive execution time of interrupt service routines; the main task can process data at its own pace, and even if it is temporarily busy, new data can still be temporarily stored in the buffer and will not be lost; the fixed-size buffer avoids the uncertainty and fragmentation problems caused by dynamic memory allocation.
[0067] Configuration Example: In this embodiment, the size of the circular buffer is set to 200 data units (which can store approximately 200 blood oxygen data frames). Integer read and write pointers are used, and the loop is implemented through modulo arithmetic. When the write pointer catches up with the read pointer (i.e., the buffer is full), the strategy of overwriting the oldest data (or discarding new data, depending on clinical needs) is adopted, and the overflow flag is set to record the abnormality.
[0068] Preferably, the local storage medium is a local storage medium connected to the main control module via an SDIO interface, and the file system is FATFS. Of course, the local storage medium can also be eMMC or NAND Flash.
[0069] Preferably, the data frame format is as follows: frame header (0xAA55), 8-byte Unix millisecond timestamp, 1-byte total number of channels, followed by 1-byte channel number for each channel, 2-byte data length, and variable-length data payload; Preferably, the absolute time is obtained by combining the second and millisecond registers of the real-time clock module read from the IIC interface.
[0070] Preferably, the reference timestamp T_frame is obtained by reading the real-time clock module immediately when the DRDY interrupt is triggered, and serves as a unified time marker for all data within this acquisition period.
[0071] Preferably, the DMA double-buffering mechanism sets up two independent DMA channels for SPI transmission and SDIO writing respectively, and configures two memory buffers for ping-pong switching.
[0072] In summary, the present invention has the following advantages compared with the prior art: 1. High-precision time synchronization: By synchronously reading the absolute time of the real-time clock module at the moment of DRDY interrupt trigger as the reference timestamp, the time error caused by the reading delay of different interfaces and the uncertainty of software processing is eliminated. This enables microsecond-level precise alignment of signals with different sampling rates, such as EEG (250Hz) and blood oxygen (1Hz). Compared with the traditional coarse alignment method that relies on the time received by the host computer, the time synchronization accuracy is improved by more than an order of magnitude, which significantly improves the accuracy of sleep stage and respiratory event judgment.
[0073] 2. Wireless and Comfortable: The wireless communication module enables wireless data transmission, freeing subjects from the constraints of traditional wired monitoring cables. Subjects can move freely and fall asleep naturally in the bedroom environment, which is closer to the real sleep state. This avoids the discomfort caused by cable constraints from interfering with the monitoring results, and also reduces the risk of electrode detachment.
[0074] 3. Zero data loss and real-time monitoring: Through a dual-channel parallel processing mechanism (real-time wireless transmission + local TF card backup), when the network is unobstructed, data is simultaneously uploaded to the host computer for real-time display and written to local storage. When the network is interrupted, wireless transmission is automatically paused, and only local storage is written, marking the offline period. After the monitoring ends, missing data is automatically retransmitted based on the timestamp. This solution completely solves the problem of data packet loss caused by network fluctuations in the traditional online mode, while preserving the data integrity of the offline mode. It achieves the unity of real-time monitoring and data integrity, avoiding the medical and time costs of repeated monitoring for patients due to data loss.
[0075] 4. High system integration and strong scalability: Utilizing daisy-chain technology, a single SPI interface can control multiple bioelectric analog front-end chips, supporting the synchronous acquisition of dozens of channels of physiological signals, which greatly simplifies circuit design and reduces power consumption and size. At the same time, it provides two daisy-chain configuration schemes (two independent chains or one main chain), which users can flexibly choose according to clinical needs, enhancing the system's adaptability and scalability.
[0076] 5. Strong robustness: The DMA double buffering mechanism realizes pipelined parallel processing of data acquisition, wireless transmission and local storage, without the CPU waiting for the transmission to complete, which greatly improves the data throughput and meets the real-time requirements under high sampling rate. Network status monitoring and dynamic traffic diversion strategy enable the system to cope with complex clinical network environments and avoid incomplete diagnostic data caused by WiFi signal fluctuations.
[0077] 6. Accurate and reliable data fusion: The host computer data fusion engine based on hardware absolute timestamps can automatically perform millisecond-level accurate alignment, deduplication, and completion of incomplete real-time data streams and complete local backup data to generate continuous and unbroken complete reports, avoiding the tediousness and errors of manual alignment and improving diagnostic efficiency.
[0078] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A lower-level data acquisition and synchronization control system for a polysomnography monitor, characterized in that, At least including: The main control module is used to control data acquisition, timestamp marking, and data transmission. The bioelectric acquisition module includes at least two bioelectric analog front-end chips for synchronously acquiring at least one bioelectric signal from electroencephalography (EEG), electrocardiography (ECG), electrooculography (EOG), and electromyography (EMG). The auxiliary signal acquisition module includes at least one bioelectric analog front-end chip, which is used to simultaneously acquire at least one auxiliary physiological signal from chest and abdominal breathing signals, oral and nasal airflow, nasal pressure, body position and snoring. The real-time clock module, connected to the main control module, is used to provide a reference time. The wireless communication module, connected to the main control module, is used to wirelessly transmit the collected data to the host computer. The local storage module, connected to the main control module, is used for real-time backup of collected data.
2. The lower-level data acquisition and synchronization control system for a polysomnography monitor according to claim 1, characterized in that, Multiple bioelectric analog front-end chips are connected in a daisy chain manner. The daisy chain connection method is as follows: the data output pin of each bioelectric analog front-end chip is connected to the data input pin of the next bioelectric analog front-end chip. The data input pin of the first bioelectric analog front-end chip is driven by the SPI master output of the main control module. The data output pin of the last bioelectric analog front-end chip is connected to the SPI master input of the main control module. The clock pin, chip select pin, and data ready pin of all bioelectric analog front-end chips are connected in parallel.
3. The lower-level data acquisition and synchronization control system for a polysomnography monitor according to claim 2, characterized in that, All the bioelectric analog front-end chips in the bioelectric acquisition module constitute a first daisy chain, which is connected to the main control module through a first SPI interface. The auxiliary signal acquisition module includes multiple bioelectric analog front-end chips, and all the bioelectric analog front-end chips in the auxiliary signal acquisition module constitute a second daisy chain, which is connected to the main control module through a second SPI interface. The two daisy chains have independent chip select signals. Alternatively, all the bioelectric analog front-end chips in the bioelectric acquisition module and all the bioelectric analog front-end chips in the auxiliary signal acquisition module together form a total daisy chain, which is connected to an SPI interface of the main control module.
4. The lower-level data acquisition and synchronization control system for a polysomnography monitor according to claim 1, characterized in that, Also includes: The blood oxygen acquisition module, connected to the main control module, is used to acquire blood oxygen saturation and pulse rate.
5. The lower-level data acquisition and synchronization control system for a polysomnography monitor according to any one of claims 1-4, characterized in that, The main control module is also used to: simultaneously send the collected and encapsulated data frames to the host computer through the wireless communication module and write them to the local storage medium through the local storage module, thereby realizing dual-channel parallel processing.
6. A method for data acquisition and synchronization control of a lower-level computer in a polysomnography monitor, characterized in that, Includes the following steps: S1. System Initialization: Initialize the peripherals of the main control module, the bioelectric acquisition module, the auxiliary signal acquisition module, the wireless communication module, and the local storage module; S2. Data Acquisition and Timestamp Encapsulation: Collect bioelectric signals and auxiliary signals according to the preset sampling rate. After each acquisition, obtain the current absolute time from the real-time clock module as the timestamp, and package the raw data and timestamp into a data frame. S3. Dual-channel parallel processing: The data frames are simultaneously sent to the host computer through the wireless communication module and written to the local storage medium for real-time backup through the local storage module. S4. Monitoring End and Data Export: After monitoring ends, the backed-up data in the local storage module is uploaded to the host computer to supplement the missing data segments in the wireless transmission.
7. The method for data acquisition and synchronization control of a lower-level computer in a polysomnography monitor according to claim 6, characterized in that, The data frame encapsulation format in step S2 includes: frame header, timestamp, total number of channels, channel number of each channel, and data payload; the timestamp is the absolute time read from the real-time clock module, accurate to milliseconds.
8. The method for data acquisition and synchronization control of a lower-level computer in a polysomnography monitor according to claim 6, characterized in that, In step S2, when collecting bioelectric signals and auxiliary signals, after the interrupt is triggered by the data ready pin of the daisy chain, all channel data of all chips in the daisy chain are read at once through SPI DMA. At the same time as starting DMA transmission, the current time of the real-time clock module is read as the reference timestamp T_frame for the acquisition cycle.
9. The method for data acquisition and synchronization control of a lower-level computer in a polysomnography monitor according to claim 6, characterized in that, In step S3, the dual-channel parallel processing adopts a DMA dual-buffering mechanism: independent DMA channels are set up for wireless transmission and local storage medium writing respectively. After the data frame is written to two different memory buffers at the same time, DMA transmission is started respectively, without the CPU waiting for the transmission to complete.
10. The method for data acquisition and synchronization control of a lower-level computer in a polysomnography monitor according to claim 6, characterized in that, When the wireless transmission queue depth of the wireless communication module exceeds a preset threshold, the writing of new data frames to the wireless transmission channel is stopped. Instead, data frames are written to the local storage module and the offline period is marked. Wireless transmission will automatically resume after the network is restored.