cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
aamir_sheikh
Contributor
Contributor
906 Views
Registered: ‎11-02-2020

VDMA and HDMI with linux

I interfaced ov2640 with pynq fpga, and used vdma to store frames to memory, and display it to an hdmi monitor.

I have to port the baremetal application to linux. I am using this example.

the video pipeline in the hardware do not require any software configuration except for vdma configuration.

now, i do not get any display on the hdmi display. s2mm works,(there is some data in the memory, see attached log file).

I am new to linux. Any help is appreciated.

0 Kudos
18 Replies
Nikhil_Thapa
Explorer
Explorer
833 Views
Registered: ‎05-28-2020

Hi @aamir_sheikh ,

Could you check the MM2S status? It can tell you what is happening to read channel of VDMA. 

 

Regards,

nikhil@logictronix.com
:::::Do not forget to Accept as solution, give Kudo and Share a post that you think is helpful:::::
0 Kudos
aamir_sheikh
Contributor
Contributor
811 Views
Registered: ‎11-02-2020

 

 

 

void vdma_s2mm_status_dump(vdma_handle *handle) {
    int status = vdma_get(handle, OFFSET_VDMA_S2MM_STATUS_REGISTER);
    printf("S2MM status register (%08x):", status);
    vdma_status_dump(status);
}

void vdma_mm2s_status_dump(vdma_handle *handle) {
    int status = vdma_get(handle, OFFSET_VDMA_MM2S_STATUS_REGISTER);
    printf("MM2S status register (%08x):", status);
    vdma_status_dump(status);
}
void vdma_status_dump(int status) {
    if (status & VDMA_STATUS_REGISTER_HALTED) printf(" halted"); else printf("running");
    if (status & VDMA_STATUS_REGISTER_VDMAInternalError) printf(" vdma-internal-error");
    if (status & VDMA_STATUS_REGISTER_VDMASlaveError) printf(" vdma-slave-error");
    if (status & VDMA_STATUS_REGISTER_VDMADecodeError) printf(" vdma-decode-error");
    if (status & VDMA_STATUS_REGISTER_StartOfFrameEarlyError) printf(" start-of-frame-early-error");
    if (status & VDMA_STATUS_REGISTER_EndOfLineEarlyError) printf(" end-of-line-early-error");
    if (status & VDMA_STATUS_REGISTER_StartOfFrameLateError) printf(" start-of-frame-late-error");
    if (status & VDMA_STATUS_REGISTER_FrameCountInterrupt) printf(" frame-count-interrupt");
    if (status & VDMA_STATUS_REGISTER_DelayCountInterrupt) printf(" delay-count-interrupt");
    if (status & VDMA_STATUS_REGISTER_ErrorInterrupt) printf(" error-interrupt");
    if (status & VDMA_STATUS_REGISTER_EndOfLineLateError) printf(" end-of-line-late-error");
    printf(" frame-count:%d", (status & VDMA_STATUS_REGISTER_FrameCount) >> 16);
    printf(" delay-count:%d", (status & VDMA_STATUS_REGISTER_DelayCount) >> 24);
    printf("\n");
}

 

i am using this to display the status register, and i get this

 

S2MM:
S2MM status register (00030810):running vdma-internal-error start-of-frame-late-error frame-count:3 delay-count:0
MM2S:
MM2S status register (00030000):running frame-count:3 delay-count:0

S2MM:
S2MM status register (00031810):running vdma-internal-error start-of-frame-late-error frame-count-interrupt frame-count:3 delay-count:0
MM2S:
MM2S status register (00021000):running frame-count-interrupt frame-count:2 delay-count:0

S2MM:
S2MM status register (00011810):running vdma-internal-error start-of-frame-late-error frame-count-interrupt frame-count:1 delay-count:0
MM2S:
MM2S status register (00031000):running frame-count-interrupt frame-count:3 delay-count:0

S2MM:
S2MM status register (00031810):running vdma-internal-error start-of-frame-late-error frame-count-interrupt frame-count:3 delay-count:0
MM2S:
MM2S status register (00021000):running frame-count-interrupt frame-count:2 delay-count:0

S2MM:
S2MM status register (00011810):running vdma-internal-error start-of-frame-late-error frame-count-interrupt frame-count:1 delay-count:0
MM2S:
MM2S status register (00031000):running frame-count-interrupt frame-count:3 delay-count:0

S2MM:
S2MM status register (00031810):running vdma-internal-error start-of-frame-late-error frame-count-interrupt frame-count:3 delay-count:0
MM2S:
MM2S status register (00021000):running frame-count-interrupt frame-count:2 delay-count:0

S2MM:
S2MM status register (00011810):running vdma-internal-error start-of-frame-late-error frame-count-interrupt frame-count:1 delay-count:0
MM2S:
MM2S status register (00031000):running frame-count-interrupt frame-count:3 delay-count:0

 

 

also, on a side note, i have not modified device tree for this, since all of the video pipleline, except for vdma is hardware based.

0 Kudos
watari
Professor
Professor
784 Views
Registered: ‎06-16-2013

Hi @aamir_sheikh 

 

Would you share the block diagram, if possible ?

 

Best regards,

0 Kudos
aamir_sheikh
Contributor
Contributor
782 Views
Registered: ‎11-02-2020

there is an unconnected video pattern generator too. ignore that. also there is a tcl file, i noted down all the settings as well. for vivado 2017.1

0 Kudos
watari
Professor
Professor
772 Views
Registered: ‎06-16-2013

Hi @aamir_sheikh 

 

Would you inform the following clock frequency and video timing ?

 

- cmos_clk

- fclk_clk0

- fclk_clk1

 

- video timing of ov2640

- video timing of dvi

 

Best regards,

0 Kudos
aamir_sheikh
Contributor
Contributor
766 Views
Registered: ‎11-02-2020

cmos_pclk.... i m not sure, it is generating 800 600 image, but at what fps, im not sure. the onboard clock(xclk) of ov2640 is 12 Mhz.

fclk_clk0 100 MHz

fclk_clk1 40 Mhz

video timing of ov2640 i have configured it for 800 600. i am not sure about fps.

video timing for dvi, vtc, it is all configured for 800 by 600 i.e 40Mhz

0 Kudos
watari
Professor
Professor
755 Views
Registered: ‎06-16-2013

Hi @aamir_sheikh 

 

I suggest you to make sure your input video timing. first.

Also, refer the following URL to debug it.

 

https://forums.xilinx.com/t5/Design-and-Debug-Techniques-Blog/Video-Series-25-Debugging-issues-on-the-AXI-VDMA-IP/ba-p/941372

 

Best regards,

aamir_sheikh
Contributor
Contributor
731 Views
Registered: ‎11-02-2020

thank you so much.

but i am getting absolutely nothing on monitor, shouldn't there be at least static, or noise etc if the vdma is unable to read correctly?

0 Kudos
watari
Professor
Professor
660 Views
Registered: ‎06-16-2013

Hi @aamir_sheikh 

 

OK.

 

>but i am getting absolutely nothing on monitor, shouldn't there be at least static,

 

First of all, you must decide output video timing.

In this case, I suggest you to decide output video timing as 800x600@60Hz.

After that you make sure input video timing.

 

Would you try it ?

 

Best regards, 

aamir_sheikh
Contributor
Contributor
658 Views
Registered: ‎11-02-2020

the output video timing, from MM2S is 40 Mhz, i have attached the relevant pictures, i think this is what you are asking

this same design works for baremetal design.

the api i used for that is the example one that xilinx provides. i have attached it just for reference

 

Screenshot from 2021-05-30 20-51-51.png
Screenshot from 2021-05-30 20-51-15.png
Screenshot from 2021-05-30 20-50-41.png
0 Kudos
watari
Professor
Professor
611 Views
Registered: ‎06-16-2013

Hi @aamir_sheikh 

 

Got it.

I guess the route cause is clock issue and/or reset tree issue.

Would you share whole boot message log to investigate and confirm the route cause ?

 

Best regards,

aamir_sheikh
Contributor
Contributor
577 Views
Registered: ‎11-02-2020

attached is the log file, there are some encoding issues or something, there are some characters missing, i reset the system twice. but it is still there, i hope it carries the information that is needed

0 Kudos
Nikhil_Thapa
Explorer
Explorer
471 Views
Registered: ‎05-28-2020

Hi @aamir_sheikh ,

The issue lies in the VDMA. You have to fix it.

Are you sure that S2MM is working? From your, VDMA status messages, I am seeing that there is VDMA SOF error on S2MM.

Here are couple of things you can check. If you think your S2MM is working and MM2S not working, then you can use XSCT Command to read the memory data. First write all the memories to zeros and then read the memory again. If you are getting data even after writing the zeros, then your S2MM is likely working. But still you have to check S2MM status. In the same way, you can do for MM2S channel. If MM2S channel is working, then you must get the output whatever data is in the memory locations. But still you have to check MM2S status.

If you are getting repeatedly SOF or EOF errors, generally, using clock converter also solves. However, I highly recommend you to check strictly your camera timing.

 

Regards,

nikhil@logictronix.com
:::::Do not forget to Accept as solution, give Kudo and Share a post that you think is helpful:::::
0 Kudos
aamir_sheikh
Contributor
Contributor
454 Views
Registered: ‎11-02-2020

thanks for replying,
for linux, I am not sure how to access XCST registers, i build a binary, and then i copy that to the SD card, and run it there. I am not using SDK.
when the same hardware is used in baremetal, the xcst reads 

xsct% mrd 0x43000034
43000034: 00011000

no errors here, when configured for a frame of 800 by 600.

the example that I'm using prints the virtual memory buffers for first 50 seconds.

I have attached another log file. initially all memory locations are FF. after sometime there is data in the buffers.

0 Kudos
aamir_sheikh
Contributor
Contributor
431 Views
Registered: ‎11-02-2020

@watarii am thinking of moving on to the approach as outlined here

do you think this is a better way of accessing vdma

0 Kudos
watari
Professor
Professor
361 Views
Registered: ‎06-16-2013

Hi @aamir_sheikh 

 

I strongly suggest you to use fb write and read instead of VDMA.

Xilinx recommends to use them as kernel driver for v4l2 and DRM. They are mainline IPs.

 

Hope this helps,

 

# Note

Perhaps, you might need to learn v4l2 and/or DRM...

 

Best regards,

 

aamir_sheikh
Contributor
Contributor
342 Views
Registered: ‎11-02-2020

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841873/Linux+Drivers says that v4l2 drivers are for Ultrascale devices.

Xilinx soft DMA drivers as described here
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842337/Linux+Soft+DMA+Driver

will they not do the job?

0 Kudos
watari
Professor
Professor
320 Views
Registered: ‎06-16-2013

Hi @aamir_sheikh 

 

Since I don't confirm it on Vivado and kernel driver source code, I don't know whether you can use FB WR/RD in Zynq or not.

But, if you follow the rule of linux and framework, ex. v4l2 and DRM, I suggest you to try it.

 

Hope this helps,

 

Best regards,