README.FPGA.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. This README contains extended details about FPGA mining with BFGMiner
  2. ModMiner (MMQ)
  3. --------------
  4. ModMiner does not have any persistent storage for bitstreams, so BFGMiner must
  5. upload it after power on. For this to work, you must first download the
  6. necessary bitstream file to BFGMiner's "bitstreams" directory, and give it the
  7. name "fpgaminer_x6500-overclocker-0402.bit". You can download this bitstream
  8. from FPGA Mining LLC's website:
  9. http://www.fpgamining.com/documentation/firmware
  10. -
  11. If the MMQ doesn't respond to BFGMiner at all, or the red LED isn't flashing
  12. then you will need to reset the MMQ.
  13. The red LED should always be flashing when it is mining or ready to mine.
  14. To reset the MMQ, you are best to press the left "RESET" button on the
  15. backplane, then unplug and replug the USB cable.
  16. If your MMQ doesn't have a button on the "RESET" pad, you need to join the two
  17. left pads of the "RESET" pad with conductive wire to reset it. Cutting a small
  18. (metal) paper-clip in half works well for this.
  19. Then unplug the USB cable, wait for 5 seconds, then plug it back in.
  20. After you press reset, the red LED near the USB port should blink continuously.
  21. If it still wont work, power off, wait for 5 seconds, then power on the MMQ
  22. This of course means it will upload the bitstream again when you start BFGMiner.
  23. -
  24. Device 0 is on the power end of the board.
  25. -
  26. You must make sure you have an appropriate firmware in your MMQ
  27. Read here for official details of changing the firmware:
  28. http://wiki.btcfpga.com/index.php?title=Firmware
  29. The basics of changing the firmware are:
  30. You need two short pieces of conductive wire if your MMQ doesn't have buttons
  31. on the "RESET" and "ISP" pads on the backplane board.
  32. Cutting a small (metal) paper-clip in half works well for this.
  33. Join the 2 left pads of the "RESET" pad with wire and the led will dim.
  34. Without disconnecting the "RESET", join the 2 left pads of the "ISP" pad with
  35. a wire and it will stay dim.
  36. Release "RESET" then release "ISP" and is should still be dim.
  37. Unplug the USB and when you plug it back in it will show up as a mass storage
  38. device.
  39. Linux: (as one single line):
  40. mcopy -i /dev/disk/by-id/usb-NXP_LPC134X_IFLASH_ISP000000000-0:0
  41. modminer091012.bin ::/firmware.bin
  42. Windows: delete the MSD device file firmware.bin and copy in the new one
  43. rename the new file and put it under the same name 'firmware.bin'
  44. Disconnect the USB correctly (so writes are flushed first)
  45. Join and then disconnect "RESET" and then plug the USB back in and it's done.
  46. Best to update to one of the latest 2 listed below if you don't already
  47. have one of them in your MMQ.
  48. The current latest different firmware are:
  49. Latest for support of normal or TLM bitstream:
  50. http://btcfpga.com/files/firmware/modminer092612-TLM.bin
  51. Latest with only normal bitstream support (Temps/HW Fix):
  52. http://btcfpga.com/files/firmware/modminer091012.bin
  53. The code is currently tested on the modminer091012.bin firmware.
  54. This comment will be updated when others have been tested.
  55. -
  56. On many Linux distributions there is an app called modem-manager that may cause
  57. problems when it is enabled, due to opening the MMQ device and writing to it.
  58. The problem will typically present itself by the flashing led on the backplane
  59. going out (no longer flashing) and it takes a power cycle to re-enable the MMQ
  60. firmware - which then can lead to the problem reoccurring.
  61. You can either disable/uninstall modem-manager if you don't need it or:
  62. a (hack) solution to this is to blacklist the MMQ USB device in
  63. /lib/udev/rules.d/77-mm-usb-device-blacklist.rules
  64. Adding 2 lines like this (just above APC) should help.
  65. # MMQ
  66. ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0003", ENV{ID_MM_DEVICE_IGNORE}="1"
  67. The change will be lost and need to be re-done, next time you update the
  68. modem-manager software.
  69. BitForce (BFL)
  70. --------------
  71. --bfl-range Use nonce range on BitForce devices if supported
  72. This option is only for BitForce devices. Earlier devices such as the single
  73. did not have any way of doing small amounts of work which meant that a lot of
  74. work could be lost across block changes. Some of the Mini Rigs have support
  75. for doing this, so less work is lost across a longpoll. However, it comes at
  76. a cost of 1% in overall hashrate so this feature is disabled by default. It
  77. is only recommended you enable this if you are mining with a Mini Rig on
  78. P2Pool.
  79. BitFORCE FPGA Single units can have their bitstream modified using the
  80. bitforce-firmware-flash utility on Linux, which can be obtained from:
  81. https://github.com/luke-jr/bitforce-fpga-firmware-flash
  82. It is untested with other devices. Use at your own risk! Windows users may use
  83. Butterfly Labs EasyMiner to change firmware.
  84. To compile:
  85. make bitforce-firmware-flash
  86. To flash your BFL, specify the BFL port and the flash file e.g.:
  87. sudo ./bitforce-firmware-flash /dev/ttyUSB0 alphaminer_832.bfl
  88. It takes a bit under 3 minutes to flash a BFL and shows a progress % counter
  89. Once it completes, you may also need to wait about 15 seconds, then power the
  90. BFL off and on again.
  91. If you get an error at the end of the BFL flash process stating:
  92. "Error reading response from ZBX"
  93. it may have worked successfully anyway.
  94. Test mining on it to be sure if it worked or not.
  95. You need to give BFGMiner about 10 minutes mining with the BFL to be sure of
  96. the Mh/s value reported with the changed firmware - and the Mh/s reported will
  97. be less than the firmware speed since you lose work on every block change.
  98. Icarus (ICA)
  99. ------------
  100. There are a number of options for Icarus-compatible devices which can be used
  101. with --set-devices (or the RPC pgaset method):
  102. baud=N The serial baud rate (default 115200)
  103. work_division=N The fraction of work divided up for each processor: 1, 2,
  104. 4, or 8. e.g. 2 means each does half the nonce range
  105. (default 2)
  106. fpga_count=N The actual number of processors working; this would
  107. normally be the same as work_division. Range is from 1 up
  108. to <work_division>. It defaults to the value of
  109. work_division, or 2 if you don't specify work_division.
  110. reopen=MODE Controls how often the driver reopens the device to
  111. workaround issues. Choices are 'never', on 'timeout' only
  112. (default), or every 'cycle'.
  113. timing=MODE Set how the timing is calculated:
  114. default[=N] Use the default hash time
  115. short[=N] Calculate the hash time and stop
  116. adjusting it at ~315 difficulty 1 shares
  117. (~1hr)
  118. long=[N] Re-calculate the hash time continuously
  119. value[=N] Specify the hash time in nanoseconds
  120. (e.g. 2.6316) and abort time (e.g.
  121. 2.6316=80).
  122. An example would be: --set-device ECM:baud=57600 --set-device
  123. ECM:work_division=2 --set-device DCM:fpga_count=1 --set-device ECM:reopen=never
  124. This would mean: use 57600 baud, the FPGA board divides the work in half however
  125. only 1 FPGA actually runs on the board, and don't reopen the device (e.g. like
  126. an early CM1 Icarus copy bitstream).
  127. Icarus timing is used to determine the number of hashes that have been checked
  128. when it aborts a nonce range (including on a longpoll).
  129. It is also used to determine the elapsed time when it should abort a nonce
  130. range to avoid letting the Icarus go idle, but also to safely maximise that
  131. time.
  132. 'short' or 'long' mode should only be used on a computer that has enough CPU
  133. available to run BFGMiner without any CPU delays.
  134. Any CPU delays while calculating the hash time will affect the result
  135. 'short' mode only requires the computer to be stable until it has completed
  136. ~315 difficulty 1 shares, 'long' mode requires it to always be stable to ensure
  137. accuracy, however, over time it continually corrects itself.
  138. The optional additional =N for 'short' or 'long' specifies the limit to set the
  139. timeout to in deciseconds; thus if the timing code calculation is higher while
  140. running, it will instead use the limit.
  141. This can be set to the appropriate value to ensure the device never goes idle
  142. even if the calculation is negatively affected by system performance.
  143. When in 'short' or 'long' mode, it will report the hash time value each time it
  144. is re-calculated.
  145. In 'short' or 'long' mode, the scan abort time starts at 5 seconds and uses the
  146. default 2.6316ns scan hash time, for the first 5 nonces or one minute
  147. (whichever is longer).
  148. In 'default' or 'value' mode the 'constants' are calculated once at the start,
  149. based on the default value or the value specified.
  150. The optional additional =N specifies to set the default abort at N 1/10ths of a
  151. second, not the calculated value, which is 112 for 2.6316ns
  152. To determine the hash time value for a non Icarus Rev3 device or an Icarus Rev3
  153. with a different bitstream to the default one, use 'long' mode and give it at
  154. least a few hundred shares, or use 'short' mode and take note of the final hash
  155. time value (Hs) calculated.
  156. You can also use the RPC API 'stats' command to see the current hash time (Hs)
  157. at any time.
  158. The Icarus code currently only works with devices that support the same commands
  159. as Icarus Rev3 requires and also is less than ~840Mh/s and greater than 2Mh/s.
  160. If your device does hash faster than ~840Mh/s it should work correctly if you
  161. supply the correct hash time nanoseconds value.
  162. The timing code itself will affect the Icarus performance since it increases
  163. the delay after work is completed or aborted until it starts again.
  164. The increase is, however, extremely small and the actual increase is reported
  165. with the RPC API 'stats' command (a very slow CPU will make it more noticeable).
  166. Using the 'short' mode will remove this delay after 'short' mode completes.
  167. The delay doesn't affect the calculation of the correct hash time.
  168. X6500
  169. -----
  170. Since X6500 FPGAs do not use serial ports for communication, the --scan-serial
  171. option instead works with product serial numbers. By default, any devices with
  172. the X6500 USB product id will be used, but some X6500s may have shipped without
  173. this product id being configured. If you have any of these, you will need to
  174. specify their serial numbers explicitly, and also add -S x6500:auto if you
  175. still want to use the autodetection for other properly-configured FPGAs.
  176. The serial number of X6500s is usually found on a label applied to the ATX
  177. power connector slot. If yours is missing, devices seen by the system can be
  178. displayed by starting bfgminer in debug mode. To get a simple list of devices,
  179. with the debug output shown, you can use: bfgminer -D -d? -T
  180. X6500 does not have any persistent storage for bitstreams, so BFGMiner must
  181. upload it after power on. For this to work, you must first download the
  182. necessary bitstream file to BFGMiner's "bitstreams" directory, and give it the
  183. name "fpgaminer_x6500-overclocker-0402.bit". You can download this bitstream
  184. from FPGA Mining LLC's website:
  185. http://www.fpgamining.com/documentation/firmware
  186. ZTEX FPGA Boards
  187. ----------------
  188. http://www.ztex.de sells two boards suitable for mining: the 1.15x with 1 FPGA
  189. and the 1.15y with 4 FPGAs. ZTEX distributes their own mining software and
  190. drivers. BFGMiner has full support for these boards, as long as they have at
  191. least the "dummy" mining bitstreams installed on them.
  192. If your boards do not have a mining bitstream yet, you must first, install
  193. ZTEX's BTCMiner (requires Java JDK version 6 or later) and install one.
  194. === WINDOWS NOTE ===
  195. Upon first powering up and connecting the board via USB, windows will attempt
  196. and fail to find the appropriate drivers. To load the initial firmware on the
  197. board, you'll need the EZ-USB FX2 SDK from here:
  198. http://www.ztex.de/downloads/#firmware_kit
  199. Extract the firmware kit and use the driver within libusb-win32/ztex.inf.
  200. Windows should now recognize the board and you're ready to program it.
  201. === END OF WINDOWS ===
  202. Grab the latest miner jar from http://www.ztex.de/btcminer/#download and program
  203. the appropriate dummy firmware for your board. The command should look
  204. something like (for a single FPGA board):
  205. java -cp ZtexBTCMiner-120417.jar BTCMiner -m p -f **FILENAME** -s 01-02-01
  206. For ZTEX 1.15x boards, the dummy bitstream filename is ztex_ufm1_15d.ihx
  207. For ZTEX 1.15y boards, the dummy bitstream filename is ztex_ufm1_15y.ihx
  208. === WINDOWS NOTE ===
  209. To mine using BFGMiner, you'll have to swap the USB drivers. The BFGMiner-
  210. compatible WinUSB drivers for the board can be generated with this tool:
  211. http://sourceforge.net/projects/libwdi/files/zadig/
  212. Basic usage instructions for Zadig can be found here:
  213. https://github.com/pbatard/libwdi/wiki/Zadig
  214. Once Zadig generates and installs a WinUSB driver, ensure everything is working
  215. by running:
  216. bfgminer -D -d? -T
  217. You should see something like this in the output:
  218. [2013-01-22 20:19:11] Found 1 ztex board
  219. [2013-01-22 20:19:11] ZTX 0: Found Ztex (ZTEX 0001-02-01-1)
  220. === END OF WINDOWS ===
  221. If you have installed a dummy bitstream, you will now need to copy the main
  222. mining bitstream where BFGMiner can find it. This are usually the same as the
  223. dummy bitstream filename, but with a number added to the end. Extract the
  224. ZtexBTCMiner-120417.jar file using any unzip utility, and look for the proper
  225. *.ihx and *.bit files (the latter will be inside the 'fpga' directory of the
  226. jar). Copy them to BFGMiner's "bitstreams" directory, and you're ready to start
  227. mining.