Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


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 -b bs_top.bit -b bs0.bit -b bs1.bit -b bs2.bit -b bs3.bit
..... -b bsn.bit
---- end of sample ----

30 Dec 2018:
Script now can program bitstreams to cards without running Vivado
Use option -b
python -b c:\users\hashm1n3r\Desktop\BS\bitstream.bit
A card database needs to be created once using option -i
python -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

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 pypiwin32
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.


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

Remember to disable MS serial mouse detection
If you don't, some serial port might be claimed by MS as MS Serial Ballpoint Mouse

  • Click on the Windows start button
  • In the search box, type in: regedit and press the enter key on your keyboard
  • The Registry editor windows will open
  • Navigate to the registry key named: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\sermouse
  • On the right hand side of the registry editor window you should find subkey named: start
  • Double click on the "start" subkey and modify the value of the key to: 4 and click the OK button to return to the registry editor window
  • Note: setting the "start" subkey value to 4 will disable windows from looking for serial mice at startup
  • Exit the regitstry editor window and reboot
  • About

    No description, website, or topics provided.



    No releases published


    No packages published