Technobit ASICs with cgminer and Raspbian

asic

NOTE: This post is deprecated. There is a newer patchset available (http://www.megafileupload.com/en/file/493742/0-1-8-rar.html), based on cgminer 3.11.0.

Yesterday I finally received my HEX16C-Avalon2 ASIC Miner by Technobit (review). Some time ago I bought a second Rasberrpy Pi, so I decided to use this one to operate the ASIC. First I prepared the Rasberrpy Pi with the latest Raspbian image. Afterwards I installed all necessary packages and got the sources of cgminer.

# apt-get install autoconf libtool libncurses-dev curl libcurl4-openssl-dev gcc make libudev-dev
# wget http://ck.kolivas.org/apps/cgminer/cgminer-3.10.0.tar.bz2
# tar xjf cgminer-3.10.0.tar.bz2

The needed drivers for Technobit ASICs are not included. This RAR archive contains the drivers as a patch against cgminer-3.10.0. The latest version of the patch should be listed here.

# cd cgminer-3.10.0
# patch -p1 < 87f0213112a3c69e2c55160b9c674b9de2cde996_u_1d.patch

While applying the patch 87f0213112a3c69e2c55160b9c674b9de2cde996_u_1d.patch I got the following rejection.

patching file Makefile.am
Hunk #1 FAILED at 51.
1 out of 2 hunks FAILED -- saving rejects to file Makefile.am.rej

The following diff can be used to apply the rejection (patch -p1 < Makefile.am.patch).

--- a/Makefile.am	2014-01-18 06:57:41.021819580 +0000
+++ b/Makefile.am	2014-01-18 06:57:16.702381944 +0000
@@ -51,9 +51,9 @@
 cgminer_SOURCES += usbutils.c usbutils.h
 endif
 
-#if WANT_LIBBITFURY
-#cgminer_SOURCES += libbitfury.c libbitfury.h
-#endif
+if WANT_LIBBITFURY
+cgminer_SOURCES += libbitfury.c libbitfury.h
+endif
 
 # Device drivers
 if HAS_AVALON

After applying the patch it's possible to enable drivers for 5 different ASICs by Technobit.

  --enable-hexminera      Compile support for hexminera (default disabled)
  --enable-hexminerb      Compile support for hexminerb (default disabled)
  --enable-hexmineru      Compile support for hexmineru (default disabled)
  --enable-hexminerc      Compile support for hexminerc (default disabled)
  --enable-hexminer8      Compile support for hexminer8 (default disabled)

To choose the right driver a look into the output of dmesg is useful. For example the 24 GH/s HEX16A2 is a HEX16C-Avalon2 ASIC Miner. So I used --enable-hexminerc.

[ 2546.356069] usb 1-1.2: New USB device found, idVendor=04d8, idProduct=000a
[ 2546.356107] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2546.356127] usb 1-1.2: Product: HEX16C-Avalon2 ASIC Miner
[ 2546.356146] usb 1-1.2: Manufacturer: TECHNOBIT HEX ASIC Miner.

Because I directly compiled on the Raspberry Pi the following steps will take some time.

# autoreconf -vi
# ./configure --enable-hexminerc
# make

After the compilation finished I started the miner the following way. eligius.conf only contains my worker data and the Stratum URL.

./cgminer -c eligius.conf --hexminerc-options 16:1500 --hexminerc-voltage 1100 --set_default_to_c

When using --enable-hexminerc the compilation will fail with the following error.

  CCLD   cgminer
cgminer-driver-hexminerc.o: In function `hexminerc_send_task':
/root/cgminer/cgminer-3.10.0/driver-hexminerc.c:72: undefined reference to `SHA256_K'
collect2: ld returned 1 exit status
make[2]: *** [cgminer] Error 1

This issue can be fixed using the following diff (patch -p1 < libhexc.c.patch).

--- a/libhexc.c	2014-01-17 18:44:57.505712000 +0000
+++ b/libhexc.c	2014-01-17 18:45:20.485712000 +0000
@@ -9,7 +9,7 @@
 		w; 
 	d = d + h; 
 	h = h + (rotate(a, 30) ^ rotate(a, 19) ^ rotate(a, 10)) + ((a & b) | (c & (a | b)))
-extern const uint32_t SHA256_K[64];
+const uint32_t SHA256_K[3] = { 0x428a2f98, 0x71374491, 0xb5c0fbcf };
 
 static bool
 libhexc_cachenonce (struct chip_resultsc *nonce_cache, uint32_t nonce)

