14 Replies Latest reply on Nov 27, 2018 2:43 AM by vladimirostu_2251656

    FX3 GPIF II for Display RGB

    vladimirostu_2251656

      Hello.

      I have a debug board with FX3 chip.

       

      I also have a display OSD057VA (640x480 pix) with a parallel interface (this one where there are signals vsync, hsync, clk, ...)

       

       

      I want to connect this display to the FX3 board using, the GPIF 2 interface (configured for output).

       

      Tell me, are there any ideas, how can this be done?

       

      Thank you very much.

        • 1. Re: FX3 GPIF II for Display RGB
          abga

          Hi,

           

          Yes it is possible to stream out video from USB to GPIF II state machine. I am attaching one demo firmware (UVCmaster) to send out data from GPIF II. Please note that this state machine is not sending any valid data. You have to modify it to take data from the DMA buffers and send it out.

          In the uvcmaster state machine, three counters are used as follows: Data_Counter: used for H_active duration Control_counter: used to count number of lines in a frame Address_Counter: used for V_blanking duration. Three empty states are used as delay states for the H_blanking duration. Since each state can take a repeat count of 255 (max), the max possible H_blanking duration possible for this design is 255*3. There are four parameters to be filled in the uvcmaster firmware. These can be calculated as follows.

          H_ACTIVE = ((Line_width)*(bytes_per_pixel)/(bus_width))

          N_LINES = Frame_height

          H_BLANKING and V_BLANKING can be approximated using the below formula.

          (FRAME_ACTIVE+ FRAME_BLANKING) = FRAME_PERIOD

          Where

          FRAME_ACTIVE = ((H_ACTIVE + H_BLANKING)*(PCLK_PERIOD))*(N_LINES)

          FRAME_BLANKING = (V_BLANKING)*(PCLK_PERIOD)

          FRAME_PERIOD = 1/FRAMERATE

          PCLK_PERIOD = 1/PCLK

          The above formulae can be used to emulate the exact timings being used by a customer on his setup and then use the customer’s UVC firmware with this to easily reproduce their hardware setup and look for any shortcomings in the their firmware.

           

          You have to change the PIB clock dividers to set the clock at GPIO 16 using pibClk.clkDiv = 5 parameter. See

          #ifdef R_1920_1080_30

          pibClk.clkDiv = 5;

          #define H_ACTIVE (1920)

          #define N_LINES (1080)

          #define H_BLANKING (300)

          #define V_BLANKING (100000)

          #endif

          See the above lines in the firmware.

           

          To change the Horizontal blanking you have to modify the generated GPIF SM wave data. Refer to CyFxSetHBlanking() in the attached firmware.

           

          If you have any other query do let me know.

           

          Thanks & Regards

          Abhinav

          1 of 1 people found this helpful
          • 2. Re: FX3 GPIF II for Display RGB
            vladimirostu_2251656

            Thank you very much.

             

            I think that put the image on LCD using GPIO II is a very promising opportunity.

             

            Please tell me one more question.

             

            Is it possible to output data from the program on "C" directly to the port DQ15-DQ0? Simultaneously to 16 pins ?

             

            Or can it be done only using GPIF II designer?

             

            I know there is a function:

             

            CyU3PReturnStatus_t CyU3PGpifWriteDataWords (uint32_t threadIndex, CyBool_t selectThread, uint32_t numWords, uint32_t? Buffer_p, uint32_t waitOption)

             

            But it uses DMA and GPIF, and threads. Now It's very difficult for me...

             

             

            Is it possible to output directly from the "C" program?

             

            Any that code:

                 DQ = 0x3355;

             

            It is really ?

             

             

            Function

            CyU3PGpioSetValue(pin, CyTrue);

             

            change only one pin...

             

            I want change 16 (or 8) pins simultaneously.

             

            Thank you very much.

            • 3. Re: FX3 GPIF II for Display RGB
              abga

              Hi,

               

              If you use CyU3PGpioSetValue(pin, CyTrue); to set 16/32 bit bus width one by one then it will consume huge delay.  We don't have any API to set 16/32 GPIO pins simultaneously without using GPIF interface. You can use CyU3PGpifWriteDataWords()  to set the GPIO pins simultaneously.

               

              Thanks & Regards

              Abhinav

              1 of 1 people found this helpful
              • 4. Re: FX3 GPIF II for Display RGB
                vladimirostu_2251656

                Many thanks !

                 

                Unfortunately, the documentation is not very clear on how to use this method (CyU3PGpifWriteDataWords() ). What is a threads, how to connect them?

                 

                I found a similar subject

                https://community.cypress.com/thread/20982?start=0&tstart=0

                 

                There is an example.

                What about reading the data? Do the same?

                • 5. Re: FX3 GPIF II for Display RGB
                  vladimirostu_2251656

                  The count of threads is 4 ?

                   

                  I can start 4 threads simultaneously ?

                  • 6. Re: FX3 GPIF II for Display RGB
                    vladimirostu_2251656

                    Hello.

                     

                    What pins are: frame valid, line valid, datas, and so on ?

                     

                    I dont't find pin descriptions in project.

                    • 7. Re: FX3 GPIF II for Display RGB
                      vladimirostu_2251656

                      streamer.jpg

                       

                      How use this program for video -> usb -> lcd chain ?

                      • 8. Re: FX3 GPIF II for Display RGB
                        vladimirostu_2251656

                        I find next sygnals on board (fx2 super speed exploere kit) by my oscilloscope:

                         

                        Above 25 MHz - pclk

                        Ctl_11 - line valid (?)

                        Ctl_12 - frame valid (?)

                         

                        It's right ?

                         

                         

                        Where I find data sygnals ?

                        Where is data enable pin ?

                        • 9. Re: FX3 GPIF II for Display RGB
                          vladimirostu_2251656

                          Please explain this code:

                           

                           

                           

                          void CyFxSetHBlanking (uint16_t horizBlanking)

                          {

                          if(horizBlanking >= 3* 0xFF)

                          return;

                           

                           

                          uint16_t numFulls = horizBlanking / 0xFF;

                          //uint32_t * arrays[] = {&CyFxGpifWavedata[5].leftData[2], &CyFxGpifWavedata[6].leftData[2], &CyFxGpifWavedata[9].leftData[2]};

                          //uint8_t i, index = 0;

                           

                           

                          horizBlanking -= numFulls * 0xFF;

                           

                           

                          switch(numFulls)

                          {

                          case 3: CyFxGpifWavedata[5].leftData[2] |= (0xFF << 22);

                          CyFxGpifWavedata[6].leftData[2] |= (0xFF << 22);

                          CyFxGpifWavedata[9].leftData[2] |= (0xFF << 22);

                          break;

                           

                           

                          case 2: CyFxGpifWavedata[5].leftData[2] |= (0xFF << 22);

                          CyFxGpifWavedata[6].leftData[2] |= (0xFF << 22);

                          CyFxGpifWavedata[9].leftData[2] |= (horizBlanking << 22);

                          break;

                           

                           

                          case 1: CyFxGpifWavedata[5].leftData[2] |= (0xFF << 22);

                          CyFxGpifWavedata[6].leftData[2] |= (horizBlanking << 22);

                          CyFxGpifWavedata[9].leftData[2] |= (0x00 << 22);

                          break;

                           

                           

                          case 0: CyFxGpifWavedata[5].leftData[2] |= (horizBlanking << 22);

                          CyFxGpifWavedata[6].leftData[2] |= (0x00 << 22);

                          CyFxGpifWavedata[9].leftData[2] |= (0x00 << 22);

                          break;

                          }

                          ...

                          }

                          • 10. Re: FX3 GPIF II for Display RGB
                            vladimirostu_2251656

                            Don't find

                             

                            CY_FX_GPIFTOUSB_PATTERN

                             

                            handler in source code...

                            • 11. Re: FX3 GPIF II for Display RGB
                              abga

                              Hi,

                               

                              In the attached project please open the GPIF project folder(Image_sensor_out.cydsn) then double click on (Image_sensor_out (CYFX file)), you will find the GPIO pin number there. Those GPIO pin numbers can be mapped to the hardware pin using datasheet.

                               

                               

                              Thanks & Regards
                              Abhinav

                              • 12. Re: FX3 GPIF II for Display RGB
                                abga

                                Hi,

                                 

                                This code is modifying the GPIF wave data in the gpif2config.h file generated by GPIF designer tool. This code will change the counter values so as to obtain the desired HBlanking in the code.

                                 

                                Please note that the code that I had shared is just a reference for designing GPIF Master. This firmware has only In-endpoint exposed to the host but in your application you have to send video file out so you have to add Out-EP in the descriptor file. Please refer to the AN65974 to see how to send data out from the host and commit it to GPIF side.

                                 

                                Thanks & Regards
                                Abhinav

                                • 13. Re: FX3 GPIF II for Display RGB
                                  abga

                                  First add Out- EP in the descriptor file and then you will be able to see Bulk out EP in the tool. To send the video file out follow the following steps:

                                   

                                  1. Select "Bulk out Endpoint".

                                  2. Click on "DataTransfer" tab.

                                  3. Select the appropriate values for wValue, Req Code, wIndex & Direction.

                                  4. Select the "Transfer File" button, browse the file and send it.

                                   

                                  Thanks & Regards
                                  Abhinav

                                  • 14. Re: FX3 GPIF II for Display RGB
                                    vladimirostu_2251656

                                    Many thanks !