A Real-time Video Signal Transmission Method, Electronic Device and Storage Medium Based on SPI Communication
By adopting a real-time video signal transmission method based on SPI communication in small portable devices, and using HSS and WCB control words to flexibly configure image data, the problem of real-time transmission of small and medium-sized video images in the prior art is solved, and video signal transmission with low power consumption and low hardware requirements is achieved.
Patent Information
- Application Number
- CN202411506283.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2044-10-28
AI Technical Summary
The existing video signal transmission interface is difficult to achieve real-time transmission of small-resolution video images in small portable devices, and has high hardware requirements and high power consumption.
The real-time video signal transmission method based on SPI communication is adopted, and the image data is flexibly configured through the HSS control word and the WCB control word to realize the adaptation of the image data decoding mode and timing signal type, and adapt to the video signal transmission in different application scenarios.
It realizes real-time display and flexible transmission of video signals when the number of interconnect lines is limited, reduces hardware requirements and power consumption, and is suitable for a variety of application environments.
Smart Images

Figure CN119383294B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video signal transmission, and particularly to a real-time video signal transmission method, an electronic device, and a storage medium based on SPI communication. Background Art
[0002] Currently, there are several mainstream video signal transmission interfaces, including HDMI, LVDS, MIPI, etc. Most of these interfaces have complete and complex protocol rules to ensure the lossless transmission of large-bandwidth video signals. However, the encoding and decoding processes are complex, with large area and power consumption, and high hardware requirements, which are not suitable for small portable devices that only need to transmit small-resolution video images.
[0003] The Serial Peripheral Interface (SPI) does not rely on complex protocol content and circuit structures. Through very simple hardware and software configurations, it can achieve flexible data transmission while maintaining a high data transmission rate. In SPI communication, it can be divided into Standard-SPI (standard SPI), Dual-SPI (dual-line SPI), and Quad-SPI (quad-line SPI) according to the number of data lines used when the host transmits to the slave, which can send 1 bit / 2 bits / 4 bits of data respectively per single time, adapting to different communication rate requirements.
[0004] The standard SPI has a slower transmission rate but the lowest power consumption. Dual-line and quad-line SPI can improve the data transmission efficiency, but consume more power and require a higher number of interfaces. To meet the transmission requirements of small-resolution images in different application scenarios, a real-time video signal transmission method that is compatible with multiple environments, flexibly configurable, and has simple protocol rules is needed to achieve instant display of images. Summary of the Invention
[0005] Technical Objective: Aiming at the existing various video transmission scenario requirements, the present invention discloses a real-time video signal transmission method, an electronic device, and a storage medium based on SPI communication, which can flexibly configure image data according to the application scenario through a control word. Even when the number of interconnecting lines is limited, the slave can still receive images, realizing a video signal transmission scheme with a simple interconnection method, simple protocol rules, and adaptable to various application environments.
[0006] Technical Solution: To achieve the above technical objective, the present invention adopts the following technical solutions:
[0007] A real-time video signal transmission method based on SPI communication specifically includes the following steps:
[0008] S1. The host enables data transmission by sending a transmission enable signal based on SPI communication, and sends two control words and image data to the slave. The two control words are the Horizontal Sub-pixel Sequence (HSS) control word and the Word Count and Base (WCB) control word respectively. The HSS control word is used to determine the decoding mode of the image data, and the WCB control word is used to determine the type of timing signal generated.
[0009] S2. The slave determines the decoding mode of the image data and the type of timing signal generated according to the HSS control word and the WCB control word respectively.
[0010] S3. The slave generates a corresponding timing signal according to the type of timing signal determined in step S2.
[0011] S4. The slave performs serial-to-parallel conversion processing on the image data according to the decoding mode of the image data and the timing signal, outputs parallel image data in units of pixels, and converts it into a video signal.
[0012] S5. Close the data transmission to complete the video signal transmission between the host and the slave.
[0013] Preferably, the decoding mode consists of three parts, namely color mode, transmission protocol, and bit depth.
[0014] Preferably, the color mode includes monochrome mode and color mode. In monochrome mode, the image data contains grayscale information of a single color, and each grayscale value is mapped to a pixel. In color mode, the image data contains grayscale information of three colors, and every three grayscale values are mapped to a pixel.
[0015] Preferably, the transmission protocol includes single-line transmission, double-line transmission, and four-line transmission. Single-line, double-line, and four-line represent the number of data lines used by the host when transmitting image data.
[0016] Preferably, the bit depth includes 4-bit depth and 8-bit depth, indicating the bit width of the grayscale value of each color in the image data.
[0017] Preferably, the WCB control word includes a valid WCB control word and an invalid WCB control word. The valid WCB control word generates two timing signals, namely a line synchronization signal and a frame synchronization signal.
[0018] The line synchronization signal indicates that the next image data is the first data of the next line.
[0019] The frame synchronization signal indicates that the next image data is the first data of the next frame.
[0020] An invalid WCB control word does not generate any timing signals, indicating that the next image data follows the content of the previous transmission.
[0021] Preferably, the HSS control word and the WCB control word are transmitted in a single line.
[0022] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements a real-time video signal transmission method based on SPI communication as described above.
[0023] The present invention also provides a storage medium storing computer-executable instructions for executing a real-time video signal transmission method based on SPI communication as described above.
[0024] Advantageous effects: A real-time video signal transmission method, an electronic device, and a storage medium based on SPI communication provided by the present invention have the following advantageous effects:
[0025] Between the host and the slave of the present invention, the SPI communication protocol is relied on as a synchronous data bus, and the transmission of image data between the host and the slave is controlled by two control words. The interconnection method and protocol rules are simple. The two control words respectively control the decoding mode of the image data and the type of timing signals, enabling the slave to select an appropriate mode to transmit the video signal according to the type of video signal required to be generated by the host.
[0026] The decoding mode of the present invention includes three parts, namely the color mode, the transmission protocol, and the bit depth. The color mode includes a monochrome mode and a color mode. The transmission protocol includes single-line transmission, two-line transmission, and four-line transmission. The bit depth includes 4-bit depth and 8-bit depth. It can reasonably and flexibly select an appropriate decoding mode to transmit image data according to the application scenario. Even when the number of interconnecting lines is limited, the slave can still receive the image data. Moreover, the video signal transmission method of the present invention can perform serial-to-parallel conversion processing on the image data according to the decoding mode, so as to adapt to various transmission environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art.
[0028] Figure 1 It is a flowchart of a real-time video signal transmission method based on SPI communication of the present invention;
[0029] Figure 2 It is an example timing diagram of control word transmission and image data conversion when the host and the slave communicate once in the present invention;
[0030] Figure 3 This is a timing diagram example for control word transmission and image data conversion during two consecutive communications between the host and the slave in the present invention. Specific embodiments
[0031] The present invention will be more clearly and completely described below by way of several preferred embodiments in conjunction with the accompanying drawings, but the present invention is not limited to the scope of the described embodiments.
[0032] As Figure 1 shown, a real-time video signal transmission method based on SPI communication specifically includes the following steps:
[0033] S1. The host enables data transmission by sending a transmission enable signal based on SPI communication, and sends two types of control words and image data to the slave.
[0034] As a synchronous data bus, the SPI communication protocol is connected and communicates between the host and the slave through four logical lines: the serial output (SO) line for the host to input and the slave to output, the serial input (SI) line for the host to output and the slave to input, the serial clock (SCLK) sent by the host to the slave, and the chip select (CS) signal.
[0035] In a specific embodiment, the video signal source serves as the host, the display driving circuit serves as the slave, and the CS signal serves as the transmission enable signal. Only during the effective period of the transmission enable can the control word and image data be sent from the host through the SI line.
[0036] The two types of control words include the HSS control word and the WCB control word. The HSS control word is used to determine the decoding mode of the image data, and the WCB control word is used to determine the type of generated timing signal. In the present invention, the two types of control words are transmitted only through one SI 0 line, while the image data is transmitted through SI 0 ~SI 3It is transmitted through 1, 2 or all 4 data lines, so that the two control words can be distinguished from general image data; when the first to the eighth SCLK after the transmission enable is effective, the HSS control word is transmitted, and the ninth to the sixteenth SCLK transmits the WCB control word. Before the image data transmission enable, the corresponding relationship between the function of the two control words and the specific 8-bit data input should be agreed in advance, and then the image data transmission can start. When transmitting, the high bits are input first. If the control word corresponding to the pre-agreed form is not received within the corresponding time, the transmission method still follows the previous valid control word, and the two control words are effective during the signal transmission enable. The previous control word becomes invalid after the next control word is input. The transmission method of the image data follows the latest control word instruction.
[0037] S2. The slave device determines the decoding mode of the image data and the type of the generated timing signal according to the HSS control word and the WCB control word respectively.
[0038] S3. The slave device generates the corresponding timing signal according to the type of the generated timing signal determined in step S2.
[0039] The WCB control word includes a valid WCB control word and an invalid WCB control word. The valid WCB control word generates two timing signals, namely the line synchronization signal and the frame synchronization signal; the line synchronization signal indicates that the next image data is the first data of the next line; the frame synchronization signal indicates that the next image data is the first data of the next frame; the invalid WCB control word does not generate any timing signals, indicating that the next image data is immediately following the content of the previous transmission.
[0040] If a valid WCB control word is detected, the corresponding timing signal pulls up the high level in the next clock cycle after receiving the control word and maintains it for one clock cycle, so as to ensure that the image data after the serial-to-parallel conversion process must be output after the timing signal is generated.
[0041] S4. The slave device performs line serial-to-parallel conversion processing on the image data according to the decoding mode of the image data and the timing signal, outputs parallel image data in units of pixels, and converts it into a video signal.
[0042] The decoding mode includes three aspects, namely the color mode, the transmission protocol and the bit depth.
[0043] The color mode is divided into a monochromatic mode and a color mode. In the monochromatic mode, the image data contains the gray information of a single color, and each gray value is mapped to a pixel; in the color mode, the image data contains the gray information of three colors, and every three gray values are mapped to a pixel;
[0044] The transmission protocol is divided into single - line transmission, double - line transmission, and four - line transmission. Each SCLK transmits 1 bit / 2 bits / 4 bits of data respectively. In single - line transmission, image data is received only from the SI line. 0 In double - line transmission, image data is received from the SI 0 / SI 1 line. In four - line transmission, image data is received from SI 0 ~SI 3 simultaneously;
[0045] The bit depth is divided into 4 - bit depth and 8 - bit depth, which represents the bit width of the gray - scale value of each color in the image data. Assuming the bit depth of the current image is K, in monochrome mode, every K - bit image data is regarded as corresponding to one pixel, while in color mode, every 3×K - bit image data is regarded as corresponding to one pixel.
[0046] When image data is transmitted, it is input from the high - order bit. In the image data transmitted by the same serial clock, from SI 0 to SI 3 is regarded as the high - order bit to the low - order bit of the gray - scale value. After receiving the gray - scale value of one pixel, it is converted into parallel image data for output, and the data of the previous pixel is maintained until the gray - scale value of the next pixel is transmitted. If the gray - scale value of one pixel is not completely transmitted when the transmission enable ends, it is processed as all - zero data for the remaining low - order bits, and then converted to parallel output.
[0047] If the transmission enable ends immediately after receiving two control words, then only timing signals are generated in this transmission, and no image data is processed.
[0048] S5. Close data transmission, complete the video signal transmission between the host and the slave, that is, turn the CS signal to high level.
[0049] Embodiment 1
[0050] As Figure 2 shown, taking one real - time communication between the host and the slave as an embodiment of the present invention, it specifically includes the following steps:
[0051] A1. Take the CS signal as the enable signal, and then turn the CS signal to low level, indicating that the transmission enable is effective. The host transmits the HSS control word, the WCB control word, and image data to the slave.
[0052] A2. The slave determines the decoding mode of the image data according to the HSS control word and determines the timing signals to be generated according to the WCB control word.
[0053] The host and the slave device pre-define the correspondence between 8-bit data and control word functions, and the high bits are input first during transmission; when the WCB control word is 0x2C, it indicates the generation of a frame synchronization signal, and when the WCB control word is 0x2E, it indicates the generation of a line synchronization signal. In other cases, it is regarded as an invalid control word; the HSS[0] bit represents the color mode, with low level corresponding to monochrome mode and high level corresponding to color mode. HSS[3:2] represents the transmission protocol, and 2’b01 / 10 / 11 correspond to single-line, double-line, and four-line transmission protocols respectively. HSS[5:4] represents the bit depth, and 2’b01 / 10 correspond to 4-bit and 8-bit bit depths respectively. The remaining bits should be set to 0.
[0054] In this embodiment, the transmitted HSS control word is 0x1B, which is equivalent to 8’b0001_1101. That is, the HSS control word determines that the color mode in the current decoding mode is color mode, follows the four-line transmission protocol, and the bit depth is 4 bits. The transmitted WCB control word is 0x2E, which determines that the type of timing signal to be generated for this transmission is a line synchronization signal.
[0055] A3. The slave device generates corresponding timing signals according to the type of timing signal determined by the WCB control word.
[0056] As Figure 2 shown, after receiving the two control words in the first 16 clock cycles, a line synchronization signal is generated in the 17th clock cycle according to the type of the WCB control word and maintained for one clock cycle, indicating that the next image data is mapped to the first pixel of a new line.
[0057] A4. The slave device performs line serial-to-parallel conversion processing on the image data according to the decoding mode of the image data and the timing signal, outputs parallel image data in units of pixels, and converts it into a video signal;
[0058] According to the color mode and 4-bit bit depth in the decoding mode, it can be known that one pixel in this transmission contains 3×4-bit = 12-bit gray value information. And because it follows the four-line transmission protocol, the gray value information of one pixel can be converted every three clock cycles of input image data. During the transmission process, following the principle of high bits first input, it is output in parallel with D[0] as the highest bit and D
[11] as the lowest bit, and the output of the gray value information data D[0]~D
[11] of the previous pixel is maintained until the gray value information D
[12] ~D
[23] of the next pixel is input completely.
[0059] A5. Turn the CS signal to high level to close the data transmission and complete the video signal transmission between the host and the slave device.
[0060] Embodiment 2
[0061] As Figure 3As shown, taking two consecutive real-time communications between the host and the slave as another embodiment of the present invention, the specific steps are as follows:
[0062] B1. Use the CS signal as the enable signal, then convert the CS signal to a low level, indicating that the transmission enable is effective. The host transmits the HSS control word, the WCB control word, and the image data to the slave.
[0063] B2. The slave determines the decoding mode of the image data according to the HSS control word and determines the timing signal to be generated according to the WCB control word.
[0064] In this embodiment, the host and the slave previously agree that the correspondence between 8-bit data and the control word function is the same as that in the first embodiment. The transmitted HSS control word is 0x28, which is equivalent to 8’b0010_1000, determining that the color mode in the current decoding mode is the monochrome mode, following the transmission protocol of dual-line transmission, and the bit depth is 8 bit; the transmitted WCB control word is 0x2C, determining that the type of timing signal to be generated for this transmission is the frame synchronization signal.
[0065] B3. The slave generates the corresponding timing signal according to the type of timing signal determined by the WCB control word.
[0066] As Figure 3 shown, after receiving the two control words in the first 16 clock cycles, the frame synchronization signal is generated and maintained for one clock cycle in the 17th clock cycle according to the type of the WCB control word, indicating that the next image data is mapped to the first pixel of a new frame.
[0067] B4. The slave performs row serial-to-parallel conversion processing on the image data according to the decoding mode of the image data and the timing signal, outputs parallel image data in units of pixels, and converts it into a video signal.
[0068] According to the monochrome mode and 8-bit bit depth in the decoding mode, it can be known that one pixel in this transmission contains 1×8 bit = 8-bit gray value information, and since the dual-line transmission protocol is followed, the gray value information of one pixel can be converted every four clock cycles of input image data. During the transmission process, the principle of high-order first input is followed, and parallel output is performed with D[0] as the highest bit and D[7] as the lowest bit, and the data of the previous pixel is maintained until the gray value information of the next pixel is input completely.
[0069] B5. After the first image data transmission between the host and the slave ends, convert the CS signal to a low level to make the enable effective, and perform the second image data transmission between the host and the slave. The host transmits the HSS control word and the WCB control word to the slave again.
[0070] B6. Determine the decoding mode of the image data during the second image data transmission according to the HSS control word, and determine the type of timing signal to be generated during the second image data transmission according to the WCB control word.
[0071] During the second image data transmission, the transmitted HSS control word is 0x2C, which is equivalent to 8’b0010_1100. The color mode in the decoding mode is updated to the monochrome mode, following the transmission protocol of four-wire transmission, and the bit depth is 8 bits; the transmitted WCB control word is an invalid control word, indicating that the next image data is the content immediately following the previous transmission. Therefore, no timing signal is generated.
[0072] B7. The slave device performs row serial-to-parallel conversion processing on the image data according to the decoding mode of the image data, outputs parallel image data in units of pixels, and converts it into a video signal.
[0073] After the HSS control word updates the decoding mode during the second data transmission, the color mode and bit depth are the same as those during the first image data transmission. In this transmission, one pixel contains 1×8 bit = 8 bit grayscale value information, and the transmission protocol changes from two-wire transmission in the first time to four-wire transmission. Therefore, the grayscale value information of one pixel can be converted every two input clock cycles of image data. During the transmission process, following the principle of high-order first input, parallel data D[12:19] and D[20:27] are output successively. When the second transmission enable ends, only the high 4-bit grayscale values D
[28] ~D
[31] in one pixel are received. Therefore, the remaining low bits are processed as all-zero data, and finally the parallel data {D[28:31], 4’b0} is output.
[0074] B8. Turn the CS signal to high level to close the data transmission and complete the video signal transmission between the host and the slave.
[0075] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements any one of the above-mentioned video signal transmission methods based on SPI communication. The memory can be various types of memories, such as random access memory, read-only memory, flash memory, etc. The processor can be various types of processors, for example, a central processing unit, a microprocessor, a digital signal processor, or an image processor, etc.
[0076] The present invention also provides a storage medium storing computer-executable instructions for executing any one of the above-mentioned video signal transmission methods based on SPI communication. The storage medium includes various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs, etc.
[0077] The above are only the preferred embodiments of the present invention. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A real-time video signal transmission method based on SPI communication, characterized in that: The specific steps include: S1. The host sends a transmission enable signal based on SPI communication to start data transmission, and sends two control words and image data to the slave. The two control words are HSS control word and WCB control word. The HSS control word is used to determine the decoding mode of the image data, and the WCB control word is used to determine the type of generated timing signal; The WCB control word includes a valid WCB control word and an invalid WCB control word. The valid WCB control word generates two timing signals, namely, a line synchronization signal and a frame synchronization signal. The line synchronization signal indicates that the next image data is the first data of the next line; the frame synchronization signal indicates that the next image data is the first data of the next frame. The invalid WCB control word does not generate any timing signal, indicating that the next image data is immediately after the content of the previous transmission. S2. The slave determines the decoding mode of the image data and the type of the generated timing signal according to the HSS control word and the WCB control word; S3, the slave generates a corresponding timing signal according to the type of the timing signal generated determined in step S2; S4, the slave performs serial-to-parallel conversion on the image data according to the decoding mode of the image data and the timing signal, outputs parallel image data in units of pixels, and converts it into a video signal; S5. Close the data transmission and complete the video signal transmission between the host and the slave.
2. A real-time video signal transmission method based on SPI communication according to claim 1, characterized in that, The decoding mode consists of three parts: color mode, transmission protocol and bit depth.
3. A real-time video signal transmission method based on SPI communication according to claim 2, characterized in that, The color mode includes monochrome mode and color mode. In monochrome mode, the image data contains grayscale information of a single color, and each grayscale value is mapped to one pixel. In color mode, the image data contains grayscale information of three colors, and every three grayscale values are mapped to one pixel.
4. A real-time video signal transmission method based on SPI communication according to claim 2, characterized in that, The transmission protocols include single-line transmission, dual-line transmission and quad-line transmission. Single-line, dual-line and quad-line represent the number of data lines used by the host to transmit image data.
5. A real-time video signal transmission method based on SPI communication according to claim 2, characterized in that, The bit depth includes 4-bit depth and 8-bit depth, which indicates the bit width of the grayscale value of each color in the image data.
6. A real-time video signal transmission method based on SPI communication according to claim 4, characterized in that: HSS control word and WCB control word are transmitted via single line.
7. An electronic device, characterized in that: It comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a real-time video signal transmission method based on SPI communication as described in any one of claims 1 to 6 is implemented.
8. A storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are used to execute a real-time video signal transmission method based on SPI communication as described in any one of claims 1-6.
Citation Information
Patent Citations
Method for expanding chip selection number and enhancing read-write response time flexibility of SPI (Serial Peripheral Interface)
CN113722261A
Video signal transmission method and device based on SPI communication and storage medium
CN117676064A