User Tools

Site Tools


tuto_fpga_pico

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tuto_fpga_pico [2016/05/18 10:50] – [Edit the .grc file] lbesemetuto_fpga_pico [2017/11/15 16:22] (current) – [Create the scenario] onicolas
Line 1: Line 1:
-# Using a custom bitstream with a PicoSDR (WORK IN PROGRESS)+# Using a custom bitstream with a PicoSDR
  
-This tutorial shows how to use a custom bitstream when you are making experiments with PicoSDR. For this we will be using a Nutaq exemple about OFDM transmission.+This tutorial shows how to use a custom bitstream when you are making experiments with PicoSDR. For this we will be using a Nutaq example about OFDM transmission.
  
- This exemple provides a bitstream and a GNURadio Companion (GRC) file interacting with the bitstream. All the OFDM work is done within the FPGA. Basically you send raw data to the PicoSDR, the FPGA make the OFDM modulation, TX antenna of card 2 make the emission and RX antenna of card 2 receive the signal, FPGA make the OFDM demodulation, and data is sent back to the computer. As you can see all the work is done with only 1 PicoSDR but using the antennas, so this really for demonstration purpose only. (Pro tip : when modulation and demodulation is made by the same FPGA you don't have to care of the synchronisation because you share the same clock)+This example provides a bitstream and a GNU Radio Companion (GRC) file interacting with the bitstream. All the OFDM work is done within the FPGA. Basically you send raw data to the PicoSDR, the FPGA makes the OFDM modulation, TX antenna of card 2 makes the emission and RX antenna of card 2 receives the signal, the FPGA makes the OFDM demodulation, and data is sent back to the computer. As you can see all the work is done with only 1 PicoSDR but using the antennas, so this is really for demonstration purpose only. (Pro tip : when modulation and demodulation are made by the same FPGA you don't have to take care of the synchronization because both share the same clock).
- +
-The GRC file can be found at ''/Path/to/toolchain/opt/Nutaq/ADP6/ADP\_MicroTCA/sdk/gnuradio/gr-nutaq/examples/ofdm.grc'' and the bitstream at ''/Path/to/toolchain/opt/Nutaq/ADP6/ADP\_MicroTCA/sdk/fpga/bin/OFDM_6_6_0_sx315.bit''. Copy both to a new folder named ''fpga-pico''.+
  
 +The GRC file can be found at ''/Path/to/toolchain/opt/Nutaq/ADP6/ADP\_MicroTCA/sdk/gnuradio/gr-nutaq/examples/ofdm.grc'' and the bitstream at ''/Path/to/toolchain/opt/Nutaq/ADP6/ADP\_MicroTCA/sdk/fpga/bin/OFDM\_6\_6\_0\_sx315.bit''. Copy both to a new folder named ''fpga-pico''. For example, on ''airlock'', the toolchain is located in ''/cortexlab/toolchains/current''.
  
 ## Edit the .grc file ## Edit the .grc file
  
-Let's take a look at ''ofdm.grc''. First, what it is intended to do : We send a video file to RTDEX Sink, and form RTDEX Source we get the constellation points of the OFDM demodulation and the video file is sent to an UDP Sink (in order to open it with VLC for example). We have also a lot of parameters blocks we don't care about in this tutorials (all the custom register blocks are specific to the bitstream).+Let's take a look at ''ofdm.grc'': On ''airlock'', run ''$ gnuradio-companion <path-to-ofdm.grc>''. 
 + 
 +First, what it is intended to do: we send a video file to RTDEX Sink, and from RTDEX Source we get the constellation points of the OFDM demodulation and the video file is sent to UDP Sink (in order to open it with VLC for example). We have also a lot of parameter blocks we don't care about in this tutorials (all the custom register blocks are specific to the bitstream).
  
  
