diff --git a/AMS_Master_Code/Core/Lib/ADBMS6830B_Driver/Core/Inc/ADBMS_Driver.h b/AMS_Master_Code/Core/Lib/ADBMS6830B_Driver/Core/Inc/ADBMS_Driver.h index aed3c78..07a8585 100644 --- a/AMS_Master_Code/Core/Lib/ADBMS6830B_Driver/Core/Inc/ADBMS_Driver.h +++ b/AMS_Master_Code/Core/Lib/ADBMS6830B_Driver/Core/Inc/ADBMS_Driver.h @@ -76,7 +76,7 @@ struct ADBMS6830_Internal_Status { typedef struct { int16_t cellVoltages[MAXIMUM_CELL_VOLTAGES]; int16_t auxVoltages[MAXIMUM_AUX_VOLTAGES]; - uint32_t bmsID; + uint64_t bmsID; struct ADBMS6830_Internal_Status status; int16_t internalDieTemp; diff --git a/AMS_Master_Code/Core/Lib/ADBMS6830B_Driver/Core/Src/ADBMS_Abstraction.c b/AMS_Master_Code/Core/Lib/ADBMS6830B_Driver/Core/Src/ADBMS_Abstraction.c index e26e811..33142a8 100644 --- a/AMS_Master_Code/Core/Lib/ADBMS6830B_Driver/Core/Src/ADBMS_Abstraction.c +++ b/AMS_Master_Code/Core/Lib/ADBMS6830B_Driver/Core/Src/ADBMS_Abstraction.c @@ -62,7 +62,7 @@ HAL_StatusTypeDef amsReset() { id |= sidbuffer[BUFFER_BMS_OFFSET(i, SID_GROUP_SIZE) + j] << (j * 8); } modules[i].bmsID = id; - debug_log_cont(LOG_LEVEL_INFO, "0x%lx%lx ", (uint32_t)(id >> 32), (uint32_t)(id & 0xFFFFFFFF)); //newlib does not support %llu + debug_log_cont(LOG_LEVEL_INFO, "0x%08lx%08lx ", (uint32_t)(id >> 32), (uint32_t)(id & 0xFFFFFFFF)); //newlib does not support %llu } } diff --git a/AMS_Master_Code/Core/Src/main.c b/AMS_Master_Code/Core/Src/main.c index f8f2d0a..96995fc 100644 --- a/AMS_Master_Code/Core/Src/main.c +++ b/AMS_Master_Code/Core/Src/main.c @@ -173,7 +173,7 @@ int main(void) debug_log(LOG_LEVEL_INFO, "AMS_Master on %s (%s), compiled at %s", COMMIT_BRANCH, COMMIT_HASH, COMPILE_DATE); debug_log(LOG_LEVEL_INFO, "Starting BMS..."); auto ret = battery_init(&hspi1); - while (ret != HAL_OK) { + while (ret != HAL_OK) { //TODO: properly handle reapeated initialization failure debug_log(LOG_LEVEL_ERROR, "Failed to initialize BMS!"); HAL_Delay(100); debug_log(LOG_LEVEL_INFO, "Retrying BMS initialization..."); diff --git a/AMS_Master_Code/Core/Src/print_module_status.c b/AMS_Master_Code/Core/Src/print_module_status.c index 826ea06..7f3cc9f 100644 --- a/AMS_Master_Code/Core/Src/print_module_status.c +++ b/AMS_Master_Code/Core/Src/print_module_status.c @@ -14,6 +14,7 @@ void print_battery_info() { for (size_t i = 0; i < N_BMS; i++) { debug_log(LOG_LEVEL_INFO, "Module %d status:", i); + debug_log(LOG_LEVEL_INFO, " BMS ID: 0x%08lx%08lx", (uint32_t)(modules[i].bmsID >> 32), (uint32_t)(modules[i].bmsID & 0xFFFFFFFF)); // Print cell voltages in 4x4 format debug_log(LOG_LEVEL_INFO, " Cell voltages (mV):"); @@ -137,7 +138,6 @@ void print_battery_info() { " Module %d voltage issues - OV: 0x%08lX, UV: 0x%08lX", i, modules[i].overVoltage, modules[i].underVoltage); } - - debug_log(LOG_LEVEL_INFO, "\n------ Updated at %lu ------", HAL_GetTick()); } + debug_log(LOG_LEVEL_INFO, "\n------ Updated at %lu ------", HAL_GetTick()); } \ No newline at end of file