Program two FPGAs in a row
1 view (last 30 days)
Show older comments
Hello,
I want to program two Xilinx FPGAs one after the other using Matlab's Xilinx HDL Coder.
For example,
filProgramFPGA('Xilinx Vivado','bitfile1',1) %% Program the first FPGA, CHAINPOSITION 1
filProgramFPGA('Xilinx Vivado','bitfile2',2) %% Program the second FPGA, CHAINPOSITION 2
Problem is, Matlab automatically tries to program the second FPGA.
The only workaround I've found is to manually disconnect the second FPGA, program the first FPGA (with the first command), and reconnect & program the second FPGA (with the second command).
Is there a way to choose which FPGA I want to program without having to manually intervene? Something like
choose FPGA#1
filProgramFPGA('Xilinx Vivado','bitfile1',1) %% Program the first FPGA, CHAINPOSITION 1
choose FPGA#2
filProgramFPGA('Xilinx Vivado','bitfile2',2) %% Program the second FPGA, CHAINPOSITION 2
Thanks in advance!
2 Comments
Marc Erickson
on 24 Feb 2020
The chain position argument is what qualifies which device you are trying to program and so that should be sufficient. I'm glad you have found a workaround. One thing to note is that the MATLAB script uses 1 indexing for chain positions, Vivado uses 0 indexing, so be sure to add 1 if you are basing it on the Vivado indexing.
I don't have a 2 FPGA board on hand, but I do have a ZedBoard which is a multi-device JTAG chain (ARM at first position, FPGA at second position). The filProgramFPGA generates a tcl script that is executed by vivado. I was able to confirm the chain position is used correctly in the generated tcl. If I tried to use the ARM position (argument value of 1) it failed. If I tried to use a non-existant position (e.g. 5) it failed. Only with a chain argument value of 2 did it work.
A couple of things you might try:
Manually connect and program via the Vivado GUI. Open Hardware Manager ; Open target / Open new target... ; Next, Next, Next, Finish. Look at the Hardware Targets and Hardware Devices listed. Select a device and set its programming file. Then click on Program device. Do the same for the second device. If it succeeds you can take the resulting vivado.jou as your script going forward, or you might discover what is going wrong with the MATLAB function.
Manually edit the tcl script generated by filProgramFPGA, "_vivado_program.cmd", to determine which hardware device name it is using for each chain position. Add these lines after open_hw_target:
set hwdev [lindex [get_hw_devices] $chain_position]
puts ${hwdev}
And then execute via:
vivado -mode batch -source vivado_program.cmd
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!