element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Experts, Learning and Guidance
  • Technologies
  • More
Experts, Learning and Guidance
Ask an Expert Forum UART custom AXI4 Lite IP
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Experts, Learning and Guidance requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 5 replies
  • Subscribers 267 subscribers
  • Views 227 views
  • Users 0 members are here
  • soc
  • AXI4
  • uart
  • ZUBoard
Related
See a helpful answer?

Be sure to click 'more' and select 'suggest as answer'!

If you're the thread creator, be sure to click 'more' then 'Verify as Answer'!

UART custom AXI4 Lite IP

MATRIX7878
MATRIX7878 9 days ago

Hello,

     I am creating a custom IP for a UART for my ZuBoard 1CG.  I am not sure how to complete the AXI4 files both the wrapper and the slave file.  I have looked for guides and none have helped me.  I tried the ZuBoard training and that did not help either.  Does anyone have any examples? or any guides to help me please?

Thank you

  • Sign in to reply
  • Cancel

Top Replies

  • javagoza
    javagoza 9 days ago +2
    I published an example for a simple custom SPI driver that can help you. Look for "Creating an AXI-Lite IP block" for the driver section. Blog 4 - FruitVision Scale - FPGA-Based HX711 Driver for Precision…
  • javagoza
    0 javagoza 9 days ago

    I published an example for a simple custom SPI driver that can help you. Look for "Creating an AXI-Lite IP block" for the driver section.

     Blog 4 - FruitVision Scale - FPGA-Based HX711 Driver for Precision Weighing with AMD PYNQ 

    Other projects I published with AXI4 Lite implementation:

     Arty S7 50 ArtyBot Custom AXI4 Lite IP Peripheral for Sensing Motor Rotational Speed 

     AMD Zynq SoC MIDI Vintage Sound Synthesizer - Final 

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • colporteur
    0 colporteur 9 days ago in reply to javagoza

    Great share J!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • MATRIX7878
    0 MATRIX7878 8 days ago in reply to javagoza

    Sorry for not responding sooner, I checked the box to email me when I got a response and the system neglected to do that.

    Apologies, however, I lacked a crucial detail that I should have mentioned.  I want to use the UART that is connected to pins MIO10 and MIO11 (the JTAG/UART connections).  Those pins though, as the pin names imply, are PS pins.  While the example you gave is very helpful, it is like other examples I have found before.  I understand the surface process (create AXI4 Lite and it creates a toplevel and wrapper), however, I am unsure what logic I need to add to the wrapper as the toplevel simply the components of the design I created.  How many registers, how to declare slave logic, assign PS connections, find UART address, how to hook the AXI4 to the processing system.

    I do hope that makes sense.  As a side note, I use VHDL, not SystemVerilog, so while I can read the design you shared, I would need to convert the logic.  Here is my program:

    LIBRARY IEEE;
    USE IEEE.STD_LOGIC_1164.ALL;
    USE IEEE.NUMERIC_STD_UNSIGNED.ALL;
    
    ENTITY UART_TX IS
        PORT (clk : IN  STD_LOGIC;
              reset : IN  STD_LOGIC;
              tx_valid : IN STD_LOGIC;
              tx_data : IN  STD_LOGIC_VECTOR (7 DOWNTO 0);
              tx_ready : OUT STD_LOGIC;
              tx_OUT : OUT STD_LOGIC);
    END UART_TX;
    
    ARCHITECTURE Behavior OF UART_TX IS
    TYPE state IS (IDLE, START, SEND, STOP);
    SIGNAL currentState : state;
    
    CONSTANT BAUD : STD_LOGIC_VECTOR (9 DOWNTO 0) := d"868";
    
    SIGNAL bits : INTEGER RANGE 7 DOWNTO 0 := 7;
    SIGNAL counter : STD_LOGIC_VECTOR (9 DOWNTO 0) := (OTHERS => '0');
    
    BEGIN
        PROCESS(ALL)
        BEGIN
            IF RISING_EDGE(clk) THEN
                IF reset THEN
                    CASE currentState IS
                    WHEN IDLE => IF tx_valid = '1' THEN
                        tx_ready <= '0';
                        tx_OUT <= '1';
                        currentState <= START;
                    ELSE
                        tx_ready <= '0';
                    END IF;
                    WHEN START => IF counter = BAUD THEN
                        tx_OUT <= '0';
                        counter <= (OTHERS => '0');
                        currentState <= SEND;
                    ELSE
                        counter <= counter + '1';
                    END IF;
                    WHEN SEND => IF counter = BAUD AND bits = 0 THEN
                        tx_OUT <= tx_data(bits);    
                        counter <= (OTHERS => '0');
                        currentState <= STOP;
                    ELSIF counter = BAUD AND bits > 0 THEN
                        tx_OUT <= tx_data(bits);
                        counter <= (OTHERS => '0');
                        bits <= bits - 1;
                    ELSE
                        counter <= counter + '1';
                    END IF;
                    WHEN STOP => IF counter = BAUD THEN
                        bits <= 7;
                        tx_ready <= '1';
                        tx_OUT <= '1';
                        counter <= (OTHERS => '0');
                        currentState <= IDLE;
                    ELSE
                        counter <= counter + '1';
                    END IF;
                    END CASE;
                END IF;
            END IF;
        END PROCESS;
    END ARCHITECTURE;
    
    LIBRARY IEEE;
    USE IEEE.STD_LOGIC_1164.ALL;
    USE IEEE.NUMERIC_STD_UNSIGNED.ALL;
    
    ENTITY UART_RX IS
        PORT(clk : IN  STD_LOGIC;
             reset : IN  STD_LOGIC;
             rx_IN : IN  STD_LOGIC;
             rx_valid : OUT STD_LOGIC;
             rx_data : OUT STD_LOGIC_VECTOR (7 downto 0)
             );
    END UART_RX;
    
    ARCHITECTURE Behavior OF UART_RX IS
    TYPE state IS (IDLE, START, RECEIVE, STOP);
    SIGNAL currentState : state;
    
    CONSTANT BAUD : STD_LOGIC_VECTOR (9 DOWNTO 0) := d"868";
    
    SIGNAL bits : INTEGER RANGE 7 DOWNTO 0 := 7;
    SIGNAL counter : STD_LOGIC_VECTOR (9 DOWNTO 0) := (OTHERS => '0');
    
    BEGIN
        PROCESS(ALL)
        BEGIN
            IF RISING_EDGE(clk) THEN
                IF reset THEN
                    CASE currentState IS
                    WHEN IDLE => IF NOT rx_In THEN
                        rx_valid <= '0';
                        currentState <= START;
                    END IF;
                    WHEN START => IF counter = BAUD / 2 THEN
                        counter <= (OTHERS => '0');
                        currentState <= RECEIVE;
                    ELSE
                        counter <= counter + '1';
                    END IF;
                    WHEN RECEIVE => IF counter = BAUD THEN
                        rx_data(bits) <= rx_IN;
                        counter <= (OTHERS => '0');
                        IF bits = 0 then
                            currentState <= STOP;
                            bits <= 0;
                        ELSE
                            bits <= bits - 1;
                        END IF;
                    ELSE
                        counter <= counter + '1';
                    END IF;
                    WHEN STOP => IF counter = BAUD / 2 THEN
                        bits <= 7;
                        rx_valid <= '1';
                        counter <= (OTHERS => '0');
                        currentState <= IDLE;
                    ELSE
                        counter <= counter + '1';
                    END IF;
                    END CASE;
                END IF;
            END IF;
        END PROCESS;
    END ARCHITECTURE;

    What I need to do is take this logic and make an IP out of it, hook it up to the Zynq PS and then create a C program in Vitis to read and write via UART.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • javagoza
    0 javagoza 7 days ago in reply to MATRIX7878

    I'm not sure I understand what you're trying to do. I'd recommend you first look at how Vivado's block designer works. In this example, I simply instantiated a Zynq PS and then dragged the UART configuration from the board provided by the manufacturer.

    image

    After running block automation, the Zynq PS block will automatically expose the enabled UART as an AXI peripheral.

    image

    Then you can check how the AXI UART Lite implements something similar

    image

    AXI UART Lite v2.0 Product Guide (PG142) • Viewer • AMD Technical Information Portal

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • MATRIX7878
    0 MATRIX7878 7 days ago

    Forgive me I am still trying to get a better grasp on SoC fundamentals., I will try to explain better.  What I want to do is create my own IP for the UARTLITE.  I want to use the dedicated UART pins (M10 and M11) with my own AXI4 IP.  I want to use the UART program I created for the ZuBoard to utilize.  That way I can create my own functions in Vitis to display.  I know it sounds like a lot of extra work; on the other hand, I want to make as much original designs as possible.  What's the fun in just using premade IPs?  Essentially, I am trying to remake the wheel with my own version of the code.  I hope that makes more sense.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube