mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-04-10 12:59:25 +02:00
more config init stuff
This commit is contained in:
parent
552ebf1edc
commit
74420a6490
@ -34,6 +34,8 @@ static uint8_t MFR_ID[] = {'B', 'A', 'X'};
|
||||
static uint8_t MFR_MODEL[] = {'H', 'E', 'X'};
|
||||
static uint8_t MFR_REVISION[] = {0x00, 0x00, 0x01};
|
||||
|
||||
static uint8_t COMPENSATION_CONFIG[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
||||
|
||||
/**
|
||||
* @brief SMBus read byte
|
||||
*/
|
||||
@ -302,6 +304,7 @@ int TPS546_init(void)
|
||||
int iout;
|
||||
uint8_t mfr_revision[3];
|
||||
int temp;
|
||||
uint8_t comp_config[5];
|
||||
|
||||
ESP_LOGI(TAG, "Initializing the core voltage regulator");
|
||||
|
||||
@ -328,6 +331,8 @@ int TPS546_init(void)
|
||||
ESP_LOGI(TAG, "Config version mismatch, writing new config values");
|
||||
//TPS546_write_entire_config();
|
||||
// TODO write new config version here
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Show temperature */
|
||||
@ -374,6 +379,11 @@ int TPS546_init(void)
|
||||
ESP_LOGI(TAG, "TOFF_FALL: %d", temp);
|
||||
ESP_LOGI(TAG, "--------------------------------------");
|
||||
|
||||
// Read the compensation config registers
|
||||
smb_read_block(PMBUS_COMPENSATION_CONFIG, comp_config, 5);
|
||||
ESP_LOGI(TAG, "COMPENSATION CONFIG");
|
||||
ESP_LOGI(TAG, "%02x %02x %02x %02x %02x", comp_config[0], comp_config[1],
|
||||
comp_config[2], comp_config[3], comp_config[4]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -447,6 +457,19 @@ void TPS546_write_entire_config(void)
|
||||
smb_write_word(PMBUS_TOFF_DELAY, int_2_slinear11(TPS546_INIT_TOFF_DELAY));
|
||||
smb_write_word(PMBUS_TOFF_FALL, int_2_slinear11(TPS546_INIT_TOFF_FALL));
|
||||
|
||||
/* Stack/sync config */
|
||||
smb_write_word(PMBUS_STACK_CONFIG, INIT_STACK_CONFIG);
|
||||
smb_write_word(PMBUS_SYNC_CONFIG, INIT_SYNC_CONFIG);
|
||||
|
||||
/* Compensation config */
|
||||
smb_write_block(PMBUS_COMPENSATION_CONFIG, COMPENSATION_CONFIG, 5);
|
||||
|
||||
/* Slave address */
|
||||
smb_write_byte(PMBUS_SLAVE_ADDRESS, TPS546_I2CADDR);
|
||||
|
||||
/* configure the bootup behavior regarding pin detect values vs NVM values */
|
||||
smb_write_word(PMBUS_PIN_DETECT_OVERRIDE, INIT_PIN_DETECT_OVERRIDE);
|
||||
|
||||
/* store configuration in NVM */
|
||||
smb_write_byte(PMBUS_STORE_USER_ALL, 0xFF);
|
||||
|
||||
|
@ -47,6 +47,10 @@
|
||||
#define TPS546_INIT_TOFF_DELAY 0
|
||||
#define TPS546_INIT_TOFF_FALL 0
|
||||
|
||||
#define INIT_STACK_CONFIG 0x0000
|
||||
#define INIT_SYNC_CONFIG 0x0010
|
||||
#define INIT_PIN_DETECT_OVERRIDE 0x0000
|
||||
|
||||
/*-------------------------*/
|
||||
|
||||
/* PMBUS_ON_OFF_CONFIG initialization values */
|
||||
|
@ -64,8 +64,8 @@
|
||||
#define PMBUS_MFR_SERIAL 0x9E
|
||||
#define PMBUS_IC_DEVICE_ID 0xAD
|
||||
#define PMBUS_IC_DEVICE_REV 0xAE
|
||||
#define PMBUS_USER_DATA_01 0xB1
|
||||
#define PMBUS_USER_DATA_05 0xB5
|
||||
#define PMBUS_COMPENSATION_CONFIG 0xB1
|
||||
#define PMBUS_POWER_STAGE_CONFIG 0xB5
|
||||
|
||||
/* Manufacturer Specific PMBUS commands used by the TPS546D24A */
|
||||
#define PMBUS_TELEMETRY_CFG 0xD0
|
||||
|
Loading…
x
Reference in New Issue
Block a user