A single-chip microcomputer and a distance measuring sensor
By using an image sensor with a DVP port and basic peripherals of a general-purpose microcontroller in the ranging sensor, high-precision and high-resolution image data processing is achieved, solving the problems of high cost and low accuracy in existing technologies.
Patent Information
- Application Number
- CN202511077347.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2045-08-01
AI Technical Summary
Existing ranging sensors have low accuracy when processing image data and cannot meet the requirements for high precision. Furthermore, microcontrollers that specifically process SPI port signals are expensive, and general-purpose microcontrollers cannot achieve high resolution.
By using an image sensor with a DVP port, and in conjunction with a timer, DMA controller and GPIO input register in a general-purpose microcontroller, the timer counts the pixel clock signal during the active period of the line synchronization signal, and controls the DMA controller to cache the image data to memory when the preset threshold is reached, thus achieving high resolution.
It achieves high-precision, high-resolution image data processing at low cost, reduces the burden on users, and avoids the need for peripherals specifically designed to handle DVP port signals.
Smart Images

Figure CN120602600B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image data processing, and more particularly to a microcontroller and a ranging sensor for achieving high precision and high resolution. Background Technology
[0002] Distance sensors are essential for robots, enabling the measurement of distances between objects and the robot. Among these, distance sensors based on triangulation are widely used. Triangulation involves projecting a laser onto the surface of an object, using a camera to capture the laser's position, and then calculating the distance based on geometric trigonometric relationships. Current solutions utilize contact image sensors (CIS) with a serial peripheral interface (SPI) port, coupled with a microcontroller specifically designed to process SPI signals, to obtain high-resolution image data. This microcontroller caches the image data from the image sensor in memory.
[0003] However, the image data processed by this type of ranging sensor currently has low precision and cannot meet users' needs for high-precision image data processing. Summary of the Invention
[0004] This application provides a microcontroller and a ranging sensor for achieving high precision and high resolution.
[0005] The first aspect of this application provides a microcontroller, including: a timer, a GPIO input register, a direct memory access (DMA) controller, and memory; wherein the DMA controller is connected to the timer, the GPIO input register, and the memory respectively;
[0006] The GPIO input register is used to latch image data sent by the image sensor through multiple parallel data terminals in the digital video port (DVP);
[0007] The timer is used to count the pixel clock signal during the effective period of the line synchronization signal when the image sensor sends a line synchronization signal and a pixel clock signal; and when the count value of the pixel clock signal reaches a preset threshold, control the DMA controller to cache the image data latched by the GPIO input register to the memory.
[0008] Optionally, the timer is provided with an external trigger input terminal and an edge detection terminal, wherein the external trigger input terminal is connected to the pixel clock terminal of the image sensor, and the edge detection terminal is connected to the line synchronization signal terminal of the image sensor;
[0009] Specifically, the timer is used to count the pixel clock signal that can trigger the timer to count when the edge detection terminal receives the line synchronization signal sent by the image sensor through the line synchronization signal terminal, which enables the timer to start.
[0010] Optionally, the timer is provided with an external trigger input terminal, wherein the external trigger input terminal is connected to the output terminal of an AND gate, and the two input terminals of the AND gate are respectively connected to the line synchronization signal terminal and the pixel clock terminal of the image sensor;
[0011] The timer is used to count the reminder count signal after receiving it from the output of the AND gate via the external trigger input, and the count of the reminder count signal is used as the count of the pixel clock signal. The image sensor inputs the horizontal synchronization signal and the pixel clock signal to the AND gate via the horizontal synchronization signal terminal and the pixel clock signal terminal, respectively. When the polarity of the horizontal synchronization signal is the start trigger polarity of the timer and the polarity of the pixel clock signal is the count trigger polarity of the timer, the output of the AND gate outputs the reminder count signal.
[0012] Optionally, the GPIO input register is provided with GPIO terminals, and the plurality of parallel data terminals are connected to the GPIO terminals with consecutive addresses in the same group, and the starting address of the GPIO terminal is the byte start bit;
[0013] The timer is specifically used to control the DMA controller to cache the same group of image data latched by the GPIO input register into the memory all at once when the count value of the pixel clock signal reaches a preset threshold.
[0014] Optionally, the timer includes input filtering and an edge detector;
[0015] The input filter and edge detector are connected to the image sensor. The input filter and edge detector are used to detect the edge of the pixel clock signal during the effective period of the line synchronization signal when receiving the line synchronization signal and pixel clock signal sent by the image sensor.
[0016] Optionally, the timer further includes a counter, which is connected to the input filter and the edge detector;
[0017] The counter is used to count the pixel clock signal when the output signal sent by the input filter and the edge detector is received.
[0018] Optionally, the counter can be 16-bit or 32-bit.
[0019] Optionally, the timer may further include a control module and an automatic reload register;
[0020] The control module is connected to the automatic reload register and the counter respectively. The automatic reload register is used to pre-store the preset threshold, and the control module is used to compare the count value with the preset threshold.
[0021] Optionally, the timer may further include a DMA request generator;
[0022] The DMA request generator is connected to the control module. The control module is used to send a control command to the DMA request generator when the count value of the pixel clock signal reaches the preset threshold, so that the DMA request generator controls the DMA controller to cache the image data latched by the GPIO input register into the memory.
[0023] A second aspect of this application provides a ranging sensor, characterized in that it includes: a microcontroller as described above, and an image sensor with a digital video port (DVP), wherein the image sensor is connected to the microcontroller based on the DVP.
[0024] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0025] If the timer receives the line synchronization signal and pixel clock signal from the image sensor, the timer counts the pixel clock signal during the valid period of the line synchronization signal. When the count value corresponding to the pixel clock signal reaches a preset threshold, the timer controls the DMA controller to cache the image data latched in the GPIO input register to memory. The microcontroller involved in this application is a general-purpose microcontroller. It does not have a dedicated peripheral for processing DVP port signals, but utilizes general-purpose basic peripherals (timer, DMA controller, and GPIO input register). It also uses an image sensor with DVP. Since DVP has multiple parallel data terminals, the corresponding data width is larger than the data width of SPI, thus enabling high resolution. Attached Figure Description
[0026] Figure 1 This is a schematic diagram of an embodiment of the connection between a microcontroller and an image sensor disclosed in this application;
[0027] Figure 2 This is a schematic diagram of another embodiment of the connection between a microcontroller and an image sensor disclosed in this application;
[0028] Figure 3 This is the timing diagram of the DVP signal disclosed in this application;
[0029] Figure 4This is a timer framework diagram disclosed in this application. Detailed Implementation
[0030] The present application will be further described in detail below with reference to the accompanying drawings.
[0031] This application provides a microcontroller and a ranging sensor for achieving high precision and high resolution.
[0032] Distance sensors are widely used across various industries. The implementation principles of distance sensors fall into two categories: the first directly or indirectly measures the round-trip time of a signal to calculate the distance; the second locates the signal within the sensor and calculates the distance based on geometric triangulation. The accuracy of distance sensors using the second principle is affected by the resolution of their receiving end (i.e., the image sensor and the receiving lens). Image sensors have ports such as SPI, DVP, and MIPI. DVP ports have higher transmission rates, corresponding to higher resolution image data, but require dedicated DVP peripherals for receiving and processing data. SPI ports have lower transmission rates and generally require SPI peripherals, which are present in almost every general-purpose microcontroller unit (MCU). In practical applications, if high-resolution image data is required, an image sensor with a DVP port can be used, paired with a microcontroller with dedicated peripherals for processing DVP port signals to obtain high-resolution data. If high-resolution image data is not required and cost savings are desired, an image sensor with an SPI port can be used, paired with a low-cost general-purpose microcontroller to obtain lower-resolution image data. While the first approach can obtain high-resolution image data, it requires a specific microcontroller, resulting in high costs. The second approach, although low-cost, cannot achieve high precision and high resolution. To address these issues, this application provides an image data caching method and related apparatus. Using an image sensor with a DVP port, and in conjunction with general-purpose peripherals in a microcontroller (i.e., timers, DMA controllers, and GPIO input registers), high-resolution image data can be cached in memory without involving dedicated DVP peripherals. This achieves high precision and high resolution at a low cost, reducing the burden on users.
[0033] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0034] The terms "first," "second," "third," "fourth," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0035] The following describes a microcontroller based on this application. Please refer to [link / reference]. Figure 1 This application discloses a microcontroller, which includes a timer, a GPIO input register, a direct memory access (DMA) controller, and memory; wherein the DMA controller is connected to the timer, the GPIO input register, and the memory respectively.
[0036] The GPIO input register is used to latch image data sent by the image sensor through multiple parallel data terminals in the digital video port (DVP);
[0037] The timer is used to count the pixel clock signal during the effective period of the line synchronization signal when the image sensor sends a line synchronization signal and a pixel clock signal; and when the count value of the pixel clock signal reaches a preset threshold, control the DMA controller to cache the image data latched by the GPIO input register to the memory.
[0038] Specifically, if the timer receives a line synchronization signal and a pixel clock signal from the image sensor that enable the timer to start and count, then the timer counts the pixel clock signal. When the image sensor receives laser light, it converts the optical signal into electrical signals, namely the line synchronization signal and the pixel clock signal. When the line synchronization signal is valid, enabling the timer to start, and the rising edge (or falling edge) of the pixel clock signal appears, the pixel clock signal is counted. During the period when the line synchronization signal is valid, one pixel clock signal is counted, and the count is continuously accumulated.
[0039] If the count value corresponding to the pixel clock signal reaches a preset threshold, the timer controls the DMA controller to cache the image data latched in the GPIO input register to memory. Specifically, while the timer counts the pixel clock signal, the image sensor sends image data to the GPIO input register, which receives and latches the image data. Then, during the active period of the horizontal synchronization signal, the timer continuously counts the pixel clock signal. If the corresponding count value reaches the preset threshold, it sends an instruction to the DMA controller, causing the DMA controller to move the image data from the GPIO input register to memory. The DMA controller is a peripheral device in embedded systems used for efficient data transfer, enabling data transfer between peripherals and memory without consuming CPU resources.
[0040] In this embodiment, if the timer receives the line synchronization signal and pixel clock signal sent by the image sensor, the timer counts the pixel clock signal during the valid period of the line synchronization signal, and controls the DMA controller to cache the image data latched by the GPIO input register to memory when the count value corresponding to the pixel clock signal reaches a preset threshold. The microcontroller involved in this application is a general-purpose microcontroller, which does not have a dedicated peripheral for processing DVP port signals, but utilizes general basic peripherals (timer, DMA controller, and GPIO input register), and uses an image sensor with DVP. Since DVP has multiple parallel data terminals, the corresponding data width is larger than the data width of SPI, thus enabling high resolution.
[0041] The microcontroller of this application is described in detail below. Please refer to [link / reference]. Figures 2 to 4 Another embodiment of the microcontroller in this application includes a timer, a GPIO input register, a direct memory access (DMA) controller, and memory; wherein the DMA controller is connected to the timer, the GPIO input register, and the memory respectively;
[0042] The GPIO input register is used to latch image data sent by the image sensor through multiple parallel data terminals in the digital video port (DVP);
[0043] The timer is used to count the pixel clock signal during the effective period of the line synchronization signal when the image sensor sends a line synchronization signal and a pixel clock signal; and when the count value of the pixel clock signal reaches a preset threshold, control the DMA controller to cache the image data latched by the GPIO input register to the memory.
[0044] Specifically, if the timer receives a line synchronization signal and a pixel clock signal from the image sensor that enable the timer to start and count, then the timer counts the pixel clock signal. When the image sensor receives laser light, it converts the optical signal into electrical signals, namely the line synchronization signal and the pixel clock signal. When the line synchronization signal is valid, enabling the timer to start, and the rising edge (or falling edge) of the pixel clock signal appears, the pixel clock signal is counted. During the period when the line synchronization signal is valid, one pixel clock signal is counted, and the count is continuously accumulated.
[0045] If the count value corresponding to the pixel clock signal reaches a preset threshold, the timer controls the DMA controller to buffer the image data latched in the GPIO input register to memory. Specifically, while the timer counts the pixel clock signal, the image sensor sends image data to the GPIO input register, which receives and latches the image data. Then, during the active period of the horizontal synchronization signal, the timer continuously counts the pixel clock signal. If the corresponding count value reaches the preset threshold, it sends a command to the DMA controller, causing the DMA controller to move the image data from the GPIO input register to memory.
[0046] There are at least two ways to connect the image sensor and the timer, and the specific method is not limited here. In one embodiment, the timer is provided with an external trigger input terminal and an edge detection terminal, wherein the external trigger input terminal is connected to the pixel clock terminal of the image sensor, and the edge detection terminal is connected to the line synchronization signal terminal of the image sensor. Specifically, the timer is used to count the pixel clock signals that can trigger the timer to count when it receives a line synchronization signal sent by the image sensor through the line synchronization signal terminal, which enables the timer to start, via the edge detection terminal. The corresponding counting method is as follows: if the timer receives a line synchronization signal sent by the image sensor based on the line synchronization signal terminal with the polarity of the timer's start trigger polarity via the edge detection terminal, then the timer receives the pixel clock signal sent by the image sensor based on the pixel clock terminal via the external trigger input terminal, and counts the pixel clock signals with the polarity of the timer's counting trigger polarity. Specifically, the image sensor buffers one frame of image data. During the period when the frame synchronization signal is valid, a line synchronization signal is directly sent to the timer. If the line synchronization signal is valid (i.e., the polarity of the line synchronization signal is the timer's start trigger polarity, for example, a high level of the line synchronization signal can trigger the timer to start), the timer will count the pixel clock signal directly sent to the timer by the image sensor. If the pixel clock signal is valid (i.e., the polarity of the pixel clock signal is the timer's count trigger polarity, for example, counting occurs when the pixel clock signal is at the rising edge), the counter in the timer will count the pixel clock signal once, continuously accumulating during the period when the line synchronization signal is valid. At the same time, the image sensor will transmit the image data to the GPIO input register, which receives and latches the data, waiting for subsequent instructions.
[0047] In another embodiment, the timer is provided with an external trigger input terminal, which is connected to the output terminal of an AND gate. The two input terminals of the AND gate are respectively connected to the horizontal synchronization signal terminal and the pixel clock terminal of the image sensor. The timer is used to receive the reminder count signal output from the output terminal of the AND gate via the external trigger input terminal, and count the reminder count signal, with the count serving as the count of the pixel clock signal. The image sensor inputs the horizontal synchronization signal and the pixel clock signal to the AND gate via the horizontal synchronization signal terminal and the pixel clock signal terminal, respectively. When the polarity of the horizontal synchronization signal is the start trigger polarity of the timer and the polarity of the pixel clock signal is the count trigger polarity of the timer, the output terminal of the AND gate outputs the reminder count signal. The corresponding counting method is as follows: If the image sensor inputs the horizontal synchronization signal and the pixel clock signal to the AND gate respectively through the horizontal synchronization signal terminal and the pixel clock signal terminal, and the polarity of the horizontal synchronization signal is the timer's start trigger polarity, and the polarity of the pixel clock signal is the timer's count trigger polarity, then the timer counts the signal received through the external trigger input terminal to count the pixel clock signal. Specifically, the image sensor is not directly connected to the timer; it needs to pass through an AND gate to transmit the signal to the timer. During the frame synchronization signal's validity period, when both signals input to the AND gate meet the conditions (i.e., the polarity of the horizontal synchronization signal is the timer's start trigger polarity, and the polarity of the pixel clock signal is the timer's count trigger polarity), the AND gate outputs the corresponding signal, and the timer counts this signal through the external trigger input terminal. Simply put, only when the horizontal synchronization signal and the pixel clock signal are valid will the valid signal output by the AND gate be counted, and only when the pixel clock signal is valid will the AND gate's output reminder count signal be valid. Therefore, counting the signal output by the AND gate is actually indirectly counting the pixel clock signal.
[0048] This embodiment uses the first implementation method as an example for illustration.
[0049] Existing solutions, which rely on software to determine the validity of the line synchronization signal and pixel clock signal, suffer from fluctuations and lost pixel data due to the long interrupt response time of general-purpose MCUs. This embodiment, however, utilizes an image sensor with a DVP port and a general-purpose MCU, enabling the acquisition of high-resolution, complete image data. Please refer to... Figure 3The DVP port includes a frame synchronization signal (VSYNC), a line synchronization signal (HSYNC), a pixel clock (PCLK), and data terminals D0-D7. The frame synchronization signal indicates the start and end of a frame of image transmission, the line synchronization signal indicates the start and end of a line of image data transmission, the pixel clock signal serves as the timing reference, and the data terminals are used for image data transmission. Assuming the image sensor can emit an image with a resolution of 640x480, this corresponds to 480 line synchronization signal cycles, and within the effective period of one line synchronization signal, there are 640 pixel clock signal cycles. During the effective period of one line synchronization signal, the corresponding pixel clock signals are counted, and data transmission also occurs simultaneously.
[0050] To avoid repeatedly retrieving image data from the GPIO input register, multiple data terminals of the image sensor are connected to the same group of GPIO terminals, allowing for simultaneous image data acquisition and improved efficiency. Specifically, the GPIO input register is equipped with GPIO terminals, and the multiple parallel data terminals are connected to GPIO terminals with consecutive addresses within the same group, with the starting address of each GPIO terminal being a byte start bit. The timer is specifically used to control the DMA controller to cache the same group of image data latched by the GPIO input register into memory all at once when the count value of the pixel clock signal reaches a preset threshold. Since all data is stored in the same group of GPIO terminals, the entire group of corresponding image data can be cached into memory at once. For example, assuming there are eight data terminals, each connected to one GPIO terminal, and all connected GPIO terminals belong to the same group with a starting address of a byte start bit, the DMA controller moves the same group of data byte by byte.
[0051] The timer includes an input filter and edge detector, a counter, a control module, an automatic reload register, and a DMA request generator.
[0052] The input filter and edge detector are connected to the image sensor. The input filter and edge detector are used to detect the edge of the pixel clock signal during the effective period of the line synchronization signal when receiving the line synchronization signal and pixel clock signal sent by the image sensor.
[0053] The counter is connected to the input filter and edge detector. The counter is used to count the pixel clock signal when it receives the output signal sent by the input filter and edge detector. The counter can be 16-bit or 32-bit, or other bit types, depending on actual needs; no specific limitation is made here.
[0054] The control module is connected to the automatic reload register and the counter respectively. The automatic reload register is used to pre-store the preset threshold, and the control module is used to compare the count value with the preset threshold.
[0055] The DMA request generator is connected to the control module. The control module is used to send a control command to the DMA request generator when the count value of the pixel clock signal reaches the preset threshold, so that the DMA request generator controls the DMA controller to cache the image data latched by the GPIO input register into the memory.
[0056] The working principle of this embodiment will now be explained with an example. In one implementation, the timer is configured in gated mode, where gated mode is a method of controlling the start and stop of the timer counting via an external signal. The horizontal sync signal terminal of the image sensor is directly connected to the edge detection terminal of the timer, and the start and stop of the timer counting is controlled based on the horizontal sync signal. In this way, the timer will only count when the horizontal sync signal is valid. This path corresponds to... Figure 4 The gated trigger source route is as follows. Additionally, the pixel clock of the image sensor is directly connected to the external trigger input (ETR) of the timer, and the ETR is configured as the clock source for the timer. The timer's counting trigger polarity is configured to match the effective polarity of the pixel clock signal. This path corresponds to... Figure 4 The external clock source path is used. The preset threshold is the value in the auto-reload register of the timer. During the active period of the horizontal synchronization signal, the counter in the timer starts and can start counting. When the subsequent pixel clock signal is active, the input filter and edge detector will perform edge detection. If it is a rising edge or falling edge, the counter counts once. One pixel clock signal counts once, and the count value is obtained. The control module will compare the preset threshold in the auto-reload register with the above count value. If the count value reaches the preset threshold, a control command is sent to the DMA request generator. The DMA request generator controls the DMA controller to move one byte of high-resolution image data from the GPIO input register to memory.
[0057] In this embodiment, if the timer receives the line synchronization signal and pixel clock signal sent by the image sensor, the timer counts the pixel clock signal during the valid period of the line synchronization signal, and when the count value corresponding to the pixel clock signal reaches a preset threshold, it controls the DMA controller to cache the image data latched by the GPIO input register to memory. The microcontroller involved in this application is a general-purpose microcontroller, which does not have a dedicated peripheral for processing DVP port signals, nor does it utilize a dedicated peripheral for processing SPI ports. Instead, it utilizes general-purpose basic peripherals (timer, DMA controller, and GPIO input register), and uses an image sensor with DVP. Since DVP has multiple parallel data terminals, the corresponding data width is larger than the data width of SPI, thus enabling high resolution.
[0058] The microcontroller of this application has been described above. The ranging sensor of this application is described below. One embodiment of the ranging sensor of this application includes the microcontroller as described above, and an image sensor with a digital video port (DVP), the image sensor being connected to the microcontroller via the DVP.
[0059] In this embodiment, the DVP port-based image sensor and general-purpose microcontroller enable high resolution to be achieved at a lower cost.
[0060] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0061] It should be noted that, in the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0062] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0063] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units. This application claims protection for all solutions belonging to the same inventive concept.
Claims
1. A microcontroller, characterized in that, include: The system includes a timer, GPIO input registers, a direct memory access (DMA) controller, and memory; wherein the DMA controller is connected to the timer, the GPIO input registers, and the memory, respectively. The GPIO input register is used to latch image data sent by the image sensor through multiple parallel data terminals in the digital video port (DVP); wherein the GPIO input register is provided with GPIO terminals, the multiple parallel data terminals are connected to the GPIO terminals with consecutive addresses in the same group, and the starting address of the GPIO terminal is the byte start bit; The timer is used to count the pixel clock signal during the effective period of the line synchronization signal when the image sensor sends a line synchronization signal and a pixel clock signal; and when the count value of the pixel clock signal reaches a preset threshold, control the DMA controller to cache the same group of image data latched by the GPIO input register into the memory all at once.
2. The microcontroller according to claim 1, characterized in that, The timer is provided with an external trigger input terminal and an edge detection terminal, wherein the external trigger input terminal is connected to the pixel clock terminal of the image sensor, and the edge detection terminal is connected to the line synchronization signal terminal of the image sensor. Specifically, the timer is used to count the pixel clock signal that can trigger the timer to count when the edge detection terminal receives the line synchronization signal sent by the image sensor through the line synchronization signal terminal, which enables the timer to start.
3. The microcontroller according to claim 1, characterized in that, The timer is provided with an external trigger input terminal, wherein the external trigger input terminal is connected to the output terminal of an AND gate, and the two input terminals of the AND gate are respectively connected to the line synchronization signal terminal and the pixel clock terminal of the image sensor; The timer is used to count the reminder count signal after receiving it from the output of the AND gate via the external trigger input, and the count of the reminder count signal is used as the count of the pixel clock signal. The image sensor inputs the horizontal synchronization signal and the pixel clock signal to the AND gate via the horizontal synchronization signal terminal and the pixel clock signal terminal, respectively. When the polarity of the horizontal synchronization signal is the start trigger polarity of the timer and the polarity of the pixel clock signal is the count trigger polarity of the timer, the output of the AND gate outputs the reminder count signal.
4. The microcontroller according to claim 1, characterized in that, The timer includes input filtering and an edge detector; The input filter and edge detector are connected to the image sensor. The input filter and edge detector are used to detect the edge of the pixel clock signal during the effective period of the line synchronization signal when receiving the line synchronization signal and pixel clock signal sent by the image sensor.
5. The microcontroller according to claim 4, characterized in that, The timer also includes a counter, which is connected to the input filter and edge detector; The counter is used to count the pixel clock signal when the output signal sent by the input filter and the edge detector is received.
6. The microcontroller according to claim 5, characterized in that, The counter has 16 or 32 bits.
7. The microcontroller according to claim 5, characterized in that, The timer also includes a control module and an automatic reload register; The control module is connected to the automatic reload register and the counter respectively. The automatic reload register is used to pre-store the preset threshold, and the control module is used to compare the count value with the preset threshold.
8. The microcontroller according to claim 7, characterized in that, The timer also includes a DMA request generator; The DMA request generator is connected to the control module. The control module is used to send a control command to the DMA request generator when the count value of the pixel clock signal reaches the preset threshold, so that the DMA request generator controls the DMA controller to cache the image data latched by the GPIO input register into the memory.
9. A ranging sensor, characterized in that, include: The microcontroller as described in any one of claims 1 to 8, and the image sensor with a digital video port (DVP), wherein the image sensor is connected to the microcontroller based on the DVP.
Citation Information
Patent Citations
Image acquisition system, control method and storage medium
CN119562104A
Apparatus, methods and systems for randomly accessing pixel data from streaming image sensor data
US20130155279A1