Skip to content

Commit

Permalink
added emc2101 ideality defines
Browse files Browse the repository at this point in the history
  • Loading branch information
skot committed Nov 15, 2024
1 parent a76bc53 commit 489c7f6
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 9 deletions.
2 changes: 1 addition & 1 deletion components/asic/bm1368.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ uint8_t BM1368_init(uint64_t frequency, uint16_t asic_count)
{0x00, 0x3C, 0x80, 0x00, 0x8b, 0x00},
{0x00, 0x3C, 0x80, 0x00, 0x80, 0x18},
{0x00, 0x14, 0x00, 0x00, 0x00, 0xFF},
{0x00, 0x54, 0x00, 0x00, 0x00, 0x03},
{0x00, 0x54, 0x00, 0x00, 0x00, 0x03}, //Analog Mux
{0x00, 0x58, 0x02, 0x11, 0x11, 0x11}
};

Expand Down
5 changes: 2 additions & 3 deletions components/asic/bm1370.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,17 +306,16 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count)
//Some misc settings?
// TX: 55 AA 51 09 [00 B9 00 00 44 80] 0D //command all chips, write chip address 00, register B9, data 00 00 44 80
_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0xB9, 0x00, 0x00, 0x44, 0x80}, 6, BM1370_SERIALTX_DEBUG);
// TX: 55 AA 51 09 [00 54 00 00 00 02] 18 //command all chips, write chip address 00, register 54, data 00 00 00 02 - Analog Mux Control - S21 does this earlier on
// TX: 55 AA 51 09 [00 54 00 00 00 02] 18 //command all chips, write chip address 00, register 54, data 00 00 00 02 - Analog Mux Control - rumored to control the temp diode
_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x54, 0x00, 0x00, 0x00, 0x02}, 6, BM1370_SERIALTX_DEBUG);
// TX: 55 AA 51 09 [00 B9 00 00 44 80] 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 -- duplicate of first command in series
_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0xB9, 0x00, 0x00, 0x44, 0x80}, 6, BM1370_SERIALTX_DEBUG);
// TX: 55 AA 51 09 [00 3C 80 00 8D EE] 1B //command all chips, write chip address 00, register 3C, data 80 00 8D EE
_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x3C, 0x80, 0x00, 0x8D, 0xEE}, 6, BM1370_SERIALTX_DEBUG);

//ramp up the hash frequency
do_frequency_ramp_up(frequency);

//BM1370_send_hash_frequency(frequency);

//register 10 is still a bit of a mystery. discussion: https://github.com/skot/ESP-Miner/pull/167

// unsigned char set_10_hash_counting[6] = {0x00, 0x10, 0x00, 0x00, 0x11, 0x5A}; //S19k Pro Default
Expand Down
57 changes: 53 additions & 4 deletions main/EMC2101.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,59 @@
#define EMC2101_DATARATE_16_HZ 0x08 //default
#define EMC2101_DATARATE_32_HZ 0x09

#define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor [1.008 -> 0x12]
#define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< Default beta compensation
#define EMC2101_DEFAULT_FILTER EMC2101_FILTER_DISABLED ///< Default temp filter setting
#define EMC2101_DEFAULT_DATARATE EMC2101_DATARATE_16_HZ ///< Default temp conversion rate
#define EMC2101_IDEALITY_0_9949 0x08
#define EMC2101_IDEALITY_0_9962 0x09
#define EMC2101_IDEALITY_0_9975 0x0A
#define EMC2101_IDEALITY_0_9988 0x0B
#define EMC2101_IDEALITY_1_0001 0x0C
#define EMC2101_IDEALITY_1_0014 0x0D
#define EMC2101_IDEALITY_1_0027 0x0E
#define EMC2101_IDEALITY_1_0040 0x0F
#define EMC2101_IDEALITY_1_0053 0x10
#define EMC2101_IDEALITY_1_0066 0x11
#define EMC2101_IDEALITY_1_0080 0x12 //default
#define EMC2101_IDEALITY_1_0093 0x13
#define EMC2101_IDEALITY_1_0106 0x14
#define EMC2101_IDEALITY_1_0119 0x15
#define EMC2101_IDEALITY_1_0133 0x16
#define EMC2101_IDEALITY_1_0146 0x17
#define EMC2101_IDEALITY_1_0159 0x18
#define EMC2101_IDEALITY_1_0172 0x19
#define EMC2101_IDEALITY_1_0185 0x1A
#define EMC2101_IDEALITY_1_0200 0x1B
#define EMC2101_IDEALITY_1_0212 0x1C
#define EMC2101_IDEALITY_1_0226 0x1D
#define EMC2101_IDEALITY_1_0239 0x1E
#define EMC2101_IDEALITY_1_0253 0x1F
#define EMC2101_IDEALITY_1_0267 0x20
#define EMC2101_IDEALITY_1_0280 0x21
#define EMC2101_IDEALITY_1_0293 0x22
#define EMC2101_IDEALITY_1_0306 0x23
#define EMC2101_IDEALITY_1_0319 0x24
#define EMC2101_IDEALITY_1_0332 0x25
#define EMC2101_IDEALITY_1_0345 0x26
#define EMC2101_IDEALITY_1_0358 0x27
#define EMC2101_IDEALITY_1_0371 0x28
#define EMC2101_IDEALITY_1_0384 0x29
#define EMC2101_IDEALITY_1_0397 0x2A
#define EMC2101_IDEALITY_1_0410 0x2B
#define EMC2101_IDEALITY_1_0423 0x2C
#define EMC2101_IDEALITY_1_0436 0x2D
#define EMC2101_IDEALITY_1_0449 0x2E
#define EMC2101_IDEALITY_1_0462 0x2F
#define EMC2101_IDEALITY_1_0475 0x30
#define EMC2101_IDEALITY_1_0488 0x31
#define EMC2101_IDEALITY_1_0501 0x32
#define EMC2101_IDEALITY_1_0514 0x33
#define EMC2101_IDEALITY_1_0527 0x34
#define EMC2101_IDEALITY_1_0540 0x35
#define EMC2101_IDEALITY_1_0553 0x36
#define EMC2101_IDEALITY_1_0566 0x37

#define EMC2101_DEFAULT_IDEALITY EMC2101_IDEALITY_1_0306 ///< Default ideality factor
#define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< Default beta compensation
#define EMC2101_DEFAULT_FILTER EMC2101_FILTER_1 ///< Default temp filter setting
#define EMC2101_DEFAULT_DATARATE EMC2101_DATARATE_32_HZ ///< Default temp conversion rate

#define EMC2101_I2CADDR_DEFAULT 0x4C ///< EMC2101 default i2c address
#define EMC2101_CHIP_ID 0x16 ///< EMC2101 default device id from part id
Expand Down
2 changes: 1 addition & 1 deletion main/self_test/self_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void self_test(void * pvParameters)
// vTaskDelay(1000 / portTICK_PERIOD_MS);


// run_temp_cal();
run_temp_cal();


int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)();
Expand Down

0 comments on commit 489c7f6

Please sign in to comment.