FPGA-README 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. This README contains extended details about FPGA mining with cgminer
  2. For ModMinerQuad (MMQ) BitForce (BFL) and Icarus (ICA, BLT, LLT, AMU, CMR)
  3. --------------------------------------------------------------------------
  4. When mining on windows, the driver being used will determine if mining will work.
  5. If the driver doesn't allow mining, you will get a "USB init," error message
  6. i.e. one of:
  7. open device failed, err %d, you need to install a Windows USB driver for the device
  8. or
  9. claim interface %d failed, err %d
  10. The best solution for this is to use a tool called Zadig to set the driver:
  11. http://sourceforge.net/projects/libwdi/files/zadig/
  12. This allows you set the driver for the device to be WinUSB which is usually
  13. required to make it work if you're having problems
  14. With Zaidg, you may need to run it as administrator and if your device is
  15. plugged in but you cannot see it, use the Menu: Options -> List All Devices
  16. You must also make sure you are using the latest libusb-1.0.dll supplied
  17. with cgminer (not the libusbx version)
  18. -
  19. When mining on linux, but not using 'sudo' and not logged into 'root' you
  20. may get a USB priviledge error (-3), so you may also need to do the following:
  21. sudo cp 01-cgminer.rules /etc/udev/rules.d/
  22. And also:
  23. sudo usermod -G plugdev -a `whoami`
  24. If your linux distro doesn't have the 'plugdev' group, you can create it like:
  25. sudo groupadd plugdev
  26. Then reboot ...
  27. -
  28. There is a hidden option in cgminer to dump out a lot of information
  29. about USB that will help the developers to assist you if you are having
  30. problems:
  31. --usb-dump 0
  32. It will only help if you have a working FPGA device listed above
  33. ModMinerQuad (MMQ)
  34. ------------------
  35. The mining bitstream does not survive a power cycle, so cgminer will upload
  36. it, if it needs to, before it starts mining (approx 7min 40sec)
  37. The red LED also flashes while it is uploading the bitstream
  38. -
  39. If the MMQ doesn't respond to cgminer at all, or the red LED isn't flashing
  40. then you will need to reset the MMQ
  41. The red LED should always be flashing when it is mining or ready to mine
  42. To reset the MMQ, you are best to press the left "RESET" button on the
  43. backplane, then unplug and replug the USB cable
  44. If your MMQ doesn't have a button on the "RESET" pad, you need to join
  45. the two left pads of the "RESET" pad with conductive wire to reset it.
  46. Cutting a small (metal) paper-clip in half works well for this
  47. Then unplug the USB cable, wait for 5 seconds, then plug it back in
  48. After you press reset, the red LED near the USB port should blink continuously
  49. If it still wont work, power off, wait for 5 seconds, then power on the MMQ
  50. This of course means it will upload the bitstream again when you start cgminer
  51. -
  52. Device 0 is on the power end of the board
  53. -
  54. You must make sure you have an approriate firmware in your MMQ
  55. Read here for official details of changing the firmware:
  56. http://wiki.btcfpga.com/index.php?title=Firmware
  57. The basics of changing the firmware are:
  58. You need two short pieces of conductive wire if your MMQ doesn't have
  59. buttons on the "RESET" and "ISP" pads on the backplane board
  60. Cutting a small (metal) paper-clip in half works well for this
  61. Join the 2 left pads of the "RESET" pad with wire and the led will dim
  62. Without disconnecting the "RESET", join the 2 left pads of the "ISP" pad
  63. with a wire and it will stay dim
  64. Release "RESET" then release "ISP" and is should still be dim
  65. Unplug the USB and when you plug it back in it will show up as a mass
  66. storage device
  67. Linux: (as one single line):
  68. mcopy -i /dev/disk/by-id/usb-NXP_LPC134X_IFLASH_ISP000000000-0:0
  69. modminer091012.bin ::/firmware.bin
  70. Windows: delete the MSD device file firmware.bin and copy in the new one
  71. rename the new file and put it under the same name 'firmware.bin'
  72. Disconnect the USB correctly (so writes are flushed first)
  73. Join and then disconnect "RESET" and then plug the USB back in and it's done
  74. Best to update to one of the latest 2 listed below if you don't already
  75. have one of them in your MMQ
  76. The current latest different firmware are:
  77. Latest for support of normal or TLM bitstream:
  78. http://btcfpga.com/files/firmware/modminer092612-TLM.bin
  79. Latest with only normal bitstream support (Temps/HW Fix):
  80. http://btcfpga.com/files/firmware/modminer091012.bin
  81. The code is currently tested on the modminer091012.bin firmware.
  82. This comment will be updated when others have been tested
  83. -
  84. On many linux distributions there is an app called modem-manager that
  85. may cause problems when it is enabled, due to opening the MMQ device
  86. and writing to it
  87. The problem will typically present itself by the flashing led on the
  88. backplane going out (no longer flashing) and it takes a power cycle to
  89. re-enable the MMQ firmware - which then can lead to the problem happening
  90. again
  91. You can either disable/uninstall modem-manager if you don't need it or:
  92. a (hack) solution to this is to blacklist the MMQ USB device in
  93. /lib/udev/rules.d/77-mm-usb-device-blacklist.rules
  94. Adding 2 lines like this (just above APC) should help
  95. # MMQ
  96. ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0003", ENV{ID_MM_DEVICE_IGNORE}="1"
  97. The change will be lost and need to be re-done, next time you update the
  98. modem-manager software
  99. TODO: check that all MMQ's have the same product ID
  100. BitForce (BFL)
  101. --------------
  102. --bfl-range Use nonce range on bitforce devices if supported
  103. This option is only for bitforce devices. Earlier devices such as the single
  104. did not have any way of doing small amounts of work which meant that a lot of
  105. work could be lost across block changes. Some of the "minirigs" have support
  106. for doing this, so less work is lost across a longpoll. However, it comes at
  107. a cost of 1% in overall hashrate so this feature is disabled by default. It
  108. is only recommended you enable this if you are mining with a minirig on
  109. p2pool.
  110. C source is included for a bitforce firmware flash utility on Linux only:
  111. bitforce-firmware-flash.c
  112. Using this, you can change the bitstream firmware on bitforce singles.
  113. It is untested with other devices. Use at your own risk!
  114. To compile:
  115. make bitforce-firmware-flash
  116. To flash your BFL, specify the BFL port and the flash file e.g.:
  117. sudo ./bitforce-firmware-flash /dev/ttyUSB0 alphaminer_832.bfl
  118. It takes a bit under 3 minutes to flash a BFL and shows a progress % counter
  119. Once it completes, you may also need to wait about 15 seconds,
  120. then power the BFL off and on again
  121. If you get an error at the end of the BFL flash process stating:
  122. "Error reading response from ZBX"
  123. it may have worked successfully anyway.
  124. Test mining on it to be sure if it worked or not.
  125. You need to give cgminer about 10 minutes mining with the BFL to be sure of
  126. the MH/s value reported with the changed firmware - and the MH/s reported
  127. will be less than the firmware speed since you lose work on every block change.
  128. Icarus (ICA, BLT, LLT, AMU, CMR)
  129. --------------------------------
  130. There are two hidden options in cgminer when Icarus support is compiled in:
  131. --icarus-options <arg> Set specific FPGA board configurations - one set of values for all or comma separated
  132. baud:work_division:fpga_count
  133. baud The Serial/USB baud rate - 115200 or 57600 only - default 115200
  134. work_division The fraction of work divided up for each FPGA chip - 1, 2, 4 or 8
  135. e.g. 2 means each FPGA does half the nonce range - default 2
  136. fpga_count The actual number of FPGA working - this would normally be the same
  137. as work_division - range is from 1 up to 'work_division'
  138. It defaults to the value of work_division - or 2 if you don't specify
  139. work_division
  140. If you define fewer comma seperated values than Icarus devices, the last values will be used
  141. for all extra devices
  142. An example would be: --icarus-options 57600:2:1
  143. This would mean: use 57600 baud, the FPGA board divides the work in half however
  144. only 1 FPGA actually runs on the board (e.g. like an early CM1 Icarus copy bitstream)
  145. --icarus-timing <arg> Set how the Icarus timing is calculated - one setting/value for all or comma separated
  146. default[=N] Use the default Icarus hash time (2.6316ns)
  147. short Calculate the hash time and stop adjusting it at ~315 difficulty 1 shares (~1hr)
  148. long Re-calculate the hash time continuously
  149. value[=N] Specify the hash time in nanoseconds (e.g. 2.6316) and abort time (e.g. 2.6316=80)
  150. If you define fewer comma seperated values than Icarus devices, the last values will be used
  151. for all extra devices
  152. Icarus timing is required for devices that do not exactly match a default Icarus Rev3 in
  153. processing speed
  154. If you have an Icarus Rev3 you should not normally need to use --icarus-timing since the
  155. default values will maximise the MH/s and display it correctly
  156. Icarus timing is used to determine the number of hashes that have been checked when it aborts
  157. a nonce range (including on a LongPoll)
  158. It is also used to determine the elapsed time when it should abort a nonce range to avoid
  159. letting the Icarus go idle, but also to safely maximise that time
  160. 'short' or 'long' mode should only be used on a computer that has enough CPU available to run
  161. cgminer without any CPU delays (an active desktop or swapping computer would not be stable enough)
  162. Any CPU delays while calculating the hash time will affect the result
  163. 'short' mode only requires the computer to be stable until it has completed ~315 difficulty 1 shares
  164. 'long' mode requires it to always be stable to ensure accuracy, however, over time it continually
  165. corrects itself
  166. When in 'short' or 'long' mode, it will report the hash time value each time it is re-calculated
  167. In 'short' or 'long' mode, the scan abort time starts at 5 seconds and uses the default 2.6316ns
  168. scan hash time, for the first 5 nonce's or one minute (whichever is longer)
  169. In 'default' or 'value' mode the 'constants' are calculated once at the start, based on the default
  170. value or the value specified
  171. The optional additional =N specifies to set the default abort at N * 100ms, not the calculated
  172. value, which is ~112 for 2.6316ns
  173. To determine the hash time value for a non Icarus Rev3 device or an Icarus Rev3 with a different
  174. bitstream to the default one, use 'long' mode and give it at least a few hundred shares, or use
  175. 'short' mode and take note of the final hash time value (Hs) calculated
  176. You can also use the RPC API 'stats' command to see the current hash time (Hs) at any time
  177. The Icarus code currently only works with an FPGA device that supports the same commands as
  178. Icarus Rev3 requires and also is less than ~840MH/s and greater than 2MH/s
  179. If an FPGA device does hash faster than ~840MH/s it should work correctly if you supply the
  180. correct hash time nanoseconds value
  181. The Icarus code will automatically detect Icarus, Lancelot, AsicminerUSB and Cairnsmore1
  182. FPGA devices and set default settings to match those devices if you don't specify them
  183. The timing code itself will affect the Icarus performance since it increases the delay after
  184. work is completed or aborted until it starts again
  185. The increase is, however, extremely small and the actual increase is reported with the
  186. RPC API 'stats' command (a very slow CPU will make it more noticeable)
  187. Using the 'short' mode will remove this delay after 'short' mode completes
  188. The delay doesn't affect the calculation of the correct hash time