Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several changes and fixes! #250

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c2d0dec
global_state: Remove unused bm1397Module
rvdgracht Oct 21, 2023
9fe7e3e
Fix typo in filename config.csv.example
rvdgracht Oct 31, 2023
b95b1be
Rename bm1397 component to asic
rvdgracht Oct 21, 2023
46b30c3
asic: Move SERIAL_debug_rx to test_job_command
rvdgracht Oct 21, 2023
111e6e7
asic: bm1366: Improve performance of hash frequency divider calculation
rvdgracht Oct 22, 2023
c5f0509
asic: bm1366: Allow equal post dividers
rvdgracht Oct 22, 2023
3e69229
asic: bm1366: Use the lowest possible pll frequency
rvdgracht Oct 22, 2023
71b5040
asic: bm1366: Replace raw commands in do_frequency_ramp_up()
rvdgracht Oct 22, 2023
678c7ae
asic: bm1366: Don't ramp-up frequency beyond the target frequency
rvdgracht Oct 22, 2023
529958c
Convert power, voltage and current values to integers
rvdgracht Nov 1, 2023
f3099d1
asic: Fix incompatible pointer type warning
rvdgracht Nov 4, 2023
f1735bb
asic: bm1366: Use sizeof to determine size of asic_response_buffer
rvdgracht Jan 20, 2024
9e39d51
Migrate to the new oneshot API for ADC conversions.
rvdgracht Oct 31, 2023
3dc2925
adc: Make API more flexible
rvdgracht Jul 2, 2024
7eebd49
connect: Make AP ssid configurable through nvs
rvdgracht Nov 1, 2023
a512fdb
Allow supplying serial pin number to serial init call
rvdgracht Jul 2, 2024
94bd3ca
i2c_master: Allow specifying sda and scl pin numbers to init function
rvdgracht Jun 28, 2024
f181561
led_controller: Use integers instead of GPIO_NUM_* macros
rvdgracht Jun 28, 2024
2f24943
vcore: Simplify vcore range check
rvdgracht Jun 30, 2024
575292b
vcore: Let ds4432_*_voltage_to_reg function take arguments
rvdgracht Jun 30, 2024
6e99f7a
vcore: Convert VCORE_set_voltage to int mv
rvdgracht Jun 30, 2024
35e2083
asic: Fix compilation warnings of defined but not used common functions
rvdgracht Jul 2, 2024
88a884c
connect: Don't use board specific name in generic code
rvdgracht Nov 2, 2023
dd2f094
Move ds4432_voltage_to_reg to DS4432 driver
rvdgracht Jul 2, 2024
1c5fa83
DS4432: Fix integer overflow for vcore values of 4900 mv and higher
rvdgracht Jul 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SRCS
"bm1397.c"
"serial.c"
"crc.c"
"common.c"

INCLUDE_DIRS
"include"
Expand Down
307 changes: 51 additions & 256 deletions components/bm1397/bm1366.c → components/asic/bm1366.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,277 +126,74 @@ static void _set_chip_address(uint8_t chipAddr)
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_SETADDRESS), read_address, 2, false);
}

