A pin-optimized multi-channel ADC data transmission device
By introducing register configuration, clock generation, signal sampling and synchronization module and asynchronous FIFO module in the multi-channel ADC data transmission device, combined with the sequence detection circuit, parallel data sampling and storage of multiple ADCs are realized, and additional additional in synchronous sampling is solved The problem of pin usage simplifies the transmission process and improves resource utilization.
Patent Information
- Application Number
- CN202111543324.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-16
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-12-16
AI Technical Summary
The prior art has the problem of unoptimized pin usage in multi-channel ADC data transmission, especially in synchronous sampling ADCs, which require additional pins to transmit synchronous signals at the head position of encoded information, resulting in waste of resources and increased complexity. .
A multi-channel ADC data transmission device with pin optimization is designed, including a register configuration module, a clock generation module, a signal sampling and synchronization module, a shift register storage module and an asynchronous FIFO module. The signal synchronization is achieved through a sequence detection circuit, and the main The clock signal and interface module configuration generated by the control chip support normal and synchronous sampling modes. Only two pins are required to sample and store eight channels of signals.
Parallel data sampling and storage of multiple ADCs is realized, pin usage is reduced, transmission process is simplified, multiple sampling modes are supported, parallel data is converted into serial data storage, and resource utilization and transmission efficiency are improved.
Smart Images

