Dear Beagle Board community,
I am developing a system based on the AM62x platform running Linux (kernel 6.x). Using the PRU, I aim to capture an incoming digital video stream in BT.656 square pixel format (768×576). The stream provides one byte at a time at a frequency of 29.5 MHz, along with a corresponding clock signal, which I also read from the source device.
For testing purposes, I am currently using a PocketBeagle 2 board with the Debian 13 image (kernel 6.2). Through multiple experiments, I determined that this task requires use of the PRU. I successfully created a device tree overlay, enabled the first 8 pins on PRU0, and increased the PRU clock frequency from 200 MHz to 333 MHz, all of which I verified experimentally.
I then implemented a simple PRU firmware that waits for a rising edge on one of the PRU0 pins and, upon detection, reads the __R31 register and stores its value into a ring buffer, updating an index accordingly. Both the ring buffer and index reside in PRU shared memory. Additionally, I developed a basic kernel driver to map this shared memory into Linux user space, along with a user-space application that accesses it via mmap().
At this point, the firmware appears to be reading BT.656 data. For example, during active video, I consistently observe 0x604 bytes (CrYCbY) following the BT.656 sync sequence 0xFF 00 00 xx, where xx reliably corresponds to header values such as 0x80 or 0xC7. My application is able to read data from the ring buffer, so the overall data path seems functional.
However, I am encountering a significant issue: I do not appear to be capturing the full video data in the Linux application. Instead of the expected 288 lines per field (with two interlaced fields, 0 and 1), I am only seeing approximately 55–60 lines. The resulting image only vaguely resembles the expected output. Since the video source has no lens, I would expect at most a grayscale gradient or shadowing; however, even within these 55–60 lines, I can observe differences when the video core is covered or uncovered.
At times, it also appears that some bytes may be skipped during capture.
Given this situation, I would appreciate your guidance on the following:
-
Does my current approach seem viable for reliably capturing the full BT.656 frame?
-
Are there specific improvements or adjustments I should consider in the PRU firmware or user-space application to avoid data loss?
-
Would it be more appropriate to move the data reception logic from the PRU/user-space path into a kernel-level driver?
Thank you in advance for your time and support.
Best regards,
Mikhail