V1.4
This commit is contained in:
4
Core/Inc/ADBMS_Abstraction.h
Normal file → Executable file
4
Core/Inc/ADBMS_Abstraction.h
Normal file → Executable file
@ -46,8 +46,8 @@ struct ADBMS6830_Internal_Status {
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
float cellVoltages[MAXIMUM_CELL_VOLTAGES];
|
||||
float auxVoltages[MAXIMUM_AUX_VOLTAGES];
|
||||
int16_t cellVoltages[MAXIMUM_CELL_VOLTAGES];
|
||||
int16_t auxVoltages[MAXIMUM_AUX_VOLTAGES];
|
||||
|
||||
struct ADBMS6830_Internal_Status status;
|
||||
uint16 internalDieTemp;
|
||||
|
||||
0
Core/Inc/ADBMS_CMD_MAKROS.h
Normal file → Executable file
0
Core/Inc/ADBMS_CMD_MAKROS.h
Normal file → Executable file
4
Core/Inc/ADBMS_LL_Driver.h
Normal file → Executable file
4
Core/Inc/ADBMS_LL_Driver.h
Normal file → Executable file
@ -27,8 +27,8 @@ uint8 calculateDataPEC(uint8* data, uint8 datalen);
|
||||
uint16 updateDataPEC(uint16 currentPEC, uint8 din);
|
||||
uint8 checkDataPEC(uint8* data, uint8 datalen);
|
||||
|
||||
uint8 writeCMD(uint16 command, uint8* args, uint8 arglen);
|
||||
uint8 readCMD(uint16 command, uint8* buffer, uint8 buflen);
|
||||
[[gnu::access(read_only, 2, 3)]] uint8 writeCMD(uint16 command, const uint8* args, uint8 arglen);
|
||||
[[gnu::access(write_only, 2, 3)]] uint8 readCMD(uint16 command, uint8* buffer, uint8 buflen);
|
||||
uint8 pollCMD(uint16 command);
|
||||
|
||||
void mcuAdbmsCSLow();
|
||||
|
||||
17
Core/Inc/AMS_HighLevel.h
Normal file → Executable file
17
Core/Inc/AMS_HighLevel.h
Normal file → Executable file
@ -12,11 +12,8 @@
|
||||
#include "ADBMS_CMD_MAKROS.h"
|
||||
#include "ADBMS_LL_Driver.h"
|
||||
#include "can.h"
|
||||
#include "TMP1075.h"
|
||||
#include "can-halal.h"
|
||||
#include "errors.h"
|
||||
#include "stm32f3xx_hal.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef enum {
|
||||
AMSDEACTIVE,
|
||||
@ -31,11 +28,7 @@ typedef enum {
|
||||
extern amsState currentAMSState;
|
||||
extern Cell_Module module;
|
||||
extern uint32_t balancedCells;
|
||||
extern uint8_t BalancingActive;
|
||||
extern uint8_t stateofcharge;
|
||||
|
||||
extern uint8_t amserrorcode;
|
||||
extern uint8_t amswarningcode;
|
||||
extern bool BalancingActive;
|
||||
|
||||
extern uint8_t numberofCells;
|
||||
extern uint8_t numberofAux;
|
||||
@ -50,8 +43,4 @@ uint8_t AMS_Error_Loop();
|
||||
uint8_t AMS_Charging_Loop();
|
||||
uint8_t AMS_Discharging_Loop();
|
||||
|
||||
uint8_t writeWarningLog(uint8_t warningCode);
|
||||
uint8_t writeErrorLog(uint8_t errorCode);
|
||||
uint8_t integrateCurrent();
|
||||
|
||||
#endif /* INC_AMS_HIGHLEVEL_H_ */
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* PWM_control.h
|
||||
*
|
||||
* Created on: 07.07.2024
|
||||
* Author: Hamza
|
||||
*/
|
||||
|
||||
#ifndef INC_PWM_CONTROL_H
|
||||
#define INC_PWM_CONTROL_H
|
||||
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* can.h
|
||||
*
|
||||
* Created on: 07.07.2024
|
||||
* Author: Hamza
|
||||
*/
|
||||
|
||||
#ifndef INC_CAN_H
|
||||
#define INC_CAN_H
|
||||
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* state_machine.h
|
||||
*
|
||||
* Created on: 07.07.2024
|
||||
* Author: Hamza
|
||||
*/
|
||||
|
||||
#ifndef INC_STATE_MACHINE_H
|
||||
#define INC_STATE_MACHINE_H
|
||||
|
||||
@ -8,17 +15,12 @@
|
||||
#include "errors.h"
|
||||
#include "PWM_control.h"
|
||||
#include "TMP1075.h"
|
||||
#include <math.h>
|
||||
|
||||
// Minimum vehicle side voltage to exit precharge
|
||||
#define MIN_VEHICLE_SIDE_VOLTAGE 150000 // mV
|
||||
// Time to wait after reaching 95% of battery voltage before exiting precharge
|
||||
// Set this to 1000 in scruti to demonstrate the voltage on the multimeter
|
||||
#define PRECHARGE_DURATION 3000 // ms
|
||||
// Time to wait for discharge
|
||||
#define DISCHARGE_DURATION 3000 // ms
|
||||
// Time to wait after there is no more error condition before exiting TS_ERROR
|
||||
#define NO_ERROR_TIME 1000 // ms
|
||||
// Time to wait for charger voltage before going to TS_ERROR
|
||||
#define MAX_CHARGING_CHECK_DURATION 2000 // ms
|
||||
// Time to wait between closing relays
|
||||
@ -91,5 +93,6 @@ void sm_handle_ams_in(const uint8 *data);
|
||||
void sm_check_errors();
|
||||
void sm_set_error(ErrorKind error_kind, bool is_errored);
|
||||
void sm_test_cycle_states();
|
||||
void sm_error_source();
|
||||
|
||||
#endif /* "INC_STATE_MACHINE_H" */
|
||||
Reference in New Issue
Block a user