Merge pull request 'Soft Watchdog, Current Monitoring and other Fixes' (#1) from oskar-watchdog-and-stuff into main

Reviewed-on: #1
This commit is contained in:
Oskar Winkels 2024-08-14 22:49:41 +02:00
commit 41c242aab7
14 changed files with 484 additions and 221 deletions

File diff suppressed because one or more lines are too long

View File

@ -20,6 +20,7 @@
#define CUR_CHANNELS_2_ID 0xCB #define CUR_CHANNELS_2_ID 0xCB
#define CUR_CHANNELS_3_ID 0xCC #define CUR_CHANNELS_3_ID 0xCC
#define CUR_CHANNELS_4_ID 0xCD #define CUR_CHANNELS_4_ID 0xCD
#define LV_SENS_ID 0xCE
typedef struct { typedef struct {
PortExtenderGPIO iostatus; PortExtenderGPIO iostatus;

View File

@ -10,8 +10,13 @@
#include "stm32f3xx_hal.h" #include "stm32f3xx_hal.h"
// Convert ADC quants to V
#define ADC_V_FACTOR (3.3f / 4096)
// Scale to LV by divider to mV
#define LV_SENSE_FACTOR (1e3 * (ADC_V_FACTOR * ((27.f+8.2f)/8.2f)))
// Convert ADC quants to I_S in mA // Convert ADC quants to I_S in mA
#define CURR_SENSE_IS_FACTOR ((3.3f / 4096) / 1.2f) // 3.3V / 12bit / 1.2kOhm #define CURR_SENSE_IS_FACTOR (ADC_V_FACTOR / 1.2f) // 3.3V / 12bit / 1.2kOhm
// Convert ADC quants to I_L in mA // Convert ADC quants to I_L in mA
#define CURR_SENSE_FACTOR_5A (3700 * CURR_SENSE_IS_FACTOR) #define CURR_SENSE_FACTOR_5A (3700 * CURR_SENSE_IS_FACTOR)
#define CURR_SENSE_FACTOR_7_5A (5450 * CURR_SENSE_IS_FACTOR) #define CURR_SENSE_FACTOR_7_5A (5450 * CURR_SENSE_IS_FACTOR)
@ -36,6 +41,7 @@ typedef struct {
uint16_t ebsvalve_a; uint16_t ebsvalve_a;
uint16_t ebsvalve_b; uint16_t ebsvalve_b;
uint16_t cooling_pump; uint16_t cooling_pump;
uint16_t lv_v;
} CurrentMeasurements; } CurrentMeasurements;
void currentMonitor_init(ADC_HandleTypeDef* hadc1, ADC_HandleTypeDef* hadc2, void currentMonitor_init(ADC_HandleTypeDef* hadc1, ADC_HandleTypeDef* hadc2,

View File

@ -75,6 +75,8 @@ void Error_Handler(void);
#define isense3_GPIO_Port GPIOA #define isense3_GPIO_Port GPIOA
#define isense7_Pin GPIO_PIN_3 #define isense7_Pin GPIO_PIN_3
#define isense7_GPIO_Port GPIOA #define isense7_GPIO_Port GPIOA
#define isense9_Pin GPIO_PIN_4
#define isense9_GPIO_Port GPIOF
#define isense2_Pin GPIO_PIN_4 #define isense2_Pin GPIO_PIN_4
#define isense2_GPIO_Port GPIOA #define isense2_GPIO_Port GPIOA
#define isense1_Pin GPIO_PIN_5 #define isense1_Pin GPIO_PIN_5
@ -83,6 +85,8 @@ void Error_Handler(void);
#define isense10_GPIO_Port GPIOA #define isense10_GPIO_Port GPIOA
#define isense4_Pin GPIO_PIN_7 #define isense4_Pin GPIO_PIN_7
#define isense4_GPIO_Port GPIOA #define isense4_GPIO_Port GPIOA
#define LV_sens_Pin GPIO_PIN_4
#define LV_sens_GPIO_Port GPIOC
#define GSS_GPIO_Pin GPIO_PIN_0 #define GSS_GPIO_Pin GPIO_PIN_0
#define GSS_GPIO_GPIO_Port GPIOB #define GSS_GPIO_GPIO_Port GPIOB
#define DSEL_3_Pin GPIO_PIN_12 #define DSEL_3_Pin GPIO_PIN_12

View File

@ -51,7 +51,7 @@
/*#define HAL_CRYP_MODULE_ENABLED */ /*#define HAL_CRYP_MODULE_ENABLED */
/*#define HAL_DAC_MODULE_ENABLED */ /*#define HAL_DAC_MODULE_ENABLED */
/*#define HAL_I2S_MODULE_ENABLED */ /*#define HAL_I2S_MODULE_ENABLED */
#define HAL_IWDG_MODULE_ENABLED /*#define HAL_IWDG_MODULE_ENABLED */
/*#define HAL_LCD_MODULE_ENABLED */ /*#define HAL_LCD_MODULE_ENABLED */
/*#define HAL_LPTIM_MODULE_ENABLED */ /*#define HAL_LPTIM_MODULE_ENABLED */
/*#define HAL_RNG_MODULE_ENABLED */ /*#define HAL_RNG_MODULE_ENABLED */

View File

@ -56,9 +56,11 @@ void DebugMon_Handler(void);
void PendSV_Handler(void); void PendSV_Handler(void);
void SysTick_Handler(void); void SysTick_Handler(void);
void DMA1_Channel1_IRQHandler(void); void DMA1_Channel1_IRQHandler(void);
void ADC1_2_IRQHandler(void);
void USB_LP_CAN_RX0_IRQHandler(void); void USB_LP_CAN_RX0_IRQHandler(void);
void CAN_RX1_IRQHandler(void); void CAN_RX1_IRQHandler(void);
void CAN_SCE_IRQHandler(void); void CAN_SCE_IRQHandler(void);
void TIM6_DAC_IRQHandler(void);
void DMA2_Channel1_IRQHandler(void); void DMA2_Channel1_IRQHandler(void);
/* USER CODE BEGIN EFP */ /* USER CODE BEGIN EFP */

View File

@ -13,8 +13,9 @@ volatile uint8_t canmsg_received = 0;
extern PortExtenderGPIO EN_Ports; extern PortExtenderGPIO EN_Ports;
extern CurrentMeasurements current_measurements_adc_val; extern CurrentMeasurements current_measurements_adc_val;
//extern IWDG_HandleTypeDef hiwdg;
extern uint32_t lastheartbeat;
extern int inhibit_SDC; extern int inhibit_SDC;
extern IWDG_HandleTypeDef hiwdg;
void can_init(CAN_HandleTypeDef* hcan) { void can_init(CAN_HandleTypeDef* hcan) {
ftcan_init(hcan); ftcan_init(hcan);
@ -31,13 +32,12 @@ void can_sendloop() {
status_data[3] = rxstate.radiatorfans; status_data[3] = rxstate.radiatorfans;
status_data[4] = rxstate.pwmaggregat; status_data[4] = rxstate.pwmaggregat;
status_data[5] = rxstate.cooling_pump; status_data[5] = rxstate.cooling_pump;
status_data[6] = 0xFF ^ rxstate.checksum; status_data[6] = !inhibit_SDC; // Now means "WD Okay". TODO: Change DBC
ftcan_transmit(TX_STATUS_MSG_ID, status_data, 7); ftcan_transmit(TX_STATUS_MSG_ID, status_data, 7);
uint8_t data[8]; uint8_t data[8];
return;
if (additionaltxcouter < 4) { switch (additionaltxcouter) {
switch (additionaltxcouter) {
case 0: case 0:
data[0] = current_measurements_adc_val.always_on >> 8; data[0] = current_measurements_adc_val.always_on >> 8;
@ -90,27 +90,38 @@ return;
ftcan_transmit(CUR_CHANNELS_4_ID, data, 8); ftcan_transmit(CUR_CHANNELS_4_ID, data, 8);
break; break;
case 4:
data[0] = current_measurements_adc_val.lv_v >> 8;
data[1] = current_measurements_adc_val.lv_v && 0xFF;
ftcan_transmit(LV_SENS_ID, data, 2);
default: default:
break; break;
}
additionaltxcouter++;
} else {
additionaltxcouter = 0;
} }
additionaltxcouter = (additionaltxcouter+1) % 5;
} }
void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t* data) { void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t* data) {
canmsg_received = 1; canmsg_received = 1;
if ((id == RX_STATUS_MSG_ID) && (datalen == 7)) { if ((id == RX_STATUS_MSG_ID) && (datalen == 7)) {
rxstate.iostatus.porta.porta = data[0]; rxstate.iostatus.porta.porta = data[0];
rxstate.iostatus.portb.portb = data[1]; rxstate.iostatus.portb.portb = data[1];
rxstate.radiatorfans = data[2]; rxstate.radiatorfans = data[2];
rxstate.tsacfans = data[3]; rxstate.tsacfans = data[3];
rxstate.pwmaggregat = data[4]; rxstate.pwmaggregat = data[4];
rxstate.cooling_pump = data[5]; rxstate.cooling_pump = data[5];
rxstate.checksum = data[6]; rxstate.checksum = data[6];
}
if (id == RX_STATUS_HEARTBEAT) {
lastheartbeat = HAL_GetTick();
inhibit_SDC = 0;
} }
if (id == RX_STATUS_HEARTBEAT)
HAL_IWDG_Refresh(&hiwdg);
} }

View File

@ -71,7 +71,7 @@ void ChannelControl_UpdatePWMs(
} }
if (timer2_running) { if (timer2_running) {
if ( (tsacfans == 0) || (pwmaggregat == 0) ) { if ( (tsacfans == 0) && (pwmaggregat == 0) ) {
timer2_running = 0; timer2_running = 0;
HAL_TIM_PWM_Stop(pwmtimer2, TIM_CHANNEL_2); HAL_TIM_PWM_Stop(pwmtimer2, TIM_CHANNEL_2);
HAL_TIM_PWM_Stop(pwmtimer2, TIM_CHANNEL_3); HAL_TIM_PWM_Stop(pwmtimer2, TIM_CHANNEL_3);

View File

@ -10,29 +10,30 @@
volatile union adc1_channels { volatile union adc1_channels {
struct { struct {
uint16_t isense12; // acu uint16_t isense5; // LiDAR | GSS (DSEL7)
uint16_t isense11; // epsc uint16_t isense3; // AlwaysOn | SDC (DSEL4)
uint16_t isense6; // radiator fans uint16_t isense7; // Misc | Inverters (DSEL5)
uint16_t isense13; // tsac fans uint16_t isense9; // DRS
uint16_t isense5; // gss and lidar uint16_t isense12; // ACU
uint16_t isense3; // sdc and always on uint16_t isense11; // EPSC = ELIAS
uint16_t isense7; // misc and inverters uint16_t isense6; // Radiator Fans
uint16_t isense13; // TSAC Fans
} adcbank1; } adcbank1;
uint16_t adcbuffer[7]; // array 7*16 bit uint16_t adcbuffer[8]; // array 8*16 bit
} adc_channels1; } adc_channels1;
// ADC's anpassen adc1 - 9, adc2 ist halt 5 , buffer anpassen und namen auch ( isense usw) // ADC's anpassen adc1 - 9, adc2 ist halt 5 , buffer anpassen und namen auch ( isense usw)
volatile union adc2_channels { volatile union adc2_channels {
struct { struct {
uint16_t isense2; // ebs valve a and ebs valve b uint16_t isense2; // EBS A | EBS B (DSEL3)
uint16_t isense1; // ebs cs valve uint16_t isense1; // EBS CS
uint16_t isense10; // hyr aggregat uint16_t isense10; // Hydraulic Aggregate
uint16_t isense4; // cooling pump and reserved uint16_t isense4; // Water Pump | Reserved (DSEL8)
uint16_t lv_sens; // LV voltage
} adcbank1; } adcbank1;
uint16_t adcbuffer[4]; uint16_t adcbuffer[5];
} adc_channels2; } adc_channels2;
@ -46,82 +47,97 @@ ADC_HandleTypeDef* adc2;
void currentMonitor_init(ADC_HandleTypeDef* hadc1, ADC_HandleTypeDef* hadc2, // init ist initilisierung void currentMonitor_init(ADC_HandleTypeDef* hadc1, ADC_HandleTypeDef* hadc2, // init ist initilisierung
TIM_HandleTypeDef* trigtim) { TIM_HandleTypeDef* trigtim) {
HAL_GPIO_WritePin(DSEL_3_GPIO_Port, DSEL_3_Pin, adcbank2); //DSELs zu adc's neu zuordnen HAL_GPIO_WritePin(DSEL_3_GPIO_Port, DSEL_3_Pin, adcbank2);
HAL_GPIO_WritePin(DSEL_4_GPIO_Port, DSEL_4_Pin, adcbank2); HAL_GPIO_WritePin(DSEL_4_GPIO_Port, DSEL_4_Pin, adcbank1);
HAL_GPIO_WritePin(DSEL_5_GPIO_Port, DSEL_5_Pin, adcbank1); HAL_GPIO_WritePin(DSEL_5_GPIO_Port, DSEL_5_Pin, adcbank1);
HAL_GPIO_WritePin(DSEL_7_GPIO_Port, DSEL_7_Pin, adcbank1); HAL_GPIO_WritePin(DSEL_7_GPIO_Port, DSEL_7_Pin, adcbank1);
HAL_GPIO_WritePin(DSEL_8_GPIO_Port, DSEL_8_Pin, adcbank2); HAL_GPIO_WritePin(DSEL_8_GPIO_Port, DSEL_8_Pin, adcbank2);
adc1 = hadc1; adc1 = hadc1;
adc2 = hadc2; adc2 = hadc2;
HAL_TIM_Base_Start(trigtim); HAL_TIM_Base_Start(trigtim);
HAL_ADC_Start_DMA(hadc1, (uint32_t*)adc_channels1.adcbuffer, 7); HAL_ADC_Start_DMA(hadc1, (uint32_t*)adc_channels1.adcbuffer, 8);
HAL_ADC_Start_DMA(hadc2, (uint32_t*)adc_channels2.adcbuffer, 7); // wie adc mit dma geht , red mit jasper HAL_ADC_Start_DMA(hadc2, (uint32_t*)adc_channels2.adcbuffer, 5); // wie adc mit dma geht , red mit jasper
} }
uint8_t currentMonitor_checklimits() { return 0; } uint8_t currentMonitor_checklimits() { return 0; }
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) { void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) {
if (hadc == adc1) {
if (adcbank1 == GPIO_PIN_RESET) {
current_measurements_adc_val.lidar =
adc_channels1.adcbank1.isense5 * CURR_SENSE_FACTOR_7_5A;
current_measurements_adc_val.always_on =
adc_channels1.adcbank1.isense3 * CURR_SENSE_FACTOR_5A;
current_measurements_adc_val.misc =
adc_channels1.adcbank1.isense7 * CURR_SENSE_FACTOR_7_5A;
adcbank1 = GPIO_PIN_SET;
} else {
current_measurements_adc_val.gss =
adc_channels1.adcbank1.isense5 * CURR_SENSE_FACTOR_7_5A;
current_measurements_adc_val.sdc =
adc_channels1.adcbank1.isense3 * CURR_SENSE_FACTOR_5A;
current_measurements_adc_val.inverters =
adc_channels1.adcbank1.isense7 * CURR_SENSE_FACTOR_7_5A;
adcbank1 = GPIO_PIN_RESET;
}
current_measurements_adc_val.servos =
adc_channels1.adcbank1.isense9 * CURR_SENSE_FACTOR_21A;
current_measurements_adc_val.acu =
adc_channels1.adcbank1.isense12 * CURR_SENSE_FACTOR_31A;
current_measurements_adc_val.epsc =
adc_channels1.adcbank1.isense11 * CURR_SENSE_FACTOR_21A;
current_measurements_adc_val.radiator_fans =
adc_channels1.adcbank1.isense6 * CURR_SENSE_FACTOR_21A;
current_measurements_adc_val.tsac_fans =
adc_channels1.adcbank1.isense13 * CURR_SENSE_FACTOR_31A;
HAL_GPIO_WritePin(DSEL_4_GPIO_Port, DSEL_4_Pin, adcbank1);
HAL_GPIO_WritePin(DSEL_5_GPIO_Port, DSEL_5_Pin, adcbank1);
HAL_GPIO_WritePin(DSEL_7_GPIO_Port, DSEL_7_Pin, adcbank1);
}
else
if (hadc == adc2) { if (hadc == adc2) {
if (adcbank2 == GPIO_PIN_RESET) { if (adcbank2 == GPIO_PIN_RESET) {
current_measurements_adc_val.ebsvalve_a =
current_measurements_adc_val.ebsvalve_a =
adc_channels2.adcbank1.isense2 * CURR_SENSE_FACTOR_5A; adc_channels2.adcbank1.isense2 * CURR_SENSE_FACTOR_5A;
current_measurements_adc_val.cooling_pump = current_measurements_adc_val.cooling_pump =
adc_channels2.adcbank1.isense4 * CURR_SENSE_FACTOR_7_5A; adc_channels2.adcbank1.isense4 * CURR_SENSE_FACTOR_7_5A;
adcbank2 = GPIO_PIN_SET;
} else {
current_measurements_adc_val.ebsvalve_b =
adc_channels2.adcbank1.isense2 * CURR_SENSE_FACTOR_5A;
current_measurements_adc_val.reserved =
adc_channels2.adcbank1.isense4 * CURR_SENSE_FACTOR_7_5A;
adcbank2 = GPIO_PIN_RESET;
}
current_measurements_adc_val.ebs_cs_valve =
adc_channels2.adcbank1.isense1 * CURR_SENSE_FACTOR_5A;
current_measurements_adc_val.aggregat =
adc_channels2.adcbank1.isense10 * CURR_SENSE_FACTOR_21A;
HAL_GPIO_WritePin(DSEL_3_GPIO_Port, DSEL_3_Pin, adcbank2 = GPIO_PIN_SET;
adcbank2);
HAL_GPIO_WritePin(DSEL_8_GPIO_Port, DSEL_8_Pin, } else {
adcbank2);
current_measurements_adc_val.ebsvalve_b =
adc_channels2.adcbank1.isense2 * CURR_SENSE_FACTOR_5A;
current_measurements_adc_val.reserved =
adc_channels2.adcbank1.isense4 * CURR_SENSE_FACTOR_7_5A;
adcbank2 = GPIO_PIN_RESET;
}
current_measurements_adc_val.ebs_cs_valve =
adc_channels2.adcbank1.isense1 * CURR_SENSE_FACTOR_5A;
current_measurements_adc_val.aggregat =
adc_channels2.adcbank1.isense10 * CURR_SENSE_FACTOR_21A;
current_measurements_adc_val.lv_v =
adc_channels2.adcbank1.lv_sens * LV_SENSE_FACTOR;
HAL_GPIO_WritePin(DSEL_3_GPIO_Port, DSEL_3_Pin, adcbank2);
HAL_GPIO_WritePin(DSEL_8_GPIO_Port, DSEL_8_Pin, adcbank2);
} }
if (hadc == adc1) { }
if (adcbank1 == GPIO_PIN_RESET) {
current_measurements_adc_val.sdc=
adc_channels1.adcbank1.isense3 * CURR_SENSE_FACTOR_5A;
current_measurements_adc_val.misc=
adc_channels1.adcbank1.isense7 * CURR_SENSE_FACTOR_7_5A;
current_measurements_adc_val.gss=
adc_channels1.adcbank1.isense5 * CURR_SENSE_FACTOR_7_5A;
adcbank1 = GPIO_PIN_SET;
} else {
current_measurements_adc_val.always_on =
adc_channels1.adcbank1.isense3 * CURR_SENSE_FACTOR_5A;
current_measurements_adc_val.inverters =
adc_channels1.adcbank1.isense7 * CURR_SENSE_FACTOR_7_5A;
current_measurements_adc_val.lidar=
adc_channels1.adcbank1.isense5 * CURR_SENSE_FACTOR_7_5A;
adcbank1 = GPIO_PIN_RESET;
}
current_measurements_adc_val.acu=
adc_channels1.adcbank1.isense12 * CURR_SENSE_FACTOR_31A;
current_measurements_adc_val.epsc =
adc_channels1.adcbank1.isense11 * CURR_SENSE_FACTOR_21A;
current_measurements_adc_val.tsac_fans =
adc_channels1.adcbank1.isense13 * CURR_SENSE_FACTOR_31A;
current_measurements_adc_val.radiator_fans=
adc_channels1.adcbank1.isense6 * CURR_SENSE_FACTOR_21A;
HAL_GPIO_WritePin(DSEL_4_GPIO_Port, DSEL_4_Pin,
adcbank1);
HAL_GPIO_WritePin(DSEL_5_GPIO_Port, DSEL_5_Pin,
adcbank1);
HAL_GPIO_WritePin(DSEL_7_GPIO_Port, DSEL_7_Pin,
adcbank1);
}
}
// current monitoring c und h anpassen

View File

@ -51,8 +51,6 @@ CAN_HandleTypeDef hcan;
I2C_HandleTypeDef hi2c1; I2C_HandleTypeDef hi2c1;
IWDG_HandleTypeDef hiwdg;
TIM_HandleTypeDef htim2; TIM_HandleTypeDef htim2;
TIM_HandleTypeDef htim3; TIM_HandleTypeDef htim3;
TIM_HandleTypeDef htim6; TIM_HandleTypeDef htim6;
@ -75,7 +73,6 @@ static void MX_TIM3_Init(void);
static void MX_I2C1_Init(void); static void MX_I2C1_Init(void);
static void MX_USART1_UART_Init(void); static void MX_USART1_UART_Init(void);
static void MX_TIM6_Init(void); static void MX_TIM6_Init(void);
static void MX_IWDG_Init(void);
/* USER CODE BEGIN PFP */ /* USER CODE BEGIN PFP */
/* USER CODE END PFP */ /* USER CODE END PFP */
@ -83,11 +80,12 @@ static void MX_IWDG_Init(void);
/* Private user code ---------------------------------------------------------*/ /* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */ /* USER CODE BEGIN 0 */
uint16_t adc1_buffer[7]; uint16_t adc1_buffer[7];
uint16_t adc2_buffer[7]; // data type specific to 16 bit integer with no sign ( vorzeichen ) uint16_t adc2_buffer[7]; // data type specific to 16 bit integer with no sign ( vorzeichen )
extern rx_status_frame rxstate; extern rx_status_frame rxstate;
extern volatile uint8_t canmsg_received; extern volatile uint8_t canmsg_received;
uint32_t lastheartbeat;
int inhibit_SDC; int inhibit_SDC;
/* USER CODE END 0 */ /* USER CODE END 0 */
@ -101,7 +99,7 @@ int main(void)
/* USER CODE BEGIN 1 */ /* USER CODE BEGIN 1 */
// Freeze WDG when debugging // Freeze WDG when debugging
__HAL_DBGMCU_FREEZE_IWDG(); //__HAL_DBGMCU_FREEZE_IWDG();
/* USER CODE END 1 */ /* USER CODE END 1 */
@ -132,10 +130,9 @@ int main(void)
MX_I2C1_Init(); MX_I2C1_Init();
MX_USART1_UART_Init(); MX_USART1_UART_Init();
MX_TIM6_Init(); MX_TIM6_Init();
//MX_IWDG_Init();
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
// REMINDER: Comment out the IWDG Init above!!! // REMINDER: Comment out the IWDG Init above!!!
HAL_GPIO_WritePin(STATUS_LED1_GPIO_Port , STATUS_LED1_Pin , GPIO_PIN_SET); HAL_GPIO_WritePin(STATUS_LED1_GPIO_Port , STATUS_LED1_Pin , GPIO_PIN_SET);
HAL_GPIO_WritePin(GSS_GPIO_GPIO_Port, GSS_GPIO_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(GSS_GPIO_GPIO_Port, GSS_GPIO_Pin, GPIO_PIN_SET);
@ -150,27 +147,26 @@ int main(void)
HAL_TIM_Base_Start(&htim3); HAL_TIM_Base_Start(&htim3);
// Prevent closing of SDC (esp. after WDG reset) // Prevent closing of SDC (esp. after WDG reset)
inhibit_SDC = 1; //inhibit_SDC = 1;
// Wait 1s to prevent bus error state while ABX is starting up // Wait 1s to prevent bus error state while ABX is starting up
// Wait 5s for the discharge of the DC link (so AMS can't restart) // Wait 5s for the discharge of the DC link (so AMS can't restart)
HAL_Delay(5000); //HAL_Delay(1000);
// SDC can now be closed // SDC can now be closed
inhibit_SDC = 0; inhibit_SDC = 0;
// PDU will reset if it doesn't receive a heartbeat every 120ms // PDU will reset if it doesn't receive a heartbeat every 120ms
MX_IWDG_Init(); //MX_IWDG_Init();
/* USER CODE END 2 */ /* USER CODE END 2 */
/* Infinite loop */ /* Infinite loop */
/* USER CODE BEGIN WHILE */ /* USER CODE BEGIN WHILE */
while(1) while(1) {
{
/* USER CODE END WHILE */ /* USER CODE END WHILE */
/* USER CODE BEGIN 3 */ /* USER CODE BEGIN 3 */
if (canmsg_received) { // USB zu CAN wandler , und dann CAN testen , validieren ob der code macht was es soll , red mit oskar/jasper if (canmsg_received) { // USB zu CAN wandler , und dann CAN testen , validieren ob der code macht was es soll , red mit oskar/jasper
canmsg_received = 0; canmsg_received = 0;
ChannelControl_UpdateGPIOs(rxstate.iostatus); ChannelControl_UpdateGPIOs(rxstate.iostatus);
ChannelControl_UpdatePWMs( ChannelControl_UpdatePWMs(
@ -186,7 +182,16 @@ while(1)
can_sendloop(); can_sendloop();
} }
currentMonitor_checklimits(); // ob irgnwo ueberstrom getreten ist // nominal WD time is 100ms, plus a bit of tolerance
// only trigger after 1s to allow for ABX bootup
if (((HAL_GetTick() - lastheartbeat) > 125U) && (HAL_GetTick() > 1000U)) {
// force open SDC, only resettable by power cycle
inhibit_SDC = 1;
}
HAL_GPIO_WritePin(STATUS_LED4_GPIO_Port , STATUS_LED4_Pin , inhibit_SDC);
currentMonitor_checklimits(); // ob irgnwo ueberstrom getreten ist
} }
/* USER CODE END 3 */ /* USER CODE END 3 */
} }
@ -204,11 +209,10 @@ void SystemClock_Config(void)
/** Initializes the RCC Oscillators according to the specified parameters /** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure. * in the RCC_OscInitTypeDef structure.
*/ */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1; RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL4; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL4;
@ -269,15 +273,15 @@ static void MX_ADC1_Init(void)
hadc1.Instance = ADC1; hadc1.Instance = ADC1;
hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1; hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;
hadc1.Init.Resolution = ADC_RESOLUTION_12B; hadc1.Init.Resolution = ADC_RESOLUTION_12B;
hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE; hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
hadc1.Init.ContinuousConvMode = DISABLE; hadc1.Init.ContinuousConvMode = DISABLE;
hadc1.Init.DiscontinuousConvMode = DISABLE; hadc1.Init.DiscontinuousConvMode = DISABLE;
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING;
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START; hadc1.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T6_TRGO;
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc1.Init.NbrOfConversion = 1; hadc1.Init.NbrOfConversion = 8;
hadc1.Init.DMAContinuousRequests = ENABLE; hadc1.Init.DMAContinuousRequests = ENABLE;
hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV; hadc1.Init.EOCSelection = ADC_EOC_SEQ_CONV;
hadc1.Init.LowPowerAutoWait = DISABLE; hadc1.Init.LowPowerAutoWait = DISABLE;
hadc1.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN; hadc1.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN;
if (HAL_ADC_Init(&hadc1) != HAL_OK) if (HAL_ADC_Init(&hadc1) != HAL_OK)
@ -295,16 +299,79 @@ static void MX_ADC1_Init(void)
/** Configure Regular Channel /** Configure Regular Channel
*/ */
sConfig.Channel = ADC_CHANNEL_1; sConfig.Channel = ADC_CHANNEL_2;
sConfig.Rank = ADC_REGULAR_RANK_1; sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SingleDiff = ADC_SINGLE_ENDED; sConfig.SingleDiff = ADC_SINGLE_ENDED;
sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5; sConfig.SamplingTime = ADC_SAMPLETIME_61CYCLES_5;
sConfig.OffsetNumber = ADC_OFFSET_NONE; sConfig.OffsetNumber = ADC_OFFSET_NONE;
sConfig.Offset = 0; sConfig.Offset = 0;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{ {
Error_Handler(); Error_Handler();
} }
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_3;
sConfig.Rank = ADC_REGULAR_RANK_2;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
Error_Handler();
}
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_4;
sConfig.Rank = ADC_REGULAR_RANK_3;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
Error_Handler();
}
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_5;
sConfig.Rank = ADC_REGULAR_RANK_4;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
Error_Handler();
}
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_6;
sConfig.Rank = ADC_REGULAR_RANK_5;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
Error_Handler();
}
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_7;
sConfig.Rank = ADC_REGULAR_RANK_6;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
Error_Handler();
}
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_8;
sConfig.Rank = ADC_REGULAR_RANK_7;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
Error_Handler();
}
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_9;
sConfig.Rank = ADC_REGULAR_RANK_8;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN ADC1_Init 2 */ /* USER CODE BEGIN ADC1_Init 2 */
/* USER CODE END ADC1_Init 2 */ /* USER CODE END ADC1_Init 2 */
@ -334,15 +401,15 @@ static void MX_ADC2_Init(void)
hadc2.Instance = ADC2; hadc2.Instance = ADC2;
hadc2.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1; hadc2.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;
hadc2.Init.Resolution = ADC_RESOLUTION_12B; hadc2.Init.Resolution = ADC_RESOLUTION_12B;
hadc2.Init.ScanConvMode = ADC_SCAN_DISABLE; hadc2.Init.ScanConvMode = ADC_SCAN_ENABLE;
hadc2.Init.ContinuousConvMode = DISABLE; hadc2.Init.ContinuousConvMode = DISABLE;
hadc2.Init.DiscontinuousConvMode = DISABLE; hadc2.Init.DiscontinuousConvMode = DISABLE;
hadc2.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc2.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING;
hadc2.Init.ExternalTrigConv = ADC_SOFTWARE_START; hadc2.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T6_TRGO;
hadc2.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc2.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc2.Init.NbrOfConversion = 1; hadc2.Init.NbrOfConversion = 5;
hadc2.Init.DMAContinuousRequests = ENABLE; hadc2.Init.DMAContinuousRequests = ENABLE;
hadc2.Init.EOCSelection = ADC_EOC_SINGLE_CONV; hadc2.Init.EOCSelection = ADC_EOC_SEQ_CONV;
hadc2.Init.LowPowerAutoWait = DISABLE; hadc2.Init.LowPowerAutoWait = DISABLE;
hadc2.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN; hadc2.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN;
if (HAL_ADC_Init(&hadc2) != HAL_OK) if (HAL_ADC_Init(&hadc2) != HAL_OK)
@ -355,13 +422,49 @@ static void MX_ADC2_Init(void)
sConfig.Channel = ADC_CHANNEL_1; sConfig.Channel = ADC_CHANNEL_1;
sConfig.Rank = ADC_REGULAR_RANK_1; sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SingleDiff = ADC_SINGLE_ENDED; sConfig.SingleDiff = ADC_SINGLE_ENDED;
sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5; sConfig.SamplingTime = ADC_SAMPLETIME_61CYCLES_5;
sConfig.OffsetNumber = ADC_OFFSET_NONE; sConfig.OffsetNumber = ADC_OFFSET_NONE;
sConfig.Offset = 0; sConfig.Offset = 0;
if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK) if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)
{ {
Error_Handler(); Error_Handler();
} }
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_2;
sConfig.Rank = ADC_REGULAR_RANK_2;
if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)
{
Error_Handler();
}
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_3;
sConfig.Rank = ADC_REGULAR_RANK_3;
if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)
{
Error_Handler();
}
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_4;
sConfig.Rank = ADC_REGULAR_RANK_4;
if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)
{
Error_Handler();
}
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_5;
sConfig.Rank = ADC_REGULAR_RANK_5;
if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN ADC2_Init 2 */ /* USER CODE BEGIN ADC2_Init 2 */
/* USER CODE END ADC2_Init 2 */ /* USER CODE END ADC2_Init 2 */
@ -453,35 +556,6 @@ static void MX_I2C1_Init(void)
} }
/**
* @brief IWDG Initialization Function
* @param None
* @retval None
*/
static void MX_IWDG_Init(void)
{
/* USER CODE BEGIN IWDG_Init 0 */
/* USER CODE END IWDG_Init 0 */
/* USER CODE BEGIN IWDG_Init 1 */
/* USER CODE END IWDG_Init 1 */
hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_4;
hiwdg.Init.Window = 1000;
hiwdg.Init.Reload = 1000;
if (HAL_IWDG_Init(&hiwdg) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN IWDG_Init 2 */
/* USER CODE END IWDG_Init 2 */
}
/** /**
* @brief TIM2 Initialization Function * @brief TIM2 Initialization Function
* @param None * @param None
@ -698,6 +772,9 @@ static void MX_GPIO_Init(void)
__HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(DSEL_8_GPIO_Port, DSEL_8_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */ /*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, GSS_GPIO_Pin|DSEL_3_Pin|DSEL_4_Pin|DSEL_5_Pin HAL_GPIO_WritePin(GPIOB, GSS_GPIO_Pin|DSEL_3_Pin|DSEL_4_Pin|DSEL_5_Pin
|DSEL_6_Pin|DSEL_7_Pin, GPIO_PIN_RESET); |DSEL_6_Pin|DSEL_7_Pin, GPIO_PIN_RESET);
@ -705,6 +782,13 @@ static void MX_GPIO_Init(void)
/*Configure GPIO pin Output Level */ /*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, STATUS_LED1_Pin|STATUS_LED2_Pin|STATUS_LED3_Pin|STATUS_LED4_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOC, STATUS_LED1_Pin|STATUS_LED2_Pin|STATUS_LED3_Pin|STATUS_LED4_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : DSEL_8_Pin */
GPIO_InitStruct.Pin = DSEL_8_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(DSEL_8_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : GSS_GPIO_Pin DSEL_3_Pin DSEL_4_Pin DSEL_5_Pin /*Configure GPIO pins : GSS_GPIO_Pin DSEL_3_Pin DSEL_4_Pin DSEL_5_Pin
DSEL_6_Pin DSEL_7_Pin */ DSEL_6_Pin DSEL_7_Pin */
GPIO_InitStruct.Pin = GSS_GPIO_Pin|DSEL_3_Pin|DSEL_4_Pin|DSEL_5_Pin GPIO_InitStruct.Pin = GSS_GPIO_Pin|DSEL_3_Pin|DSEL_4_Pin|DSEL_5_Pin

View File

@ -106,26 +106,32 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
__HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
/**ADC1 GPIO Configuration /**ADC1 GPIO Configuration
PC0 ------> ADC1_IN6 PC0 ------> ADC1_IN6
PC1 ------> ADC1_IN7 PC1 ------> ADC1_IN7
PC2 ------> ADC1_IN8 PC2 ------> ADC1_IN8
PC3 ------> ADC1_IN9 PC3 ------> ADC1_IN9
PA0 ------> ADC1_IN1
PA1 ------> ADC1_IN2 PA1 ------> ADC1_IN2
PA2 ------> ADC1_IN3 PA2 ------> ADC1_IN3
PA3 ------> ADC1_IN4 PA3 ------> ADC1_IN4
PF4 ------> ADC1_IN5
*/ */
GPIO_InitStruct.Pin = isense12_Pin|isense11_Pin|isense6_Pin|isense13_Pin; GPIO_InitStruct.Pin = isense12_Pin|isense11_Pin|isense6_Pin|isense13_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = DSEL_8_Pin|isense5_Pin|isense3_Pin|isense7_Pin; GPIO_InitStruct.Pin = isense5_Pin|isense3_Pin|isense7_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = isense9_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(isense9_GPIO_Port, &GPIO_InitStruct);
/* ADC1 DMA Init */ /* ADC1 DMA Init */
/* ADC1 Init */ /* ADC1 Init */
hdma_adc1.Instance = DMA1_Channel1; hdma_adc1.Instance = DMA1_Channel1;
@ -143,6 +149,9 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
__HAL_LINKDMA(hadc,DMA_Handle,hdma_adc1); __HAL_LINKDMA(hadc,DMA_Handle,hdma_adc1);
/* ADC1 interrupt Init */
HAL_NVIC_SetPriority(ADC1_2_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(ADC1_2_IRQn);
/* USER CODE BEGIN ADC1_MspInit 1 */ /* USER CODE BEGIN ADC1_MspInit 1 */
/* USER CODE END ADC1_MspInit 1 */ /* USER CODE END ADC1_MspInit 1 */
@ -172,10 +181,10 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_4; GPIO_InitStruct.Pin = LV_sens_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); HAL_GPIO_Init(LV_sens_GPIO_Port, &GPIO_InitStruct);
/* ADC2 DMA Init */ /* ADC2 DMA Init */
/* ADC2 Init */ /* ADC2 Init */
@ -194,6 +203,9 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
__HAL_LINKDMA(hadc,DMA_Handle,hdma_adc2); __HAL_LINKDMA(hadc,DMA_Handle,hdma_adc2);
/* ADC2 interrupt Init */
HAL_NVIC_SetPriority(ADC1_2_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(ADC1_2_IRQn);
/* USER CODE BEGIN ADC2_MspInit 1 */ /* USER CODE BEGIN ADC2_MspInit 1 */
/* USER CODE END ADC2_MspInit 1 */ /* USER CODE END ADC2_MspInit 1 */
@ -225,17 +237,29 @@ void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
PC1 ------> ADC1_IN7 PC1 ------> ADC1_IN7
PC2 ------> ADC1_IN8 PC2 ------> ADC1_IN8
PC3 ------> ADC1_IN9 PC3 ------> ADC1_IN9
PA0 ------> ADC1_IN1
PA1 ------> ADC1_IN2 PA1 ------> ADC1_IN2
PA2 ------> ADC1_IN3 PA2 ------> ADC1_IN3
PA3 ------> ADC1_IN4 PA3 ------> ADC1_IN4
PF4 ------> ADC1_IN5
*/ */
HAL_GPIO_DeInit(GPIOC, isense12_Pin|isense11_Pin|isense6_Pin|isense13_Pin); HAL_GPIO_DeInit(GPIOC, isense12_Pin|isense11_Pin|isense6_Pin|isense13_Pin);
HAL_GPIO_DeInit(GPIOA, DSEL_8_Pin|isense5_Pin|isense3_Pin|isense7_Pin); HAL_GPIO_DeInit(GPIOA, isense5_Pin|isense3_Pin|isense7_Pin);
HAL_GPIO_DeInit(isense9_GPIO_Port, isense9_Pin);
/* ADC1 DMA DeInit */ /* ADC1 DMA DeInit */
HAL_DMA_DeInit(hadc->DMA_Handle); HAL_DMA_DeInit(hadc->DMA_Handle);
/* ADC1 interrupt DeInit */
/* USER CODE BEGIN ADC1:ADC1_2_IRQn disable */
/**
* Uncomment the line below to disable the "ADC1_2_IRQn" interrupt
* Be aware, disabling shared interrupt may affect other IPs
*/
/* HAL_NVIC_DisableIRQ(ADC1_2_IRQn); */
/* USER CODE END ADC1:ADC1_2_IRQn disable */
/* USER CODE BEGIN ADC1_MspDeInit 1 */ /* USER CODE BEGIN ADC1_MspDeInit 1 */
/* USER CODE END ADC1_MspDeInit 1 */ /* USER CODE END ADC1_MspDeInit 1 */
@ -260,10 +284,20 @@ void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
*/ */
HAL_GPIO_DeInit(GPIOA, isense2_Pin|isense1_Pin|isense10_Pin|isense4_Pin); HAL_GPIO_DeInit(GPIOA, isense2_Pin|isense1_Pin|isense10_Pin|isense4_Pin);
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_4); HAL_GPIO_DeInit(LV_sens_GPIO_Port, LV_sens_Pin);
/* ADC2 DMA DeInit */ /* ADC2 DMA DeInit */
HAL_DMA_DeInit(hadc->DMA_Handle); HAL_DMA_DeInit(hadc->DMA_Handle);
/* ADC2 interrupt DeInit */
/* USER CODE BEGIN ADC2:ADC1_2_IRQn disable */
/**
* Uncomment the line below to disable the "ADC1_2_IRQn" interrupt
* Be aware, disabling shared interrupt may affect other IPs
*/
/* HAL_NVIC_DisableIRQ(ADC1_2_IRQn); */
/* USER CODE END ADC2:ADC1_2_IRQn disable */
/* USER CODE BEGIN ADC2_MspDeInit 1 */ /* USER CODE BEGIN ADC2_MspDeInit 1 */
/* USER CODE END ADC2_MspDeInit 1 */ /* USER CODE END ADC2_MspDeInit 1 */
@ -477,6 +511,9 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
/* USER CODE END TIM6_MspInit 0 */ /* USER CODE END TIM6_MspInit 0 */
/* Peripheral clock enable */ /* Peripheral clock enable */
__HAL_RCC_TIM6_CLK_ENABLE(); __HAL_RCC_TIM6_CLK_ENABLE();
/* TIM6 interrupt Init */
HAL_NVIC_SetPriority(TIM6_DAC_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn);
/* USER CODE BEGIN TIM6_MspInit 1 */ /* USER CODE BEGIN TIM6_MspInit 1 */
/* USER CODE END TIM6_MspInit 1 */ /* USER CODE END TIM6_MspInit 1 */
@ -580,6 +617,9 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
/* USER CODE END TIM6_MspDeInit 0 */ /* USER CODE END TIM6_MspDeInit 0 */
/* Peripheral clock disable */ /* Peripheral clock disable */
__HAL_RCC_TIM6_CLK_DISABLE(); __HAL_RCC_TIM6_CLK_DISABLE();
/* TIM6 interrupt DeInit */
HAL_NVIC_DisableIRQ(TIM6_DAC_IRQn);
/* USER CODE BEGIN TIM6_MspDeInit 1 */ /* USER CODE BEGIN TIM6_MspDeInit 1 */
/* USER CODE END TIM6_MspDeInit 1 */ /* USER CODE END TIM6_MspDeInit 1 */

View File

@ -57,7 +57,10 @@
/* External variables --------------------------------------------------------*/ /* External variables --------------------------------------------------------*/
extern DMA_HandleTypeDef hdma_adc1; extern DMA_HandleTypeDef hdma_adc1;
extern DMA_HandleTypeDef hdma_adc2; extern DMA_HandleTypeDef hdma_adc2;
extern ADC_HandleTypeDef hadc1;
extern ADC_HandleTypeDef hadc2;
extern CAN_HandleTypeDef hcan; extern CAN_HandleTypeDef hcan;
extern TIM_HandleTypeDef htim6;
/* USER CODE BEGIN EV */ /* USER CODE BEGIN EV */
/* USER CODE END EV */ /* USER CODE END EV */
@ -215,6 +218,21 @@ void DMA1_Channel1_IRQHandler(void)
/* USER CODE END DMA1_Channel1_IRQn 1 */ /* USER CODE END DMA1_Channel1_IRQn 1 */
} }
/**
* @brief This function handles ADC1 and ADC2 interrupts.
*/
void ADC1_2_IRQHandler(void)
{
/* USER CODE BEGIN ADC1_2_IRQn 0 */
/* USER CODE END ADC1_2_IRQn 0 */
HAL_ADC_IRQHandler(&hadc1);
HAL_ADC_IRQHandler(&hadc2);
/* USER CODE BEGIN ADC1_2_IRQn 1 */
/* USER CODE END ADC1_2_IRQn 1 */
}
/** /**
* @brief This function handles USB low priority or CAN_RX0 interrupts. * @brief This function handles USB low priority or CAN_RX0 interrupts.
*/ */
@ -257,6 +275,20 @@ void CAN_SCE_IRQHandler(void)
/* USER CODE END CAN_SCE_IRQn 1 */ /* USER CODE END CAN_SCE_IRQn 1 */
} }
/**
* @brief This function handles Timer 6 interrupt and DAC underrun interrupts.
*/
void TIM6_DAC_IRQHandler(void)
{
/* USER CODE BEGIN TIM6_DAC_IRQn 0 */
/* USER CODE END TIM6_DAC_IRQn 0 */
HAL_TIM_IRQHandler(&htim6);
/* USER CODE BEGIN TIM6_DAC_IRQn 1 */
/* USER CODE END TIM6_DAC_IRQn 1 */
}
/** /**
* @brief This function handles DMA2 channel1 global interrupt. * @brief This function handles DMA2 channel1 global interrupt.
*/ */

View File

@ -1,24 +1,91 @@
#MicroXplorer Configuration settings - do not modify #MicroXplorer Configuration settings - do not modify
ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_1 ADC1.Channel-11\#ChannelRegularConversion=ADC_CHANNEL_2
ADC1.Channel-12\#ChannelRegularConversion=ADC_CHANNEL_3
ADC1.Channel-13\#ChannelRegularConversion=ADC_CHANNEL_4
ADC1.Channel-14\#ChannelRegularConversion=ADC_CHANNEL_5
ADC1.Channel-15\#ChannelRegularConversion=ADC_CHANNEL_6
ADC1.Channel-16\#ChannelRegularConversion=ADC_CHANNEL_7
ADC1.Channel-17\#ChannelRegularConversion=ADC_CHANNEL_8
ADC1.Channel-18\#ChannelRegularConversion=ADC_CHANNEL_9
ADC1.DMAContinuousRequests=ENABLE ADC1.DMAContinuousRequests=ENABLE
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,Offset-0\#ChannelRegularConversion,NbrOfConversionFlag,master,DMAContinuousRequests,NbrOfConversion ADC1.EOCSelection=ADC_EOC_SEQ_CONV
ADC1.NbrOfConversion=1 ADC1.EnableRegularConversion=ENABLE
ADC1.ExternalTrigConv=ADC_EXTERNALTRIGCONV_T6_TRGO
ADC1.IPParameters=DMAContinuousRequests,EOCSelection,EnableRegularConversion,Rank-11\#ChannelRegularConversion,Channel-11\#ChannelRegularConversion,SamplingTime-11\#ChannelRegularConversion,OffsetNumber-11\#ChannelRegularConversion,Offset-11\#ChannelRegularConversion,NbrOfConversionFlag,Rank-12\#ChannelRegularConversion,Channel-12\#ChannelRegularConversion,SamplingTime-12\#ChannelRegularConversion,OffsetNumber-12\#ChannelRegularConversion,Offset-12\#ChannelRegularConversion,Rank-13\#ChannelRegularConversion,Channel-13\#ChannelRegularConversion,SamplingTime-13\#ChannelRegularConversion,OffsetNumber-13\#ChannelRegularConversion,Offset-13\#ChannelRegularConversion,Rank-14\#ChannelRegularConversion,Channel-14\#ChannelRegularConversion,SamplingTime-14\#ChannelRegularConversion,OffsetNumber-14\#ChannelRegularConversion,Offset-14\#ChannelRegularConversion,Rank-15\#ChannelRegularConversion,Channel-15\#ChannelRegularConversion,SamplingTime-15\#ChannelRegularConversion,OffsetNumber-15\#ChannelRegularConversion,Offset-15\#ChannelRegularConversion,Rank-16\#ChannelRegularConversion,Channel-16\#ChannelRegularConversion,SamplingTime-16\#ChannelRegularConversion,OffsetNumber-16\#ChannelRegularConversion,Offset-16\#ChannelRegularConversion,Rank-17\#ChannelRegularConversion,Channel-17\#ChannelRegularConversion,SamplingTime-17\#ChannelRegularConversion,OffsetNumber-17\#ChannelRegularConversion,Offset-17\#ChannelRegularConversion,NbrOfConversion,ExternalTrigConv,master,Rank-18\#ChannelRegularConversion,Channel-18\#ChannelRegularConversion,SamplingTime-18\#ChannelRegularConversion,SamplingTimeOPAMP-18\#ChannelRegularConversion,OffsetNumber-18\#ChannelRegularConversion,Offset-18\#ChannelRegularConversion
ADC1.NbrOfConversion=8
ADC1.NbrOfConversionFlag=1 ADC1.NbrOfConversionFlag=1
ADC1.Offset-0\#ChannelRegularConversion=0 ADC1.Offset-11\#ChannelRegularConversion=0
ADC1.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE ADC1.Offset-12\#ChannelRegularConversion=0
ADC1.Rank-0\#ChannelRegularConversion=1 ADC1.Offset-13\#ChannelRegularConversion=0
ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_1CYCLE_5 ADC1.Offset-14\#ChannelRegularConversion=0
ADC1.Offset-15\#ChannelRegularConversion=0
ADC1.Offset-16\#ChannelRegularConversion=0
ADC1.Offset-17\#ChannelRegularConversion=0
ADC1.Offset-18\#ChannelRegularConversion=0
ADC1.OffsetNumber-11\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC1.OffsetNumber-12\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC1.OffsetNumber-13\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC1.OffsetNumber-14\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC1.OffsetNumber-15\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC1.OffsetNumber-16\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC1.OffsetNumber-17\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC1.OffsetNumber-18\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC1.Rank-11\#ChannelRegularConversion=1
ADC1.Rank-12\#ChannelRegularConversion=2
ADC1.Rank-13\#ChannelRegularConversion=3
ADC1.Rank-14\#ChannelRegularConversion=4
ADC1.Rank-15\#ChannelRegularConversion=5
ADC1.Rank-16\#ChannelRegularConversion=6
ADC1.Rank-17\#ChannelRegularConversion=7
ADC1.Rank-18\#ChannelRegularConversion=8
ADC1.SamplingTime-11\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC1.SamplingTime-12\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC1.SamplingTime-13\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC1.SamplingTime-14\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC1.SamplingTime-15\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC1.SamplingTime-16\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC1.SamplingTime-17\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC1.SamplingTime-18\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC1.SamplingTimeOPAMP-18\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC1.master=1 ADC1.master=1
ADC2.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_1 ADC2.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_1
ADC2.Channel-1\#ChannelRegularConversion=ADC_CHANNEL_2
ADC2.Channel-2\#ChannelRegularConversion=ADC_CHANNEL_3
ADC2.Channel-3\#ChannelRegularConversion=ADC_CHANNEL_4
ADC2.Channel-4\#ChannelRegularConversion=ADC_CHANNEL_5
ADC2.ClockPrescaler=ADC_CLOCK_ASYNC_DIV1 ADC2.ClockPrescaler=ADC_CLOCK_ASYNC_DIV1
ADC2.DMAContinuousRequests=ENABLE ADC2.DMAContinuousRequests=ENABLE
ADC2.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,Offset-0\#ChannelRegularConversion,NbrOfConversionFlag,ClockPrescaler,LowPowerAutoWait,DMAContinuousRequests ADC2.EOCSelection=ADC_EOC_SEQ_CONV
ADC2.EnableInjectedConversion=DISABLE
ADC2.ExternalTrigConv=ADC_EXTERNALTRIGCONV_T6_TRGO
ADC2.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,Offset-0\#ChannelRegularConversion,NbrOfConversionFlag,ClockPrescaler,LowPowerAutoWait,DMAContinuousRequests,EOCSelection,NbrOfConversion,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,SamplingTimeOPAMP-1\#ChannelRegularConversion,OffsetNumber-1\#ChannelRegularConversion,Offset-1\#ChannelRegularConversion,Rank-2\#ChannelRegularConversion,Channel-2\#ChannelRegularConversion,SamplingTime-2\#ChannelRegularConversion,SamplingTimeOPAMP-2\#ChannelRegularConversion,OffsetNumber-2\#ChannelRegularConversion,Offset-2\#ChannelRegularConversion,Rank-3\#ChannelRegularConversion,Channel-3\#ChannelRegularConversion,SamplingTime-3\#ChannelRegularConversion,SamplingTimeOPAMP-3\#ChannelRegularConversion,OffsetNumber-3\#ChannelRegularConversion,Offset-3\#ChannelRegularConversion,Rank-4\#ChannelRegularConversion,Channel-4\#ChannelRegularConversion,SamplingTime-4\#ChannelRegularConversion,SamplingTimeOPAMP-4\#ChannelRegularConversion,OffsetNumber-4\#ChannelRegularConversion,Offset-4\#ChannelRegularConversion,ExternalTrigConv,EnableInjectedConversion
ADC2.LowPowerAutoWait=DISABLE ADC2.LowPowerAutoWait=DISABLE
ADC2.NbrOfConversion=5
ADC2.NbrOfConversionFlag=1 ADC2.NbrOfConversionFlag=1
ADC2.Offset-0\#ChannelRegularConversion=0 ADC2.Offset-0\#ChannelRegularConversion=0
ADC2.Offset-1\#ChannelRegularConversion=0
ADC2.Offset-2\#ChannelRegularConversion=0
ADC2.Offset-3\#ChannelRegularConversion=0
ADC2.Offset-4\#ChannelRegularConversion=0
ADC2.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE ADC2.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC2.OffsetNumber-1\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC2.OffsetNumber-2\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC2.OffsetNumber-3\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC2.OffsetNumber-4\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC2.Rank-0\#ChannelRegularConversion=1 ADC2.Rank-0\#ChannelRegularConversion=1
ADC2.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_1CYCLE_5 ADC2.Rank-1\#ChannelRegularConversion=2
ADC2.Rank-2\#ChannelRegularConversion=3
ADC2.Rank-3\#ChannelRegularConversion=4
ADC2.Rank-4\#ChannelRegularConversion=5
ADC2.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC2.SamplingTime-1\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC2.SamplingTime-2\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC2.SamplingTime-3\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC2.SamplingTime-4\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC2.SamplingTimeOPAMP-1\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC2.SamplingTimeOPAMP-2\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC2.SamplingTimeOPAMP-3\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
ADC2.SamplingTimeOPAMP-4\#ChannelRegularConversion=ADC_SAMPLETIME_61CYCLES_5
CAD.formats= CAD.formats=
CAD.pinconfig= CAD.pinconfig=
CAD.provider= CAD.provider=
@ -56,61 +123,56 @@ File.Version=6
GPIO.groupedBy=Group By Peripherals GPIO.groupedBy=Group By Peripherals
I2C1.IPParameters=Timing I2C1.IPParameters=Timing
I2C1.Timing=0x00303D5B I2C1.Timing=0x00303D5B
IWDG.IPParameters=Prescaler,Window,Reload
IWDG.Prescaler=IWDG_PRESCALER_4
IWDG.Reload=1000
IWDG.Window=1000
KeepUserPlacement=false KeepUserPlacement=false
Mcu.CPN=STM32F302RBT6 Mcu.CPN=STM32F302RBT6
Mcu.Family=STM32F3 Mcu.Family=STM32F3
Mcu.IP0=ADC1 Mcu.IP0=ADC1
Mcu.IP1=ADC2 Mcu.IP1=ADC2
Mcu.IP10=TIM3 Mcu.IP10=TIM6
Mcu.IP11=TIM6 Mcu.IP11=USART1
Mcu.IP12=USART1
Mcu.IP2=CAN Mcu.IP2=CAN
Mcu.IP3=DMA Mcu.IP3=DMA
Mcu.IP4=I2C1 Mcu.IP4=I2C1
Mcu.IP5=IWDG Mcu.IP5=NVIC
Mcu.IP6=NVIC Mcu.IP6=RCC
Mcu.IP7=RCC Mcu.IP7=SYS
Mcu.IP8=SYS Mcu.IP8=TIM2
Mcu.IP9=TIM2 Mcu.IP9=TIM3
Mcu.IPNb=13 Mcu.IPNb=12
Mcu.Name=STM32F302R(B-C)Tx Mcu.Name=STM32F302R(B-C)Tx
Mcu.Package=LQFP64 Mcu.Package=LQFP64
Mcu.Pin0=PF0-OSC_IN Mcu.Pin0=PF0-OSC_IN
Mcu.Pin1=PF1-OSC_OUT Mcu.Pin1=PF1-OSC_OUT
Mcu.Pin10=PA4 Mcu.Pin10=PF4
Mcu.Pin11=PA5 Mcu.Pin11=PA4
Mcu.Pin12=PA6 Mcu.Pin12=PA5
Mcu.Pin13=PA7 Mcu.Pin13=PA6
Mcu.Pin14=PC4 Mcu.Pin14=PA7
Mcu.Pin15=PB0 Mcu.Pin15=PC4
Mcu.Pin16=PB1 Mcu.Pin16=PB0
Mcu.Pin17=PB10 Mcu.Pin17=PB1
Mcu.Pin18=PB12 Mcu.Pin18=PB10
Mcu.Pin19=PB13 Mcu.Pin19=PB12
Mcu.Pin2=PC0 Mcu.Pin2=PC0
Mcu.Pin20=PB14 Mcu.Pin20=PB13
Mcu.Pin21=PB15 Mcu.Pin21=PB14
Mcu.Pin22=PC6 Mcu.Pin22=PB15
Mcu.Pin23=PC7 Mcu.Pin23=PC6
Mcu.Pin24=PC8 Mcu.Pin24=PC7
Mcu.Pin25=PC9 Mcu.Pin25=PC8
Mcu.Pin26=PA9 Mcu.Pin26=PC9
Mcu.Pin27=PA10 Mcu.Pin27=PA9
Mcu.Pin28=PA11 Mcu.Pin28=PA10
Mcu.Pin29=PA12 Mcu.Pin29=PA11
Mcu.Pin3=PC1 Mcu.Pin3=PC1
Mcu.Pin30=PA13 Mcu.Pin30=PA12
Mcu.Pin31=PA14 Mcu.Pin31=PA13
Mcu.Pin32=PA15 Mcu.Pin32=PA14
Mcu.Pin33=PB3 Mcu.Pin33=PA15
Mcu.Pin34=PB4 Mcu.Pin34=PB3
Mcu.Pin35=PB7 Mcu.Pin35=PB4
Mcu.Pin36=PB9 Mcu.Pin36=PB7
Mcu.Pin37=VP_IWDG_VS_IWDG Mcu.Pin37=PB9
Mcu.Pin38=VP_SYS_VS_Systick Mcu.Pin38=VP_SYS_VS_Systick
Mcu.Pin39=VP_TIM6_VS_ClockSourceINT Mcu.Pin39=VP_TIM6_VS_ClockSourceINT
Mcu.Pin4=PC2 Mcu.Pin4=PC2
@ -125,6 +187,7 @@ Mcu.UserConstants=
Mcu.UserName=STM32F302RBTx Mcu.UserName=STM32F302RBTx
MxCube.Version=6.11.1 MxCube.Version=6.11.1
MxDb.Version=DB.6.0.111 MxDb.Version=DB.6.0.111
NVIC.ADC1_2_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.CAN_RX1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true NVIC.CAN_RX1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
NVIC.CAN_SCE_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true NVIC.CAN_SCE_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
@ -139,13 +202,13 @@ 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.TIM6_DAC_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
PA0.GPIO_Label=DSEL 8 PA0.GPIO_Label=DSEL 8
PA0.Locked=true PA0.Locked=true
PA0.Mode=IN1-Single-Ended PA0.Signal=GPIO_Output
PA0.Signal=ADC1_IN1
PA1.GPIOParameters=GPIO_Label PA1.GPIOParameters=GPIO_Label
PA1.GPIO_Label=isense5 PA1.GPIO_Label=isense5
PA1.Locked=true PA1.Locked=true
@ -256,6 +319,8 @@ PC2.Signal=ADCx_IN8
PC3.GPIOParameters=GPIO_Label PC3.GPIOParameters=GPIO_Label
PC3.GPIO_Label=isense13 PC3.GPIO_Label=isense13
PC3.Signal=ADCx_IN9 PC3.Signal=ADCx_IN9
PC4.GPIOParameters=GPIO_Label
PC4.GPIO_Label=LV_sens
PC4.Locked=true PC4.Locked=true
PC4.Mode=IN5-Single-Ended PC4.Mode=IN5-Single-Ended
PC4.Signal=ADC2_IN5 PC4.Signal=ADC2_IN5
@ -281,6 +346,11 @@ PF0-OSC_IN.Signal=RCC_OSC_IN
PF1-OSC_OUT.Locked=true PF1-OSC_OUT.Locked=true
PF1-OSC_OUT.Mode=HSE-External-Oscillator PF1-OSC_OUT.Mode=HSE-External-Oscillator
PF1-OSC_OUT.Signal=RCC_OSC_OUT PF1-OSC_OUT.Signal=RCC_OSC_OUT
PF4.GPIOParameters=GPIO_Label
PF4.GPIO_Label=isense9
PF4.Locked=true
PF4.Mode=IN5-Single-Ended
PF4.Signal=ADC1_IN5
PinOutPanel.RotationAngle=0 PinOutPanel.RotationAngle=0
ProjectManager.AskForMigrate=true ProjectManager.AskForMigrate=true
ProjectManager.BackupPrevious=false ProjectManager.BackupPrevious=false
@ -377,15 +447,13 @@ TIM2.Period=65535
TIM2.Pulse-PWM\ Generation2\ CH2=0 TIM2.Pulse-PWM\ Generation2\ CH2=0
TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1 TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
TIM3.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4 TIM3.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4
TIM3.IPParameters=Channel-PWM Generation4 CH4,Channel-PWM Generation1 CH1 TIM3.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation4 CH4
TIM6.IPParameters=Prescaler,Period,TIM_MasterOutputTrigger TIM6.IPParameters=Prescaler,Period,TIM_MasterOutputTrigger
TIM6.Period=8000-1 TIM6.Period=8000-1
TIM6.Prescaler=400 TIM6.Prescaler=400
TIM6.TIM_MasterOutputTrigger=TIM_TRGO_UPDATE TIM6.TIM_MasterOutputTrigger=TIM_TRGO_UPDATE
USART1.IPParameters=VirtualMode-Multiprocessor_communication USART1.IPParameters=VirtualMode-Multiprocessor_communication
USART1.VirtualMode-Multiprocessor_communication=VM_ASYNC USART1.VirtualMode-Multiprocessor_communication=VM_ASYNC
VP_IWDG_VS_IWDG.Mode=IWDG_Activate
VP_IWDG_VS_IWDG.Signal=IWDG_VS_IWDG
VP_SYS_VS_Systick.Mode=SysTick VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick VP_SYS_VS_Systick.Signal=SYS_VS_Systick
VP_TIM6_VS_ClockSourceINT.Mode=Enable_Timer VP_TIM6_VS_ClockSourceINT.Mode=Enable_Timer

View File

@ -59,7 +59,6 @@ Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c \
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c \ Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c \
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c \ Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c \
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c \ Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c \
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_iwdg.c \
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c \ Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c \
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c \ Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c \
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c \ Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c \
@ -86,7 +85,7 @@ PREFIX = arm-none-eabi-
POSTFIX = " POSTFIX = "
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
# either it can be added to the PATH environment variable. # either it can be added to the PATH environment variable.
GCC_PATH="c:/Users/nived/AppData/Roaming/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/12.3.1-1.2.1/.content/bin GCC_PATH="c:/Users/GETAC/AppData/Roaming/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/13.2.1-1.1.1/.content/bin
ifdef GCC_PATH ifdef GCC_PATH
CXX = $(GCC_PATH)/$(PREFIX)g++$(POSTFIX) CXX = $(GCC_PATH)/$(PREFIX)g++$(POSTFIX)
CC = $(GCC_PATH)/$(PREFIX)gcc$(POSTFIX) CC = $(GCC_PATH)/$(PREFIX)gcc$(POSTFIX)
@ -239,13 +238,13 @@ $(BUILD_DIR):
# flash # flash
####################################### #######################################
flash: $(BUILD_DIR)/$(TARGET).elf flash: $(BUILD_DIR)/$(TARGET).elf
"C:/USERS/NIVED/APPDATA/ROAMING/CODE/USER/GLOBALSTORAGE/BMD.STM32-FOR-VSCODE/@XPACK-DEV-TOOLS/OPENOCD/0.12.0-2.1/.CONTENT/BIN/OPENOCD.EXE" -f ./openocd.cfg -c "program $(BUILD_DIR)/$(TARGET).elf verify reset exit" "C:/USERS/GETAC/APPDATA/ROAMING/CODE/USER/GLOBALSTORAGE/BMD.STM32-FOR-VSCODE/@XPACK-DEV-TOOLS/OPENOCD/0.12.0-3.1/.CONTENT/BIN/OPENOCD.EXE" -f ./openocd.cfg -c "program $(BUILD_DIR)/$(TARGET).elf verify reset exit"
####################################### #######################################
# erase # erase
####################################### #######################################
erase: $(BUILD_DIR)/$(TARGET).elf erase: $(BUILD_DIR)/$(TARGET).elf
"C:/USERS/NIVED/APPDATA/ROAMING/CODE/USER/GLOBALSTORAGE/BMD.STM32-FOR-VSCODE/@XPACK-DEV-TOOLS/OPENOCD/0.12.0-2.1/.CONTENT/BIN/OPENOCD.EXE" -f ./openocd.cfg -c "init; reset halt; stm32f3x mass_erase 0; exit" "C:/USERS/GETAC/APPDATA/ROAMING/CODE/USER/GLOBALSTORAGE/BMD.STM32-FOR-VSCODE/@XPACK-DEV-TOOLS/OPENOCD/0.12.0-3.1/.CONTENT/BIN/OPENOCD.EXE" -f ./openocd.cfg -c "init; reset halt; stm32f3x mass_erase 0; exit"
####################################### #######################################
# clean up # clean up