Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-35257

Play and document C API Generator to work with FPGA code in C/C++

    XMLWordPrintable

Details

    • Story
    • Status: Done
    • Resolution: Done
    • None
    • ts_main_telescope

    Description

      Create a simple code in cRIO FPGA, use C API Generator to create header files, and create a simple C/C++ code to understand and document this procedure. This will help John understand better how this works.

      Attachments

        Activity

          Today John and I worked on a LabVIEW and C++ code to understand how to compile cRIO FPGA and access I/Os from C++ code. The code is stored in this repo: https://github.com/pcortes80/crio_cpp with LabVIEW 2021 SP1 and C++ code (still work-in-progress). I used this LabVIEW version because the cRIO I'm using for this test has this version installed and because I wanted to change some physical input in one of the modules I had installed on this cRIO. That´s why I did not use the cRIO simulator. 

          In this test, we use digital inputs and one FIFO to read them from C++ code. This was a successful test and allowed us to understand how the C API Generator works and how to use generated files.

          Next week we will continue working together to write and read a FIFO.

          pcortes Patricio Cortes added a comment - Today John and I worked on a LabVIEW and C++ code to understand how to compile cRIO FPGA and access I/Os from C++ code. The code is stored in this repo: https://github.com/pcortes80/crio_cpp  with LabVIEW 2021 SP1 and C++ code (still work-in-progress). I used this LabVIEW version because the cRIO I'm using for this test has this version installed and because I wanted to change some physical input in one of the modules I had installed on this cRIO. That´s why I did not use the cRIO simulator.  In this test, we use digital inputs and one FIFO to read them from C++ code. This was a successful test and allowed us to understand how the C API Generator works and how to use generated files. Next week we will continue working together to write and read a FIFO.
          pcortes Patricio Cortes added a comment - - edited

          Today John and I were doing some test reading and writing DMA FIFOs on the FPGA. I created FIFO_A (Host to Target) and FIFO_B (Target to Host) and put them in a separate while loop than reading switches. This is the  FPGA code:

          Jonh modified the c++ code to read UserSwitch0, UserSwitch1, UserSwitch2, put values into FIFO_A, and read them from FIFO_B. The result is shown in the following image:

          We thought these tests were successful. He knows how to handle controls and DMA FIFOs on the FPGA with C++, and we are ready to move on to modify M2Cell code. We need to think about how to do that, and we want to discuss this in the next Weekly M2 Progress Meeting.

          I only have to document how to use the C API Generator. 

           

          pcortes Patricio Cortes added a comment - - edited Today John and I were doing some test reading and writing DMA FIFOs on the FPGA. I created FIFO_A (Host to Target) and FIFO_B (Target to Host) and put them in a separate while loop than reading switches. This is the  FPGA code: Jonh modified the c++ code to read UserSwitch0, UserSwitch1, UserSwitch2, put values into FIFO_A, and read them from FIFO_B. The result is shown in the following image: We thought these tests were successful. He knows how to handle controls and DMA FIFOs on the FPGA with C++, and we are ready to move on to modify M2Cell code. We need to think about how to do that, and we want to discuss this in the next Weekly M2 Progress Meeting. I only have to document how to use the C API Generator.   
          ttsai Te-Wei Tsai added a comment -

          I think you may need to document the example (labview code + CPP example) in additional to the C API generator for all the process. This should be helpful for the future's developer/maintainer.

          ttsai Te-Wei Tsai added a comment - I think you may need to document the example (labview code + CPP example) in additional to the C API generator for all the process. This should be helpful for the future's developer/maintainer.

          Please check this document I created after the demo I worked with John:

          https://confluence.lsstcorp.org/pages/viewpage.action?pageId=192906897

          Thanks!

          pcortes Patricio Cortes added a comment - Please check this document I created after the demo I worked with John: https://confluence.lsstcorp.org/pages/viewpage.action?pageId=192906897 Thanks!
          ttsai Te-Wei Tsai added a comment -

          Looks good. I have some suggestion that we could discuss first before putting the ticket into done. Thanks!

          ttsai Te-Wei Tsai added a comment - Looks good. I have some suggestion that we could discuss first before putting the ticket into done. Thanks!

          People

            pcortes Patricio Cortes
            pcortes Patricio Cortes
            Te-Wei Tsai
            Patricio Cortes, Te-Wei Tsai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Jenkins

                No builds found.