Also have a look at http://sven-goessling.de/14/12/2013/der-40ghs-hex16b-bitfury-asic-bitcoin-miner-auf-dem-raspberry-pi-14-12-13/ . I have used this documentation as starting point.

  • Miloslav Strnad

    Hello following diff (patch -p1 < libhexc.c.patch) return me:

    patch unexpectedly ends in middle of line
    patch: **** Only garbage was found in the patch input.

    can you help me with this issue ?

    Thx

    • http://www.cberendt.de Christian Berendt

      Probably something went wrong while copying the patch. There are two ways to proceed. First, manually edit the file libhexc.c and replace the line “extern const uint32_t SHA256_K[64];” with “const uint32_t SHA256_K[3] = { 0x428a2f98, 0×71374491, 0xb5c0fbcf };”. Second, run “./configure –enable-hexminerc –enable-hexminera” instead of “./configure –enable-hexminerc” and you should not need the patch at all.

  • Miloslav Strnad

    Ok, i try it thank you very much.

  • Kevin Schmidt

    Hi, I followed your description. But when I want to check if the miner is detected, I got the following error.

    pi@raspberrypi ~ $ /home/pi/cgminer-3.11.0/cgminer -n
    [2014-02-17 16:39:16] USB all: found 8 devices – listing known devices
    .USB dev 0: Bus 1 Device 5 ID: 04d8:000a
    ** dev 0: Failed to open, err -3
    [2014-02-17 16:39:16] 1 known USB devices
    pi@raspberrypi ~ $

    With LSUSB I got the following information:

    pi@raspberrypi ~ $ lsusb
    Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 008: ID 0835:8502 Action Star Enterprise Co., Ltd
    Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
    Bus 001 Device 004: ID 0835:8500 Action Star Enterprise Co., Ltd
    Bus 001 Device 005: ID 04d8:000a Microchip Technology, Inc. CDC RS-232 Emulation Demo
    Bus 001 Device 006: ID 0835:8501 Action Star Enterprise Co., Ltd
    Bus 001 Device 007: ID 0835:8500 Action Star Enterprise Co., Ltd

    Any idea where I went wrong? Or is the miner broken? Or should I erase the SD-Card and start once over?

    Kind regards

    Kevin

    • http://www.cberendt.de Christian Berendt

      @Kevin: Try it as root. 04d8:000a is the HEX16C-Avalon2.

      # ./cgminer -n
      [2014-02-18 09:40:36] USB all: found 5 devices – listing known devices
      .USB dev 0: Bus 1 Device 13 ID: 04d8:000a
      Manufacturer: ‘TECHNOBIT HEX ASIC Miner.’
      Product: ‘HEX16C-Avalon2 ASIC Miner’
      [2014-02-18 09:40:36] 1 known USB devices

      • Achib

        pi@raspberrypi ~/cgminer $ ./cgminer -n
        [2014-03-26 20:01:42] USB all: found 6 devices – listing known devices
        .USB dev 0: Bus 1 Device 6 ID: 04d8:000a
        ** dev 0: Failed to open, err -3
        .USB dev 1: Bus 1 Device 5 ID: 04d8:000a
        ** dev 1: Failed to open, err -3
        [2014-03-26 20:01:42] 2 known USB devices
        pi@raspberrypi ~/cgminer $ sudo ./cgminer -n
        [2014-03-26 20:02:35] USB all: found 6 devices – listing known devices
        .USB dev 0: Bus 1 Device 6 ID: 04d8:000a
        Manufacturer: ‘** err:(-9) LIBUSB_ERROR_PIPE’
        Product: ‘** err:(-9) LIBUSB_ERROR_PIPE’
        .USB dev 1: Bus 1 Device 5 ID: 04d8:000a
        Manufacturer: ‘** err:(-9) LIBUSB_ERROR_PIPE’
        Product: ‘** err:(-9) LIBUSB_ERROR_PIPE’
        [2014-03-26 20:02:35] 2 known USB devices

        any hints ?

        • Achib

          How exactly do i this:
          This issue can be fixed using the following diff (patch -p1 < libhexc.c.patch).
          what do i have to type ?
          or from where do i get the libhexc.c.patch ?

          Thanks !

  • Mikko

    How do i modify the .conf file to work with this: –set_default_to_c
    i keep getting error with this setting: “set_default_to_c” : “”

    Thanks.

    • http://www.cberendt.de Christian Berendt

      Sorry. I have not yet seen this error.

  • Antonio

    Hello, thanks for the information. I wanted to ask what is the final command to start mine. thanks again

    • http://www.cberendt.de Christian Berendt
      ./cgminer -c eligius.conf --hexminerc-options 16:1500 --hexminerc-voltage 1100 --set_default_to_c
  • Antonio

    Hi, I’ve done step by step as described, but did not succeed.
    I have a hex16c but I could not get it started with the raspberry.
    I’m new in this world and they are not so good, could you help me step by step from the beginning? I am willing to pay you by paypal. thank you

    • http://www.cberendt.de Christian Berendt

      I’m on the CeBIT right now. I’ll come back to you in the next week when I have access to my mining systems.

  • Tres B

    Greetings! Massive thnx for this tutorial. Took a little while but I have my technobit up and running…almost. I can run ./cgminer -n and it will detect my Hex16c, so it looks like i complied/installed everything on Raspbian okay.

    Bascially, miner will connect with a mining pool but cgminer doesn’t hash. I have 0.0 hashrate. Any thoughts? My miner is behind a router? Perhaps portforwarding? Any suggestion would be helpful :)