Commit Graph

12 Commits

Author SHA1 Message Date
mutatrum
e5c317fb97 Improve PLL calculation for BM1366/BM1368/BM1370 (#1051)
* Accept and store float frequency values

* Unify PLL resolver for 1366/1368/1370

Pick the closest frequency to the requested target. If there are multiple PLL settings, pick the one with first the lowest VDO frequency, and finally the lowest posdividers.

Merged frequency ramp start and loop. This solves overshooting when requesting a target frequency within the current step size. It also eliminates the duplicate setting of the target frequency is that's on a step boundary.

Cleaned up several unused defines.

* Restore postdiv2 < postdiv1 condition for BM1368 and BM1370

* Whitespace

* Clean up intermediate functions

Simplify frequency_transition further, finally fix overshoot

* Code cleanup

* Add debug logging for BM1397

* Fix log

* Flip postdiv condition for readability

* Add test

* Fix BM1370 fb_range

* EOF line in test_pll.c
2025-08-07 13:16:36 +02:00
mutatrum
1cf656b411 Several refactors and cleanups (#1102)
- Extract BM##_set_job_difficulty_mask into a single function
- Set self_test difficulty before ASIC_init to eliminate ASIC_set_job_difficulty_mask
- Fixed some capitalisations of GLOBAL_STATE and some others
- Thermal.c: pass DEVICE_CONFIG by pointer instead of by value
2025-07-05 20:58:58 -04:00
mutatrum
47a5516f35 Custom board config (#1018)
* Initial commit
* Fix NVS field name length
* Add config-custom.cvs example
* Extend example config
* Update self_test.c
* Add documentation
2025-06-21 15:50:36 +02:00
mutatrum
6414e06161 Clean up duplicate ASIC reset code (#986)
* Unify ASIC reset code

* Add missing include

Build was fine in vscode, not sure why it's failing on GitHub

* Move asic_reset  into separate file
2025-06-09 17:11:10 +02:00
mutatrum
0aa8c359fb Device model cleanup (#857)
* Add mock-up of device name and model on logo screen

* Remove nvs_get_wifi_credits

* Proof of concept for code review

* Fix merge

* Refactored vcore.c

* Log simplification

* Fix missed field rename

* Refactor self-test

* Refactor power.c

* Move Power_disable into VCORE_set_voltage

* Restore ASIC log line

* Clean up self-test.c

* Remove unused constants

* Ultra uses EMC2101 internal temperature sensor

* Simplify thermal configuration

* Set power_offset to 10W for GT (#867)

* Hex is BM1366

* Add board_version 600

* Use boardVersion from config in http response

* Fix GammaTurbo EMC2103 init

* Add Max 0.11 and Ultra 2.2 board versions

* Flip 0.11 and 2.2

* Merge branch 'dev-latest' into HEAD

* Move frequency and voltage options and defaults to device_config.h

* Fix voltage_options loop

* Fix missing frequency and voltage options for BM1368

* Add swarm colors

* Add new fields to openapi.yaml

* Fix asic_job_frequency for Max

* Fix merge
2025-05-15 22:51:21 +02:00
mutatrum
d766493725 Add asic failure status screen (#777)
* Add an asic-status screen and graceful continuation

Fixes #311

* Remove asic_state when model_name is unknown
2025-03-27 19:12:32 +01:00
mutatrum
a5842a54b3 Verify CHIP_ID response (#745)
* Verify CHIP_ID response

Fixes #740

* Log warning on CHIP_ID mismatch

* Fix CHIP_ID checksum calculation

* On BM1397, CORE_NUM should be 0x18

* CORE_NUM and ADDR log only and early exit when no chips are detected

* Fix compile error

* Refactored out duplicated code

Moved count_asic_chips and receive_work functions to common.c
Moved asic_response_buffer to local scope
Unified preamble and crc check on serial rx
Fixed typo in proccess_work
Moved CRC5_MASK define to proper location

* Change receive_work read timeout log to debug

* Changed wrong log to debug

* Fix merge

* Fix length check for bm1397

* add ASIC TX dubugging on BM1397 (crap, does this fix the ticket mask?!)

---------

Co-authored-by: Skot <skot@bitnet.cx>
2025-03-12 22:45:33 +01:00
Erik Olof Gunnar Andersson
deaa291675 Revert "Refactor Stratum code for Seamless Failover (#717)" (#754)
This reverts commit 1eeb303672.
2025-03-10 13:30:31 +01:00
WantClue
d032f2da4a feat: frequency transition (#747)
* feat: frequency transition

* remove floats that are unnecessary

* fix: callback of set_freq function

* refactor asic model code to asic.c

* fix: change namining scheme
2025-03-09 13:58:13 +01:00
Erik Olof Gunnar Andersson
1eeb303672 Refactor Stratum code for Seamless Failover (#717)
* Refactor stratum code

* No need to abandon work when switching connection

* Bump primary task priority slightly

* Reduce watchdog stack size

* Revert debug changes

* Removed unused code

* Removed unused unit test code

* Handle jobs more aggressively

* Fix merge conflict
2025-03-09 13:55:58 +01:00
Erik Olof Gunnar Andersson
b8c748be69 Restore Max support (#705) 2025-02-15 12:14:27 +01:00
Skot
7dcb69ebdc GammaTurbo support and HW abstraction (#698)
* initial changes for the gammaturbo bringup
* added preliminary TPS546 changes
* added preliminary EMC2103 support
* ASIC temp seems to be maybe working.
* magically now fan seems to have the right polarity
* added in ideality and beta constants (currently unused). Fixed EMC2103_get_fan_speed()
* abstract fan and ASIC temp into thermal functions
* abstracted voltage regulator specifics out of tasks and into power.c and vcore.c functions
* add TPS546 support for multiple models
* move TPS40305/DS4432U vout setter to DS4432U.c
* move all ASIC specific functions to asic.c
* bad device_model nvs handling
* remove old code
* add workaround for TPS546 VIN_UV_WARN_LIMIT silicon bug.
2025-02-11 22:46:56 -05:00