implemented working epsc precharge and current monitoring
This commit is contained in:
@ -19,9 +19,9 @@
|
||||
#define CUR_CHANNELS_2_ID 0xCB
|
||||
#define CUR_CHANNELS_3_ID 0xCC
|
||||
#define CUR_CHANNELS_4_ID 0xCD
|
||||
//#define LV_SENS_ID 0xCE // not used
|
||||
#define ERROR_ID 0xCE
|
||||
|
||||
typedef struct { // TODO: add error-codes
|
||||
typedef struct {
|
||||
enable_gpios iostatus;
|
||||
uint8_t checksum;
|
||||
} rx_status_frame;
|
||||
|
||||
@ -11,19 +11,18 @@
|
||||
#include "stm32f3xx_hal.h"
|
||||
|
||||
// convert ADC quants to V
|
||||
#define ADC_V_FACTOR (3.3f / 4096) // 3.3V / 12bit
|
||||
#define ADC_V_FACTOR (3.3f / 4095) // 3.3V / 12bit
|
||||
// scale to LV by divider to mV
|
||||
#define LV_SENSE_FACTOR (1e3 * (ADC_V_FACTOR * ((12.f + 1.8f) / 1.8f)))
|
||||
#define PC_VSENSE_FACTOR (1e3 * (ADC_V_FACTOR * ((100.f + 10.f) / 10.f)));
|
||||
#define LV_SENSE_FACTOR (1e3 * (ADC_V_FACTOR * ((12.f + 1.8f) / 1.8f))) // scaled with voltage divider
|
||||
|
||||
// convert ADC quants to I_S in mA
|
||||
#define CURR_SENSE_IS_FACTOR_9A (ADC_V_FACTOR / 1.2f) // 3.3V / 12bit / 1.2kOhm
|
||||
#define CURR_SENSE_IS_FACTOR_4_5A (ADC_V_FACTOR / 1.f)
|
||||
#define CURR_SENSE_IS_FACTOR_1A (ADC_V_FACTOR / 4.f)
|
||||
// convert ADC quants to I_L in mA
|
||||
#define CURR_SENSE_FACTOR_1A (300 * CURR_SENSE_IS_FACTOR) // typical current sense ratio (datasheet PROFET)
|
||||
#define CURR_SENSE_FACTOR_4_5A (1500 * CURR_SENSE_IS_FACTOR)
|
||||
#define CURR_SENSE_FACTOR_9A (3900 * CURR_SENSE_IS_FACTOR)
|
||||
#define CURR_SENSE_FACTOR_1A (300 * CURR_SENSE_IS_FACTOR_1A) // typical current sense ratio (datasheet PROFET)
|
||||
#define CURR_SENSE_FACTOR_4_5A (1500 * CURR_SENSE_IS_FACTOR_4_5A)
|
||||
#define CURR_SENSE_FACTOR_9A (3900 * CURR_SENSE_IS_FACTOR_9A)
|
||||
|
||||
typedef struct {
|
||||
uint16_t acc_cooling;
|
||||
|
||||
17
Software/Code/Core/Inc/plausibility_check.h
Normal file
17
Software/Code/Core/Inc/plausibility_check.h
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* plausibility_check.h
|
||||
*
|
||||
* Created on: Mar 18, 2025
|
||||
* Author: janek
|
||||
*/
|
||||
|
||||
#ifndef INC_PLAUSIBILITY_CHECK_H_
|
||||
#define INC_PLAUSIBILITY_CHECK_H_
|
||||
|
||||
#include "current_monitoring.h"
|
||||
#include "channel_control.h"
|
||||
#include "can_communication.h"
|
||||
|
||||
void check_plausibility();
|
||||
|
||||
#endif /* INC_PLAUSIBILITY_CHECK_H_ */
|
||||
@ -165,6 +165,7 @@
|
||||
#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */
|
||||
#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */
|
||||
#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */
|
||||
#define USE_HAL_SDADC_REGISTER_CALLBACKS 0U /* SDADC register callback disabled */
|
||||
#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */
|
||||
#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */
|
||||
#define USE_HAL_PCCARD_REGISTER_CALLBACKS 0U /* PCCARD register callback disabled */
|
||||
|
||||
Reference in New Issue
Block a user