-This example can be used straight away when you are working on your setup, but not in CortXlab because of the video file over UDP thing. Instead of this, we are going to do something a lot easier, which is sending a constant integer to the PicoSDR, and see if we get it back.+This example can be used straight away when you are working on your setup, but not in CorteXlab because of the video file over UDP thing. Instead of this, we are going to do something a lot easier, which is sending a constant integer to the PicoSDR, and see if we get it back.
  
  
Line 19: Line 20:
  
  
-Let's back to the idea of sending a constant number to the PicoSDR and see if we get it back. First thing to do is to add a ''Constant Source'' block (with Int as Output Type, and whatever-you-want as the constant), and connect it to ''RTDEX Sink''. Now, how can we check that we receive the right number ? We could send it to a file and then check the file, but this ain't funny. Instead of this, we're gonna use a super cool new type of block added to GNURadio lately (As I am writing this tutorial). I'm talking about ''Python Block''. With this block, you can create a custom block, with its associated python code easily, without going through an OOT module. +Let'get back to the idea of sending a constant number to the PicoSDR and see if we get it back. First thing to do is to add a ''Constant Source'' block (with Int as Output Type, and whatever-you-want as the constant) (block can be found in category ''Waveform Generator''), and connect it to ''RTDEX Sink''. Now, how can we check that we receive the right number ? We could send it to a file and then check the file, but this ain't funny. Instead of this, we're gonna use a super cool new type of block added to GNURadio lately (As I am writing this tutorial). I'm talking about ''Python Block''. With this block, you can create a custom block, with its associated python code easily, without going through an OOT module. 
  
-Add a Python Block, open it, and click on 'Open in Editor'. You can now edit the python code behind the block, and as soon as you save it, changes are repercuted to the block in GRC. You can either write your own code comparing two inputs or use mine :+Add a Python Block (from category ''Misc''), open it, and click on 'Open in Editor'. You can now edit the python code behind the block, and as soon as you save it, changes are repercuted to the block in GRC. You can either write your own code comparing two inputs or use mine :
 <code> <code>
 """ """
 Embedded Python Blocks: Embedded Python Blocks:
  
-Each this file is saved, GRC will instantiate the first class it finds to get +Each time this file is saved, GRC will instantiate the first class it finds to get 
-ports and parameters of your block. The arguments to __init__  will be the+the ports and parameters of your block. The arguments to __init__  will be the
 parameters. All of them are required to have default values! parameters. All of them are required to have default values!
 """ """
Line 82: Line 83:
 ## Create the scenario ## Create the scenario
  
-In order to run the experiment in CorteXlab we need a description called scenario. Create a file name ''scenario.desc'' and copy the following in it :+In order to run the experiment in CorteXlab we need a description called scenario. Create a file named ''scenario.yaml'' and copy the following in it :
 <code> <code>
 # Example scenario description file # Example scenario description file
Line 91: Line 92:
 # Scenario textual description # Scenario textual description
 #   simple string (a one liner) #   simple string (a one liner)
-desc base scenario for CorteXlab+description: base scenario for CorteXlab
  
 # Experiment maximum duration # Experiment maximum duration
 #   Time after which the experiment is forced to stop #   Time after which the experiment is forced to stop
-#   integer (minutes+#   integer (seconds
-durat 5+duration: 300
  
 # Node list # Node list
Line 102: Line 103:
 #   format: #   format:
 # #
