Python script to launch Windows CLI pogram that need access to USB ports for Xilinx 1525 FPGA cards. The script will get a list of FPGA cards, lock them out by opening the corresponding COM port, and release the ports one by one while running Window CLI instances that talk to the FPGA cards.
8 Apr 2019:
The script can program partial bitstreams by adding them in a batch file
---- Sample batch file for partial bitstreams ----
cd c:\users\xxxx\desktop\bitstreams
launch.py -b bs_top.bit
launch.py -b bs0.bit
launch.py -b bs1.bit
launch.py -b bs2.bit
launch.py -b bs3.bit
.....
launch.py -b bsn.bit
---- end of sample ----
30 Dec 2018:
Script now can program bitstreams to cards without running Vivado
Use option -b
python launch.py -b c:\users\hashm1n3r\Desktop\BS\bitstream.bit
A card database needs to be created once using option -i
python launch.py -i
The cards are programmed sequentially, and require a working installation of Vivado Lab.
The script uses the xsdb binary from Vivado to program the cards. There is still the time delay when Vivado hardware manager
tries to scan for all cards in a system.
It is recommended to open Vivado and leave the hardware manager in Auto-detect before running the script, with the cards detected by Vivado. This avoid re-scanning of FPGA cards each time the script starts
Install Python 3.7 for Windows
https://www.python.org/downloads/windows/
Download the "Windows x86-64 executable installer" version
Ensure "Add Python 3.7 to PATH" Option is selected on the installer
From a Command Prompt, install the pywin32 and pyserial modules:
pip install pyserial
Edit and change the working_dir and cmd variables at the start of the script to suit your environment.
cmd should be the name of the .cmd or .bat file to launch the CLI program
Note the double backslashes "\\" used to escape "\" in windows path
working_dir = "C:\\Users\\hashm1n3r\\Desktop";
You wil need to stop all the instances of the windows program that tries to access the FPGAs.
THe script will relaunch them all
You can execute a different program for each card. This is configured at the beginning of the script:
custom_cmd = {
"2143028XXX03C" : "nh_530.cmd",
"1280962XXX02C" : "nh_510.cmd",
"214302895XXXC" : "nh_510.cmd",
"dummy" : "dummy"
}
In this case these cards are run at different clock rates.
All other cards run the default program specified in cmd variable
You can also use custom command to run different miners.
Example:
C:\Users\hashm1n3r>python launch.py
COM4 2143028XXX03C
COM5 1280962XXX02C
Locking out card 2143028XXX03C by opening Serial Port COM4
Locking out card 1280962XXX02C by opening Serial Port COM5
Unlocking card 2143028XXX03C by closing serial port COM4
Starting CMD for card 2143028XXX03C on COM4
Unlocking card 1280962XXX02C by closing serial port COM5
Starting CMD for card 1280962XXX02C on COM5
Starting CMD for card 2143028XXX03C on COM4: nh_530.cmd
Starting CMD for card 1280962XXX02C on COM5: nh_510.cmd
C:\Users\hashm1n3r>
Remember to disable MS serial mouse detection
If you don't, some serial port might be claimed by MS as MS Serial Ballpoint Mouse
http://www.taltech.com/support/entry/windows_2000_nt_serial_mice_and_missing_com_port