Figure CN114221657B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a data transmission device, in particular to a pin-optimized multi-channel ADC data transmission device. Background Art
[0002] For a common sampling ADC, after the external ADC is started, the clock signal and the converted multi-channel digital signal are sent to the main control chip. The 8 bits of the digital signal correspond to the eight data channels of the interface from small to large. The main control chip needs to configure the enable bit of each channel in advance and use a high-frequency clock inside the chip to complete the sampling of the ADC data. This high-frequency clock is much larger than the clock of the external ADC. The main control chip can be selected by configuring the register to complete the sampling of the ADC data at a certain time point of the ADC clock. Each channel has a corresponding sampling circuit, a 32-bit shift register and an asynchronous FIFO memory (the FIFO depth can be determined according to requirements). After the main control chip samples the data signal using the high-frequency clock, the single-bit data is stored in the 32-bit shift register, and the 32 single-bit signals are packaged into 32-bit data and stored in the asynchronous FIFO memory. After the data is stored in the FIFO of the enabled channel, the channel will initiate a transfer request to the DMA. According to the priority of channels 0-7, the prepared data will be stored in the RAM in turn to complete the conversion of parallel data to serial data.
[0003] For synchronous sampling ADC, the sampling of single-bit signal of a single channel is the same as that of ordinary sampling ADC, but before saving the data, it is necessary to detect the sampled single-bit signal sequence to find the starting position of the encoded information to achieve synchronous transmission. In view of this, the present invention designs a signal synchronous transmission method, by agreeing on a signal transmission protocol between the synchronous sampling ADC and the main control chip interface, so as to determine the starting position of the encoded information after ADC synchronous sampling. The main control chip stores the data collected after the starting position as valid data into the asynchronous FIFO, and the rest of the operations are the same as those of ordinary sampling ADC. Summary of the invention
[0004] Purpose of the invention: The technical problem to be solved by the present invention is to provide a multi-channel ADC data transmission device with optimized pins in view of the deficiencies in the prior art.
[0005] In order to solve the above technical problems, the present invention discloses a pin-optimized multi-channel ADC data transmission device.
[0006] A pin-optimized multi-channel ADC data transmission device comprises: a register configuration module, a clock generation module, a signal sampling and synchronization module, a shift register storage module and an asynchronous FIFO module;
[0007] Among them, the register configuration module configures the static data of the registers in each module before starting the analog-to-digital converter ADC data transmission;
[0008] The clock generation module generates a clock for the external synchronous sampling data analog-to-digital converter ADC by the main control chip, sends the clock signal to the external synchronous sampling data analog-to-digital converter ADC as a starting working clock, and uses the clock as the high-frequency clock of the signal sampling and synchronization module to determine the data sampling position;
[0009] The signal sampling and synchronization module supports 8 channel signal transmission and has 8 corresponding synchronization modules; the synchronization module is responsible for signal sampling; the signal sampling and synchronization module includes a sequence detection circuit;
[0010] The shift register storage module is a 32-bit circular shift register. After the signal transmission synchronization is successful, the single-bit data obtained by sampling is stored in the circular shift register, and the single-bit data is stored 32 times, and a complete 32-bit data is stored in the asynchronous FIFO module corresponding to each channel.
[0011] The asynchronous FIFO module is provided with 8 identical asynchronous FIFO devices, which correspond to the 8 channels in the signal sampling and synchronization module respectively and are connected to the respective 32-bit shift registers; finally, the multi-channel analog-to-digital converter ADC data transmission is completed.
[0012] The register configuration module in the present invention configures the static data of the registers in each module before the analog-to-digital converter ADC data transmission is enabled, including the clock division data of the clock generation module, the sampling edge selection data of the signal sampling and synchronization module, the number of sequence groups of the sequence detection module and the number of 1 or 0 points in each sequence group, and the accumulated error count data during the detection process.
[0013] In the signal sampling and synchronization module of the present invention, a common analog-to-digital converter ADC mode or a synchronous sampling analog-to-digital converter ADC mode is selected through a register configuration module; a sampling clock signal is generated in the module, and the clock signal selects a set position after the rising edge or falling edge of the analog-to-digital converter ADC clock to be detected generated by the clock generation module according to the configuration information of the register configuration module to sample the single-bit data sent to the analog-to-digital converter ADC to be detected, and the data at the position is used as the sampled data.
[0014] In the signal sampling and synchronization module of the present invention, for the common analog-to-digital converter ADC mode, the single-bit data obtained by sampling is directly stored in the corresponding shift register storage module.
[0015] In the signal sampling and synchronization module of the present invention, for the synchronous sampling analog-to-digital converter ADC mode, a sequence detection is performed on the sampled single-bit data and then the data is stored in the corresponding shift register storage module.
[0016] In the asynchronous FIFO module of the present invention, 8 identical asynchronous FIFO devices are set, which correspond to 8 channels in the signal sampling and synchronization module respectively and are connected to their respective 32-bit shift registers; after data is stored in each asynchronous FIFO device, a transfer request is initiated to the direct memory access module DMA in the chip, and the direct memory access module DMA stores the data stored in the FIFO into the RAM of the chip in sequence according to the priority of channels 0-7, thereby completing the transmission and storage of multi-channel analog-to-digital converter ADC data from parallel data to serial data.
[0017] The sequence detection method in the present invention is implemented by a sequence detection circuit, which includes a state machine, a counter and a sequence array counter.
[0018] The sequence detection method of the present invention comprises:
[0019] Step 1, the state machine of the sequence detection circuit starts to be in an idle state;
[0020] Step 2, after configuring the analog-to-digital converter ADC clock to be enabled, the state machine enters the first receiving state;
[0021] Step 3, record the number of 1 or 0 through the counter, accumulate the number of 1s sent from the signal sampling module, and if the number of 1s accumulates to the number of 1 or 0 points in the register configuration sequence, enter the second receiving state;
[0022] Step 4, clear the counter and start detecting the number of times 0 appears in the 10 sequence. If 0 appears before the counter is full, synchronization fails, clear the counter, and start detecting 1 again;
[0023] Step 5, in the second receiving state, set 10 sequence group number counters. If the counter accumulates the full step count and the sequence group number counter accumulates the full register configuration sequence synchronization group number, the state machine enters the save to shift register state, that is, the transmission synchronization is successful, and starts to store valid data;
[0024] Step 6: If the counter accumulates the full step count and the sequence group number counter has not accumulated the full register configuration sequence synchronization group number, the state machine enters the third receiving state;
[0025] Step 7, detecting the number of 1s in a new round. If 1 is detected in the second receiving state, it means that the transmission synchronization has failed, and the state machine returns to the first receiving state to restart the detection;
[0026] Step 8, in the third receiving state, if the counter accumulates the full step count, the state machine enters the second receiving state, if 0 is detected in the third receiving state, it means that the transmission synchronization fails, and the state machine returns to the first receiving state to restart the detection;
[0027] Step 9: Each time the state machine switches, the counter is reset. Each time the transmission synchronization fails, the sequence group number counter is reset.
[0028] During the sequence detection process, a failure count counter is set to record the number of transmission synchronization failures. The counter remains unchanged at the maximum value before overflowing. The synchronous transmission situation is monitored through the value of the counter register.
[0029] The present invention adopts a sequence detection circuit to realize synchronous transmission, including:
[0030] Step 1: The main control chip sends a clock signal through the clock channel of the interface to start the synchronous sampling ADC outside the main control chip. The on / off and frequency of the clock signal are configured through the interface module register;
[0031] Step 2: After the analog-to-digital converter ADC outside the main control chip is started, it first sends a fixed number of 10 sequences, and then sends valid sampling data;
[0032] Step 3, the interface module of the main control chip enters a state of transmission signal detection after configuring the analog-to-digital converter ADC clock signal to be turned on;
[0033] Step 4: In the transmission signal detection state, the main control chip repeatedly detects the 10 sequence sent by the off-chip synchronous sampling analog-to-digital converter ADC. When a 10 sequence that fully meets the configuration requirements is detected, the signal synchronization is completed and the data is stored in the FIFO module, otherwise it is re-detected.
[0034] Beneficial effects: A pin-optimized signal transmission method between an external ADC and a main control chip, which only requires two pins, can enable the main control chip to simultaneously sample up to eight channel signals from an ordinary sampling ADC or a synchronous sampling ADC outside the chip, convert the parallel data of multiple ADCs into serial data after sampling and store them. It can support the selection of sampling modes and sampling channels supported by the main control chip through configuration registers. The feature of the present invention is that other pins are not required to transmit synchronization signals for indicating the position of the head of the coded information during the transmission process. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more clear.
[0036] Figure 1 This is a schematic diagram of the hardware circuit architecture.
[0037] Figure 2 Schematic diagram of the sequence detection protocol.
[0038] Figure 3 Schematic diagram of the sequence detection state machine. DETAILED DESCRIPTION
[0039] The present invention is applied to the scenario where off-chip multi-channel ADC data is transmitted to the main control chip. The off-chip ADC transmits the digital signal after the analog signal is converted, that is, the 0,1 data stream to the main control chip through the IO port. The present invention designs a pin-optimized signal transmission method between the external ADC and the main control chip, which only requires two pins, and can enable the main control chip to simultaneously sample up to eight channel signals from an ordinary sampling ADC or a synchronous sampling ADC outside the chip, and convert the parallel data of the multiple ADCs into serial data after sampling and store them. It can support the selection of sampling modes, sampling channels, etc. supported by the main control chip through the configuration register. The feature of the present invention is that other pins are not required to transmit the synchronization signal indicating the position of the head of the coded information during the transmission process.
[0040] A signal transmission method between an external ADC and a main control chip can simultaneously support the main control chip to simultaneously sample single-bit digital signals from a normal sampling ADC or a maximum of eight channels with a synchronous sampling ADC outside the chip. The interface between the external ADC and the main control chip has only one 8-bit data channel interface and one clock interface. For the synchronous sampling ADC containing coded information, a specific signal transmission protocol is designed. When there is no synchronization signal between the external ADC and the main control chip, the head position of the ADC data stream containing the coded information data is found, and the valid sampling data is stored starting from the head position, thereby completing the signal transmission synchronization.
[0041] The transmission interface circuit designed by the present invention mainly comprises the following modules: a register configuration module, a clock generation module, a signal sampling (synchronization) module, a shift register storage module, and an asynchronous FIFO module.
[0042] Register configuration module, i.e. Figure 1 The EADC_REGS module in is used to configure the static data of the registers in each module before starting the transmission, including the clock division number of the clock generation module, the selection of the sampling edge of the signal sampling module, the number of sequence groups of the sequence detection module and the number of 1(0) points in each sequence group, the number of errors accumulated during the detection process, etc.
[0043] Clock generation module, i.e. Figure 1The CLK_GEN module in the ADC is for external synchronous sampling data. After the main control chip generates the clock, it sends the clock to the ADC as the starting working clock. At the same time, the clock will be used as the high-frequency clock of the signal sampling (synchronization) module to determine the data sampling position.
[0044] Signal sampling (synchronization) module, that is Figure 1 SYN_X module in. In the present invention, up to eight channels of signal transmission are supported, so there are 8 SYN modules corresponding to each channel. This module is mainly responsible for signal sampling. For the synchronous sampling ADC mode, there will be an additional sequence detection process. The register configuration module can be used to select whether it is a normal ADC mode or a synchronous sampling ADC mode. There is a high-frequency sampling clock in this module. It will select a position after the rising edge or falling edge of the ADC clock (adc_clk) generated by the CLK_GEN module according to the configuration information of the register configuration module to sample the single-bit data (adc_in) sent by the ADC, and use the data of adc_in at this position as the sampled data. If it is a normal ADC mode, the sampled single-bit data will be directly stored in the corresponding shift register. If it is a synchronous sampling ADC mode, a sequence detection will be performed on the sampled single-bit data. The sequence detection circuit is used to realize synchronous transmission. The present invention designs a signal transmission protocol, and the timing is as follows:
[0045] First, the main control chip sends a clock signal through the clock channel of the interface to start the off-chip synchronous sampling ADC. The on / off and frequency of the clock signal are configured through the interface module register. After the off-chip ADC is started, it will first send a fixed number of "10" sequences, and then send valid sampling data. The interface module of the main control chip starts from the configuration of the ADC clock signal after starting. Figure 2 The initial state in the chip enters the state of transmission signal detection. In this state, the interface module of the main control chip will repeatedly detect the "10" sequence sent by the synchronous sampling ADC outside the chip. The number of groups of the detection target "10" sequence and the length of 1 and 0 in the sequence are configured through registers. Only when a "10" sequence that fully meets the configuration requirements is detected, it can be said that the transmission synchronization of the signal has been completed, and this is used as the starting position of the valid data after synchronization, and the subsequent data is stored in the FIFO, otherwise it will be re-detected. The state machine of the sequence detection circuit is as follows. Figure 3As shown. The state machine is in the initial state at the beginning. After the ADC clock is enabled, it enters the first receiving state. By designing a 1(0) counter (cnt), the number of 1s sent from the signal sampling module is accumulated. If the number of 1s accumulates to the number of 1(0) points in the register configuration sequence (counting step), it enters the second receiving state, clears the counter and starts detecting the number of 0s in the "10" sequence. If 0 appears before the counter is fully accumulated, the synchronization fails, the counter is cleared, and detection of 1 starts again. In the second receiving state, a "10" sequence group number counter (sequence group number) is designed. If the cnt counter accumulates the full count step and the sequence group number counter accumulates the full register configuration sequence synchronization group number (seq_sets_num), the state machine enters the save to shift register state, that is, the transmission synchronization is successful, and starts to store valid data. If the cnt counter accumulates the full count step and the sequence group number counter has not accumulated full (seq_sets_num), the state machine enters the third receiving state to detect the number of 1s in the new round. If 1 is detected in the second receiving state, it means that the transmission synchronization has failed, and the state machine returns to the first receiving state to restart the detection. In the third receiving state, if the cnt counter accumulates the full count step, the state machine enters the second receiving state. If 0 is detected in the third receiving state, it means that the transmission synchronization has failed, and the state machine returns to the first receiving state to restart the detection. Each time the state machine switches, the cnt counter will be cleared. Each time the transmission synchronization fails, the sequence group number counter will be cleared. During the sequence detection process, a counter is designed to record the number of transmission synchronization failures. This counter will remain unchanged at the maximum value before overflowing. The software can monitor the synchronization transmission status by checking the value of the counter register.
[0046] Shift register storage module, that is Figure 2 The CHX_SREG module in the . A 32-bit circular shift register is designed in this module. After the normal mode sampling is completed or the synchronous sampling mode sequence detection module signal transmission synchronization is successful, the sampled single-bit data will be stored in the circular shift register, and the single-bit data will be stored 32 times, and a complete 32-bit data will be stored in the asynchronous FIFO corresponding to each channel.
[0047] Asynchronous FIFO module, that is Figure 2The afifo_2x32 module in the figure. The asynchronous FIFO in the figure takes a depth of 2 and a data width of 32 bits as an example. There are 8 identical asynchronous FIFOs in this design, corresponding to each channel and connected to their respective 32-bit shift registers. After data is stored in each asynchronous FIFO, it will initiate a transfer request to the DMA. The DMA will store the data stored in the FIFO into the RAM in turn according to the priority of channels 0-7, completing the transmission and storage of parallel data to serial data.
[0048] The present invention provides a concept and method of a pin-optimized multi-channel ADC data transmission device. There are many methods and ways to implement the technical solution. The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be considered as the protection scope of the present invention. All components not specified in this embodiment can be implemented by existing technologies.
Claims
1. A pin-optimized multi-channel ADC data transmission device, characterized in that: include: Register configuration module, clock generation module, signal sampling and synchronization module, shift register storage module and asynchronous FIFO module; Among them, the register configuration module configures the static data of the registers in each module before starting the analog-to-digital converter ADC data transmission; The clock generation module generates a clock for the external synchronous sampling data analog-to-digital converter ADC by the main control chip, sends the clock signal to the external synchronous sampling data analog-to-digital converter ADC as a starting working clock, and uses the clock as the high-frequency clock of the signal sampling and synchronization module to determine the data sampling position; The signal sampling and synchronization module supports 8 channel signal transmission and has 8 corresponding synchronization modules; the synchronization module is responsible for signal sampling; the signal sampling and synchronization module includes a sequence detection circuit; The shift register storage module is a 32-bit circular shift register. After the signal transmission synchronization is successful, the single-bit data obtained by sampling is stored in the circular shift register, and the single-bit data is stored 32 times, and a complete 32-bit data is stored in the asynchronous FIFO module corresponding to each channel. The asynchronous FIFO module is provided with 8 identical asynchronous FIFO devices, which correspond to the 8 channels in the signal sampling and synchronization module respectively and are connected to their respective 32-bit shift registers; finally, the multi-channel analog-to-digital converter ADC data transmission is completed; Wherein, the sequence detection method is implemented by a sequence detection circuit, and the sequence detection circuit includes a state machine, a counter and a sequence array counter; The sequence detection method comprises: Step 1, the state machine of the sequence detection circuit starts to be in an idle state; Step 2, after configuring the analog-to-digital converter ADC clock to be enabled, the state machine enters the first receiving state; Step 3, record the number of 1 or 0 through the counter, accumulate the number of 1s sent from the signal sampling module, and if the number of 1s accumulates to the number of 1 or 0 points in the register configuration sequence, enter the second receiving state; Step 4, clear the counter and start detecting the number of times 0 appears in the 10 sequence. If 0 appears before the counter is full, synchronization fails, clear the counter, and start detecting 1 again; Step 5, in the second receiving state, set 10 sequence group number counters. If the counter accumulates the full step count and the sequence group number counter accumulates the full register configuration sequence synchronization group number, the state machine enters the save to shift register state, that is, the transmission synchronization is successful, and starts to store valid data; Step 6: If the counter accumulates the full step count and the sequence group number counter has not accumulated the full register configuration sequence synchronization group number, the state machine enters the third receiving state; Step 7, detecting the number of 1s in a new round. If 1 is detected in the second receiving state, it means that the transmission synchronization has failed, and the state machine returns to the first receiving state to restart the detection; Step 8, in the third receiving state, if the counter accumulates the full step count, the state machine enters the second receiving state, if 0 is detected in the third receiving state, it means that the transmission synchronization fails, and the state machine returns to the first receiving state to restart the detection; Step 9: Each time the state machine switches, the counter will be cleared, and each time the transmission synchronization fails, the sequence group number counter will be cleared.
2. The pin-optimized multi-channel ADC data transmission device according to claim 1, characterized in that: The register configuration module configures the static data of the registers in each module before starting the analog-to-digital converter ADC data transmission, including the clock division data of the clock generation module, the sampling edge selection data of the signal sampling and synchronization module, the number of sequence groups of the sequence detection module and the number of 1 or 0 points in each sequence group, as well as the accumulated number of errors during the detection process.
3. The pin-optimized multi-channel ADC data transmission device according to claim 2, characterized in that: In the signal sampling and synchronization module, the ordinary analog-to-digital converter ADC mode or the synchronous sampling analog-to-digital converter ADC mode is selected through the register configuration module; a sampling clock signal is generated in the module, and the clock signal selects a set position after the rising edge or falling edge of the analog-to-digital converter ADC clock to be detected generated by the clock generation module according to the configuration information of the register configuration module to sample the single-bit data sent to the analog-to-digital converter ADC to be detected, and the data at this position is used as the sampled data.
4. The pin-optimized multi-channel ADC data transmission device according to claim 3, characterized in that: In the signal sampling and synchronization module, for the common analog-to-digital converter ADC mode, the single-bit data obtained by sampling is directly stored in the corresponding shift register storage module.
5. The pin-optimized multi-channel ADC data transmission device according to claim 4, characterized in that: In the signal sampling and synchronization module, for the synchronous sampling analog-to-digital converter ADC mode, a sequence detection is performed on the sampled single-bit data and then the data is stored in the corresponding shift register storage module.
6. The pin-optimized multi-channel ADC data transmission device according to claim 5, characterized in that: In the asynchronous FIFO module, 8 identical asynchronous FIFO devices are set, corresponding to the 8 channels in the signal sampling and synchronization module respectively, and connected to their respective 32-bit shift registers; after data is stored in each asynchronous FIFO device, a transfer request is initiated to the direct memory access module DMA in the chip. The direct memory access module DMA stores the data stored in the FIFO into the RAM of the chip in turn according to the priority of channels 0-7, completing the transmission and storage of multi-channel analog-to-digital converter ADC data from parallel data to serial data.
7. The pin-optimized multi-channel ADC data transmission device according to claim 6, characterized in that: During the sequence detection process, a failure count counter is set to record the number of transmission synchronization failures. The counter remains unchanged at the maximum value before overflowing. The synchronous transmission situation is monitored through the value of the counter register.
8. The pin-optimized multi-channel ADC data transmission device according to claim 7, characterized in that: The synchronous transmission is realized by using a sequence detection circuit, including: Step 1: The main control chip sends a clock signal through the clock channel of the interface to start the synchronous sampling ADC outside the main control chip. The on / off and frequency of the clock signal are configured through the interface module register; Step 2: After the analog-to-digital converter ADC outside the main control chip is started, it first sends a fixed number of 10 sequences, and then sends valid sampling data; Step 3, the interface module of the main control chip enters a state of transmission signal detection after configuring the analog-to-digital converter ADC clock signal to be turned on; Step 4: In the transmission signal detection state, the main control chip repeatedly detects the 10 sequence sent by the off-chip synchronous sampling analog-to-digital converter ADC. When a 10 sequence that fully meets the configuration requirements is detected, the signal synchronization is completed and the data is stored in the FIFO module, otherwise it is re-detected.