-#   (machine): +#   nodes: 
-  entry (entry point script relative to the task root+#     (machine): 
-#   exit (exit point script relative to the task root. Use "none" for none)+      command: (entry point script relative to the task root)
  
-node31: +nodes: 
-   entry ofdm.py +  node31: 
-   bitstreamA OFDM_6_6_0_sx315.bit+    command: ./ofdm.py 
 +    bitstreamAOFDM_6_6_0_sx315.bit
 </code> </code>
  
-If you trasnlate this file it says "The experiment will run for 5 minutes. The file ofdm.py will be executed on node 31 using the bitstream OFDM_6_6_0_sx315.bit".+If you translate this file it says "The experiment will run for 5 minutes. The script ofdm.py will be executed on node 31 using the bitstream OFDM_6_6_0_sx315.bit".
  
  
Line 122: Line 124:
 │   ├── ofdm.py │   ├── ofdm.py
 │   ├── epy_block_0.py │   ├── epy_block_0.py
-│   ├── scenario.desc+│   ├── scenario.yaml
 │   ├── ofdm.grc │   ├── ofdm.grc
 │   └── OFDM_6_6_0_sx315.bit │   └── OFDM_6_6_0_sx315.bit
Line 128: Line 130:
 </code> </code>
  
-The .grc will not be used by CorteXlab but you can let it in the same directory. ''epy_block_0.py'' correspond to the python code of your custom block ''error rate''.+The .grc will not be used by CorteXlab but you can let it in the same directory. ''epy\_block\_0.py'' correspond to the python code of your custom block ''error rate''.
  
 ### Upload the files on airlock ### Upload the files on airlock
Line 208: Line 210:
 </code> </code>
  
-So we see that we have a folder for each task and inside each folder one compressed file per participant node. Let'decompress node31.tgz :+So we see that we have a folder for each task and inside each folder one compressed file per participant node. Let'extract node31.tgz :
  
 <code> <code>
Line 217: Line 219:
 you@srvairlock:~/results/task_15/node31$ ls you@srvairlock:~/results/task_15/node31$ ls
 epy_block_0.py    impact_instr.txt      ofdm.py        stdout.txt epy_block_0.py    impact_instr.txt      ofdm.py        stdout.txt
-epy_block_0.pyc   OFDM_6_6_0_sx315.bit  scenario.desc+epy_block_0.pyc   OFDM_6_6_0_sx315.bit  scenario.yaml
 _impactbatch.log  ofdm.grc              stderr.txt _impactbatch.log  ofdm.grc              stderr.txt
 </code> </code>
  
-We see that all of the files we used to create the task are inside. The other two are:+We see that all of the files we used to create the task are inside. The others are:
  
   * ''stdout.txt'': all output messages from your GNU Radio python script are written here. These include GNU Radio messages as well as all "print"s you include in your code. Seeing the contents of this file is useful to assert its correct operation.   * ''stdout.txt'': all output messages from your GNU Radio python script are written here. These include GNU Radio messages as well as all "print"s you include in your code. Seeing the contents of this file is useful to assert its correct operation.
   * ''stderr.txt'': all error messages are printed here. If you see strange things on the ''stdout.txt'' or nothing at all, it might be interesting to take a look at the ''stderr.txt'' to debug your code.   * ''stderr.txt'': all error messages are printed here. If you see strange things on the ''stdout.txt'' or nothing at all, it might be interesting to take a look at the ''stderr.txt'' to debug your code.
-  * ''impact_instr.txt'': The impact instructions used to flash the bitstream +  * ''impact_instr.txt'': The impact instructions used to flash the bitstream (this file is automatically generated) 
-  * ''_impactbatch.log'': Impact log+  * ''_impactbatch.log'': Impact execution log
  
 Let's take a look inside ''stdout.txt'': Let's take a look inside ''stdout.txt'':
Line 234: Line 236:
 </code> </code>
  
-You should get a long file that looks more or less like this:+You should get a file looking like this:
  
 <code> <code>
Line 283: Line 285:
 </code> </code>
  
-Here we have 98% valid reveived numbers, which is what we expected because the two antennas are close. You should have a result at least superior to 90%.+Here we have 98% valid received numbers, which is what we expected because the two antennas are close. You should have a result at least superior to 90%.
  
  
 ## What's next ## What's next
  
-Obviously, the next step for you is to try an experiment with your own bitstream. But you can also try to adapt other Nutaq exemple bistream !+Obviously, the next step for you is to try an experiment with your own bitstream. But you can also try to adapt other Nutaq example bistream !
  
tuto_fpga_pico.1463561448.txt.gz · Last modified: 2016/05/18 10:50 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki