Compare commits
4 Commits
208d84e2a5
...
61155995f8
Author | SHA1 | Date | |
---|---|---|---|
61155995f8 | |||
410597c0f3 | |||
12422071a5 | |||
554eecfc94 |
File diff suppressed because one or more lines are too long
36
Core/Inc/imd_monitoring.h
Normal file
36
Core/Inc/imd_monitoring.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#ifndef INC_IMD_MONITORING_H
|
||||||
|
#define INC_IMD_MONITORING_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "stm32f3xx_hal.h"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
IMD_STATE_UNKNOWN,
|
||||||
|
IMD_STATE_SHORTCIRCUIT_SUPPLY,
|
||||||
|
IMD_STATE_SHORTCIRCUIT_GND,
|
||||||
|
IMD_STATE_NORMAL,
|
||||||
|
IMD_STATE_UNDERVOLTAGE,
|
||||||
|
IMD_STATE_SST,
|
||||||
|
IMD_STATE_DEV_ERROR,
|
||||||
|
IMD_STATE_GND_FAULT,
|
||||||
|
} IMDState;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ok;
|
||||||
|
|
||||||
|
IMDState state;
|
||||||
|
uint32_t r_iso;
|
||||||
|
|
||||||
|
uint32_t freq;
|
||||||
|
uint32_t duty_cycle;
|
||||||
|
uint32_t last_high;
|
||||||
|
} IMDData;
|
||||||
|
|
||||||
|
extern IMDData imd_data;
|
||||||
|
|
||||||
|
void imd_init(TIM_HandleTypeDef *htim);
|
||||||
|
|
||||||
|
void imd_update(void);
|
||||||
|
|
||||||
|
#endif // INC_IMD_MONITORING_H
|
@ -61,6 +61,10 @@ void Error_Handler(void);
|
|||||||
#define HV_MISMATCH_ERR_GPIO_Port GPIOA
|
#define HV_MISMATCH_ERR_GPIO_Port GPIOA
|
||||||
#define RELAY_MISMATCH_ERR_Pin GPIO_PIN_1
|
#define RELAY_MISMATCH_ERR_Pin GPIO_PIN_1
|
||||||
#define RELAY_MISMATCH_ERR_GPIO_Port GPIOA
|
#define RELAY_MISMATCH_ERR_GPIO_Port GPIOA
|
||||||
|
#define IMD_M_Pin GPIO_PIN_2
|
||||||
|
#define IMD_M_GPIO_Port GPIOA
|
||||||
|
#define IMD_OK_Pin GPIO_PIN_3
|
||||||
|
#define IMD_OK_GPIO_Port GPIOA
|
||||||
#define RELAY_CONNECTION_ERR_Pin GPIO_PIN_4
|
#define RELAY_CONNECTION_ERR_Pin GPIO_PIN_4
|
||||||
#define RELAY_CONNECTION_ERR_GPIO_Port GPIOA
|
#define RELAY_CONNECTION_ERR_GPIO_Port GPIOA
|
||||||
#define HV_ACTIVE_Pin GPIO_PIN_5
|
#define HV_ACTIVE_Pin GPIO_PIN_5
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
/*#define HAL_RNG_MODULE_ENABLED */
|
/*#define HAL_RNG_MODULE_ENABLED */
|
||||||
/*#define HAL_RTC_MODULE_ENABLED */
|
/*#define HAL_RTC_MODULE_ENABLED */
|
||||||
/*#define HAL_SPI_MODULE_ENABLED */
|
/*#define HAL_SPI_MODULE_ENABLED */
|
||||||
/*#define HAL_TIM_MODULE_ENABLED */
|
#define HAL_TIM_MODULE_ENABLED
|
||||||
#define HAL_UART_MODULE_ENABLED
|
#define HAL_UART_MODULE_ENABLED
|
||||||
/*#define HAL_USART_MODULE_ENABLED */
|
/*#define HAL_USART_MODULE_ENABLED */
|
||||||
/*#define HAL_IRDA_MODULE_ENABLED */
|
/*#define HAL_IRDA_MODULE_ENABLED */
|
||||||
|
@ -56,6 +56,7 @@ void DebugMon_Handler(void);
|
|||||||
void PendSV_Handler(void);
|
void PendSV_Handler(void);
|
||||||
void SysTick_Handler(void);
|
void SysTick_Handler(void);
|
||||||
void USB_LP_CAN_RX0_IRQHandler(void);
|
void USB_LP_CAN_RX0_IRQHandler(void);
|
||||||
|
void TIM1_BRK_TIM15_IRQHandler(void);
|
||||||
/* USER CODE BEGIN EFP */
|
/* USER CODE BEGIN EFP */
|
||||||
|
|
||||||
/* USER CODE END EFP */
|
/* USER CODE END EFP */
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "can.h"
|
#include "can.h"
|
||||||
|
|
||||||
|
#include "imd_monitoring.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "shunt_monitoring.h"
|
#include "shunt_monitoring.h"
|
||||||
#include "slave_monitoring.h"
|
#include "slave_monitoring.h"
|
||||||
@ -21,11 +22,17 @@ void can_init(CAN_HandleTypeDef *handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HAL_StatusTypeDef can_send_status() {
|
HAL_StatusTypeDef can_send_status() {
|
||||||
uint8_t data[6];
|
uint8_t data[8];
|
||||||
data[0] = ts_state.current_state | (sdc_closed << 7);
|
data[0] = ts_state.current_state | (sdc_closed << 7);
|
||||||
data[1] = roundf(current_soc);
|
data[1] = roundf(current_soc);
|
||||||
ftcan_marshal_unsigned(&data[2], min_voltage, 2);
|
ftcan_marshal_unsigned(&data[2], min_voltage, 2);
|
||||||
ftcan_marshal_signed(&data[4], max_temp, 2);
|
ftcan_marshal_signed(&data[4], max_temp, 2);
|
||||||
|
data[6] = imd_data.state | (imd_data.ok << 7);
|
||||||
|
if (imd_data.r_iso < 0xFFF) {
|
||||||
|
data[7] = imd_data.r_iso >> 4;
|
||||||
|
} else {
|
||||||
|
data[7] = 0xFF;
|
||||||
|
}
|
||||||
return ftcan_transmit(CAN_ID_AMS_STATUS, data, sizeof(data));
|
return ftcan_transmit(CAN_ID_AMS_STATUS, data, sizeof(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
86
Core/Src/imd_monitoring.c
Normal file
86
Core/Src/imd_monitoring.c
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
#include "imd_monitoring.h"
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
#define FREQ_TIMER 1000 // Hz
|
||||||
|
|
||||||
|
#define FREQ_TOLERANCE 1 // Hz
|
||||||
|
#define FREQ_NORMAL 10 // Hz
|
||||||
|
#define FREQ_UNDERVOLTAGE 20 // Hz
|
||||||
|
#define FREQ_SST 30 // Hz
|
||||||
|
#define FREQ_DEV_ERROR 40 // Hz
|
||||||
|
#define FREQ_GND_FAULT 50 // Hz
|
||||||
|
|
||||||
|
#define RISO_MIN_DUTY_CYCLE 8 // %
|
||||||
|
#define RISO_MAX 50000 // kOhm
|
||||||
|
|
||||||
|
#define PWM_TIMEOUT 200 // ms
|
||||||
|
|
||||||
|
IMDData imd_data;
|
||||||
|
|
||||||
|
static TIM_HandleTypeDef *htim;
|
||||||
|
|
||||||
|
void imd_init(TIM_HandleTypeDef *handle) {
|
||||||
|
htim = handle;
|
||||||
|
HAL_TIM_IC_Start_IT(htim, TIM_CHANNEL_1);
|
||||||
|
HAL_TIM_IC_Start(htim, TIM_CHANNEL_2);
|
||||||
|
|
||||||
|
imd_data.state = IMD_STATE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *handle) {
|
||||||
|
if (handle != htim || htim->Channel != HAL_TIM_ACTIVE_CHANNEL_1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uint32_t period = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
|
||||||
|
if (period == 0) {
|
||||||
|
// First edge, ignore
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
imd_data.last_high = HAL_GetTick();
|
||||||
|
|
||||||
|
imd_data.freq = FREQ_TIMER / period;
|
||||||
|
uint32_t high_time = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2);
|
||||||
|
imd_data.duty_cycle = (100 * high_time) / period;
|
||||||
|
|
||||||
|
// Check PWM frequency for state determination
|
||||||
|
if (imd_data.freq > FREQ_NORMAL - FREQ_TOLERANCE &&
|
||||||
|
imd_data.freq < FREQ_NORMAL + FREQ_TOLERANCE) {
|
||||||
|
imd_data.state = IMD_STATE_NORMAL;
|
||||||
|
} else if (imd_data.freq > FREQ_UNDERVOLTAGE - FREQ_TOLERANCE &&
|
||||||
|
imd_data.freq < FREQ_UNDERVOLTAGE + FREQ_TOLERANCE) {
|
||||||
|
imd_data.state = IMD_STATE_UNDERVOLTAGE;
|
||||||
|
} else if (imd_data.freq > FREQ_SST - FREQ_TOLERANCE &&
|
||||||
|
imd_data.freq < FREQ_SST + FREQ_TOLERANCE) {
|
||||||
|
imd_data.state = IMD_STATE_SST;
|
||||||
|
} else if (imd_data.freq > FREQ_DEV_ERROR - FREQ_TOLERANCE &&
|
||||||
|
imd_data.freq < FREQ_DEV_ERROR + FREQ_TOLERANCE) {
|
||||||
|
imd_data.state = IMD_STATE_DEV_ERROR;
|
||||||
|
} else if (imd_data.freq > FREQ_GND_FAULT - FREQ_TOLERANCE &&
|
||||||
|
imd_data.freq < FREQ_GND_FAULT + FREQ_TOLERANCE) {
|
||||||
|
imd_data.state = IMD_STATE_GND_FAULT;
|
||||||
|
} else {
|
||||||
|
imd_data.state = IMD_STATE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate R_iso
|
||||||
|
if (imd_data.state == IMD_STATE_NORMAL ||
|
||||||
|
imd_data.state == IMD_STATE_UNDERVOLTAGE) {
|
||||||
|
if (imd_data.duty_cycle < RISO_MIN_DUTY_CYCLE) {
|
||||||
|
imd_data.r_iso = RISO_MAX;
|
||||||
|
} else {
|
||||||
|
imd_data.r_iso = (90 * 1200) / (imd_data.duty_cycle - 5) - 1200;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void imd_update() {
|
||||||
|
imd_data.ok = HAL_GPIO_ReadPin(IMD_OK_GPIO_Port, IMD_OK_Pin);
|
||||||
|
if (HAL_GetTick() - imd_data.last_high > PWM_TIMEOUT) {
|
||||||
|
if (HAL_GPIO_ReadPin(IMD_M_GPIO_Port, IMD_M_Pin) == GPIO_PIN_SET) {
|
||||||
|
imd_data.state = IMD_STATE_SHORTCIRCUIT_SUPPLY;
|
||||||
|
} else {
|
||||||
|
imd_data.state = IMD_STATE_SHORTCIRCUIT_GND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
128
Core/Src/main.c
128
Core/Src/main.c
@ -22,14 +22,15 @@
|
|||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
#include "can.h"
|
#include "can.h"
|
||||||
#include "soc_estimation.h"
|
#include "imd_monitoring.h"
|
||||||
#include "stm32f3xx_hal.h"
|
|
||||||
#include "stm32f3xx_hal_gpio.h"
|
|
||||||
|
|
||||||
#include "shunt_monitoring.h"
|
#include "shunt_monitoring.h"
|
||||||
#include "slave_monitoring.h"
|
#include "slave_monitoring.h"
|
||||||
|
#include "soc_estimation.h"
|
||||||
#include "ts_state_machine.h"
|
#include "ts_state_machine.h"
|
||||||
|
|
||||||
|
#include "stm32f3xx_hal.h"
|
||||||
|
#include "stm32f3xx_hal_gpio.h"
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
@ -52,6 +53,10 @@ ADC_HandleTypeDef hadc2;
|
|||||||
|
|
||||||
CAN_HandleTypeDef hcan;
|
CAN_HandleTypeDef hcan;
|
||||||
|
|
||||||
|
I2C_HandleTypeDef hi2c1;
|
||||||
|
|
||||||
|
TIM_HandleTypeDef htim15;
|
||||||
|
|
||||||
UART_HandleTypeDef huart1;
|
UART_HandleTypeDef huart1;
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
/* USER CODE BEGIN PV */
|
||||||
@ -64,6 +69,8 @@ static void MX_GPIO_Init(void);
|
|||||||
static void MX_ADC2_Init(void);
|
static void MX_ADC2_Init(void);
|
||||||
static void MX_CAN_Init(void);
|
static void MX_CAN_Init(void);
|
||||||
static void MX_USART1_UART_Init(void);
|
static void MX_USART1_UART_Init(void);
|
||||||
|
static void MX_I2C1_Init(void);
|
||||||
|
static void MX_TIM15_Init(void);
|
||||||
/* USER CODE BEGIN PFP */
|
/* USER CODE BEGIN PFP */
|
||||||
|
|
||||||
/* USER CODE END PFP */
|
/* USER CODE END PFP */
|
||||||
@ -116,12 +123,15 @@ int main(void) {
|
|||||||
MX_ADC2_Init();
|
MX_ADC2_Init();
|
||||||
MX_CAN_Init();
|
MX_CAN_Init();
|
||||||
MX_USART1_UART_Init();
|
MX_USART1_UART_Init();
|
||||||
|
MX_I2C1_Init();
|
||||||
|
MX_TIM15_Init();
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
can_init(&hcan);
|
can_init(&hcan);
|
||||||
slaves_init();
|
slaves_init();
|
||||||
shunt_init();
|
shunt_init();
|
||||||
ts_sm_init();
|
ts_sm_init();
|
||||||
soc_init();
|
soc_init();
|
||||||
|
imd_init(&htim15);
|
||||||
HAL_GPIO_WritePin(AMS_NERROR_GPIO_Port, AMS_NERROR_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(AMS_NERROR_GPIO_Port, AMS_NERROR_Pin, GPIO_PIN_SET);
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
@ -139,6 +149,7 @@ int main(void) {
|
|||||||
shunt_check();
|
shunt_check();
|
||||||
ts_sm_update();
|
ts_sm_update();
|
||||||
soc_update();
|
soc_update();
|
||||||
|
imd_update();
|
||||||
can_send_status();
|
can_send_status();
|
||||||
|
|
||||||
loop_delay();
|
loop_delay();
|
||||||
@ -183,9 +194,10 @@ void SystemClock_Config(void) {
|
|||||||
Error_Handler();
|
Error_Handler();
|
||||||
}
|
}
|
||||||
PeriphClkInit.PeriphClockSelection =
|
PeriphClkInit.PeriphClockSelection =
|
||||||
RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_ADC12;
|
RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_ADC12;
|
||||||
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
|
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
|
||||||
PeriphClkInit.Adc12ClockSelection = RCC_ADC12PLLCLK_DIV1;
|
PeriphClkInit.Adc12ClockSelection = RCC_ADC12PLLCLK_DIV1;
|
||||||
|
PeriphClkInit.I2c1ClockSelection = RCC_I2C1CLKSOURCE_HSI;
|
||||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
}
|
}
|
||||||
@ -278,6 +290,108 @@ static void MX_CAN_Init(void) {
|
|||||||
/* USER CODE END CAN_Init 2 */
|
/* USER CODE END CAN_Init 2 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief I2C1 Initialization Function
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static void MX_I2C1_Init(void) {
|
||||||
|
|
||||||
|
/* USER CODE BEGIN I2C1_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END I2C1_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN I2C1_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END I2C1_Init 1 */
|
||||||
|
hi2c1.Instance = I2C1;
|
||||||
|
hi2c1.Init.Timing = 0x2000090E;
|
||||||
|
hi2c1.Init.OwnAddress1 = 0;
|
||||||
|
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
||||||
|
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
|
||||||
|
hi2c1.Init.OwnAddress2 = 0;
|
||||||
|
hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
|
||||||
|
hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
||||||
|
hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
||||||
|
if (HAL_I2C_Init(&hi2c1) != HAL_OK) {
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configure Analogue filter
|
||||||
|
*/
|
||||||
|
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK) {
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configure Digital filter
|
||||||
|
*/
|
||||||
|
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK) {
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN I2C1_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END I2C1_Init 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TIM15 Initialization Function
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static void MX_TIM15_Init(void) {
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM15_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM15_Init 0 */
|
||||||
|
|
||||||
|
TIM_SlaveConfigTypeDef sSlaveConfig = {0};
|
||||||
|
TIM_IC_InitTypeDef sConfigIC = {0};
|
||||||
|
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM15_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM15_Init 1 */
|
||||||
|
htim15.Instance = TIM15;
|
||||||
|
htim15.Init.Prescaler = 16000 - 1;
|
||||||
|
htim15.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||||
|
htim15.Init.Period = 65535;
|
||||||
|
htim15.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||||
|
htim15.Init.RepetitionCounter = 0;
|
||||||
|
htim15.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||||
|
if (HAL_TIM_IC_Init(&htim15) != HAL_OK) {
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
sSlaveConfig.SlaveMode = TIM_SLAVEMODE_RESET;
|
||||||
|
sSlaveConfig.InputTrigger = TIM_TS_TI1FP1;
|
||||||
|
sSlaveConfig.TriggerPolarity = TIM_INPUTCHANNELPOLARITY_RISING;
|
||||||
|
sSlaveConfig.TriggerPrescaler = TIM_ICPSC_DIV1;
|
||||||
|
sSlaveConfig.TriggerFilter = 0;
|
||||||
|
if (HAL_TIM_SlaveConfigSynchro(&htim15, &sSlaveConfig) != HAL_OK) {
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
sConfigIC.ICPolarity = TIM_INPUTCHANNELPOLARITY_RISING;
|
||||||
|
sConfigIC.ICSelection = TIM_ICSELECTION_DIRECTTI;
|
||||||
|
sConfigIC.ICPrescaler = TIM_ICPSC_DIV1;
|
||||||
|
sConfigIC.ICFilter = 0;
|
||||||
|
if (HAL_TIM_IC_ConfigChannel(&htim15, &sConfigIC, TIM_CHANNEL_1) != HAL_OK) {
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
sConfigIC.ICPolarity = TIM_INPUTCHANNELPOLARITY_FALLING;
|
||||||
|
sConfigIC.ICSelection = TIM_ICSELECTION_INDIRECTTI;
|
||||||
|
if (HAL_TIM_IC_ConfigChannel(&htim15, &sConfigIC, TIM_CHANNEL_2) != HAL_OK) {
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||||
|
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||||
|
if (HAL_TIMEx_MasterConfigSynchronization(&htim15, &sMasterConfig) !=
|
||||||
|
HAL_OK) {
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN TIM15_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM15_Init 2 */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USART1 Initialization Function
|
* @brief USART1 Initialization Function
|
||||||
* @param None
|
* @param None
|
||||||
@ -338,11 +452,11 @@ static void MX_GPIO_Init(void) {
|
|||||||
HAL_GPIO_WritePin(PRECHARGE_CTRL_GPIO_Port, PRECHARGE_CTRL_Pin,
|
HAL_GPIO_WritePin(PRECHARGE_CTRL_GPIO_Port, PRECHARGE_CTRL_Pin,
|
||||||
GPIO_PIN_RESET);
|
GPIO_PIN_RESET);
|
||||||
|
|
||||||
/*Configure GPIO pins : HV_MISMATCH_ERR_Pin RELAY_MISMATCH_ERR_Pin
|
/*Configure GPIO pins : HV_MISMATCH_ERR_Pin RELAY_MISMATCH_ERR_Pin IMD_OK_Pin
|
||||||
RELAY_CONNECTION_ERR_Pin HV_ACTIVE_Pin NEG_AIR_CLOSED_Pin
|
RELAY_CONNECTION_ERR_Pin HV_ACTIVE_Pin NEG_AIR_CLOSED_Pin
|
||||||
POS_AIR_CLOSED_Pin */
|
POS_AIR_CLOSED_Pin */
|
||||||
GPIO_InitStruct.Pin = HV_MISMATCH_ERR_Pin | RELAY_MISMATCH_ERR_Pin |
|
GPIO_InitStruct.Pin = HV_MISMATCH_ERR_Pin | RELAY_MISMATCH_ERR_Pin |
|
||||||
RELAY_CONNECTION_ERR_Pin | HV_ACTIVE_Pin |
|
IMD_OK_Pin | RELAY_CONNECTION_ERR_Pin | HV_ACTIVE_Pin |
|
||||||
NEG_AIR_CLOSED_Pin | POS_AIR_CLOSED_Pin;
|
NEG_AIR_CLOSED_Pin | POS_AIR_CLOSED_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
@ -91,9 +91,10 @@ void slaves_check() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void slaves_handle_panic(const uint8_t *data) {
|
void slaves_handle_panic(const uint8_t *data) {
|
||||||
uint8_t slave_id = ftcan_unmarshal_unsigned(&data, 1);
|
const uint8_t **ptr = &data;
|
||||||
|
uint8_t slave_id = ftcan_unmarshal_unsigned(ptr, 1);
|
||||||
uint8_t idx = get_slave_index(slave_id);
|
uint8_t idx = get_slave_index(slave_id);
|
||||||
uint8_t error_kind = ftcan_unmarshal_unsigned(&data, 1);
|
uint8_t error_kind = ftcan_unmarshal_unsigned(ptr, 1);
|
||||||
switch (error_kind) {
|
switch (error_kind) {
|
||||||
case SLAVE_PANIC_OT:
|
case SLAVE_PANIC_OT:
|
||||||
slaves[idx].error.kind = SLAVE_ERR_OT;
|
slaves[idx].error.kind = SLAVE_ERR_OT;
|
||||||
@ -118,11 +119,7 @@ void slaves_handle_status(const uint8_t *data) {
|
|||||||
uint8_t slave_id = data[0] & 0x7F;
|
uint8_t slave_id = data[0] & 0x7F;
|
||||||
uint8_t idx = get_slave_index(slave_id);
|
uint8_t idx = get_slave_index(slave_id);
|
||||||
int error = data[0] & 0x80;
|
int error = data[0] & 0x80;
|
||||||
if (error) {
|
if (!error) {
|
||||||
if (slaves[idx].error.kind == SLAVE_ERR_NONE) {
|
|
||||||
slaves[idx].error.kind = SLAVE_ERR_UNKNOWN;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
slaves[idx].error.kind = SLAVE_ERR_NONE;
|
slaves[idx].error.kind = SLAVE_ERR_NONE;
|
||||||
}
|
}
|
||||||
slaves[idx].soc = data[1];
|
slaves[idx].soc = data[1];
|
||||||
|
@ -207,6 +207,149 @@ void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief I2C MSP Initialization
|
||||||
|
* This function configures the hardware resources used in this example
|
||||||
|
* @param hi2c: I2C handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
if(hi2c->Instance==I2C1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN I2C1_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END I2C1_MspInit 0 */
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
/**I2C1 GPIO Configuration
|
||||||
|
PA15 ------> I2C1_SCL
|
||||||
|
PB9 ------> I2C1_SDA
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_15;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_9;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_I2C1_CLK_ENABLE();
|
||||||
|
/* USER CODE BEGIN I2C1_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END I2C1_MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief I2C MSP De-Initialization
|
||||||
|
* This function freeze the hardware resources used in this example
|
||||||
|
* @param hi2c: I2C handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c)
|
||||||
|
{
|
||||||
|
if(hi2c->Instance==I2C1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN I2C1_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END I2C1_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_I2C1_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**I2C1 GPIO Configuration
|
||||||
|
PA15 ------> I2C1_SCL
|
||||||
|
PB9 ------> I2C1_SDA
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_15);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_9);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN I2C1_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END I2C1_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TIM_IC MSP Initialization
|
||||||
|
* This function configures the hardware resources used in this example
|
||||||
|
* @param htim_ic: TIM_IC handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_TIM_IC_MspInit(TIM_HandleTypeDef* htim_ic)
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
if(htim_ic->Instance==TIM15)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM15_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM15_MspInit 0 */
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_TIM15_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
/**TIM15 GPIO Configuration
|
||||||
|
PA2 ------> TIM15_CH1
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = IMD_M_Pin;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF9_TIM15;
|
||||||
|
HAL_GPIO_Init(IMD_M_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* TIM15 interrupt Init */
|
||||||
|
HAL_NVIC_SetPriority(TIM1_BRK_TIM15_IRQn, 0, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(TIM1_BRK_TIM15_IRQn);
|
||||||
|
/* USER CODE BEGIN TIM15_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM15_MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TIM_IC MSP De-Initialization
|
||||||
|
* This function freeze the hardware resources used in this example
|
||||||
|
* @param htim_ic: TIM_IC handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef* htim_ic)
|
||||||
|
{
|
||||||
|
if(htim_ic->Instance==TIM15)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM15_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM15_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_TIM15_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**TIM15 GPIO Configuration
|
||||||
|
PA2 ------> TIM15_CH1
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(IMD_M_GPIO_Port, IMD_M_Pin);
|
||||||
|
|
||||||
|
/* TIM15 interrupt DeInit */
|
||||||
|
HAL_NVIC_DisableIRQ(TIM1_BRK_TIM15_IRQn);
|
||||||
|
/* USER CODE BEGIN TIM15_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM15_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief UART MSP Initialization
|
* @brief UART MSP Initialization
|
||||||
* This function configures the hardware resources used in this example
|
* This function configures the hardware resources used in this example
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
|
|
||||||
/* External variables --------------------------------------------------------*/
|
/* External variables --------------------------------------------------------*/
|
||||||
extern CAN_HandleTypeDef hcan;
|
extern CAN_HandleTypeDef hcan;
|
||||||
|
extern TIM_HandleTypeDef htim15;
|
||||||
/* USER CODE BEGIN EV */
|
/* USER CODE BEGIN EV */
|
||||||
|
|
||||||
/* USER CODE END EV */
|
/* USER CODE END EV */
|
||||||
@ -217,6 +218,20 @@ void USB_LP_CAN_RX0_IRQHandler(void)
|
|||||||
/* USER CODE END USB_LP_CAN_RX0_IRQn 1 */
|
/* USER CODE END USB_LP_CAN_RX0_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles TIM1 break and TIM15 interrupts.
|
||||||
|
*/
|
||||||
|
void TIM1_BRK_TIM15_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM1_BRK_TIM15_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM1_BRK_TIM15_IRQn 0 */
|
||||||
|
HAL_TIM_IRQHandler(&htim15);
|
||||||
|
/* USER CODE BEGIN TIM1_BRK_TIM15_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM1_BRK_TIM15_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN 1 */
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
/* USER CODE END 1 */
|
/* USER CODE END 1 */
|
||||||
|
@ -38,6 +38,7 @@ BUILD_DIR = build
|
|||||||
C_SOURCES = \
|
C_SOURCES = \
|
||||||
Core/Lib/can-halal/can-halal.c \
|
Core/Lib/can-halal/can-halal.c \
|
||||||
Core/Src/can.c \
|
Core/Src/can.c \
|
||||||
|
Core/Src/imd_monitoring.c \
|
||||||
Core/Src/main.c \
|
Core/Src/main.c \
|
||||||
Core/Src/shunt_monitoring.c \
|
Core/Src/shunt_monitoring.c \
|
||||||
Core/Src/slave_monitoring.c \
|
Core/Src/slave_monitoring.c \
|
||||||
|
@ -26,45 +26,51 @@ Mcu.CPN=STM32F302CBT6
|
|||||||
Mcu.Family=STM32F3
|
Mcu.Family=STM32F3
|
||||||
Mcu.IP0=ADC2
|
Mcu.IP0=ADC2
|
||||||
Mcu.IP1=CAN
|
Mcu.IP1=CAN
|
||||||
Mcu.IP2=NVIC
|
Mcu.IP2=I2C1
|
||||||
Mcu.IP3=RCC
|
Mcu.IP3=NVIC
|
||||||
Mcu.IP4=SYS
|
Mcu.IP4=RCC
|
||||||
Mcu.IP5=USART1
|
Mcu.IP5=SYS
|
||||||
Mcu.IPNb=6
|
Mcu.IP6=TIM15
|
||||||
|
Mcu.IP7=USART1
|
||||||
|
Mcu.IPNb=8
|
||||||
Mcu.Name=STM32F302C(B-C)Tx
|
Mcu.Name=STM32F302C(B-C)Tx
|
||||||
Mcu.Package=LQFP48
|
Mcu.Package=LQFP48
|
||||||
Mcu.Pin0=PF0-OSC_IN
|
Mcu.Pin0=PF0-OSC_IN
|
||||||
Mcu.Pin1=PF1-OSC_OUT
|
Mcu.Pin1=PF1-OSC_OUT
|
||||||
Mcu.Pin10=PB2
|
Mcu.Pin10=PB0
|
||||||
Mcu.Pin11=PB10
|
Mcu.Pin11=PB1
|
||||||
Mcu.Pin12=PB11
|
Mcu.Pin12=PB2
|
||||||
Mcu.Pin13=PB12
|
Mcu.Pin13=PB10
|
||||||
Mcu.Pin14=PB13
|
Mcu.Pin14=PB11
|
||||||
Mcu.Pin15=PB14
|
Mcu.Pin15=PB12
|
||||||
Mcu.Pin16=PB15
|
Mcu.Pin16=PB13
|
||||||
Mcu.Pin17=PA8
|
Mcu.Pin17=PB14
|
||||||
Mcu.Pin18=PA9
|
Mcu.Pin18=PB15
|
||||||
Mcu.Pin19=PA10
|
Mcu.Pin19=PA8
|
||||||
Mcu.Pin2=PA0
|
Mcu.Pin2=PA0
|
||||||
Mcu.Pin20=PA11
|
Mcu.Pin20=PA9
|
||||||
Mcu.Pin21=PA12
|
Mcu.Pin21=PA10
|
||||||
Mcu.Pin22=PA13
|
Mcu.Pin22=PA11
|
||||||
Mcu.Pin23=PA14
|
Mcu.Pin23=PA12
|
||||||
Mcu.Pin24=PB3
|
Mcu.Pin24=PA13
|
||||||
Mcu.Pin25=PB4
|
Mcu.Pin25=PA14
|
||||||
Mcu.Pin26=PB5
|
Mcu.Pin26=PA15
|
||||||
Mcu.Pin27=PB6
|
Mcu.Pin27=PB3
|
||||||
Mcu.Pin28=PB7
|
Mcu.Pin28=PB4
|
||||||
Mcu.Pin29=PB8
|
Mcu.Pin29=PB5
|
||||||
Mcu.Pin3=PA1
|
Mcu.Pin3=PA1
|
||||||
Mcu.Pin30=VP_SYS_VS_Systick
|
Mcu.Pin30=PB6
|
||||||
Mcu.Pin4=PA4
|
Mcu.Pin31=PB7
|
||||||
Mcu.Pin5=PA5
|
Mcu.Pin32=PB8
|
||||||
Mcu.Pin6=PA6
|
Mcu.Pin33=PB9
|
||||||
Mcu.Pin7=PA7
|
Mcu.Pin34=VP_SYS_VS_Systick
|
||||||
Mcu.Pin8=PB0
|
Mcu.Pin4=PA2
|
||||||
Mcu.Pin9=PB1
|
Mcu.Pin5=PA3
|
||||||
Mcu.PinsNb=31
|
Mcu.Pin6=PA4
|
||||||
|
Mcu.Pin7=PA5
|
||||||
|
Mcu.Pin8=PA6
|
||||||
|
Mcu.Pin9=PA7
|
||||||
|
Mcu.PinsNb=35
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32F302CBTx
|
Mcu.UserName=STM32F302CBTx
|
||||||
@ -80,6 +86,7 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
|||||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
||||||
|
NVIC.TIM1_BRK_TIM15_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||||
NVIC.USB_LP_CAN_RX0_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
NVIC.USB_LP_CAN_RX0_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
PA0.GPIOParameters=GPIO_Label
|
PA0.GPIOParameters=GPIO_Label
|
||||||
@ -105,6 +112,16 @@ PA13.Signal=SYS_JTMS-SWDIO
|
|||||||
PA14.Locked=true
|
PA14.Locked=true
|
||||||
PA14.Mode=Trace_Asynchronous_SW
|
PA14.Mode=Trace_Asynchronous_SW
|
||||||
PA14.Signal=SYS_JTCK-SWCLK
|
PA14.Signal=SYS_JTCK-SWCLK
|
||||||
|
PA15.Mode=I2C
|
||||||
|
PA15.Signal=I2C1_SCL
|
||||||
|
PA2.GPIOParameters=GPIO_Label
|
||||||
|
PA2.GPIO_Label=IMD_M
|
||||||
|
PA2.Locked=true
|
||||||
|
PA2.Signal=S_TIM15_CH1
|
||||||
|
PA3.GPIOParameters=GPIO_Label
|
||||||
|
PA3.GPIO_Label=IMD_OK
|
||||||
|
PA3.Locked=true
|
||||||
|
PA3.Signal=GPIO_Input
|
||||||
PA4.GPIOParameters=GPIO_Label
|
PA4.GPIOParameters=GPIO_Label
|
||||||
PA4.GPIO_Label=RELAY_CONNECTION_ERR
|
PA4.GPIO_Label=RELAY_CONNECTION_ERR
|
||||||
PA4.Locked=true
|
PA4.Locked=true
|
||||||
@ -188,6 +205,8 @@ PB8.GPIOParameters=GPIO_Label
|
|||||||
PB8.GPIO_Label=AMS_NERROR
|
PB8.GPIO_Label=AMS_NERROR
|
||||||
PB8.Locked=true
|
PB8.Locked=true
|
||||||
PB8.Signal=GPIO_Output
|
PB8.Signal=GPIO_Output
|
||||||
|
PB9.Mode=I2C
|
||||||
|
PB9.Signal=I2C1_SDA
|
||||||
PF0-OSC_IN.Mode=HSE-External-Oscillator
|
PF0-OSC_IN.Mode=HSE-External-Oscillator
|
||||||
PF0-OSC_IN.Signal=RCC_OSC_IN
|
PF0-OSC_IN.Signal=RCC_OSC_IN
|
||||||
PF1-OSC_OUT.Mode=HSE-External-Oscillator
|
PF1-OSC_OUT.Mode=HSE-External-Oscillator
|
||||||
@ -221,7 +240,7 @@ ProjectManager.StackSize=0x400
|
|||||||
ProjectManager.TargetToolchain=Makefile
|
ProjectManager.TargetToolchain=Makefile
|
||||||
ProjectManager.ToolChainLocation=
|
ProjectManager.ToolChainLocation=
|
||||||
ProjectManager.UnderRoot=false
|
ProjectManager.UnderRoot=false
|
||||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ADC2_Init-ADC2-false-HAL-true,4-MX_CAN_Init-CAN-false-HAL-true,5-MX_USART1_UART_Init-USART1-false-HAL-true
|
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ADC2_Init-ADC2-false-HAL-true,4-MX_CAN_Init-CAN-false-HAL-true,5-MX_USART1_UART_Init-USART1-false-HAL-true,6-MX_I2C1_Init-I2C1-false-HAL-true,7-MX_TIM15_Init-TIM15-false-HAL-true
|
||||||
RCC.ADC12outputFreq_Value=16000000
|
RCC.ADC12outputFreq_Value=16000000
|
||||||
RCC.AHBFreq_Value=16000000
|
RCC.AHBFreq_Value=16000000
|
||||||
RCC.APB1Freq_Value=16000000
|
RCC.APB1Freq_Value=16000000
|
||||||
@ -256,6 +275,10 @@ RCC.USART2Freq_Value=16000000
|
|||||||
RCC.USART3Freq_Value=16000000
|
RCC.USART3Freq_Value=16000000
|
||||||
RCC.USBFreq_Value=16000000
|
RCC.USBFreq_Value=16000000
|
||||||
RCC.VCOOutput2Freq_Value=4000000
|
RCC.VCOOutput2Freq_Value=4000000
|
||||||
|
SH.S_TIM15_CH1.0=TIM15_CH1,PWM_Input_1
|
||||||
|
SH.S_TIM15_CH1.ConfNb=1
|
||||||
|
TIM15.IPParameters=Prescaler
|
||||||
|
TIM15.Prescaler=16000-1
|
||||||
USART1.IPParameters=VirtualMode-Asynchronous
|
USART1.IPParameters=VirtualMode-Asynchronous
|
||||||
USART1.VirtualMode-Asynchronous=VM_ASYNC
|
USART1.VirtualMode-Asynchronous=VM_ASYNC
|
||||||
VP_SYS_VS_Systick.Mode=SysTick
|
VP_SYS_VS_Systick.Mode=SysTick
|
||||||
|
Loading…
x
Reference in New Issue
Block a user