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

Several changes and fixes! #250

wants to merge 25 commits into from

Conversation

rvdgracht
Copy link

Hi!

I've designed and build my own miner based on a ESP32C6 with an asic chain consisting of 4 x BM1366. I've
ben running ESP-Miner for a while. I had to make some changes, and I want to contribute them back to the community.

This is about half of the changes I've made. The other half moves all Bitaxe (board) specific code in a separate file with a generic API so more boards/hardware support can more easely be added. Let me know if you're interested in that
part as well.

rvdgracht added 4 commits July 2, 2024 15:13
The asic frequency is stored in POWER_MANAGEMENT_MODULE->frequency_value.

Signed-off-by: Robin van der Gracht <[email protected]>
Signed-off-by: Robin van der Gracht <[email protected]>
A more generic name since multiple types are supported now.

Signed-off-by: Robin van der Gracht <[email protected]>
It's only used there and its debug output is to stderr.

Signed-off-by: Robin van der Gracht <[email protected]>
@skot
Copy link
Owner

skot commented Jul 2, 2024

wow, there is a lot here! thanks @rvdgracht I'll take a look through this.

rvdgracht added 21 commits July 5, 2024 20:40
We should avoid using floating point arithmetic. Floating point
calculations are always slower than integer calculations, especially
on platforms without an FPU.

Signed-off-by: Robin van der Gracht <[email protected]>
The first set frequency command send in do_frequency_ramp_up() uses
equal post dividers so apparently that's allowed.

Signed-off-by: Robin van der Gracht <[email protected]>
Keep on looping to find alternative divider settings which still result
in the requested target hash frequency. The one that results in the
lowest pll frequency (25 * fbdiv / refdiv) is used. This is more in line
with the values used in the raw commands in do_frequency_ramp_up().

Since the resulting values ware a bit lower than the ones used by the
raw commands in do_frequency_ramp_up(), the allowed minimal value for fbdiv
had to be increased from 144 to 160. After doing so, using this function
gives the exact same results as the raw commands in do_frequency_ramp_up().

Signed-off-by: Robin van der Gracht <[email protected]>
We should avoid using floating point arithmetic.

Signed-off-by: Robin van der Gracht <[email protected]>
This way we only have the buffer size defined in one location.

Signed-off-by: Robin van der Gracht <[email protected]>
Cannot compile adc.c since the legacy API is no longer available.

#warning "legacy adc driver is deprecated" please migrate to use
esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and
continuous mode drivers respectively"

Signed-off-by: Robin van der Gracht <[email protected]>
This change allows changing attenuation and perform measurements of
alternative channels.

Signed-off-by: Robin van der Gracht <[email protected]>
This gives more flexibility and will allow using this code for boards
with other pin configuration.

Signed-off-by: Robin van der Gracht <[email protected]>
The macros availability depends on the platform you're building for. If
you build for a esp32c6 (which has much less pins), than the
macro for GPIO_NUM_36 is not available and compilation fails.

Signed-off-by: Robin van der Gracht <[email protected]>
This allows dropping 2 board specific defines.

Signed-off-by: Robin van der Gracht <[email protected]>
This allows using this function for other setups with a ds4432 as well.
Converted calculations to int for efficiency especially on systems without
a fpu.

Signed-off-by: Robin van der Gracht <[email protected]>
This now matches the return type of VCORE_get_voltage_mv().

Signed-off-by: Robin van der Gracht <[email protected]>
Every file that included common.h but didn't use the _largest_power_of_two
or _reverse_bits functions gave warnings about them being defined but
not used since they ware declared in the header file.

Signed-off-by: Robin van der Gracht <[email protected]>
The function is now generic and can be moved to the driver.

Signed-off-by: Robin van der Gracht <[email protected]>
@rvdgracht rvdgracht force-pushed the master branch 2 times, most recently from ea64263 to 1c5fa83 Compare July 5, 2024 20:36
@rvdgracht
Copy link
Author

I found a bug in my changes to the DS4432 driver which I fixed in the last commit, and a merge fault which is now fixed as well.

@BeeEvolved
Copy link

Awesome work! Thank you for the contribution

@pixeldoc2000
Copy link
Contributor

@rvdgracht
This might be OT, but do you have any documentation about your miner design with 4 x BM1366 ?

@rvdgracht
Copy link
Author

@rvdgracht This might be OT, but do you have any documentation about your miner design with 4 x BM1366 ?

Well I intended it to be an open hardware and software project from the start. I share @skot's vision about making Bitcoin mining more open and accesible for everyone. I created the schematics and layout in Easyeda. I'll make some time to update and export them to a Github repository in the next couple of days.

@rvdgracht
Copy link
Author

@rvdgracht This might be OT, but do you have any documentation about your miner design with 4 x BM1366 ?

@skot and @pixeldoc2000, I just created a Github repository for the Hardware. You'll find some details, photos and schematics there. Let me know what you think :)
The repository is called Bitcuboid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants