Skip to content

Commit

Permalink
added some more register debugging. setting VIN_UV_WARN to 4.5 still …
Browse files Browse the repository at this point in the history
…isn't working.
  • Loading branch information
skot committed Feb 4, 2025
1 parent 51b9762 commit 08fa99c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
18 changes: 16 additions & 2 deletions main/TPS546.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,13 @@ int TPS546_init(void)
temp = slinear11_2_int(u16_value);
ESP_LOGI(TAG, "TOFF_FALL: %d", temp);
ESP_LOGI(TAG, "--------------------------------------");
smb_read_byte(PMBUS_PHASE, &u8_value);
ESP_LOGI(TAG, "PHASE: %02x", u8_value);
smb_read_word(PMBUS_STACK_CONFIG, &u16_value);
ESP_LOGI(TAG, "STACK_CONFIG: %04x", u16_value);
smb_read_byte(PMBUS_SYNC_CONFIG, &u8_value);
ESP_LOGI(TAG, "SYNC_CONFIG: %02x", u8_value);


// Read the compensation config registers
if (smb_read_block(PMBUS_COMPENSATION_CONFIG, comp_config, 5) != ESP_OK) {
Expand Down Expand Up @@ -502,6 +509,10 @@ void TPS546_write_entire_config(void)
return;
}

/* Phase */
ESP_LOGI(TAG, "Setting PHASE");
smb_write_byte(PMBUS_PHASE, TPS546_INIT_PHASE);

/* Switch frequency */
ESP_LOGI(TAG, "Setting FREQUENCY");
smb_write_word(PMBUS_FREQUENCY_SWITCH, int_2_slinear11(TPS546_INIT_FREQUENCY));
Expand All @@ -511,10 +522,13 @@ void TPS546_write_entire_config(void)
smb_write_word(PMBUS_VIN_ON, float_2_slinear11(TPS546_INIT_VIN_ON));
ESP_LOGI(TAG, "Setting VIN_OFF: %.2f", TPS546_INIT_VIN_OFF);
smb_write_word(PMBUS_VIN_OFF, float_2_slinear11(TPS546_INIT_VIN_OFF));
ESP_LOGI(TAG, "Setting VIN_UV_WARN_LIMIT: %.2f", TPS546_INIT_VIN_UV_WARN_LIMIT);
smb_write_word(PMBUS_VIN_UV_WARN_LIMIT, float_2_slinear11(TPS546_INIT_VIN_UV_WARN_LIMIT));

ESP_LOGI(TAG, "Setting VIN_OV_FAULT_LIMIT: %.2f", TPS546_INIT_VIN_OV_FAULT_LIMIT);
smb_write_word(PMBUS_VIN_OV_FAULT_LIMIT, float_2_slinear11(TPS546_INIT_VIN_OV_FAULT_LIMIT));

ESP_LOGI(TAG, "Setting VIN_UV_WARN_LIMIT: %.2f", TPS546_INIT_VIN_UV_WARN_LIMIT);
smb_write_word(PMBUS_VIN_UV_WARN_LIMIT, float_2_slinear11(TPS546_INIT_VIN_UV_WARN_LIMIT));

ESP_LOGI(TAG, "Setting VIN_OV_FAULT_RESPONSE: %02X", TPS546_INIT_VIN_OV_FAULT_RESPONSE);
smb_write_byte(PMBUS_VIN_OV_FAULT_RESPONSE, TPS546_INIT_VIN_OV_FAULT_RESPONSE);

Expand Down
6 changes: 4 additions & 2 deletions main/TPS546.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

#define TPS546_INIT_FREQUENCY 650 /* KHz */

#define TPS546_INIT_PHASE 0x00 /* phase */

/* vin voltage */
#define TPS546_INIT_VIN_ON 4.8 /* V */
#define TPS546_INIT_VIN_OFF 4.5 /* V */
#define TPS546_INIT_VIN_UV_WARN_LIMIT 5.8 /* V */
#define TPS546_INIT_VIN_OV_FAULT_LIMIT 6.0 /* V */
#define TPS546_INIT_VIN_UV_WARN_LIMIT 4.5 /* V */
#define TPS546_INIT_VIN_OV_FAULT_LIMIT 5.5 /* V */
#define TPS546_INIT_VIN_OV_FAULT_RESPONSE 0xB7 /* retry 6 times */

/* vout voltage */
Expand Down

0 comments on commit 08fa99c

Please sign in to comment.