├── README.md ├── SF3301_Datasheet_v0.51.pdf ├── SF3301_Power_Report_v0.5.pdf ├── SF3301_SV_Board_Hardware_Guide.doc ├── SF3301_SV_Schematic_v1.0.pdf ├── SV_POWER_BOARD_CONFIGURATION.xls ├── miner_code ├── README.md └── cpuminer-2.4.2_sfards.tar.gz ├── sf100 ├── hardware │ ├── future-power │ │ ├── bom │ │ │ └── SFS-0001 BOM R2.3 150729.xlsx │ │ └── schematic │ │ │ ├── SFS-0001_P1_V2.3 150729.PDF │ │ │ ├── SFS-0001_P2_V2.3 150729.PDF │ │ │ ├── SFS-0001_P3_V2.3 150729.PDF │ │ │ ├── SFS-0001_P4_V2.3 150729.PDF │ │ │ └── SFS-0001_Paux_V2.0 150101.PDF │ ├── hashboard │ │ ├── bom │ │ │ └── HASHBOARD_V1_0817.xlsx │ │ └── schematic │ │ │ └── HASHBOARD_V1_0603_V1.pdf │ └── linear-power │ │ ├── bom │ │ └── BOM-2014-11-04.xlsx │ │ └── schematic │ │ └── SF3875A-1.pdf └── software │ └── sfminer.0.95.13.tar.gz ├── sv_util_code ├── Makefile ├── README ├── gpio.c ├── ltc.c ├── main.c ├── serial.c └── serial.h └── usb_dualminer ├── README.md ├── SF3301_USB_V1.1_BOM.xlsx ├── SF3301_USB_V1R1_518FINAL.DSN ├── SF3301_USB_V1R1_518FINAL.opj ├── SF3301_USB_V1R1_518FINAL_0.DBK ├── SF3301_USB_V1R1_FINAL.pdf ├── SF3301_USB_V1R1_PCB.brd ├── SF3301_USB_V1R1_PCB.zip ├── SF3301_USB_V1_1_asm.zip ├── SF3301_USB_V1_1_cam.zip └── SF3301_USB_V1_1_smd.zip /README.md: -------------------------------------------------------------------------------- 1 | # ASIC-SF3301 2 | BTC&LTC 双挖芯片 / BTC&LTC Dual Mining ASIC 3 | 4 | SF3301 is the most advanced ASIC chip to Power High-performance Bitcoin & Litecoin mining. 5 | 6 | 文档列表: 7 | 8 | usb_dualminer : SF3301 USB Dual Miner Resources 双挖USB矿机设计资料 9 | 10 | SF3301_SV_Board_Hardware_Guide.doc : SF3301 验证板硬件指南 11 | 12 | SV_POWER_BOARD_CONFIGURATION.xls : SF3301 验证板电压配置表 13 | 14 | sv_util_code : SF3301 验证板串口驱动程序 15 | 16 | SF3301_Datasheet_v0.5.pdf : SF3301 芯片手册 17 | 18 | SF3301_Power_Report_v0.5.pdf : SF3301 芯片功耗测试数据 19 | 20 | SF3301_SV_Schematic_v1.0.pdf : SF3301 芯片验证板原理图 21 | -------------------------------------------------------------------------------- /SF3301_Datasheet_v0.51.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/SF3301_Datasheet_v0.51.pdf -------------------------------------------------------------------------------- /SF3301_Power_Report_v0.5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/SF3301_Power_Report_v0.5.pdf -------------------------------------------------------------------------------- /SF3301_SV_Board_Hardware_Guide.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/SF3301_SV_Board_Hardware_Guide.doc -------------------------------------------------------------------------------- /SF3301_SV_Schematic_v1.0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/SF3301_SV_Schematic_v1.0.pdf -------------------------------------------------------------------------------- /SV_POWER_BOARD_CONFIGURATION.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/SV_POWER_BOARD_CONFIGURATION.xls -------------------------------------------------------------------------------- /miner_code/README.md: -------------------------------------------------------------------------------- 1 | This is a multi-threaded miner for SFARDS miner device, 2 | fork of Pooler's cpuminer 3 | 4 | Dependencies: 5 | 6 | libcurl http://curl.haxx.se/libcurl/ 7 | 8 | jansson http://www.digip.org/jansson/ 9 | 10 | Build intstructions(Linux only): 11 | 12 | ./configure 13 | 14 | make 15 | 16 | Usage instructions: Run "minerd --help" to see options. 17 | 18 | Example: 19 | 20 | BTC: 21 | 22 | sudo ./minerd -a sha256d -o stratum+tcp://POOL_URL -u USER -p PASSWORD -d /dev/ttyUSBx -f 600 23 | 24 | LTC 25 | 26 | sudo ./minerd -o stratum+tcp://POOL_URL -u USER -p PASSWORD -d /dev/ttyUSBx -f 600 27 | -------------------------------------------------------------------------------- /miner_code/cpuminer-2.4.2_sfards.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/miner_code/cpuminer-2.4.2_sfards.tar.gz -------------------------------------------------------------------------------- /sf100/hardware/future-power/bom/SFS-0001 BOM R2.3 150729.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/sf100/hardware/future-power/bom/SFS-0001 BOM R2.3 150729.xlsx -------------------------------------------------------------------------------- /sf100/hardware/future-power/schematic/SFS-0001_P1_V2.3 150729.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/sf100/hardware/future-power/schematic/SFS-0001_P1_V2.3 150729.PDF -------------------------------------------------------------------------------- /sf100/hardware/future-power/schematic/SFS-0001_P2_V2.3 150729.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/sf100/hardware/future-power/schematic/SFS-0001_P2_V2.3 150729.PDF -------------------------------------------------------------------------------- /sf100/hardware/future-power/schematic/SFS-0001_P3_V2.3 150729.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/sf100/hardware/future-power/schematic/SFS-0001_P3_V2.3 150729.PDF -------------------------------------------------------------------------------- /sf100/hardware/future-power/schematic/SFS-0001_P4_V2.3 150729.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/sf100/hardware/future-power/schematic/SFS-0001_P4_V2.3 150729.PDF -------------------------------------------------------------------------------- /sf100/hardware/future-power/schematic/SFS-0001_Paux_V2.0 150101.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/sf100/hardware/future-power/schematic/SFS-0001_Paux_V2.0 150101.PDF -------------------------------------------------------------------------------- /sf100/hardware/hashboard/bom/HASHBOARD_V1_0817.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/sf100/hardware/hashboard/bom/HASHBOARD_V1_0817.xlsx -------------------------------------------------------------------------------- /sf100/hardware/hashboard/schematic/HASHBOARD_V1_0603_V1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/sf100/hardware/hashboard/schematic/HASHBOARD_V1_0603_V1.pdf -------------------------------------------------------------------------------- /sf100/hardware/linear-power/bom/BOM-2014-11-04.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/sf100/hardware/linear-power/bom/BOM-2014-11-04.xlsx -------------------------------------------------------------------------------- /sf100/hardware/linear-power/schematic/SF3875A-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/sf100/hardware/linear-power/schematic/SF3875A-1.pdf -------------------------------------------------------------------------------- /sf100/software/sfminer.0.95.13.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/sf100/software/sfminer.0.95.13.tar.gz -------------------------------------------------------------------------------- /sv_util_code/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | CXX = g++ 3 | SRC = main.c serial.c ltc.c gpio.c 4 | 5 | CFLAGS = -Wall -O2 -c 6 | LDFLAGS = -lm -lpthread -lrt 7 | TARGET = chiptest 8 | OBJ := $(SRC:.c=.o) 9 | all:$(OBJ) 10 | $(CC) $(OBJ) -o $(TARGET) $(LDFLAGS) 11 | %.o:%.c 12 | $(CC) $(CFLAGS) $< 13 | clean: 14 | -rm -f $(OBJ) 15 | -rm -f $(TARGET) 16 | 17 | -------------------------------------------------------------------------------- /sv_util_code/README: -------------------------------------------------------------------------------- 1 | *Util for SF3301 SV board 2 | Linux build instructions: 3 | Run "make" 4 | 5 | Usage instructions: 6 | Run "./chiptest" to see oprions 7 | 8 | ==================== 9 | usage: 10 | for test: 11 | chiptest [count] 12 | for debug: 13 | chiptest [wait time] 14 | for detect: 15 | chiptest [wait time] 16 | 17 | ==================== 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /sv_util_code/gpio.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define GPIO_RESET "/sys/class/gpio/gpio4/value" 9 | 10 | void gpio_reset(void) 11 | { 12 | int fd = open(GPIO_RESET,O_RDWR); 13 | int len = 0; 14 | if (fd < 0) 15 | { 16 | return; 17 | } 18 | 19 | len = write(fd,"0",1); 20 | usleep(500000); 21 | len = write(fd,"1",1); 22 | //usleep(500000); 23 | len = len; 24 | sleep(2); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /sv_util_code/ltc.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *ltc_task = 4 | "000000000000000000000000" 5 | "000000000000000000000000000000f0" 6 | "ff0f0000a5ee21baaa9aabba839d80d3" 7 | "a36556ae637c091a1dad513c71538318" 8 | "950c2b2400000002720442a122ca7c90" 9 | "74d6c360e12a641cb46767060499ef12" 10 | "d11c2cc890f2c6e350eebc91604abef3" 11 | "f62815c81ddffb27d0a4e846d1bdd3ec" 12 | "7e1e372d354c981f53602cb11b093d64"; 13 | 14 | uint32_t ltc_nonce[140] = 15 | { 16 | 0x27e11500, 17 | 0x0bab2400, 18 | 0x41dc4300, 19 | 0x57405100, 20 | 0x08725500, 21 | 0x09ce5700, 22 | 0x1dd35f00, 23 | 0xcea08300, 24 | 0x57829500, 25 | 0xe0b6b800, 26 | 0x0703c100, 27 | 0xea16c900, 28 | 0xbd71d500, 29 | 0xa5e9dd00, 30 | 0xd694f100, 31 | 0x2e81fd00, 32 | 0x1ddf0601, 33 | 0xab610701, 34 | 0x2ff41901, 35 | 0xe1f23401, 36 | 0x801b3a01, 37 | 0x29704a01, 38 | 0x54776a01, 39 | 0x8160ab01, 40 | 0xa313b901, 41 | 0xf844c901, 42 | 0x4a61df01, 43 | 0x196ef401, 44 | 0x214c0202, 45 | 0xa77b0202, 46 | 0x39c63a02, 47 | 0xd78e3f02, 48 | 0x93784d02, 49 | 0x11ce6102, 50 | 0x0d036402, 51 | 0x4ad36502, 52 | 0x88a57f02, 53 | 0xc584ad02, 54 | 0x3d98b602, 55 | 0x2cd7bd02, 56 | 0x25d3d002, 57 | 0x6620d102, 58 | 0x88b1d502, 59 | 0x6453de02, 60 | 0x03c20403, 61 | 0xf69e0603, 62 | 0x3ea41c03, 63 | 0x4da21f03, 64 | 0xe9163403, 65 | 0x052d3c03, 66 | 0x8b183d03, 67 | 0xd1b34603, 68 | 0x85985003, 69 | 0xa4696003, 70 | 0x84879403, 71 | 0xbf12ac03, 72 | 0xacf3b803, 73 | 0x21cdb903, 74 | 0xe329ce03, 75 | 0x2708ec03, 76 | 0xa58ced03, 77 | 0x0e6eee03, 78 | 0x4a66ef03, 79 | 0xc2ca0d04, 80 | 0x8fa01804, 81 | 0x08506104, 82 | 0xc8116d04, 83 | 0xc342a104, 84 | 0xed54b904, 85 | 0x8720bf04, 86 | 0xab09c404, 87 | 0x704fc604, 88 | 0xf27dc604, 89 | 0xff92e404, 90 | 0xc13b0205, 91 | 0x58e81705, 92 | 0xd52f5105, 93 | 0x9f195a05, 94 | 0x6ffb8805, 95 | 0x906f9805, 96 | 0xa8a3a905, 97 | 0x46f9ad05, 98 | 0x86acb405, 99 | 0x6014ba05, 100 | 0x5df4bf05, 101 | 0x0a66c205, 102 | 0x754fcd05, 103 | 0x8f8fdc05, 104 | 0xdff32e06, 105 | 0xfcd44006, 106 | 0x47185506, 107 | 0xe9456106, 108 | 0x2af87006, 109 | 0x3baa7c06, 110 | 0x31409606, 111 | 0x0f849d06, 112 | 0x128ca306, 113 | 0x6e8cca06, 114 | 0x43cccd06, 115 | 0x1737d906, 116 | 0xb6e1e606, 117 | 0xa6840b07, 118 | 0xb5311907, 119 | 0x89856407, 120 | 0xd2fe6407, 121 | 0x20b46807, 122 | 0xdf7d6f07, 123 | 0x69358507, 124 | 0x028cb807, 125 | 0xbd62ce07, 126 | 0xe9e6db07, 127 | 0x542ff007, 128 | 0x3c0a0308, 129 | 0xe7c30608, 130 | 0xc9db0708, 131 | 0x364b2008, 132 | 0x005f2008, 133 | 0x51632408, 134 | 0xcba52e08, 135 | 0x4b303308, 136 | 0x10ed3608, 137 | 0x47114108, 138 | 0xffe05308, 139 | 0x3b9f7508, 140 | 0xd3e49108, 141 | 0x26649708, 142 | 0xa112a108, 143 | 0x4b6ea408, 144 | 0x8b75c208, 145 | 0x4ab7c708, 146 | 0xfca0d608, 147 | 0xe8c3db08, 148 | 0x6865f308, 149 | 0x478bf508, 150 | 0x8d6d1609, 151 | 0x2fb81a09, 152 | 0x7f5f1e09, 153 | 0xee592909, 154 | 0x2e523f09, 155 | 0x5d384609 156 | }; 157 | 158 | -------------------------------------------------------------------------------- /sv_util_code/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "serial.h" 8 | 9 | //#define PIGPIO_RESET 10 | 11 | void gpio_reset(void); 12 | 13 | static void show_usage() 14 | { 15 | printf("chiptest for SF3301\n"); 16 | printf("usage:\n"); 17 | printf(" for test:\n"); 18 | printf(" chiptest [count]\n"); 19 | printf(" for debug:\n"); 20 | printf(" chiptest [wait time]\n"); 21 | printf(" for detect:\n"); 22 | printf(" chiptest [wait time]\n"); 23 | } 24 | 25 | static int char2hex(char c) 26 | { 27 | if (c >= '0' && c <= '9') 28 | { 29 | return (c - '0'); 30 | } 31 | else if (c >= 'a' && c <= 'f') 32 | { 33 | return (c - 'a' + 10); 34 | } 35 | else if (c >= 'A' && c <= 'F') 36 | { 37 | return (c - 'A' + 10); 38 | } 39 | 40 | return -1; 41 | } 42 | 43 | static int hexstr2bin(char *cmd,uint8_t *buf,int len) 44 | { 45 | int i,j; 46 | int h,l; 47 | if (len * 2 < strlen(cmd)) 48 | { 49 | return -1; 50 | } 51 | 52 | for (i = 0,j = 0;i < strlen(cmd);i++) 53 | { 54 | if (cmd[i] == ' ') 55 | { 56 | continue; 57 | } 58 | 59 | h = char2hex(cmd[i]); 60 | l = char2hex(cmd[i + 1]); 61 | if (h < 0 || l < 0) 62 | { 63 | return -1; 64 | } 65 | 66 | buf[j++] = (h << 4) | l; 67 | i++; 68 | } 69 | return j; 70 | } 71 | 72 | static void send_cmd(struct serial_port *serial,char * cmd,uint8_t *buf,int len) 73 | { 74 | int size = hexstr2bin(cmd,buf,len); 75 | if (size > 0) 76 | { 77 | serial_send(serial,buf,size); 78 | } 79 | usleep(2000); 80 | } 81 | 82 | static uint32_t calc_freq(int freq) 83 | { 84 | uint32_t val = 0x0000600d; 85 | uint32_t pll_od,pll_f; 86 | int fact = freq / 25;; 87 | if (fact < 1) 88 | { 89 | fact = 1; 90 | } 91 | if (fact > 40) 92 | { 93 | fact = 40; 94 | } 95 | 96 | pll_od = fact < 8 ? 8 : 1; 97 | pll_f = pll_od * fact; 98 | 99 | val |= (pll_f << 17) | (pll_od << 24); 100 | 101 | return ((val << 24) | (val >> 24) | ((val << 8) & 0xff0000) | ((val >> 8) & 0xff00)); 102 | } 103 | 104 | static uint32_t btc_nonce[4] = 105 | {0x77e446d1,0xa7d458f7,0x6b908a24,0x9c1aa145}; 106 | 107 | static int btc_nonce_count = 0; 108 | static int btc_nonce_error = 0; 109 | static int btc_chipid = 0; 110 | 111 | static void btc_test_cb(void *buf,int len) 112 | { 113 | static uint8_t recv_buf[1024]; 114 | static int recv_buf_offset = 0; 115 | int i,k; 116 | 117 | if (recv_buf_offset + len > 1024) 118 | { 119 | len -= 1024 - recv_buf_offset; 120 | } 121 | memcpy(recv_buf + recv_buf_offset,buf,len); 122 | 123 | recv_buf_offset += len; 124 | 125 | i = 0; 126 | while(i <= recv_buf_offset - 8) 127 | { 128 | if (recv_buf[i] == 0x55) 129 | { 130 | if (recv_buf[i + 1] == btc_chipid 131 | && recv_buf[i + 2] == 0xff 132 | && recv_buf[i + 3] == 0x00) 133 | { 134 | uint32_t nonce = recv_buf[i + 7] | recv_buf[i + 6] << 8 135 | | recv_buf[i + 5] << 16 | recv_buf[i + 4] << 24; 136 | for (k = 0;k < 4;k++) 137 | { 138 | if (nonce == btc_nonce[k]) 139 | { 140 | break; 141 | } 142 | } 143 | if (k >= 4) 144 | { 145 | btc_nonce_error++; 146 | } 147 | btc_nonce_count++; 148 | } 149 | i += 7; 150 | } 151 | i++; 152 | } 153 | if (i > 0) 154 | { 155 | memmove(recv_buf,recv_buf + i,recv_buf_offset - i); 156 | recv_buf_offset -= i; 157 | } 158 | } 159 | 160 | static void btc_test(char *path,int baud,int chipid,int freq,int count) 161 | { 162 | char *cmd_auto_cfg = "55fef07f010000c0"; 163 | char *cmd_clear = "55ff f002 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000"; 164 | char *cmd_disable = "55ff f01e 0000 0000"; 165 | char *cmd_enable = "55ff f01e 0300 0000"; 166 | char cmd_set_freq[17] = ""; 167 | char *cmd_init_seq[] = 168 | { 169 | "55ff f054 0200 5a8a","55ff f052 6895 a712", 170 | "55ff f055 8233 7f2a","55ff f058 1911 1420", 171 | "55ff f05a 0000 0020","55ff f05c 0210 0000", 172 | "55ff f060 1906 1420","55ff f064 2410 9640", 173 | "55ff f066 ffaa 0312","55ff f06a 0122 0030", 174 | "55ff ef1f 180c 7e17","55ff ef01 ffff ffff", 175 | "55ff ef00 0000 0000","55ff f020 1f1b 81b4", 176 | "55ff f002 0100 0000","55ff f003 0100 0000", 177 | "55ff f004 0100 0000","55ff f005 0100 0000", 178 | "55ff f006 0100 0000", 179 | "55ff f002 0300 0000","55ff f003 0300 0000", 180 | "55ff f004 0300 0000","55ff f005 0300 0000", 181 | "55ff f006 0300 0000","55ff f002 0700 0000", 182 | "55ff f003 0700 0000","55ff f004 0700 0000", 183 | "55ff f005 ffff ff07","55ff f006 ffff ff07", 184 | "55ff f002 ffff ff0f","55ff f003 ffff ff0f", 185 | "55ff f004 ffff ff0f","55ff f005 ffff ff0f", 186 | "55ff f006 ffff ff0f","55ff f002 ffff ff1f", 187 | "55ff f003 ffff ff1f","55ff f004 ffff ff1f", 188 | "55ff f005 ffff ff1f","55ff f006 ffff ff1f", 189 | "55ff f002 ffff ff3f", 190 | "55ff f003 ffff ff3f","55ff f004 ffff ff3f", 191 | "55ff f005 ffff ff3f","55ff f006 ffff ff3f", 192 | "55ff f002 ffff ff7f","55ff f003 ffff ff7f", 193 | "55ff f004 ffff ff7f","55ff f005 ffff ff7f", 194 | "55ff f006 ffff ff7f","55ff f002 ffff ffff", 195 | "55ff f003 ffff ffff","55ff f004 ffff ffff", 196 | "55ff f005 ffff ffff","55ff f006 ffff ffff", 197 | }; 198 | 199 | char *cmd_task_fmt[] = 200 | { 201 | "55%2.2x ef21 00e0 ff1f 1b71 4871 7e49 8ce1" 202 | "5868 5055 77ba 7c3d c696 a917 c26b adde" 203 | "ed36 3e61 6f5e cd7d df70 61f2 553b 7eaf" 204 | "1817 17f0", 205 | "55%2.2x ef41 00e0 ff1f a092 4de2" 206 | "edca 349f 87ab 15d1 58cc 6363 e3c0 ac09" 207 | "0ac6 7120 3cb7 2390 3fa6 9689 cc0c ccc0" 208 | "553b 7ec0 1817 17f0", 209 | "55%2.2x ef61 00e0 ff1f c7cf 6e20 0dd9 7643 1899 7d16 b005 b0ee" 210 | "437a 35d0 9192 4818 42ab a3a3 5b7a 9a72" 211 | "6bdd d834 553b 7ec0 1817 17f0", 212 | "55%2.2x ef01 00e0 ff1f f7fd b588 65ae 81a0 ca67 3add" 213 | "3ba4 7ed9 6b6c 1e93 6033 e089 95c8 8a71" 214 | "8899 65a4 6ed1 11a5 553b 7ec0 1817 17f4", 215 | }; 216 | 217 | char cmd_task_buf[320]; 218 | struct serial_port *serial; 219 | uint8_t buf[1024]; 220 | const int buf_len = 1024; 221 | int i,prev = 0; 222 | serial = serial_init(path,baud,btc_test_cb); 223 | sprintf(cmd_set_freq,"55fff000%8.8x",calc_freq(freq)); 224 | if (serial == NULL) 225 | { 226 | printf("Failed open serial port\n"); 227 | return; 228 | } 229 | btc_chipid = chipid; 230 | 231 | send_cmd(serial,cmd_auto_cfg,buf,buf_len); 232 | sleep(2); 233 | send_cmd(serial,cmd_clear,buf,buf_len); 234 | send_cmd(serial,cmd_disable,buf,buf_len); 235 | send_cmd(serial,cmd_enable,buf,buf_len); 236 | send_cmd(serial,cmd_set_freq,buf,buf_len); 237 | for (i = 0;i < 34;i++) 238 | { 239 | send_cmd(serial,cmd_init_seq[i],buf,buf_len); 240 | } 241 | 242 | for (i = 0;i < 4;i++) 243 | { 244 | sprintf(cmd_task_buf,cmd_task_fmt[i],chipid); 245 | send_cmd(serial,cmd_task_buf,buf,buf_len); 246 | } 247 | 248 | while(count > btc_nonce_count) 249 | { 250 | sleep(1); 251 | if (btc_nonce_count > prev) 252 | { 253 | prev = btc_nonce_count; 254 | printf("btc nonce count = %d error = %d (%3.2f%%)\n", 255 | btc_nonce_count,btc_nonce_error, 256 | (btc_nonce_count - btc_nonce_error) * 100.0 / btc_nonce_count); 257 | } 258 | } 259 | send_cmd(serial,cmd_clear,buf,buf_len); 260 | send_cmd(serial,cmd_disable,buf,buf_len); 261 | serial_destroy(serial); 262 | } 263 | 264 | extern char *ltc_task; 265 | extern uint32_t ltc_nonce[140]; 266 | static int ltc_nonce_count = 0; 267 | static int ltc_nonce_error = 0; 268 | static int ltc_chipid = 0; 269 | 270 | static void ltc_test_cb(void *buf,int len) 271 | { 272 | static uint8_t recv_buf[128]; 273 | static int recv_buf_offset = 0; 274 | int i,k; 275 | 276 | if (recv_buf_offset + len > 128) 277 | { 278 | len -= 128 - recv_buf_offset; 279 | } 280 | memcpy(recv_buf + recv_buf_offset,buf,len); 281 | 282 | recv_buf_offset += len; 283 | 284 | i = 0; 285 | while(i <= recv_buf_offset - 8) 286 | { 287 | if (recv_buf[i] == 0x55 && ltc_nonce_count < 140) 288 | { 289 | if (recv_buf[i + 1] == ltc_chipid 290 | && recv_buf[i + 2] == 0xff 291 | && recv_buf[i + 3] == 0x00) 292 | { 293 | uint32_t nonce = recv_buf[i + 7] | recv_buf[i + 6] << 8 294 | | recv_buf[i + 5] << 16 | recv_buf[i + 4] << 24; 295 | for (k = 0;k < 140;k++) 296 | { 297 | if (nonce == ltc_nonce[k]) 298 | { 299 | break; 300 | } 301 | } 302 | if (k >= 140) 303 | { 304 | ltc_nonce_error++; 305 | } 306 | ltc_nonce_count++; 307 | } 308 | i += 7; 309 | } 310 | i++; 311 | } 312 | if (i > 0) 313 | { 314 | memmove(recv_buf,recv_buf + i,recv_buf_offset - i); 315 | recv_buf_offset -= i; 316 | } 317 | } 318 | 319 | static void ltc_test(char *path,int baud,int chipid,int freq,int count) 320 | { 321 | char *cmd_auto_cfg = "55fef07f010800c0"; 322 | char *cmd_en_pll = "55fff002ffffff7f"; 323 | char *cmd_cmp_mode = "55ffbf300a000080"; 324 | char *cmd_init_nonce = "55ffbf0000000000"; 325 | char *cmd_task_fmt = "55%2.2xbf01%s"; 326 | char cmd_set_freq[17] = ""; 327 | 328 | char cmd_task_buf[320]; 329 | struct serial_port *serial; 330 | uint8_t buf[1024]; 331 | const int buf_len = 1024; 332 | int prev = 0; 333 | serial = serial_init(path,baud,ltc_test_cb); 334 | sprintf(cmd_task_buf,cmd_task_fmt,chipid,ltc_task); 335 | sprintf(cmd_set_freq,"55fff000%8.8x",calc_freq(freq)); 336 | if (serial == NULL) 337 | { 338 | printf("Failed open serial port\n"); 339 | return; 340 | } 341 | ltc_chipid = chipid; 342 | 343 | send_cmd(serial,cmd_auto_cfg,buf,buf_len); 344 | sleep(2); 345 | send_cmd(serial,cmd_set_freq,buf,buf_len); 346 | send_cmd(serial,cmd_en_pll,buf,buf_len); 347 | send_cmd(serial,cmd_cmp_mode,buf,buf_len); 348 | send_cmd(serial,cmd_init_nonce,buf,buf_len); 349 | 350 | send_cmd(serial,cmd_task_buf,buf,buf_len); 351 | while(count > ltc_nonce_count) 352 | { 353 | sleep(1); 354 | if (ltc_nonce_count > prev) 355 | { 356 | prev = ltc_nonce_count; 357 | printf("ltc nonce count = %d error = %d (%3.2f%%)\n", 358 | ltc_nonce_count,ltc_nonce_error, 359 | (ltc_nonce_count - ltc_nonce_error) * 100.0 / ltc_nonce_count); 360 | } 361 | } 362 | 363 | serial_destroy(serial); 364 | } 365 | 366 | static void reg_debug_cb(void *buf,int len) 367 | { 368 | static int count = 0; 369 | uint8_t *p = buf; 370 | 371 | while(len--) 372 | { 373 | printf("%2.2x",*p++); 374 | if (((count++) & 7) == 7) 375 | { 376 | printf("\n"); 377 | } 378 | } 379 | } 380 | 381 | static void reg_debug(char *path,int baud,char *data,int waittime) 382 | { 383 | struct serial_port *serial; 384 | uint8_t buf[1024]; 385 | const int buf_len = 1024; 386 | serial = serial_init(path,baud,reg_debug_cb); 387 | if (serial == NULL) 388 | { 389 | printf("Failed open serial port\n"); 390 | return; 391 | } 392 | 393 | send_cmd(serial,data,buf,buf_len); 394 | if (waittime) 395 | { 396 | sleep(waittime); 397 | } 398 | else 399 | { 400 | usleep(20000); 401 | } 402 | 403 | serial_destroy(serial); 404 | } 405 | 406 | static void chip_detect_cb(void *buf,int len) 407 | { 408 | static uint8_t recv_buf[128]; 409 | static int recv_buf_offset = 0; 410 | int i; 411 | 412 | if (recv_buf_offset + len > 128) 413 | { 414 | len -= 128 - recv_buf_offset; 415 | } 416 | memcpy(recv_buf + recv_buf_offset,buf,len); 417 | 418 | recv_buf_offset += len; 419 | 420 | i = 0; 421 | while(i <= recv_buf_offset - 8) 422 | { 423 | if (recv_buf[i] == 0x55) 424 | { 425 | if (recv_buf[i + 2] == 0x00 && recv_buf[i + 3] == 0x75) 426 | { 427 | printf("detected chip id = %d, device id = %2.2x%2.2x%2.2x%2.2x\n", 428 | recv_buf[i + 1],recv_buf[i + 7],recv_buf[i + 6], 429 | recv_buf[i + 5],recv_buf[i + 4]); 430 | } 431 | i += 7; 432 | } 433 | i++; 434 | } 435 | if (i > 0) 436 | { 437 | memmove(recv_buf,recv_buf + i,recv_buf_offset - i); 438 | recv_buf_offset -= i; 439 | } 440 | } 441 | 442 | static void chip_detect(char *path,int baud,int waittime) 443 | { 444 | char *cmd_auto_cfg = "55fef07f010000c0"; 445 | char *cmd_deviceid = "55fff0f500000000"; 446 | struct serial_port *serial; 447 | uint8_t buf[1024]; 448 | const int buf_len = 1024; 449 | #ifdef PIGPIO_RESET 450 | gpio_reset(); 451 | #endif 452 | serial = serial_init(path,baud,chip_detect_cb); 453 | if (serial == NULL) 454 | { 455 | printf("Failed open serial port\n"); 456 | return; 457 | } 458 | 459 | send_cmd(serial,cmd_auto_cfg,buf,buf_len); 460 | sleep(3); 461 | send_cmd(serial,cmd_deviceid,buf,buf_len); 462 | 463 | if (waittime) 464 | { 465 | sleep(waittime); 466 | } 467 | else 468 | { 469 | usleep(20000); 470 | } 471 | serial_destroy(serial); 472 | } 473 | 474 | int main(int argc,char **argv) 475 | { 476 | int baud = 115200; 477 | char *path = argv[1]; 478 | 479 | if (argc < 3) 480 | { 481 | show_usage(); 482 | exit(0); 483 | } 484 | 485 | if (strcmp(argv[2],"btc") == 0 || strcmp(argv[2],"ltc") == 0) 486 | { 487 | int chipid,freq,count; 488 | if (argc < 5) 489 | { 490 | show_usage(); 491 | exit(0); 492 | } 493 | chipid = atoi(argv[3]); 494 | freq = atoi(argv[4]); 495 | count = argc > 5 ? atoi(argv[5]) : 1; 496 | if (strcmp(argv[2],"btc") == 0) 497 | { 498 | btc_test(path,baud,chipid,freq,count); 499 | } 500 | else 501 | { 502 | ltc_test(path,baud,chipid,freq,count); 503 | } 504 | } 505 | else 506 | { 507 | int waittime = argc > 3 ? atoi(argv[3]) : 0; 508 | if (strcmp(argv[2],"det") == 0) 509 | { 510 | chip_detect(path,baud,waittime); 511 | } 512 | else 513 | { 514 | reg_debug(path,baud,argv[2],waittime); 515 | } 516 | } 517 | 518 | return 0; 519 | } 520 | 521 | -------------------------------------------------------------------------------- /sv_util_code/serial.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "serial.h" 14 | 15 | #define SERIAL_RECV_BUF_LEN (256) 16 | 17 | //#define SERIAL_LOG 18 | 19 | static void serial_iolog(void *buf,int len,int input) 20 | { 21 | #ifdef SERIAL_LOG 22 | struct timeval t; 23 | uint8_t *data = buf; 24 | int i; 25 | 26 | gettimeofday(&t,NULL); 27 | printf("[%4.4d.%3.3d] %s %d bytes :\n", 28 | (int)t.tv_sec % 100000,(int)t.tv_usec / 1000, 29 | input ? "Recv" : "Send",len); 30 | 31 | for (i = 0;i < len ;i++) 32 | { 33 | if ((i & 3) == 3) 34 | { 35 | if ((i & 31) == 31 && i != len - 1) 36 | { 37 | printf("%2.2x\n",data[i]); 38 | } 39 | else 40 | { 41 | printf("%2.2x ",data[i]); 42 | } 43 | } 44 | else 45 | { 46 | printf("%2.2x",data[i]); 47 | } 48 | } 49 | 50 | printf("\n"); 51 | #endif 52 | } 53 | 54 | static void *serial_proc(void *arg) 55 | { 56 | struct serial_port *serial = (struct serial_port *)arg; 57 | struct timeval timeout; 58 | fd_set rfds; 59 | int maxfd,len,retval; 60 | char buf[SERIAL_RECV_BUF_LEN]; 61 | 62 | while(1) 63 | { 64 | pthread_rwlock_rdlock(&serial->rwlock); 65 | 66 | if (serial->fd <= 0) 67 | { 68 | pthread_rwlock_unlock(&serial->rwlock); 69 | break; 70 | } 71 | 72 | FD_ZERO(&rfds); 73 | FD_SET(serial->fd,&rfds); 74 | maxfd = serial->fd + 1; 75 | timeout.tv_sec = 1; 76 | timeout.tv_usec = 0; 77 | 78 | pthread_rwlock_unlock(&serial->rwlock); 79 | retval = select(maxfd,&rfds,NULL,NULL,&timeout); 80 | 81 | pthread_rwlock_rdlock(&serial->rwlock); 82 | 83 | if (serial->fd <= 0 || retval < 0) 84 | { 85 | pthread_rwlock_unlock(&serial->rwlock); 86 | break; 87 | } 88 | 89 | if (retval == 0) 90 | { 91 | pthread_rwlock_unlock(&serial->rwlock); 92 | continue; 93 | } 94 | len = read(serial->fd,buf,SERIAL_RECV_BUF_LEN); 95 | 96 | pthread_rwlock_unlock(&serial->rwlock); 97 | 98 | serial_iolog(buf,len,1); 99 | serial->recv(buf,len); 100 | } 101 | 102 | return NULL; 103 | } 104 | 105 | struct serial_port* serial_init(const char *port,int baud,void (*recv)(void *,int)) 106 | { 107 | struct serial_port* serial; 108 | 109 | serial = calloc(sizeof(struct serial_port),1); 110 | if (serial == NULL) 111 | { 112 | return NULL; 113 | } 114 | 115 | serial->recv = recv; 116 | 117 | if (pthread_rwlock_init(&serial->rwlock,NULL) < 0) 118 | { 119 | goto err_rwlock; 120 | } 121 | 122 | serial->fd = open(port,O_RDWR | O_NOCTTY); 123 | if (serial->fd < 0) 124 | { 125 | goto err_open; 126 | } 127 | 128 | if (serial_setup(serial,baud) < 0) 129 | { 130 | goto err_baud; 131 | } 132 | 133 | if (pthread_create(&serial->tid,NULL,serial_proc,serial) < 0) 134 | { 135 | goto err_thr; 136 | } 137 | 138 | return serial; 139 | err_thr: 140 | err_baud: 141 | close(serial->fd); 142 | err_open: 143 | pthread_rwlock_destroy(&serial->rwlock); 144 | err_rwlock: 145 | free(serial); 146 | return NULL; 147 | } 148 | 149 | int serial_setup(struct serial_port *serial,int baud) 150 | { 151 | const int baudrate[] = {2400,4800,9600,19200,38400,57600,115200}; 152 | const speed_t baudspeed[] = {B2400,B4800,B9600,B19200,B38400,B57600,B115200}; 153 | struct termios options; 154 | int index; 155 | 156 | for (index = 0;index < sizeof(baudrate) / sizeof(int);index++) 157 | { 158 | if (baudrate[index] == baud) 159 | { 160 | break; 161 | } 162 | } 163 | 164 | if (index >= sizeof(baudrate)/sizeof(int)) 165 | { 166 | return -1; 167 | } 168 | 169 | if (baud == serial->baud) 170 | { 171 | return 0; 172 | } 173 | 174 | pthread_rwlock_wrlock(&serial->rwlock); 175 | 176 | if (tcgetattr(serial->fd,&options) < 0) 177 | { 178 | pthread_rwlock_unlock(&serial->rwlock); 179 | return -1; 180 | } 181 | 182 | cfsetspeed(&options,baudspeed[index]); 183 | 184 | options.c_cflag &= ~(CSIZE | PARENB); 185 | options.c_cflag |= CS8; 186 | options.c_cflag |= CREAD; 187 | options.c_cflag |= CLOCAL; 188 | 189 | options.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | 190 | ISTRIP | INLCR | IGNCR | ICRNL | IXON); 191 | options.c_oflag &= ~OPOST; 192 | options.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); 193 | 194 | options.c_cc[VTIME] = (cc_t)10; 195 | options.c_cc[VMIN] = 0; 196 | 197 | if (tcsetattr(serial->fd,TCSANOW, &options) < 0) 198 | { 199 | pthread_rwlock_unlock(&serial->rwlock); 200 | return -1; 201 | } 202 | 203 | pthread_rwlock_unlock(&serial->rwlock); 204 | 205 | serial->baud = baud; 206 | 207 | return 0; 208 | } 209 | 210 | int serial_send(struct serial_port *serial,void *buf,int len) 211 | { 212 | int bytes,offset = 0; 213 | 214 | pthread_rwlock_rdlock(&serial->rwlock); 215 | 216 | if (serial->fd <= 0) 217 | { 218 | pthread_rwlock_unlock(&serial->rwlock); 219 | return -1; 220 | } 221 | 222 | while(offset < len) 223 | { 224 | bytes = write(serial->fd,((char*)buf) + offset,len - offset); 225 | if (bytes > 0) 226 | { 227 | offset += bytes; 228 | } 229 | else 230 | { 231 | pthread_rwlock_unlock(&serial->rwlock); 232 | return -1; 233 | } 234 | } 235 | 236 | pthread_rwlock_unlock(&serial->rwlock); 237 | 238 | serial_iolog(buf,len,0); 239 | return 0; 240 | } 241 | 242 | void serial_destroy(struct serial_port *serial) 243 | { 244 | pthread_rwlock_wrlock(&serial->rwlock); 245 | 246 | close(serial->fd); 247 | serial->fd = -1; 248 | 249 | pthread_rwlock_unlock(&serial->rwlock); 250 | 251 | pthread_join(serial->tid,NULL); 252 | 253 | pthread_rwlock_destroy(&serial->rwlock); 254 | 255 | free(serial); 256 | } 257 | 258 | 259 | -------------------------------------------------------------------------------- /sv_util_code/serial.h: -------------------------------------------------------------------------------- 1 | #ifndef __SERIAL_INCL__ 2 | #define __SERIAL_INCL__ 3 | #include 4 | #include 5 | 6 | struct serial_port 7 | { 8 | int fd; 9 | int baud; 10 | void (*recv)(void *,int); 11 | pthread_t tid; 12 | pthread_rwlock_t rwlock; 13 | }; 14 | 15 | struct serial_port* serial_init(const char *port,int baud,void (*recv)(void *,int)); 16 | int serial_setup(struct serial_port *serial,int baud); 17 | int serial_send(struct serial_port *serial,void *buf,int len); 18 | void serial_destroy(struct serial_port *serial); 19 | 20 | #endif //__SERIAL_INCL__ 21 | -------------------------------------------------------------------------------- /usb_dualminer/README.md: -------------------------------------------------------------------------------- 1 | # ASIC-SF3301 USB Dual Miner Resources 2 | 3 | 文档列表: 4 | 5 | SF3301_USB_V1R1_FINAL.pdf : Schematic 双挖USB矿机原理图 6 | 7 | SF3301_USB_V1R1_PCB.brd : PCB Layout 双挖USB矿机PCB资料 8 | 9 | SF3301_USB_V1.1_BOM.xlsx : BOM List 双挖USB矿机BOM清单 10 | 11 | -------------------------------------------------------------------------------- /usb_dualminer/SF3301_USB_V1.1_BOM.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/usb_dualminer/SF3301_USB_V1.1_BOM.xlsx -------------------------------------------------------------------------------- /usb_dualminer/SF3301_USB_V1R1_518FINAL.DSN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/usb_dualminer/SF3301_USB_V1R1_518FINAL.DSN -------------------------------------------------------------------------------- /usb_dualminer/SF3301_USB_V1R1_518FINAL.opj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/usb_dualminer/SF3301_USB_V1R1_518FINAL.opj -------------------------------------------------------------------------------- /usb_dualminer/SF3301_USB_V1R1_518FINAL_0.DBK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/usb_dualminer/SF3301_USB_V1R1_518FINAL_0.DBK -------------------------------------------------------------------------------- /usb_dualminer/SF3301_USB_V1R1_FINAL.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/usb_dualminer/SF3301_USB_V1R1_FINAL.pdf -------------------------------------------------------------------------------- /usb_dualminer/SF3301_USB_V1R1_PCB.brd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/usb_dualminer/SF3301_USB_V1R1_PCB.brd -------------------------------------------------------------------------------- /usb_dualminer/SF3301_USB_V1R1_PCB.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/usb_dualminer/SF3301_USB_V1R1_PCB.zip -------------------------------------------------------------------------------- /usb_dualminer/SF3301_USB_V1_1_asm.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/usb_dualminer/SF3301_USB_V1_1_asm.zip -------------------------------------------------------------------------------- /usb_dualminer/SF3301_USB_V1_1_cam.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/usb_dualminer/SF3301_USB_V1_1_cam.zip -------------------------------------------------------------------------------- /usb_dualminer/SF3301_USB_V1_1_smd.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfards/ASIC-SF3301/7dafc9605cd930382380ea82df9bbb224ae15a93/usb_dualminer/SF3301_USB_V1_1_smd.zip --------------------------------------------------------------------------------