Add BQ soft reset function

This commit is contained in:
jazzpi 2022-08-04 14:32:25 +02:00
parent 1be16efadf
commit 48d8a90c4a
3 changed files with 10 additions and 0 deletions

View File

@ -51,6 +51,7 @@ extern BQ_Error_Description bq_error;
extern uint32_t lastmeasurementtime;
void afe_init(UART_HandleTypeDef* uarthandle);
void afe_soft_reset();
void afe_shutdown();
void afe_measure();
void afe_selftest();

View File

@ -188,6 +188,8 @@
#define EE_BURN_SIZE 0x01
#define MAGIC2_SIZE 0x04
#define DEV_CNTRL_SOFT_RESET (1 << 7)
#define GPI_FAULT_SUM (1 << 6)
#define CHIP_FAULT_SUM (1 << 7)
#define SYS_FAULT_SUM (1 << 8)

View File

@ -44,8 +44,15 @@ void afe_init(UART_HandleTypeDef* uarthandle) {
afe_wakeup();
HAL_Delay(10);
afe_soft_reset();
}
void afe_soft_reset() {
bq_status = BQ_INIT_PHASE;
BQ_Write_Register(DEV_CNTRL, DEV_CNTRL_SIZE, DEV_CNTRL_SOFT_RESET);
HAL_Delay(10);
afe_config_communication();
afe_config_measurement_channels();