void BM1366_send_hash_frequency(float target_freq)
void BM1366_send_hash_frequency(unsigned int khz)
{
// default 200Mhz if it fails
unsigned char freqbuf[9] = {0x00, 0x08, 0x40, 0xA0, 0x02, 0x41}; // freqbuf - pll0_parameter
float newf = 200.0;

uint8_t fb_divider = 0;
uint8_t post_divider1 = 0, post_divider2 = 0;
uint8_t ref_divider = 0;
float min_difference = 10;
unsigned int newf = 200000;
uint8_t cmd[] = {0x00, 0x08, 0x40, 0xA0, 0x02, 0x41}; // 200MHz fallback
int rd, k_fd, pd1, pd2;
uint8_t refdiv, postdiv1, postdiv2, fbdiv = 0;
unsigned int k_pll_div, k_pll_div_lowest = 0;

// refdiver is 2 or 1
// postdivider 2 is 1 to 7
// postdivider 1 is 1 to 7 and less than postdivider 2
// postdivider 1 is 1 to 7 and <= postdivider 2
// fbdiv is 144 to 235
for (uint8_t refdiv_loop = 2; refdiv_loop > 0 && fb_divider == 0; refdiv_loop--) {
for (uint8_t postdiv1_loop = 7; postdiv1_loop > 0 && fb_divider == 0; postdiv1_loop--) {
for (uint8_t postdiv2_loop = 1; postdiv2_loop < postdiv1_loop && fb_divider == 0; postdiv2_loop++) {
int temp_fb_divider = round(((float) (postdiv1_loop * postdiv2_loop * target_freq * refdiv_loop) / 25.0));

if (temp_fb_divider >= 144 && temp_fb_divider <= 235) {
float temp_freq = 25.0 * (float) temp_fb_divider / (float) (refdiv_loop * postdiv2_loop * postdiv1_loop);
float freq_diff = fabs(target_freq - temp_freq);

if (freq_diff < min_difference) {
fb_divider = temp_fb_divider;
post_divider1 = postdiv1_loop;
post_divider2 = postdiv2_loop;
ref_divider = refdiv_loop;
min_difference = freq_diff;
break;
}
}

// Find a suitable setting with the lowest pll frequency
// If a valid setting is found with rd=2, we're not going to find a better
// one with rd=1.
for (rd = 2; rd > 0 && !fbdiv; rd--) {
for (pd1 = 7; pd1 > 0; pd1--) {
for (pd2 = 1; pd2 <= pd1; pd2++) {
k_fd = khz * rd * pd1 * pd2 / 25;
if (k_fd % 1000)
continue; // Not a round value
if (k_fd < 160000)
continue; // Out of acceptable range
if (k_fd > 235000)
break; // Increasing pd2 will only give a higher fbdiv
k_pll_div = k_fd / rd;
if (k_pll_div_lowest && k_pll_div >= k_pll_div_lowest)
continue; // Not a better setting
k_pll_div_lowest = k_pll_div;
fbdiv = k_fd / 1000;
refdiv = rd;
postdiv1 = pd1;
postdiv2 = pd2;
}
}
}

if (fb_divider == 0) {
puts("Finding dividers failed, using default value (200Mhz)");
if (fbdiv == 0) {
puts("Finding dividers failed, using default value (200000 Khz)");
} else {
newf = 25.0 / (float) (ref_divider * fb_divider) / (float) (post_divider1 * post_divider2);
printf("final refdiv: %d, fbdiv: %d, postdiv1: %d, postdiv2: %d, min diff value: %f\n", ref_divider, fb_divider,
post_divider1, post_divider2, min_difference);
newf = (25000 * fbdiv) / (refdiv * postdiv1 * postdiv2);
printf("final refdiv: %d, fbdiv: %d, postdiv1: %d, postdiv2: %d, min diff value: %u\n",
refdiv, fbdiv, postdiv1, postdiv2, k_pll_div_lowest / 1000);

freqbuf[3] = fb_divider;
freqbuf[4] = ref_divider;
freqbuf[5] = (((post_divider1 - 1) & 0xf) << 4) + ((post_divider2 - 1) & 0xf);
if (k_pll_div_lowest >= 96000)
cmd[2] = 0x50;

if (fb_divider * 25 / (float) ref_divider >= 2400) {
freqbuf[2] = 0x50;
}
cmd[3] = fbdiv;
cmd[4] = refdiv;
cmd[5] = (postdiv1 - 1) << 4 | (postdiv2 - 1);
ESP_LOGI(TAG, "Setting Frequency to %ukHz (%u)", khz, newf);
}

_send_BM1366((TYPE_CMD | GROUP_ALL | CMD_WRITE), freqbuf, 6, false);
_send_BM1366((TYPE_CMD | GROUP_ALL | CMD_WRITE), cmd, 6, false);

ESP_LOGI(TAG, "Setting Frequency to %.2fMHz (%.2f)", target_freq, newf);
}

static void do_frequency_ramp_up()
static void do_frequency_ramp_up(unsigned int end_khz)
{
// TODO: figure out how to replicate this ramp up.
// bm1366 doesn't get going until after this sequence
unsigned char init724[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA2, 0x02, 0x55, 0x0F};
_send_simple(init724, 11);

unsigned char init725[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAF, 0x02, 0x64, 0x08};
_send_simple(init725, 11);

unsigned char init726[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA5, 0x02, 0x54, 0x08};
_send_simple(init726, 11);

unsigned char init727[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA8, 0x02, 0x63, 0x11};
_send_simple(init727, 11);

unsigned char init728[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB6, 0x02, 0x63, 0x0C};
_send_simple(init728, 11);

unsigned char init729[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA8, 0x02, 0x53, 0x1A};
_send_simple(init729, 11);

unsigned char init730[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB4, 0x02, 0x53, 0x12};
_send_simple(init730, 11);

unsigned char init731[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA8, 0x02, 0x62, 0x14};
_send_simple(init731, 11);

unsigned char init732[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAA, 0x02, 0x43, 0x15};
_send_simple(init732, 11);

unsigned char init733[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA2, 0x02, 0x52, 0x14};
_send_simple(init733, 11);

unsigned char init734[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAB, 0x02, 0x52, 0x12};
_send_simple(init734, 11);

unsigned char init735[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB4, 0x02, 0x52, 0x17};
_send_simple(init735, 11);

unsigned char init736[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xBD, 0x02, 0x52, 0x11};
_send_simple(init736, 11);

unsigned char init737[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA5, 0x02, 0x42, 0x0C};
_send_simple(init737, 11);

unsigned char init738[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA1, 0x02, 0x61, 0x1D};
_send_simple(init738, 11);

unsigned char init739[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA8, 0x02, 0x61, 0x1B};
_send_simple(init739, 11);

unsigned char init740[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAF, 0x02, 0x61, 0x19};
_send_simple(init740, 11);

unsigned char init741[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB6, 0x02, 0x61, 0x06};
_send_simple(init741, 11);

unsigned char init742[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA2, 0x02, 0x51, 0x1B};
_send_simple(init742, 11);

unsigned char init743[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA8, 0x02, 0x51, 0x10};
_send_simple(init743, 11);

unsigned char init744[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAE, 0x02, 0x51, 0x0A};
_send_simple(init744, 11);

unsigned char init745[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB4, 0x02, 0x51, 0x18};
_send_simple(init745, 11);

unsigned char init746[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xBA, 0x02, 0x51, 0x1C};
_send_simple(init746, 11);

unsigned char init747[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA0, 0x02, 0x41, 0x14};
_send_simple(init747, 11);

unsigned char init748[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA5, 0x02, 0x41, 0x03};
_send_simple(init748, 11);

unsigned char init749[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAA, 0x02, 0x41, 0x1F};
_send_simple(init749, 11);

unsigned char init750[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAF, 0x02, 0x41, 0x08};
_send_simple(init750, 11);

unsigned char init751[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB4, 0x02, 0x41, 0x02};
_send_simple(init751, 11);

unsigned char init752[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB9, 0x02, 0x41, 0x0B};
_send_simple(init752, 11);

unsigned char init753[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xBE, 0x02, 0x41, 0x09};
_send_simple(init753, 11);

unsigned char init754[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x50, 0xC3, 0x02, 0x41, 0x01};
_send_simple(init754, 11);

unsigned char init755[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA0, 0x02, 0x31, 0x18};
_send_simple(init755, 11);

unsigned char init756[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA4, 0x02, 0x31, 0x17};
_send_simple(init756, 11);

unsigned char init757[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA8, 0x02, 0x31, 0x06};
_send_simple(init757, 11);
unsigned int khz = 0, start_khz = 56250, step_khz = 6250;

unsigned char init758[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAC, 0x02, 0x31, 0x09};
_send_simple(init758, 11);
for (khz = start_khz; khz <= end_khz; khz += step_khz)
BM1366_send_hash_frequency(khz);

unsigned char init759[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB0, 0x02, 0x31, 0x01};
_send_simple(init759, 11);

unsigned char init760[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB4, 0x02, 0x31, 0x0E};
_send_simple(init760, 11);

unsigned char init761[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA1, 0x02, 0x60, 0x18};
_send_simple(init761, 11);

unsigned char init762[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xBC, 0x02, 0x31, 0x10};
_send_simple(init762, 11);

unsigned char init763[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA8, 0x02, 0x60, 0x1E};
_send_simple(init763, 11);

unsigned char init764[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x50, 0xC4, 0x02, 0x31, 0x0F};
_send_simple(init764, 11);

unsigned char init765[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAF, 0x02, 0x60, 0x1C};
_send_simple(init765, 11);

unsigned char init766[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x50, 0xCC, 0x02, 0x31, 0x11};
_send_simple(init766, 11);

unsigned char init767[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB6, 0x02, 0x60, 0x03};
_send_simple(init767, 11);

unsigned char init768[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x50, 0xD4, 0x02, 0x31, 0x16};
_send_simple(init768, 11);

unsigned char init769[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA2, 0x02, 0x50, 0x1E};
_send_simple(init769, 11);

unsigned char init770[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA5, 0x02, 0x50, 0x1C};
_send_simple(init770, 11);

unsigned char init771[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA8, 0x02, 0x50, 0x15};
_send_simple(init771, 11);

unsigned char init772[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAB, 0x02, 0x50, 0x18};
_send_simple(init772, 11);

unsigned char init773[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAE, 0x02, 0x50, 0x0F};
_send_simple(init773, 11);

unsigned char init774[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB1, 0x02, 0x50, 0x0A};
_send_simple(init774, 11);

unsigned char init775[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB4, 0x02, 0x50, 0x1D};
_send_simple(init775, 11);

unsigned char init776[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB7, 0x02, 0x50, 0x10};
_send_simple(init776, 11);

unsigned char init777[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xBA, 0x02, 0x50, 0x19};
_send_simple(init777, 11);

unsigned char init778[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xBD, 0x02, 0x50, 0x1B};
_send_simple(init778, 11);

unsigned char init779[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA0, 0x02, 0x40, 0x11};
_send_simple(init779, 11);

unsigned char init780[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x50, 0xC3, 0x02, 0x50, 0x1E};
_send_simple(init780, 11);

unsigned char init781[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xA5, 0x02, 0x40, 0x06};
_send_simple(init781, 11);

unsigned char init782[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x50, 0xC9, 0x02, 0x50, 0x15};
_send_simple(init782, 11);

unsigned char init783[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAA, 0x02, 0x40, 0x1A};
_send_simple(init783, 11);

unsigned char init784[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x50, 0xCF, 0x02, 0x50, 0x0F};
_send_simple(init784, 11);

unsigned char init785[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xAF, 0x02, 0x40, 0x0D};
_send_simple(init785, 11);

unsigned char init786[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x50, 0xD5, 0x02, 0x50, 0x1D};
_send_simple(init786, 11);

unsigned char init787[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB4, 0x02, 0x40, 0x07};
_send_simple(init787, 11);

unsigned char init788[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x50, 0xDB, 0x02, 0x50, 0x19};
_send_simple(init788, 11);

unsigned char init789[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xB9, 0x02, 0x40, 0x0E};
_send_simple(init789, 11);

unsigned char init790[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x50, 0xE1, 0x02, 0x50, 0x1C};
_send_simple(init790, 11);

unsigned char init791[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x40, 0xBE, 0x02, 0x40, 0x0C};
_send_simple(init791, 11);

unsigned char init792[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x50, 0xE7, 0x02, 0x50, 0x06};
_send_simple(init792, 11);

unsigned char init793[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x08, 0x50, 0xC2, 0x02, 0x40, 0x1C};
_send_simple(init793, 11);
// In case end_khz is not dividable by step_khz, set explicitly
if (khz != end_khz)
BM1366_send_hash_frequency(end_khz);
}

static uint8_t _send_init(uint64_t frequency, uint16_t asic_count)
Expand Down Expand Up @@ -509,9 +306,7 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count)
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_third, 6, false);
}

do_frequency_ramp_up();

BM1366_send_hash_frequency(frequency);
do_frequency_ramp_up(frequency * 1000);

unsigned char init794[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x10, 0x00, 0x00, 0x15, 0x1C, 0x02};
_send_simple(init794, 11);
Expand Down Expand Up @@ -549,7 +344,7 @@ uint8_t BM1366_init(uint64_t frequency, uint16_t asic_count)
{
ESP_LOGI(TAG, "Initializing BM1366");

memset(asic_response_buffer, 0, 1024);
memset(asic_response_buffer, 0, sizeof(asic_response_buffer));

esp_rom_gpio_pad_select_gpio(BM1366_RST_PIN);
gpio_set_direction(BM1366_RST_PIN, GPIO_MODE_OUTPUT);
Expand Down Expand Up @@ -643,7 +438,7 @@ void BM1366_send_work(void * pvParameters, bm_job * next_bm_job)
// ESP_LOGI(TAG, "Added Job: %i", job.job_id);
pthread_mutex_unlock(&GLOBAL_STATE->valid_jobs_lock);

_send_BM1366((TYPE_JOB | GROUP_SINGLE | CMD_WRITE), &job, sizeof(BM1366_job), false);
_send_BM1366((TYPE_JOB | GROUP_SINGLE | CMD_WRITE), (uint8_t *)&job, sizeof(BM1366_job), false);
}

asic_result * BM1366_receive_work(void)
Expand Down
2 changes: 1 addition & 1 deletion components/bm1397/bm1368.c → components/asic/bm1368.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ uint8_t BM1368_init(uint64_t frequency, uint16_t asic_count)
{
ESP_LOGI(TAG, "Initializing BM1368");

memset(asic_response_buffer, 0, 1024);
memset(asic_response_buffer, 0, sizeof(asic_response_buffer));

esp_rom_gpio_pad_select_gpio(BM1368_RST_PIN);
gpio_set_direction(BM1368_RST_PIN, GPIO_MODE_OUTPUT);
Expand Down
2 changes: 1 addition & 1 deletion components/bm1397/bm1397.c → components/asic/bm1397.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void BM1397_send_work(void *pvParameters, bm_job *next_bm_job)
// ESP_LOGI(TAG, "Added Job: %i", job.job_id);
pthread_mutex_unlock(&GLOBAL_STATE->valid_jobs_lock);

_send_BM1397((TYPE_JOB | GROUP_SINGLE | CMD_WRITE), &job, sizeof(job_packet), BM1397_DEBUG_WORK);
_send_BM1397((TYPE_JOB | GROUP_SINGLE | CMD_WRITE), (uint8_t *)&job, sizeof(job_packet), BM1397_DEBUG_WORK);
}

asic_result *BM1397_receive_work(void)
Expand Down
Loading