References
- Digilent ZedBoard
- Hardware E & F (I have E, despite F being available)
- Avnet ZedBoard
DDR References from Digilent: (Not really related to ZedBoard)
Set up Vivado 2022.2 to use VS Code (Windows 10 Pro) as the editor.
I added C:\Program Files\Microsoft VS Code
and ...\bin
to my PATH
.
See here
and use code.cmd -g [file name]:[line number]
.
Protected folder access blocked
- App:
vivado.exe
- Protected folder:
%userprofile%\Documents\
- Blocked by:
Controlled folder access
- Action chosen:
Allow on device
Antivirus sent a lot of Vivado files to see if they were safe.
Reference: Digilent Walkthrough
-
Clone the GitHub repo
-
Run Vivado 2022.2
-
Settings -> Vivado Store -> Board Repository
- Add the cloned repo's
new/board_files
directory
Note that the Vivado Store inside Vivado gets its board files
from this GitHub repository
and branch 2022.2
. If you update the Vivado Store repository it
adds it to the settings automatically. Then, in the Boards selector (below)
you will see three ZedBoards: An Avnet one, and two Digilents - the 1.0 from
Xilinx Board Store and the 1.1 from the repo above.
- The Avnet ZedBoard has an
Add Companion Card
option- This has the
FMC XM105 Debug Card
selectable - I have one of these! :)
- How can I get that usable in the Digilent
Zedboard
? - What does it mean/do?
- This has the
Using: Vivado 2022.2
References:
- Run Vivado 2022.1 and create a new project
- RTL project with no sources to start with
- Use the Zedboard 1.1 board definition
(This says it is for board
D.3
but I haveE
)
- Add a constraint file from the GitHub Repo to the project
- Be sure to
Copy constraints files into project
is selected - This now appears in Sources -> Constraints -> constrs_1 -> Zedboard-Master.xdc
- Uncomment the constraints for the pins we will use
- Add a
create_clock
as well- I am assuming the GCLK is 100 MHz
-
Create the SystemVerilog blinker code
-
Create the bitstream with
Generate Bitstream
- This takes an unreasonable amount of time. Quite a few minutes on my laptop (Alienware 13R3, 32G RAM)
- Open Hardware Manager
- Plug a USB Micro-B cable to the
PROG
port next to the power jack - Open Target -> Auto Connect
Program Device
->xc7z020_1
Voila. The LED should be blinking about 3 times a second.
- After powering on and letting the Zedboard boot from the default image with Linux and all that - I have no idea if the previously running Linux is still running!
References:
-
Create blank project (as above)
-
Project Manager -> IP INTEGRATOR -> Create Block Design
- Give it a name, I chose
BMBlock
- Add an IP block for the Zynq processor
- Click the
+
in theDiagram
pane - Add a
ZYNQ7 Processing System
- Two additional tabbed panes will show up,
Address Editor
andAddress Map
- The block will be named
processing_system7_0
- Two additional tabbed panes will show up,
- Click the
Run Block Automation
link that pops up in a green bar in theDiagram
pane- A window will pop up, just click
OK
- (
Apply Board Preset
is checked, we have that ZedBoard Digilent 1.1 preset, and it says that checking it will discard the existing IP configuration, of which we have none.)
- A window will pop up, just click
- This added a bunch of ports to the Zynq block in the
Diagram
pane, including connections toDDR
andFIXED_IO
.- There are also these unconnected:
MDIO_ETHERNET_0
SDIO_0
USBIND_0
M_AXI_GP0
- with an odd dotted portTTC0_WAVE#_OUT
for 0, 1, 2M_AXI_GP0_ACLK
(seems to be an input?)FCLK_CLK0
andFCLK_RESET0_N
- see below
- There are also these unconnected:
- Double-clicking the Zynq block opens up a
Re-customize IP
window sayingZYNQ7 Processing System (5.5)
with a lot of pages. The first page is theZynq Block Design
which has (double?) clickable green blocks that take you to other pages. Some have checkmarks next to them. (You can also right-click and chooseCustomize Block...
)- Clicking
Summary Report
generates a huge HTML page and opens it in your browser.
- Clicking
- To see what the
DDR
andFIXED_IO
are:- See the
Design
pane, underExternal Interfaces
- This lists all the pins for that external interface
FIXED_IO
includesmio
,srstb
,clk
, andporb
- Not sure what some of those are
- See the
- NOTE: Changes in the Block Diagram have to be saved with Control-S like a text file.
- Deal with PS-generated clocks
- The block has a
FCLK_CLK0
added by default, unconnected- (There is also an
FCLK_RESET0_N
- meaning?)
- (There is also an
- By using
Customize Block...
on the Zynq, then going to theClock Configuration
page, and then thePL Fabric Clocks
you can see the speed of this clock, which is curently 100 MHz. - You can add 3 more at whatever speed you want.
- Using
IO PLL
it does not have good granularity - the actual speed will not usually match the requested speed. For example, I couldn't get any 1280x1024 VGA pixel clock speed close for any refresh rate.
- Using
- "All board files for Digilent Zynq boards enable a single Zynq PL clock by
default, which is intended to be used with peripherals connected to the
Zynq's
M_AXI_GP0
port."
- Add GPIO for LEDs to Block Diagram
- Note the
Board
pane in theBLOCK DESIGN
, and theGeneral Purpose Input or Output
which contains buttons, LEDs and switches. (The switches are called "DIP switches" but the ZedBoard has regular sliders switches.) - Right click the
LED
and chooseConnect Board Component...
- Choose
AXI GPIO
->GPIO
and clickOK
- A new block appears in the diagram, called
axi_gpio_0
- Contains a pre-connected output to
leds_8bits
- Tutorial says this pre-connection "will not require any further work to constrain."
- Contains a pre-connected output to
- Rename it to
AXI_GPIO_LED
- Add GPIO for buttons to Block Diagram (in a different way)
- Click the
+
in theDiagram
pane and add anAXI GPIO
block - Name it
AXI_GPIO_BUTTONS
- Right click the
GPIO
output and selectMake External
which will add a linkage toGPIO_0
.- "This option creates a new external interface port that does not rely on the board files."
- So this will require us to make our own
.xdc
file.
- Deal with constraints file & board design
- Add the Digilent-provided ZedBoard constraints file (as above)
- Uncomment the 5
BTNx
lines
- Uncomment the 5
- Back to the
Diagram
pane - Expand the
GPIO
output of theAXI_GPIO_BUTTONS
to reveal three connections, for Tristates:_i
,_o
and_t
- When constrained to Tristate buffers these are combined into
tri_io
, the docs say, but I don't see it.
- When constrained to Tristate buffers these are combined into
- Edit the
.xdc
file to rename theBTNx
lines tobtn_tri_io[#]
for the appropriate#
(in this case, 5 for the ZedBoard) - In the diagram, double-click
AXI_GPIO_BUTTONS
to get theRe-customize IP
window- Choose the
IP Configuration
pane - Change
GPIO Width
to the number of buttons (5
for the ZedBoard)
- Choose the
- Click
Run Connection Automation
in the green bar- Select
All Automation
which includes theS_AXI
for the two AXI blocks we added, and hitOK
- Select
- The diagram turns into a rats nest!
- An
AXI Interconnect
and aProcessor System Reset
are added - Move things around to make it look nice
- Change the
Default View
dropdown box to see other perspectives of the same boxes
- An
- Deal with Addresses
- Open the
Address Editor
pane - Update the
Range
for the two GPIOs to 4k (they defaulted to 64k) - this is probably unnecessary - Go back to the
Diagram
- Right click it and choose
Validate Design
or hit F6 - This gave
Critical warnings
for fourDDR_DQS_TO_CLOCK_DELAY
things (ignore?).- "These warnings are ignorable and will not affect the functionality of the project. See the Hardware Errata section of your board's reference manual for more information."
- These Errata are the only Errata I could find; I saw none on Digilent's web site. This errata shows nothing useful.
- This board post says to ignore it for a Zybo board.
- Here is the Zybo Errata which mentions this
- Right click it and choose
- Create an HDL Wrapper of the Block Design
Sources
pane ->Design Sources
-> BMBlock (right click) ->Create HDL Wrapper...
- Select
Let Vivado manage wrapper and auto-update
(the default choice) - The
Design Sources
now showsBMBlock_wrapper
instead withBMBLock_wrapper.v
andBMBlock.v
- There is also a
Simulation Sources
entry for theBMBlock_wrapper
- You can double-click the
BMBLock_wrapper.v
and see it in your editor- This contains only top-level instantiations:
BMBlock
- Five
IOBUF
s for the five button tristates (which really should be inputs only)
- And look at the
BMBlock.v
- And build it!
- Click
Generate Bitstream
in theFlow Navigator
- I have no idea how to monitor what it is doing
- It took a while to generate stuff for
IP Integrator blocks
inTcl Console
Project Summary
pane shows Synthesis, Implementation areQueued
- It shows
Running multple block runs
at the top corner, with a green spinny - Occasionally a small window will pop up in the bottom right of the screen with a quick update that quickly disappears (how useless is that?!)
- It took a while to generate stuff for
- Eventually it gets to
Synthesis
with 585 warnings - Then to
Implementation
- Critical warnings (which we can ignore) in the
.xdc
file:set_property IOSTANDARD LVCMOS18 [get_ports -of_objects [get_iobanks 35]];
set_property IOSTANDARD LVCMOS33 [get_ports -of_objects [get_iobanks 13]];
- Since evidently we didn't use those IO Banks
- Critical warnings (which we can ignore) in the
- This probably took 10-15 minutes (!!!)
- Vivado is sooooo sloooooow
- "Critical warnings about how IPs included within another IP were packaged with a
different board value can be safely ignored. The same is true for warnings related
to negative CK-to-DQS delays seen on some Zynq boards."
- I did not see any critical warnings other than the
DQS
and the.xdc
ones.
- I did not see any critical warnings other than the
- Get ready for Vitis
- File -> Export -> Export Hardware
- In
Output
pane, choose toInclude bitstream
that we just generated - Choose the default location for the
.xsa
file in theFiles
pane - And let it do it's thing
- The
.xsa
file is a binary file of some sort
Now we move into Vitis! (This IDE seems to be based on Eclipse.)
- Launch Vitis
- From Start Menu
- From Tools -> Launch Vitis IDE in Vivado
- Choose a workspace when it pops up
- I chose
C:\src\FPGA\dpf-zb-barmetal-workspace
- Create Application Project
- Project -> Create Application Project in the Vitis welcome window
- In the
Platform
pane, click theCreate a new platform from hardware (XSA)
tab- XSA = Xilinx Shell Architecture
- Browse for the
.xsa
file we just exported - Select it in the
Hardware Specification
XSA File:
list - Select
Generate boot components
- Give it a platform name (I chose
DPF-BareMetal
) - Click Next to see
Application Project Details
pane - Application Project Name:
BareMetal1
- Target
ps7_cortexa9_0
(for now) - Click
Next
to see theDomain
pane- We will use defaults in
Domain
- We will use defaults in
- Click
Next
to see theTemplates
pane - Choose
Empty Application(C)
and clickFinish
- ...and the Vitis IDE opens with the
BareMetal1
andBareMetal1_system
panes available
- Create Source
Explorer
pane- Right-click
src
directory, New -> File - Name it
main.c
- COpy the code from the tutorial
- Edit the
BTN_MASK
andLED_MASK
- Build!
Assistant
pane- Select
BareMetal1_system
- Click
Build
hammer icon or right-click and selectBuild
- It does its thing for a while, building a
.bif
file and stuff
- Update the board settings to boot from JTAG
- Default as shipped ZedBoard MIO[6:2] jumpers are 01100 to boot from SD card (MIO[5:3])
- Hardware guide says JTAG boot is MIO[5:3] of 3'b000
- Set Jumpers 7-11 appropriately
-
Connect TeraTerm at 115.2kbps and no flow control
-
Power the board on with both JTAG and UART Micro-USB cables connected to computer
-
Run it!
- Explorer pane
BareMetal1_system
(right click) -> Run As -> 1 Launch Hardware- The blue LED marked
DONE
should light up (LD12
) - TeraTerm will say "Entered function main"
- Tap any of the 5 buttons
- All 8 LEDs should light up
- Tapping
PROG
button will clear the PL and things will break (blue light goes out) - Tapping
PS-RST
will reset the PS and things will also break - You can re-program exactly the same way and the blue light will come back
- Make the LEDs display each button
- And "all on" or "all off" or "any on" lights
- Send console message with each button change
- Go to Vivado and add GPIO switches to the Block Diagram
- I also seem to have accidentally turned my buttons into input-only,
and consequently needed to add new constraints for
btn_tri_i
instead. - Set the address window to 4K again
-
Regenerate the bitstream
-
Re-export the hardware
-
In Vitis, in the
Assistant
pane, right click the[Platform]
(calledDPF-BareMetal
in mine) andUpdate Hardware Specification
- Give it the re=exported
.xsa
from the step above and let it do its thing - THen right-click it again and pick
Open Platform Editor
- Click the
Board Support Package
for eitherzynq_fsbl
orstandalone_ps7_cortexa9_0
- You will see
AXI_GPIO_SWITCHES
under the Operating System -> Drivers tab
- You will see
- It says
Out-of-date
and if you look inxproperties.h
you see no reference to the switches we just added - Let's see what happens if I now hit
Build
on the[Platform]
- THIS WORKED
- The
Out-of-date
goes away on the system xparameters.h
now has a section onDefinitions for peripheral AXI_GPIO_SWITCHES
- Modify the C code to use the switches however you like
- In
Assistant
pane, clickBuild
on theBareMetal1_system [System]
- Run
1 Launch Hardware
to build the software (in theExplorer
pane) - Test it on the board
- If the board works, you're golden, otherwise, fix it and repeat this step (or possibly go to step 1)
Digilent Tutorial to follow along with.
- Apparently this is automatically built due to having selected
Generate boot components
earlier (above)
- See
dpf-zb-baremetal-workspace/BareMetal1_system/Debug/sd_card
directory
- Prepare SD card
- FAT32 formatted microSD (so up to 32G will work)
- Copy BOOT.BIN file into its root directory (about 4 Mbytes long)
- Set the ZedBoard to boot from SD card (see above)
- Insert the SD card
- Boot
- It literally configures in under a second
- Windows can't configure the UART fast enough to get the introductory message
- Other buttons
- PROG button will kill the application
- PS-RST will reload the application quickly
- The initial startup printf will show up on console
Zooming and movement:
- Center-drag to move the window
- Control-scroll wheel to zoom in and out
- Left-drag to do various zooms:
- Area (downward right diagnonal)
- To fit (upward left diagonal)
- In or out (along a one diagonal) by 0.5
-
How are the pre-made
DDR
andFIXED_IO
connections in the Block Design set up and/or connected? -
Where do I get documentation on all the APIs available in the Vitis project?
- Like documentation on
XGpio_CfgInitialize
orxil_printf
and so forth? - What about the
xxx_CHANNEL
parameter toXGpio_SetDataDirection
- Like documentation on
-
Build my own AXI LED & button/switch interface from scratch
- Instantiate it in the diagram
- Read buttons/switches and send LED outputs from bare metal
- ...and from Linux
-
Build character RAM based external display (e.g. I2C or SPI display with one of my other character display drivers, or VGA)
- Build AXI interface to the character memory using true dual-port RAM (?)
- Since I never built anything with AXI this will be the real challenge
- Change character buffers from bare metal
- Since I never built anything using Zynq in general this will be challenge #2
- Change character buffer from a Linux device driver
- Since I never built PetaLinux or Ubuntu with Zynq this will be challenge #3
- Build AXI interface to the character memory using true dual-port RAM (?)