Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Frame reader initialization

Hello,

I know there is already a lot on the forum about the Frame reader from the VIP suite, but I still don't get it running. I used the memtest software example to test the DDR Ram module of my Cyclone III Nios II evaluation kit (LCD 800 x 480 pixels) and it worked perfectly, so the harware design seems OK.

I've implemented a Frame reader in the design (the same design with the test pattern generator works perfectly, so I think it must be the C-code for the initialization that contains some errors...). I want the LCD to display a complete white image, but the screen stays black.

Here is the main.c file:

#include <stdio.h># include <unistd.h># include <stdlib.h># include <string.h># include <ctype.h># include "system.h"# include <stdio.h># include <io.h>
 
typedef struct 
{
  unsigned int framebuffer;
}display_buffer;
 
int main(void)
{
 
  display_buffer buffer;
  //Make a White background
  int xctr=0, yctr=0;
  for( xctr=0; xctr<800; ++xctr ) {
    for( yctr=0; yctr<480; ++yctr ) {
        buffer.framebuffer = 0xFFFFFFFF;
    }
  }
 
  //Frame 0 base adress
  IOWR(ALT_VIP_VFR_0_BASE, 4, &buffer.framebuffer);
  //Select frame 0
  IOWR(ALT_VIP_VFR_0_BASE, 3, 0);
  //number of words for frame 0 (800*480)=384 000
  IOWR(ALT_VIP_VFR_0_BASE, 5, 384000);
  //color cycles for frame 0 (800*480)
  // see http://www.alteraforum.com/forum/showthread.php?t=20596&page=2
  IOWR(ALT_VIP_VFR_0_BASE, 6, 384000);
  // Frame 0 Reserved
  IOWR(ALT_VIP_VFR_0_BASE, 7, 0);
  //Frame 0 width
  IOWR(ALT_VIP_VFR_0_BASE, 8, 800);
  //Frame 0 Height
  IOWR(ALT_VIP_VFR_0_BASE, 9, 480);
  // Frame 0 Interlaced
  IOWR(ALT_VIP_VFR_0_BASE, 10, 0); 
  //Start Frame Reader  
  IOWR(ALT_VIP_VFR_0_BASE, 0, 1);
  printf("Frame reader initialized");
 
  while(1);
  return 0;
}

Any suggestions?

Thanks!

Best regards,

Hans

18 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi there. It's not a problem. Here are some tipps to get that NIOS Code running. First to tell you, you are totally right. The Nios EDS codes many paths hard into the bsp. I also have problems with that every time I get a project from a colleague.

    My way (perhaps not the best way, but it works) is to generate a totally new Nios Project. Generate it from template, with bsp. I always take "hello world" as template. When the generation is completed, you will have to edit the bsp settings. In the first tab you chose the ssram for the two stacks. Then in the linker tab you set every property to ssram. After that generate the bsp.

    Now the last thing to do is open the previous c-code file in your favorite editor and past and copy the code over to the new hello world c-file. When you then compile the whole code it should work fine with my synthesized system.

    I will also have some sparetime over lunch, where I will test your hint with the sequential transmission. I really never thought about that, also not read it in any documentation I think, but that seems to make sense. Will have to try that on the hardware.

    (btw. it's not your problem, that I bite something like this question so much. This even helps me very much, because when we get that system to work with the CVO it will help me for an old project. So don't let yourself wear down by it.) ;-)

    Yours, Peet.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hey Peet,

    I spent the whole afternoon trying stuff out. First of all I'll start with another dumbass question ;) , I was able to set up the "NIOS Software build tools for Eclipse" software instead of the NIOS IDE, it is indeed much handier to import projects and the projects themself are much better organised (to my feeling). The only problem is that I don't have a "Run as NIOS II hardware" option available, I only have a "Run as local C/C++ application" option. Probably still something wrong with the basic settings somewhere. Any hints (I run the SP2 version of the NIOS software)? But I was able with the flash programmer to test your design (but then I can't use the console to view printf messages, so now running or debugging possible from the NIOS software), and indeed it flickers, so I used the VCO instead and also I got no picture.

    Now I looked again at the other example (for the CIIIc120 board) and discovered they activated the "use control port" option on the VCO as well and they initialized the VCO after the frame buffer. So I activated it, connected it to the data master of the CPU and wrote some basic settings into the control registers. I still got no picture, but when I can run/debug from within NIOS, then I can check the status registers of the VCO using simple printf messages (but for now I can't see any printf messages of the software because I cannot run it from NIOS), because then we can see if the VCO is outputting data or not.

    Another thing that's done in the example is they set the FIFO underflow bit again (they say it's not necessairy but they set it anyway...). I tried it here, but no direct succes without debug option.

    BTW, for the neek daughter card manual use this link:

    http://www.terasic.com/downloads/cd-rom/mtdb/

    There you can download all the documentation for the daughter card and it includes a pdf where you can find all the info about the MAX chip, LCD data for the VCO and VGA data,... might be handy.

    I have a feeling succes is not far away.... :cool:

    Thanks and take care,

    Best,

    Hans
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hey Peet,

    Don't bother about the "run as" configurations, it seems to have something to do with the windows 7 x64 release. Some compatibility issues, I'm now reinstalling the entire altera software with the help of another forum thread.

    I will be away for a big part of the weekend to play concerts, but I hope to investgate some more in our issue next week. By then all those minor software problems on my side will be solved, normally.

    Take care and enjoy the weekend!:cool:

    Best

    Hans
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hey Hans,

    Perhaps we should erase all other components that uses IRQs from the system. There is one thread here in the forum, where they had problems with the uart in this case, but I did not find it again.

    I tried the system on friday, but hadn't the time to reply. Same as you, I am out and and do much on the weekends. Hope your concert went well. So I think the system flickers one frame, but then stops. It is very short and I can't see it every time. I thought about, what would happen, if there is a FrameBuffer after the FrameReader. The Buffer could repeat the Image when it's buffer runs out, so there will be a way to see what it shows in the first frame. I have not tried that, but it might be interesting. Problem there will be, that the FrameReader and FrameBuffer must share the ddr ram for this.

    I will not have much time next week, but perhaps you find out something more. Good luck!
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hey Peet,

    I was experimenting some more this afternoon and I realized that we will need to take one step back and look again at the hardware setup. I didn't get the STATUS register of the VCO to a "1", this happens when the VCO is outputting correct data. I will check this in detail tonight using signaltap.

    So I changed the SOPC settings again, I added a test pattern generator and connected it straight to the VCO (I switched off the control bus again, so also no IRQ problems anymore) and disabled the FR. But still I got no image, normally in this setup we need a nice test pattern as you can see in Experiment3 I added in the attachment. This is the most simple form to use the VCO and TPG, and here it works perfectly. A cause of the problem can be:

    -The timing problems we get when the design builds (the current design is more complex then Experiment3, so maybe better constraints needed?). This could be solved by adding the "alt_vip_cvo.sdc" file to the timequest list (when there's a problem with the VCO constraints). This file is included in the IP directory of altera, and sets the timing constraints for the VCO. But when I add this file to the project, timequest ignores all the false path settings because of some error in the sdc (I'm not very good in sdc language so I wasn't able to implement it correctly...). They used this sdc file also in the example for the C3C120 board we shared earlier in this thread.

    It's just after some thinking I came to this conclusion, I have no idea if it can help us to solve the problem...

    Best and talk soon!

    Hans
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Hans,

    I added the TPG again and deactivated the FR. Worked here right without touching anything else. Setup and Hold timings are ok, rest is violated. I have only the clocks constrained.

    When I add the FR again and connect to the CVO it does not work, but the flicker is still there. So if you like try to step into your idea, I will first try to get out of the system what he is transmitting in the first frame.

    We will see...
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hey Peet

    I put a lot of efford in our design yesterday. I'm still investigating in the configuration of the CVO, because I think it is necessary it uses its control port in combination with the FR (I see it on every example I found).

    The reason is the following:

    The clocked_video_out works perfectly, so the FR is outputting good data. But when we connect the VCO, everything dies (although both output modules work perfectly with the TPG). So I read all the documentation again and tried to setup the VCO trough the control port. Which didn't succeed yet. I also posted a reply in our names to a thread which was investigating in the control port of the VCO (I hope you have no problem I used your name as well...).

    here is the link of the thread:

    http://www.alteraforum.com/forum/showthread.php?t=4884&page=3

    I hope to have some better news for you soon...

    Best,

    Hans