Pieapplej
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    1
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Programming FPGA on USRP 2944R/Ettus X310 with UHD & RFNoc -- I # Starting with 1In1Out RFNoC Module For mutiple I/O realization, please take the following link. There are more details about the whole system as well. + [Programming FPGA on USRP 2944R/Ettus X310 with UHD & RFNoc -- II](/XNm0c9WdR9OtHZcTst8tLw) + [Problem Collection for USRP](/GHUV5o10Q9yw0GgNtNsTVQ) ## Preliminary This project is going to migrate DSP based on Verilog onto NI-USRP 2944R. Since the development tool is different from vivado, which I'm more familiar with. Hoping this starting guide can help any newer to USRP. ## Introduction Since there are UHD3.0 & UHD4.0 already, as well as RFNoC3.0 & RFNoC4.0. All of them are still under-maintained but there isn’t downward compatibility. Actually, the tools are quite different for them. That leads to the workflow differently. For me, I follow the starting guide, the instruction let me git clone the RFNoC4.0, while the guides are written for the RFNoC3.0. Besides, RFNoC4.0 has just been introduced for over a year. Most of the resources are based on 3.0. The document for starting RFNoC4.0 is not clear about its dependency though. Thus after a week of debugging, I summarized the workflow so far from my own experience. I'm still improving this project and the note. Please feel free to contact me or leave a message. ## 0. Some points that we should be caution - UHD is the usrp driver. - RFNoc is in gr-ettus package. It wraps the custom FPGA block (or IP). - GNU radio is the GPP radio software. UHD4.0 works with RFNoc4.0, GNU radio3.8, Xilinx Vivado 2019.1. Make sure each version is capable to each other, or even a little update will cause a disaster. ## 1.Software setting If you understand what’s the meaning of the instruction. You can do little modifications to it (like make -j15). Besides, it's suggested to follow this priority and build from the source. ### 1.1 UHD 4.0 ```shell= git clone --branch UHD-4.0 https://github.com/ettusresearch/uhd.git uhd mkdir uhd/host/build; cd uhd/host/build; cmake .. make -j4 sudo make install ``` ### 1.2 GNU Radio 3.8 ```shell= git clone --branch maint-3.8 --recursive \ https://github.com/gnuradio/gnuradio.git mkdir gnuradio/build; cd gnuradio/build; cmake .. make -j4 sudo make install ``` ### 1.3 gr-ettus ```shell= git clone --branch maint-3.8-uhd4.0 https://github.com/ettusresearch/gr-ettus.git gr-ettus mkdir gr-ettus/build; cmake.. make -j4 sudo make install ``` ### 1.4 Xilinx Vivado 2019.1 ```shell= Get the web package from xilinx website. Chmode +x the file Excute it ``` After all, restart the computer and now we have the working environment. We can do some tricks to verify them. ``` gnuradio-config-info ``` ![](https://i.imgur.com/JBpWoZL.png) ``` uhd_find_devices ``` If the result is wired, try this command to make sure usrp work correct. ``` uhd_usrp_probe ``` ![](https://i.imgur.com/FihFIEK.png) ``` rfnocmodtool help ``` ![](https://i.imgur.com/12kwa81.png) For uploading default image, please refer to the link below. https://files.ettus.com/manual/page_usrp_x3x0.html --- ## 2.Create Custom FPGA Module with rfnocmodtool I'm going to realize the "gain" module that example provided by UHD. Let's start with creating the custom rfnoc block with rfnocmodtool. ```shell= rfnocmodtool newmod test1 cd rfnoc-test1 rfnocmodtool add gain Enter name of block/code (without module name prefix): gain Enter valid argument list, including default arguments: (leave blank) Add Python QA Code? [y/N] N Add C++ QA Code? [y/N] N Block NoC ID (Hexadecimal): Leaving blank results in random NoC ID Skip Block Controllers Generation? [UHD block ctrl files] [y/N] N Skip Block interface files Generation? [GRC block ctrl files] [y/N] N ``` :::info In some situation you may able to skip the last two generation. Abstracted from "Getting Started with RFNoC Development"-AN-823 . It's worthy to note that though this file is for UHD3.0, there are some information that doesn't mention in "Getting_Started_with_RFNoC_in_UHD_4.0"-AN-400 . + *Block Controllers Generation: The block controllers are the C++ control that the user can apply to the UHD-part of the design. In these files, the user can add more control over this layer of the design. Depending on the complexity of the block it may be possible to add all necessary control using NoCScript (more details on NoCScript can be found in the section labeled UHD Integration). In this case the cpp/hpp block control files generation are not needed. Default is to generate as their existence will be ignored if not edited.* + *Block Interface: Add more design specific functionality to the design at the GNU Radio interface by generating these block-interface files and adding necessary logic. Depending on the complexity of the block it may be possible to add all necessary control using NoC-Script. In this case the block-interface files are not needed. Default is to generate as their existence will be ignored if not edited.* ::: Now we have the directory tree and we can divide it into three parts. **FPGA parts** + rfnoc/blocks + /blocks/ - gain.yml – Block Description YAML + /fpga/rfnoc_block_gain/ - rfnoc_block_gain.v – RFNoC Block HDL - rfnoc_block_gain_tb.sv – RFNoC Block Test Bench - noc_shell_gain.v – Custom NoC Shell + /icores/ - gain_x310_rfnoc_image_core.yml – Image Core YAML, handling the whole RFNoC configurations. --- **Driver** + lib - gain_block_ctrl_impl.cpp – UHD Block Controller C++ code - gain_impl.cc – GNU Radio Block C++ code + include/gain - gain_block_ctrl.hpp – UHD Block Controler C++ header - gain.h – GNU Radio Block C++ header --- **GnuRadio Application** + grc - test4gain_gain.block.yml - the block description in GunRadio + examples - gain.grc – Example flowgraph of GunRadio using RFNoC Block - .py -GunRadio excute file About this article that only talking about single I/O, we only need to program the FPGA part generally. The rest files are already done when the file structures are generated by rfnocmodtool. ## 3.Program custom FPGA module ### 3.1 block/gain.yml For the project *gain*, it's not necessary to modify this file. However, if the origin configuration can't satisfy you, like you want more ports. Editing the .yml file in /block folder as you wish. Then apply *rfnoc_create_verilog.py* to help you re-generate the corresponding .v file. To have more details, our custom IP are wrapped by RFNoC and communcate to outside by noc_shell.v Thus modified I/O requires corresponding RFNoC file. ``` python3 ~/USRP_dep/uhd/host/utils/rfnoc_blocktool/rfnoc_create_verilog.py -c ./adb.yml -d ~/USRP_dep/rfnoc-add1/rfnoc/fpga/rfnoc_block_adb ``` ### .v file + rfnoc/fpga/rfnoc_block_gain - rfnoc_block_gain.v – RFNoC Block HDL Put your verilog code here. - noc_shell_gain If you re-configure the port, you should edit this depents on needs. - rfnoc_block_gain_tb.sv – RFNoC Block Test Bench Put your testbench here. ### icore yml file ... ## 4.Cmake and test our IP. Mkdir a build folder at <repo> and cmake inside. For me since the cmake required by Vivado is 3.3.2 rather than over 3.8 that UHD needed. We need to specify the uhd/fpga folder as well. ``` /usr/bin/cmake -DUHD_FPGA_DIR=~/USRP_dep/uhd/fpga .. ``` The result should be like this. :::success ``` -- Checking for module SWIG -- Found SWIG version 4.0.1. -- Found SWIG: /usr/bin/swig4.0 -- Registering RFNoC block: rfnoc_block_gain -- Adding testbench target: rfnoc_block_gain_tb -- Adding image core target: gain_x310_rfnoc_image_core -- Configuring done -- Generating done -- Build files have been written to: /home/pieapple/USRP_dep/rfnoc-test4gain/build ::: Then we do the test bench by ``` make rfnoc_block_gain_tb ``` It'll show the tb result. :::success ``` ======================================================== TESTBENCH STARTED: rfnoc_block_gain_tb ======================================================== [TEST CASE 1] (t = 0 ns) BEGIN: Flush block then reset it... [TEST CASE 1] (t = 6450 ns) DONE... Passed [TEST CASE 2] (t = 6450 ns) BEGIN: Verify Block Info... [TEST CASE 2] (t = 6450 ns) DONE... Passed [TEST CASE 3] (t = 6450 ns) BEGIN: Verify user register... [TEST CASE 3] (t = 7850 ns) DONE... Passed [TEST CASE 4] (t = 8425 ns) BEGIN: Test passing through samples... [TEST CASE 4] (t = 9025 ns) DONE... Passed ======================================================== TESTBENCH FINISHED: rfnoc_block_gain_tb - Time elapsed: 9025 ns - Tests Run: 4 - Tests Passed: 4 - Tests Failed: 0 Result: PASSED ::: Then we can build the image file. ```shell= make sudo make install make gain_x310_rfnoc_image_core ``` or if you inster the debug probes, it'll be like: ``` rfnoc_image_builder -y ~/USRP_dep/rfnoc-add4/rfnoc/icores/add_x310_rfnoc_image_core.yml -t X310_1G -F ~/USRP_dep/uhd/fpga -l debug -I ~/USRP_dep/rfnoc-add4/rfnoc/blocks/add.yml ``` --- ## 5.Programming bitstream and upload After the image file building successfully, the .bin file will be in this directory. ``` <repo>/uhd/fpga/usrp3/top/x300/build/usrp_x310_fpga_HG.bit ``` Upload it. ``` uhd_image_loader --args "type=x300,addr=192.168.10.2" --fpga-path ./usrp_x310_fpga_1G.bin ``` >An alternative method is viv_jtag_program or just using vivado. Generally, you only use this method when USRP bricks. Re-power on the device and we can confirm the custom block by ``` uhd_usrp_probe ``` We can observe the Block#0 in FPGA right now. :::success ``` | _____________________________________________________ | / | | RFNoC blocks on this device: | | | | * 0/Block#0 | | * 0/DDC#0 | | * 0/DDC#1 | | * 0/DUC#0 | | * 0/DUC#1 | | * 0/Radio#0 | | * 0/Radio#1 ``` ::: ## 6.GRC yml If your rfnoc port aren't 1 in out, which's the defalut setting and you're going to apply the rfnoc module with GnuRadio. Iti's necessary to modfiy the .grc yml to tell GnuRadio the correct port configure. ## 7.Result Let's see the result by appling the RFNoC block in GnuRadio. ![](https://i.imgur.com/ysFyWGy.png) ![](https://i.imgur.com/w2JZbmN.png) ## Reference + RFNoC4 Workshop Part 2, Jonathon Pendlum – Ettus Research, Neel Pandeya – Ettus Research, GRCon 2020 + https://kb.ettus.com/Getting_Started_with_RFNoC_in_UHD_4.0 + https://kb.ettus.com/Getting_Started_with_RFNoC_Development + https://wiki.gnuradio.org/index.php?title=Creating_Python_OOT_with_gr-modtool -- ###### tags: `USRP`, `FPGA`, `Ettus Research`, `UHD`, `RFNoC`, `RFNoC搭建` >jessest94106@g.ncu.edu.tw Department of Space Science & Engineering Center for Astronautical Physics & Engineering National Central University, Taiwan [name=PieappleJ] [time=Sun, Mar 27, 2022]

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully