Compare commits
10 Commits
ad69b0a0be
...
fschina
| Author | SHA1 | Date | |
|---|---|---|---|
| 00bb72d7b7 | |||
| ea45c3cbfb | |||
| d1d61da006 | |||
| a2c6fbf97f | |||
| bedc8a2eb7 | |||
| 061cdde78d | |||
| 41c242aab7 | |||
| bfba65b904 | |||
| 1887a178c1 | |||
| 957cfbaec2 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -96,7 +96,6 @@ CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
@ -134,3 +133,5 @@ fp-info-cache
|
||||
*.xml
|
||||
*.csv
|
||||
|
||||
# clangd
|
||||
.cache/
|
||||
|
||||
22
.mxproject
22
.mxproject
File diff suppressed because one or more lines are too long
@ -20,6 +20,7 @@
|
||||
#define CUR_CHANNELS_2_ID 0xCB
|
||||
#define CUR_CHANNELS_3_ID 0xCC
|
||||
#define CUR_CHANNELS_4_ID 0xCD
|
||||
#define LV_SENS_ID 0xCE
|
||||
|
||||
typedef struct {
|
||||
PortExtenderGPIO iostatus;
|
||||
|
||||
@ -13,27 +13,27 @@
|
||||
typedef union {
|
||||
struct {
|
||||
uint8_t NC : 1;
|
||||
uint8_t en13 : 1; // inverters
|
||||
uint8_t en2 : 1; //servos regler
|
||||
uint8_t en1 : 1; //acu
|
||||
uint8_t en4 : 1; // reserved
|
||||
uint8_t en11 : 1; //lidar
|
||||
uint8_t en8 : 1; // sdc
|
||||
uint8_t alwayson : 1; // en7 ist always on
|
||||
uint8_t inverter : 1;
|
||||
uint8_t drs_buck : 1;
|
||||
uint8_t acu : 1;
|
||||
uint8_t reserved : 1;
|
||||
uint8_t lidar : 1;
|
||||
uint8_t sdc : 1;
|
||||
uint8_t alwayson : 1;
|
||||
};
|
||||
uint8_t porta;
|
||||
} gpio_port_a;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
uint8_t en15: 1; // epsc
|
||||
uint8_t en12 : 1; // hyd aggregat
|
||||
uint8_t epsc: 1;
|
||||
uint8_t hyd_pump : 1;
|
||||
uint8_t NC : 1;
|
||||
uint8_t en3 : 1; // ebs cs valve
|
||||
uint8_t en6 : 1; // ebs valve b
|
||||
uint8_t en5 : 1; //ebs valve a
|
||||
uint8_t en14 : 1; //servos
|
||||
uint8_t en16 : 1; //misc
|
||||
uint8_t ebs_cs : 1;
|
||||
uint8_t ebs_b : 1;
|
||||
uint8_t ebs_a : 1;
|
||||
uint8_t drs_profet : 1;
|
||||
uint8_t misc : 1;
|
||||
};
|
||||
uint8_t portb;
|
||||
} gpio_port_b;
|
||||
@ -47,8 +47,7 @@ typedef union {
|
||||
|
||||
} PortExtenderGPIO;
|
||||
|
||||
void ChannelControl_init(I2C_HandleTypeDef* hi2c, TIM_HandleTypeDef* timer3,
|
||||
TIM_HandleTypeDef* timer2);
|
||||
void ChannelControl_init(I2C_HandleTypeDef* hi2c, TIM_HandleTypeDef* timer2);
|
||||
void ChannelControl_UpdateGPIOs(PortExtenderGPIO);
|
||||
|
||||
void ChannelControl_UpdatePWMs(
|
||||
|
||||
@ -10,8 +10,13 @@
|
||||
|
||||
#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
|
||||
#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
|
||||
#define CURR_SENSE_FACTOR_5A (3700 * 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_b;
|
||||
uint16_t cooling_pump;
|
||||
uint16_t lv_v;
|
||||
} CurrentMeasurements;
|
||||
|
||||
void currentMonitor_init(ADC_HandleTypeDef* hadc1, ADC_HandleTypeDef* hadc2,
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#define PCA_I2C_BASE_ADDRESS 0x40
|
||||
|
||||
void PCA9535_init(I2C_HandleTypeDef* hi2c, uint8_t subadr);
|
||||
HAL_StatusTypeDef PCA9535_writeRegister(uint8_t reg, uint8_t data);
|
||||
|
||||
void PCA9535_setGPIOPinDirection(uint8_t Port, uint8_t pin, uint8_t state);
|
||||
void PCA9535_setGPIOPinOutput(uint8_t Port, uint8_t pin, uint8_t state);
|
||||
|
||||
@ -75,6 +75,8 @@ void Error_Handler(void);
|
||||
#define isense3_GPIO_Port GPIOA
|
||||
#define isense7_Pin GPIO_PIN_3
|
||||
#define isense7_GPIO_Port GPIOA
|
||||
#define isense9_Pin GPIO_PIN_4
|
||||
#define isense9_GPIO_Port GPIOF
|
||||
#define isense2_Pin GPIO_PIN_4
|
||||
#define isense2_GPIO_Port GPIOA
|
||||
#define isense1_Pin GPIO_PIN_5
|
||||
@ -83,8 +85,12 @@ void Error_Handler(void);
|
||||
#define isense10_GPIO_Port GPIOA
|
||||
#define isense4_Pin GPIO_PIN_7
|
||||
#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_GPIO_Port GPIOB
|
||||
#define EN_PUMP_Pin GPIO_PIN_1
|
||||
#define EN_PUMP_GPIO_Port GPIOB
|
||||
#define DSEL_3_Pin GPIO_PIN_12
|
||||
#define DSEL_3_GPIO_Port GPIOB
|
||||
#define DSEL_4_Pin GPIO_PIN_13
|
||||
@ -101,6 +107,10 @@ void Error_Handler(void);
|
||||
#define STATUS_LED3_GPIO_Port GPIOC
|
||||
#define STATUS_LED4_Pin GPIO_PIN_9
|
||||
#define STATUS_LED4_GPIO_Port GPIOC
|
||||
#define EN_TSACFAN_Pin GPIO_PIN_3
|
||||
#define EN_TSACFAN_GPIO_Port GPIOB
|
||||
#define EN_RADFAN_Pin GPIO_PIN_4
|
||||
#define EN_RADFAN_GPIO_Port GPIOB
|
||||
#define DSEL_7_Pin GPIO_PIN_9
|
||||
#define DSEL_7_GPIO_Port GPIOB
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
/*#define HAL_CRYP_MODULE_ENABLED */
|
||||
/*#define HAL_DAC_MODULE_ENABLED */
|
||||
/*#define HAL_I2S_MODULE_ENABLED */
|
||||
#define HAL_IWDG_MODULE_ENABLED
|
||||
/*#define HAL_IWDG_MODULE_ENABLED */
|
||||
/*#define HAL_LCD_MODULE_ENABLED */
|
||||
/*#define HAL_LPTIM_MODULE_ENABLED */
|
||||
/*#define HAL_RNG_MODULE_ENABLED */
|
||||
|
||||
@ -56,9 +56,11 @@ void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
void DMA1_Channel1_IRQHandler(void);
|
||||
void ADC1_2_IRQHandler(void);
|
||||
void USB_LP_CAN_RX0_IRQHandler(void);
|
||||
void CAN_RX1_IRQHandler(void);
|
||||
void CAN_SCE_IRQHandler(void);
|
||||
void TIM6_DAC_IRQHandler(void);
|
||||
void DMA2_Channel1_IRQHandler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
|
||||
@ -36,9 +36,8 @@ void can_sendloop() {
|
||||
ftcan_transmit(TX_STATUS_MSG_ID, status_data, 7);
|
||||
|
||||
uint8_t data[8];
|
||||
return;
|
||||
if (additionaltxcouter < 4) {
|
||||
switch (additionaltxcouter) {
|
||||
|
||||
switch (additionaltxcouter) {
|
||||
case 0:
|
||||
|
||||
data[0] = current_measurements_adc_val.always_on >> 8;
|
||||
@ -91,13 +90,19 @@ return;
|
||||
ftcan_transmit(CUR_CHANNELS_4_ID, data, 8);
|
||||
|
||||
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:
|
||||
break;
|
||||
}
|
||||
additionaltxcouter++;
|
||||
} else {
|
||||
additionaltxcouter = 0;
|
||||
}
|
||||
|
||||
additionaltxcouter = (additionaltxcouter+1) % 5;
|
||||
|
||||
}
|
||||
|
||||
void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t* data) {
|
||||
|
||||
@ -7,20 +7,16 @@
|
||||
|
||||
#include "Channel_Control.h"
|
||||
#include "PCA9535D_Driver.h"
|
||||
#include "main.h"
|
||||
|
||||
PortExtenderGPIO EN_Ports;
|
||||
|
||||
uint8_t timer3_running = 0;
|
||||
uint8_t timer2_running = 0;
|
||||
TIM_HandleTypeDef* pwmtimer3;
|
||||
TIM_HandleTypeDef* pwmtimer2;
|
||||
|
||||
extern int inhibit_SDC;
|
||||
|
||||
void ChannelControl_init(I2C_HandleTypeDef* hi2c, TIM_HandleTypeDef* timer3,
|
||||
TIM_HandleTypeDef* timer2) {
|
||||
|
||||
pwmtimer3 = timer3;
|
||||
void ChannelControl_init(I2C_HandleTypeDef* hi2c, TIM_HandleTypeDef* timer2) {
|
||||
pwmtimer2 = timer2;
|
||||
PCA9535_init(hi2c, 0);
|
||||
PCA9535_setGPIOPortOutput(PC9535_PORTA, 0x00);
|
||||
@ -38,8 +34,9 @@ void ChannelControl_init(I2C_HandleTypeDef* hi2c, TIM_HandleTypeDef* timer3,
|
||||
void ChannelControl_UpdateGPIOs(PortExtenderGPIO UpdatePorts) { // ctrl + left click auf portextender
|
||||
EN_Ports = UpdatePorts;
|
||||
UpdatePorts.porta.alwayson = 1; // Always on stays always on
|
||||
if (inhibit_SDC)
|
||||
UpdatePorts.porta.en8 = 0;
|
||||
if (inhibit_SDC) {
|
||||
UpdatePorts.porta.sdc = 0;
|
||||
}
|
||||
PCA9535_setGPIOPortOutput(PC9535_PORTA, UpdatePorts.porta.porta);
|
||||
PCA9535_setGPIOPortOutput(PC9535_PORTB, UpdatePorts.portb.portb);
|
||||
}
|
||||
@ -50,39 +47,27 @@ void ChannelControl_UpdatePWMs(
|
||||
uint8_t tsacfans,
|
||||
uint8_t pwmaggregat)
|
||||
{
|
||||
|
||||
pwmtimer3->Instance->CCR1 = radiatorfans << 8;
|
||||
pwmtimer3->Instance->CCR4 = pwmpumps << 8;
|
||||
pwmtimer2->Instance->CCR2 = tsacfans << 8;
|
||||
pwmtimer2->Instance->CCR3 = pwmaggregat << 8;
|
||||
|
||||
if (timer3_running) {
|
||||
if ((pwmpumps == 0) && (radiatorfans == 0)) {
|
||||
timer3_running = 0;
|
||||
HAL_TIM_PWM_Stop(pwmtimer3, TIM_CHANNEL_4);
|
||||
HAL_TIM_PWM_Stop(pwmtimer3, TIM_CHANNEL_1);
|
||||
}
|
||||
} else {
|
||||
if ( (pwmpumps != 0) || (radiatorfans != 0)) {
|
||||
timer3_running = 1;
|
||||
HAL_TIM_PWM_Start(pwmtimer3, TIM_CHANNEL_4);
|
||||
HAL_TIM_PWM_Start(pwmtimer3, TIM_CHANNEL_1);
|
||||
}
|
||||
}
|
||||
|
||||
if (timer2_running) {
|
||||
if ( (tsacfans == 0) || (pwmaggregat == 0) ) {
|
||||
if (pwmaggregat == 0) {
|
||||
timer2_running = 0;
|
||||
HAL_TIM_PWM_Stop(pwmtimer2, TIM_CHANNEL_2);
|
||||
HAL_TIM_PWM_Stop(pwmtimer2, TIM_CHANNEL_3);
|
||||
}
|
||||
} else {
|
||||
if ( (tsacfans != 0) || (pwmaggregat != 0) ) {
|
||||
if (pwmaggregat != 0) {
|
||||
timer2_running = 1;
|
||||
HAL_TIM_PWM_Start(pwmtimer2, TIM_CHANNEL_2);
|
||||
HAL_TIM_PWM_Start(pwmtimer2, TIM_CHANNEL_3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: This should probably be done in UpdateGPIOs (and only be enable bits
|
||||
// in the CAN command)
|
||||
HAL_GPIO_WritePin(EN_TSACFAN_GPIO_Port, EN_TSACFAN_Pin,
|
||||
tsacfans ? GPIO_PIN_SET : GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(EN_RADFAN_GPIO_Port, EN_RADFAN_Pin,
|
||||
radiatorfans ? GPIO_PIN_SET : GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(EN_PUMP_GPIO_Port, EN_PUMP_Pin,
|
||||
pwmpumps ? GPIO_PIN_SET : GPIO_PIN_RESET);
|
||||
}
|
||||
|
||||
@ -10,29 +10,30 @@
|
||||
|
||||
volatile union adc1_channels {
|
||||
struct {
|
||||
uint16_t isense12; // acu
|
||||
uint16_t isense11; // epsc
|
||||
uint16_t isense6; // radiator fans
|
||||
uint16_t isense13; // tsac fans
|
||||
uint16_t isense5; // gss and lidar
|
||||
uint16_t isense3; // sdc and always on
|
||||
uint16_t isense7; // misc and inverters
|
||||
uint16_t isense5; // LiDAR | GSS (DSEL7)
|
||||
uint16_t isense3; // AlwaysOn | SDC (DSEL4)
|
||||
uint16_t isense7; // Misc | Inverters (DSEL5)
|
||||
uint16_t isense9; // DRS
|
||||
uint16_t isense12; // ACU
|
||||
uint16_t isense11; // EPSC = ELIAS
|
||||
uint16_t isense6; // Radiator Fans
|
||||
uint16_t isense13; // TSAC Fans
|
||||
} adcbank1;
|
||||
|
||||
uint16_t adcbuffer[7]; // array 7*16 bit
|
||||
uint16_t adcbuffer[8]; // array 8*16 bit
|
||||
|
||||
} adc_channels1;
|
||||
// ADC's anpassen adc1 - 9, adc2 ist halt 5 , buffer anpassen und namen auch ( isense usw)
|
||||
volatile union adc2_channels {
|
||||
struct {
|
||||
uint16_t isense2; // ebs valve a and ebs valve b
|
||||
uint16_t isense1; // ebs cs valve
|
||||
uint16_t isense10; // hyr aggregat
|
||||
uint16_t isense4; // cooling pump and reserved
|
||||
|
||||
uint16_t isense2; // EBS A | EBS B (DSEL3)
|
||||
uint16_t isense1; // EBS CS
|
||||
uint16_t isense10; // Hydraulic Aggregate
|
||||
uint16_t isense4; // Water Pump | Reserved (DSEL8)
|
||||
uint16_t lv_sens; // LV voltage
|
||||
} adcbank1;
|
||||
|
||||
uint16_t adcbuffer[4];
|
||||
uint16_t adcbuffer[5];
|
||||
|
||||
} adc_channels2;
|
||||
|
||||
@ -46,82 +47,97 @@ ADC_HandleTypeDef* adc2;
|
||||
|
||||
void currentMonitor_init(ADC_HandleTypeDef* hadc1, ADC_HandleTypeDef* hadc2, // init ist initilisierung
|
||||
TIM_HandleTypeDef* trigtim) {
|
||||
HAL_GPIO_WritePin(DSEL_3_GPIO_Port, DSEL_3_Pin, adcbank2); //DSELs zu adc's neu zuordnen
|
||||
HAL_GPIO_WritePin(DSEL_4_GPIO_Port, DSEL_4_Pin, adcbank2);
|
||||
HAL_GPIO_WritePin(DSEL_3_GPIO_Port, DSEL_3_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_7_GPIO_Port, DSEL_7_Pin, adcbank1);
|
||||
HAL_GPIO_WritePin(DSEL_8_GPIO_Port, DSEL_8_Pin, adcbank2);
|
||||
adc1 = hadc1;
|
||||
adc2 = hadc2;
|
||||
HAL_TIM_Base_Start(trigtim);
|
||||
HAL_ADC_Start_DMA(hadc1, (uint32_t*)adc_channels1.adcbuffer, 7);
|
||||
HAL_ADC_Start_DMA(hadc2, (uint32_t*)adc_channels2.adcbuffer, 7); // wie adc mit dma geht , red mit jasper
|
||||
HAL_ADC_Start_DMA(hadc1, (uint32_t*)adc_channels1.adcbuffer, 8);
|
||||
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; }
|
||||
|
||||
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 (adcbank2 == GPIO_PIN_RESET) {
|
||||
current_measurements_adc_val.ebsvalve_a =
|
||||
|
||||
current_measurements_adc_val.ebsvalve_a =
|
||||
adc_channels2.adcbank1.isense2 * CURR_SENSE_FACTOR_5A;
|
||||
current_measurements_adc_val.cooling_pump =
|
||||
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);
|
||||
HAL_GPIO_WritePin(DSEL_8_GPIO_Port, DSEL_8_Pin,
|
||||
adcbank2);
|
||||
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;
|
||||
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
|
||||
}
|
||||
@ -31,8 +31,23 @@ void PCA9535_init(I2C_HandleTypeDef* hi2c, uint8_t subadr) {
|
||||
pcai2c = hi2c;
|
||||
deviceadr = PCA_I2C_BASE_ADDRESS | (subadr << 1);
|
||||
|
||||
uint8_t initalizationconfig[7] = {0x02, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF};
|
||||
HAL_I2C_Master_Transmit(pcai2c, deviceadr, initalizationconfig, 7, 1000);
|
||||
if (PCA9535_writeRegister(2, 0) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
if (PCA9535_writeRegister(3, 0) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
if (PCA9535_writeRegister(6, 0) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
if (PCA9535_writeRegister(7, 0) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
||||
|
||||
HAL_StatusTypeDef PCA9535_writeRegister(uint8_t reg, uint8_t data) {
|
||||
uint8_t dataarray[2] = {reg, data};
|
||||
return HAL_I2C_Master_Transmit(pcai2c, deviceadr, dataarray, 2, 1000);
|
||||
}
|
||||
|
||||
void PCA9535_setGPIOPinDirection(uint8_t Port, uint8_t pin, uint8_t state) {
|
||||
|
||||
258
Core/Src/main.c
258
Core/Src/main.c
@ -51,10 +51,7 @@ CAN_HandleTypeDef hcan;
|
||||
|
||||
I2C_HandleTypeDef hi2c1;
|
||||
|
||||
IWDG_HandleTypeDef hiwdg;
|
||||
|
||||
TIM_HandleTypeDef htim2;
|
||||
TIM_HandleTypeDef htim3;
|
||||
TIM_HandleTypeDef htim6;
|
||||
|
||||
UART_HandleTypeDef huart1;
|
||||
@ -71,11 +68,9 @@ static void MX_ADC1_Init(void);
|
||||
static void MX_ADC2_Init(void);
|
||||
static void MX_CAN_Init(void);
|
||||
static void MX_TIM2_Init(void);
|
||||
static void MX_TIM3_Init(void);
|
||||
static void MX_I2C1_Init(void);
|
||||
static void MX_USART1_UART_Init(void);
|
||||
static void MX_TIM6_Init(void);
|
||||
//static void MX_IWDG_Init(void);
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
@ -129,18 +124,16 @@ int main(void)
|
||||
MX_ADC2_Init();
|
||||
MX_CAN_Init();
|
||||
MX_TIM2_Init();
|
||||
MX_TIM3_Init();
|
||||
MX_I2C1_Init();
|
||||
MX_USART1_UART_Init();
|
||||
MX_TIM6_Init();
|
||||
//MX_IWDG_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
// REMINDER: Comment out the IWDG Init above!!!
|
||||
|
||||
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);
|
||||
|
||||
ChannelControl_init(&hi2c1, &htim3, &htim2);
|
||||
ChannelControl_init(&hi2c1, &htim2);
|
||||
// handler struktur ( handler adc1 .... usw )
|
||||
can_init(&hcan); // can bus initilisiert , kommunikation zum hauptsteuergeraet ( autobox )
|
||||
|
||||
@ -148,7 +141,6 @@ int main(void)
|
||||
|
||||
uint32_t lasttick = HAL_GetTick(); // gibt dir zuruck die milisekunden seit start. ( es fangt an und dann milisekunden + 1 usw....)
|
||||
HAL_TIM_Base_Start(&htim2);
|
||||
HAL_TIM_Base_Start(&htim3);
|
||||
|
||||
// Prevent closing of SDC (esp. after WDG reset)
|
||||
//inhibit_SDC = 1;
|
||||
@ -184,6 +176,7 @@ int main(void)
|
||||
if ((HAL_GetTick() - lasttick) > 100U) {
|
||||
lasttick = HAL_GetTick();
|
||||
can_sendloop();
|
||||
HAL_GPIO_TogglePin(STATUS_LED1_GPIO_Port, STATUS_LED1_Pin);
|
||||
}
|
||||
|
||||
// nominal WD time is 100ms, plus a bit of tolerance
|
||||
@ -193,6 +186,8 @@ int main(void)
|
||||
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 */
|
||||
@ -211,11 +206,10 @@ void SystemClock_Config(void)
|
||||
/** Initializes the RCC Oscillators according to the specified parameters
|
||||
* 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.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL4;
|
||||
@ -276,15 +270,15 @@ static void MX_ADC1_Init(void)
|
||||
hadc1.Instance = ADC1;
|
||||
hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;
|
||||
hadc1.Init.Resolution = ADC_RESOLUTION_12B;
|
||||
hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE;
|
||||
hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
|
||||
hadc1.Init.ContinuousConvMode = DISABLE;
|
||||
hadc1.Init.DiscontinuousConvMode = DISABLE;
|
||||
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
|
||||
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
|
||||
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING;
|
||||
hadc1.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T6_TRGO;
|
||||
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||
hadc1.Init.NbrOfConversion = 1;
|
||||
hadc1.Init.NbrOfConversion = 8;
|
||||
hadc1.Init.DMAContinuousRequests = ENABLE;
|
||||
hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
|
||||
hadc1.Init.EOCSelection = ADC_EOC_SEQ_CONV;
|
||||
hadc1.Init.LowPowerAutoWait = DISABLE;
|
||||
hadc1.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN;
|
||||
if (HAL_ADC_Init(&hadc1) != HAL_OK)
|
||||
@ -302,16 +296,79 @@ static void MX_ADC1_Init(void)
|
||||
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_1;
|
||||
sConfig.Channel = ADC_CHANNEL_2;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||
sConfig.SingleDiff = ADC_SINGLE_ENDED;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_61CYCLES_5;
|
||||
sConfig.OffsetNumber = ADC_OFFSET_NONE;
|
||||
sConfig.Offset = 0;
|
||||
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||
{
|
||||
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 END ADC1_Init 2 */
|
||||
@ -341,15 +398,15 @@ static void MX_ADC2_Init(void)
|
||||
hadc2.Instance = ADC2;
|
||||
hadc2.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;
|
||||
hadc2.Init.Resolution = ADC_RESOLUTION_12B;
|
||||
hadc2.Init.ScanConvMode = ADC_SCAN_DISABLE;
|
||||
hadc2.Init.ScanConvMode = ADC_SCAN_ENABLE;
|
||||
hadc2.Init.ContinuousConvMode = DISABLE;
|
||||
hadc2.Init.DiscontinuousConvMode = DISABLE;
|
||||
hadc2.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
|
||||
hadc2.Init.ExternalTrigConv = ADC_SOFTWARE_START;
|
||||
hadc2.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING;
|
||||
hadc2.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T6_TRGO;
|
||||
hadc2.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||
hadc2.Init.NbrOfConversion = 1;
|
||||
hadc2.Init.NbrOfConversion = 5;
|
||||
hadc2.Init.DMAContinuousRequests = ENABLE;
|
||||
hadc2.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
|
||||
hadc2.Init.EOCSelection = ADC_EOC_SEQ_CONV;
|
||||
hadc2.Init.LowPowerAutoWait = DISABLE;
|
||||
hadc2.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN;
|
||||
if (HAL_ADC_Init(&hadc2) != HAL_OK)
|
||||
@ -362,13 +419,49 @@ static void MX_ADC2_Init(void)
|
||||
sConfig.Channel = ADC_CHANNEL_1;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||
sConfig.SingleDiff = ADC_SINGLE_ENDED;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_61CYCLES_5;
|
||||
sConfig.OffsetNumber = ADC_OFFSET_NONE;
|
||||
sConfig.Offset = 0;
|
||||
if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)
|
||||
{
|
||||
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 END ADC2_Init 2 */
|
||||
@ -460,41 +553,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 */
|
||||
|
||||
//
|
||||
// CALC:
|
||||
//
|
||||
// 1000 × 1/(32 kHz / 4)
|
||||
//
|
||||
|
||||
/* 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
|
||||
* @param None
|
||||
@ -533,10 +591,6 @@ static void MX_TIM2_Init(void)
|
||||
sConfigOC.Pulse = 0;
|
||||
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
|
||||
if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_2) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_3) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
@ -548,59 +602,6 @@ static void MX_TIM2_Init(void)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TIM3 Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_TIM3_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN TIM3_Init 0 */
|
||||
|
||||
/* USER CODE END TIM3_Init 0 */
|
||||
|
||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||
TIM_OC_InitTypeDef sConfigOC = {0};
|
||||
|
||||
/* USER CODE BEGIN TIM3_Init 1 */
|
||||
|
||||
/* USER CODE END TIM3_Init 1 */
|
||||
htim3.Instance = TIM3;
|
||||
htim3.Init.Prescaler = 0;
|
||||
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim3.Init.Period = 65535;
|
||||
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
if (HAL_TIM_PWM_Init(&htim3) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||
sConfigOC.Pulse = 0;
|
||||
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
|
||||
if (HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_4) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN TIM3_Init 2 */
|
||||
|
||||
/* USER CODE END TIM3_Init 2 */
|
||||
HAL_TIM_MspPostInit(&htim3);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TIM6 Initialization Function
|
||||
* @param None
|
||||
@ -712,16 +713,29 @@ static void MX_GPIO_Init(void)
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
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);
|
||||
HAL_GPIO_WritePin(DSEL_8_GPIO_Port, DSEL_8_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOB, GSS_GPIO_Pin|EN_PUMP_Pin|DSEL_3_Pin|DSEL_4_Pin
|
||||
|DSEL_5_Pin|DSEL_6_Pin|EN_TSACFAN_Pin|EN_RADFAN_Pin
|
||||
|DSEL_7_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOC, STATUS_LED1_Pin|STATUS_LED2_Pin|STATUS_LED3_Pin|STATUS_LED4_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pins : GSS_GPIO_Pin DSEL_3_Pin DSEL_4_Pin DSEL_5_Pin
|
||||
DSEL_6_Pin DSEL_7_Pin */
|
||||
GPIO_InitStruct.Pin = GSS_GPIO_Pin|DSEL_3_Pin|DSEL_4_Pin|DSEL_5_Pin
|
||||
|DSEL_6_Pin|DSEL_7_Pin;
|
||||
/*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 EN_PUMP_Pin DSEL_3_Pin DSEL_4_Pin
|
||||
DSEL_5_Pin DSEL_6_Pin EN_TSACFAN_Pin EN_RADFAN_Pin
|
||||
DSEL_7_Pin */
|
||||
GPIO_InitStruct.Pin = GSS_GPIO_Pin|EN_PUMP_Pin|DSEL_3_Pin|DSEL_4_Pin
|
||||
|DSEL_5_Pin|DSEL_6_Pin|EN_TSACFAN_Pin|EN_RADFAN_Pin
|
||||
|DSEL_7_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
|
||||
@ -62,7 +62,7 @@ extern DMA_HandleTypeDef hdma_adc2;
|
||||
/* USER CODE END 0 */
|
||||
|
||||
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
|
||||
/**
|
||||
/**
|
||||
* Initializes the Global MSP.
|
||||
*/
|
||||
void HAL_MspInit(void)
|
||||
@ -106,26 +106,32 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||
/**ADC1 GPIO Configuration
|
||||
PC0 ------> ADC1_IN6
|
||||
PC1 ------> ADC1_IN7
|
||||
PC2 ------> ADC1_IN8
|
||||
PC3 ------> ADC1_IN9
|
||||
PA0 ------> ADC1_IN1
|
||||
PA1 ------> ADC1_IN2
|
||||
PA2 ------> ADC1_IN3
|
||||
PA3 ------> ADC1_IN4
|
||||
PF4 ------> ADC1_IN5
|
||||
*/
|
||||
GPIO_InitStruct.Pin = isense12_Pin|isense11_Pin|isense6_Pin|isense13_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
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.Pull = GPIO_NOPULL;
|
||||
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 Init */
|
||||
hdma_adc1.Instance = DMA1_Channel1;
|
||||
@ -143,6 +149,9 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
|
||||
|
||||
__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 END ADC1_MspInit 1 */
|
||||
@ -172,10 +181,10 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
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.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(LV_sens_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/* ADC2 DMA Init */
|
||||
/* ADC2 Init */
|
||||
@ -194,6 +203,9 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
|
||||
|
||||
__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 END ADC2_MspInit 1 */
|
||||
@ -225,17 +237,29 @@ void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
|
||||
PC1 ------> ADC1_IN7
|
||||
PC2 ------> ADC1_IN8
|
||||
PC3 ------> ADC1_IN9
|
||||
PA0 ------> ADC1_IN1
|
||||
PA1 ------> ADC1_IN2
|
||||
PA2 ------> ADC1_IN3
|
||||
PA3 ------> ADC1_IN4
|
||||
PF4 ------> ADC1_IN5
|
||||
*/
|
||||
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 */
|
||||
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 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(GPIOC, GPIO_PIN_4);
|
||||
HAL_GPIO_DeInit(LV_sens_GPIO_Port, LV_sens_Pin);
|
||||
|
||||
/* ADC2 DMA DeInit */
|
||||
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 END ADC2_MspDeInit 1 */
|
||||
@ -448,17 +482,6 @@ void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* htim_pwm)
|
||||
|
||||
/* USER CODE END TIM2_MspInit 1 */
|
||||
}
|
||||
else if(htim_pwm->Instance==TIM3)
|
||||
{
|
||||
/* USER CODE BEGIN TIM3_MspInit 0 */
|
||||
|
||||
/* USER CODE END TIM3_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_TIM3_CLK_ENABLE();
|
||||
/* USER CODE BEGIN TIM3_MspInit 1 */
|
||||
|
||||
/* USER CODE END TIM3_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -477,6 +500,9 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
|
||||
/* USER CODE END TIM6_MspInit 0 */
|
||||
/* Peripheral clock 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 END TIM6_MspInit 1 */
|
||||
@ -492,12 +518,12 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
|
||||
/* USER CODE BEGIN TIM2_MspPostInit 0 */
|
||||
|
||||
/* USER CODE END TIM2_MspPostInit 0 */
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**TIM2 GPIO Configuration
|
||||
PB10 ------> TIM2_CH3
|
||||
PB3 ------> TIM2_CH2
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_3;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_10;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
@ -508,28 +534,6 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
|
||||
|
||||
/* USER CODE END TIM2_MspPostInit 1 */
|
||||
}
|
||||
else if(htim->Instance==TIM3)
|
||||
{
|
||||
/* USER CODE BEGIN TIM3_MspPostInit 0 */
|
||||
|
||||
/* USER CODE END TIM3_MspPostInit 0 */
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**TIM3 GPIO Configuration
|
||||
PB1 ------> TIM3_CH4
|
||||
PB4 ------> TIM3_CH1
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_4;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN TIM3_MspPostInit 1 */
|
||||
|
||||
/* USER CODE END TIM3_MspPostInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
@ -551,17 +555,6 @@ void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef* htim_pwm)
|
||||
|
||||
/* USER CODE END TIM2_MspDeInit 1 */
|
||||
}
|
||||
else if(htim_pwm->Instance==TIM3)
|
||||
{
|
||||
/* USER CODE BEGIN TIM3_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END TIM3_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_TIM3_CLK_DISABLE();
|
||||
/* USER CODE BEGIN TIM3_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END TIM3_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -580,6 +573,9 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
|
||||
/* USER CODE END TIM6_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_TIM6_CLK_DISABLE();
|
||||
|
||||
/* TIM6 interrupt DeInit */
|
||||
HAL_NVIC_DisableIRQ(TIM6_DAC_IRQn);
|
||||
/* USER CODE BEGIN TIM6_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END TIM6_MspDeInit 1 */
|
||||
|
||||
@ -57,7 +57,10 @@
|
||||
/* External variables --------------------------------------------------------*/
|
||||
extern DMA_HandleTypeDef hdma_adc1;
|
||||
extern DMA_HandleTypeDef hdma_adc2;
|
||||
extern ADC_HandleTypeDef hadc1;
|
||||
extern ADC_HandleTypeDef hadc2;
|
||||
extern CAN_HandleTypeDef hcan;
|
||||
extern TIM_HandleTypeDef htim6;
|
||||
/* USER CODE BEGIN EV */
|
||||
|
||||
/* USER CODE END EV */
|
||||
@ -215,6 +218,21 @@ void DMA1_Channel1_IRQHandler(void)
|
||||
/* 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.
|
||||
*/
|
||||
@ -257,6 +275,20 @@ void CAN_SCE_IRQHandler(void)
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
204
Makefile
Normal file
204
Makefile
Normal file
@ -0,0 +1,204 @@
|
||||
##########################################################################################################################
|
||||
# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Thu Sep 05 20:41:52 CEST 2024]
|
||||
##########################################################################################################################
|
||||
|
||||
# ------------------------------------------------
|
||||
# Generic Makefile (based on gcc)
|
||||
#
|
||||
# ChangeLog :
|
||||
# 2017-02-10 - Several enhancements + project update mode
|
||||
# 2015-07-22 - first version
|
||||
# ------------------------------------------------
|
||||
|
||||
######################################
|
||||
# target
|
||||
######################################
|
||||
TARGET = PDU FT24 MCU
|
||||
|
||||
|
||||
######################################
|
||||
# building variables
|
||||
######################################
|
||||
# debug build?
|
||||
DEBUG = 1
|
||||
# optimization
|
||||
OPT = -Og
|
||||
|
||||
|
||||
#######################################
|
||||
# paths
|
||||
#######################################
|
||||
# Build path
|
||||
BUILD_DIR = build
|
||||
|
||||
######################################
|
||||
# source
|
||||
######################################
|
||||
# C sources
|
||||
C_SOURCES = \
|
||||
Core/Src/main.c \
|
||||
Core/Src/stm32f3xx_it.c \
|
||||
Core/Src/stm32f3xx_hal_msp.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_adc.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_adc_ex.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.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_flash.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.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_exti.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_can.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart_ex.c \
|
||||
Core/Src/system_stm32f3xx.c \
|
||||
Core/Src/sysmem.c \
|
||||
Core/Src/syscalls.c
|
||||
|
||||
# ASM sources
|
||||
ASM_SOURCES = \
|
||||
startup_stm32f302xc.s
|
||||
|
||||
# ASM sources
|
||||
ASMM_SOURCES =
|
||||
|
||||
|
||||
#######################################
|
||||
# binaries
|
||||
#######################################
|
||||
PREFIX = arm-none-eabi-
|
||||
# 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.
|
||||
ifdef GCC_PATH
|
||||
CC = $(GCC_PATH)/$(PREFIX)gcc
|
||||
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
|
||||
CP = $(GCC_PATH)/$(PREFIX)objcopy
|
||||
SZ = $(GCC_PATH)/$(PREFIX)size
|
||||
else
|
||||
CC = $(PREFIX)gcc
|
||||
AS = $(PREFIX)gcc -x assembler-with-cpp
|
||||
CP = $(PREFIX)objcopy
|
||||
SZ = $(PREFIX)size
|
||||
endif
|
||||
HEX = $(CP) -O ihex
|
||||
BIN = $(CP) -O binary -S
|
||||
|
||||
#######################################
|
||||
# CFLAGS
|
||||
#######################################
|
||||
# cpu
|
||||
CPU = -mcpu=cortex-m4
|
||||
|
||||
# fpu
|
||||
FPU = -mfpu=fpv4-sp-d16
|
||||
|
||||
# float-abi
|
||||
FLOAT-ABI = -mfloat-abi=hard
|
||||
|
||||
# mcu
|
||||
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
|
||||
|
||||
# macros for gcc
|
||||
# AS defines
|
||||
AS_DEFS =
|
||||
|
||||
# C defines
|
||||
C_DEFS = \
|
||||
-DUSE_HAL_DRIVER \
|
||||
-DSTM32F302xC
|
||||
|
||||
|
||||
# AS includes
|
||||
AS_INCLUDES =
|
||||
|
||||
# C includes
|
||||
C_INCLUDES = \
|
||||
-ICore/Inc \
|
||||
-IDrivers/STM32F3xx_HAL_Driver/Inc \
|
||||
-IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy \
|
||||
-IDrivers/CMSIS/Device/ST/STM32F3xx/Include \
|
||||
-IDrivers/CMSIS/Include
|
||||
|
||||
|
||||
# compile gcc flags
|
||||
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
||||
|
||||
CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -g -gdwarf-2
|
||||
endif
|
||||
|
||||
|
||||
# Generate dependency information
|
||||
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
|
||||
|
||||
|
||||
#######################################
|
||||
# LDFLAGS
|
||||
#######################################
|
||||
# link script
|
||||
LDSCRIPT = STM32F302RBTx_FLASH.ld
|
||||
|
||||
# libraries
|
||||
LIBS = -lc -lm -lnosys
|
||||
LIBDIR =
|
||||
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
|
||||
|
||||
# default action: build all
|
||||
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
|
||||
|
||||
|
||||
#######################################
|
||||
# build the application
|
||||
#######################################
|
||||
# list of objects
|
||||
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
|
||||
vpath %.c $(sort $(dir $(C_SOURCES)))
|
||||
# list of ASM program objects
|
||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
|
||||
vpath %.s $(sort $(dir $(ASM_SOURCES)))
|
||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASMM_SOURCES:.S=.o)))
|
||||
vpath %.S $(sort $(dir $(ASMM_SOURCES)))
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
||||
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
|
||||
$(AS) -c $(CFLAGS) $< -o $@
|
||||
$(BUILD_DIR)/%.o: %.S Makefile | $(BUILD_DIR)
|
||||
$(AS) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
|
||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
$(SZ) $@
|
||||
|
||||
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
||||
$(HEX) $< $@
|
||||
|
||||
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
||||
$(BIN) $< $@
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $@
|
||||
|
||||
#######################################
|
||||
# clean up
|
||||
#######################################
|
||||
clean:
|
||||
-rm -fR $(BUILD_DIR)
|
||||
|
||||
#######################################
|
||||
# dependencies
|
||||
#######################################
|
||||
-include $(wildcard $(BUILD_DIR)/*.d)
|
||||
|
||||
# *** EOF ***
|
||||
202
PDU FT24 MCU.ioc
202
PDU FT24 MCU.ioc
@ -1,24 +1,91 @@
|
||||
#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.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,Offset-0\#ChannelRegularConversion,NbrOfConversionFlag,master,DMAContinuousRequests,NbrOfConversion
|
||||
ADC1.NbrOfConversion=1
|
||||
ADC1.EOCSelection=ADC_EOC_SEQ_CONV
|
||||
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.Offset-0\#ChannelRegularConversion=0
|
||||
ADC1.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE
|
||||
ADC1.Rank-0\#ChannelRegularConversion=1
|
||||
ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_1CYCLE_5
|
||||
ADC1.Offset-11\#ChannelRegularConversion=0
|
||||
ADC1.Offset-12\#ChannelRegularConversion=0
|
||||
ADC1.Offset-13\#ChannelRegularConversion=0
|
||||
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
|
||||
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.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.NbrOfConversion=5
|
||||
ADC2.NbrOfConversionFlag=1
|
||||
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-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.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.pinconfig=
|
||||
CAD.provider=
|
||||
@ -56,61 +123,55 @@ File.Version=6
|
||||
GPIO.groupedBy=Group By Peripherals
|
||||
I2C1.IPParameters=Timing
|
||||
I2C1.Timing=0x00303D5B
|
||||
IWDG.IPParameters=Prescaler,Window,Reload
|
||||
IWDG.Prescaler=IWDG_PRESCALER_4
|
||||
IWDG.Reload=1000
|
||||
IWDG.Window=1000
|
||||
KeepUserPlacement=false
|
||||
Mcu.CPN=STM32F302RBT6
|
||||
Mcu.Family=STM32F3
|
||||
Mcu.IP0=ADC1
|
||||
Mcu.IP1=ADC2
|
||||
Mcu.IP10=TIM3
|
||||
Mcu.IP11=TIM6
|
||||
Mcu.IP12=USART1
|
||||
Mcu.IP10=USART1
|
||||
Mcu.IP2=CAN
|
||||
Mcu.IP3=DMA
|
||||
Mcu.IP4=I2C1
|
||||
Mcu.IP5=IWDG
|
||||
Mcu.IP6=NVIC
|
||||
Mcu.IP7=RCC
|
||||
Mcu.IP8=SYS
|
||||
Mcu.IP9=TIM2
|
||||
Mcu.IPNb=13
|
||||
Mcu.IP5=NVIC
|
||||
Mcu.IP6=RCC
|
||||
Mcu.IP7=SYS
|
||||
Mcu.IP8=TIM2
|
||||
Mcu.IP9=TIM6
|
||||
Mcu.IPNb=11
|
||||
Mcu.Name=STM32F302R(B-C)Tx
|
||||
Mcu.Package=LQFP64
|
||||
Mcu.Pin0=PF0-OSC_IN
|
||||
Mcu.Pin1=PF1-OSC_OUT
|
||||
Mcu.Pin10=PA4
|
||||
Mcu.Pin11=PA5
|
||||
Mcu.Pin12=PA6
|
||||
Mcu.Pin13=PA7
|
||||
Mcu.Pin14=PC4
|
||||
Mcu.Pin15=PB0
|
||||
Mcu.Pin16=PB1
|
||||
Mcu.Pin17=PB10
|
||||
Mcu.Pin18=PB12
|
||||
Mcu.Pin19=PB13
|
||||
Mcu.Pin10=PF4
|
||||
Mcu.Pin11=PA4
|
||||
Mcu.Pin12=PA5
|
||||
Mcu.Pin13=PA6
|
||||
Mcu.Pin14=PA7
|
||||
Mcu.Pin15=PC4
|
||||
Mcu.Pin16=PB0
|
||||
Mcu.Pin17=PB1
|
||||
Mcu.Pin18=PB10
|
||||
Mcu.Pin19=PB12
|
||||
Mcu.Pin2=PC0
|
||||
Mcu.Pin20=PB14
|
||||
Mcu.Pin21=PB15
|
||||
Mcu.Pin22=PC6
|
||||
Mcu.Pin23=PC7
|
||||
Mcu.Pin24=PC8
|
||||
Mcu.Pin25=PC9
|
||||
Mcu.Pin26=PA9
|
||||
Mcu.Pin27=PA10
|
||||
Mcu.Pin28=PA11
|
||||
Mcu.Pin29=PA12
|
||||
Mcu.Pin20=PB13
|
||||
Mcu.Pin21=PB14
|
||||
Mcu.Pin22=PB15
|
||||
Mcu.Pin23=PC6
|
||||
Mcu.Pin24=PC7
|
||||
Mcu.Pin25=PC8
|
||||
Mcu.Pin26=PC9
|
||||
Mcu.Pin27=PA9
|
||||
Mcu.Pin28=PA10
|
||||
Mcu.Pin29=PA11
|
||||
Mcu.Pin3=PC1
|
||||
Mcu.Pin30=PA13
|
||||
Mcu.Pin31=PA14
|
||||
Mcu.Pin32=PA15
|
||||
Mcu.Pin33=PB3
|
||||
Mcu.Pin34=PB4
|
||||
Mcu.Pin35=PB7
|
||||
Mcu.Pin36=PB9
|
||||
Mcu.Pin37=VP_IWDG_VS_IWDG
|
||||
Mcu.Pin30=PA12
|
||||
Mcu.Pin31=PA13
|
||||
Mcu.Pin32=PA14
|
||||
Mcu.Pin33=PA15
|
||||
Mcu.Pin34=PB3
|
||||
Mcu.Pin35=PB4
|
||||
Mcu.Pin36=PB7
|
||||
Mcu.Pin37=PB9
|
||||
Mcu.Pin38=VP_SYS_VS_Systick
|
||||
Mcu.Pin39=VP_TIM6_VS_ClockSourceINT
|
||||
Mcu.Pin4=PC2
|
||||
@ -125,6 +186,7 @@ Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F302RBTx
|
||||
MxCube.Version=6.11.1
|
||||
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.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
|
||||
@ -139,13 +201,13 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||
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.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.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
PA0.GPIOParameters=GPIO_Label
|
||||
PA0.GPIO_Label=DSEL 8
|
||||
PA0.Locked=true
|
||||
PA0.Mode=IN1-Single-Ended
|
||||
PA0.Signal=ADC1_IN1
|
||||
PA0.Signal=GPIO_Output
|
||||
PA1.GPIOParameters=GPIO_Label
|
||||
PA1.GPIO_Label=isense5
|
||||
PA1.Locked=true
|
||||
@ -212,8 +274,10 @@ PB0.GPIOParameters=GPIO_Label
|
||||
PB0.GPIO_Label=GSS_GPIO
|
||||
PB0.Locked=true
|
||||
PB0.Signal=GPIO_Output
|
||||
PB1.GPIOParameters=GPIO_Label
|
||||
PB1.GPIO_Label=EN_PUMP
|
||||
PB1.Locked=true
|
||||
PB1.Signal=S_TIM3_CH4
|
||||
PB1.Signal=GPIO_Output
|
||||
PB10.Locked=true
|
||||
PB10.Signal=S_TIM2_CH3
|
||||
PB12.GPIOParameters=GPIO_Label
|
||||
@ -232,10 +296,14 @@ PB15.GPIOParameters=GPIO_Label
|
||||
PB15.GPIO_Label=DSEL 6
|
||||
PB15.Locked=true
|
||||
PB15.Signal=GPIO_Output
|
||||
PB3.GPIOParameters=GPIO_Label
|
||||
PB3.GPIO_Label=EN_TSACFAN
|
||||
PB3.Locked=true
|
||||
PB3.Signal=S_TIM2_CH2
|
||||
PB3.Signal=GPIO_Output
|
||||
PB4.GPIOParameters=GPIO_Label
|
||||
PB4.GPIO_Label=EN_RADFAN
|
||||
PB4.Locked=true
|
||||
PB4.Signal=S_TIM3_CH1
|
||||
PB4.Signal=GPIO_Output
|
||||
PB7.Locked=true
|
||||
PB7.Mode=I2C
|
||||
PB7.Signal=I2C1_SDA
|
||||
@ -256,6 +324,8 @@ PC2.Signal=ADCx_IN8
|
||||
PC3.GPIOParameters=GPIO_Label
|
||||
PC3.GPIO_Label=isense13
|
||||
PC3.Signal=ADCx_IN9
|
||||
PC4.GPIOParameters=GPIO_Label
|
||||
PC4.GPIO_Label=LV_sens
|
||||
PC4.Locked=true
|
||||
PC4.Mode=IN5-Single-Ended
|
||||
PC4.Signal=ADC2_IN5
|
||||
@ -281,6 +351,11 @@ PF0-OSC_IN.Signal=RCC_OSC_IN
|
||||
PF1-OSC_OUT.Locked=true
|
||||
PF1-OSC_OUT.Mode=HSE-External-Oscillator
|
||||
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
|
||||
ProjectManager.AskForMigrate=true
|
||||
ProjectManager.BackupPrevious=false
|
||||
@ -312,7 +387,7 @@ ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UAScriptAfterPath=
|
||||
ProjectManager.UAScriptBeforePath=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_ADC1_Init-ADC1-false-HAL-true,5-MX_ADC2_Init-ADC2-false-HAL-true,6-MX_CAN_Init-CAN-false-HAL-true,7-MX_TIM2_Init-TIM2-false-HAL-true,8-MX_TIM3_Init-TIM3-false-HAL-true,9-MX_I2C1_Init-I2C1-false-HAL-true,10-MX_USART1_UART_Init-USART1-false-HAL-true,11-MX_TIM6_Init-TIM6-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_ADC1_Init-ADC1-false-HAL-true,5-MX_ADC2_Init-ADC2-false-HAL-true,6-MX_CAN_Init-CAN-false-HAL-true,7-MX_TIM2_Init-TIM2-false-HAL-true,8-MX_TIM3_Init-TIM3-false-HAL-true,8-MX_I2C1_Init-I2C1-false-HAL-true,9-MX_USART1_UART_Init-USART1-false-HAL-true,10-MX_TIM6_Init-TIM6-false-HAL-true
|
||||
RCC.ADC12outputFreq_Value=64000000
|
||||
RCC.AHBFreq_Value=16000000
|
||||
RCC.APB1Freq_Value=16000000
|
||||
@ -362,30 +437,17 @@ SH.ADCx_IN8.0=ADC1_IN8,IN8-Single-Ended
|
||||
SH.ADCx_IN8.ConfNb=1
|
||||
SH.ADCx_IN9.0=ADC1_IN9,IN9-Single-Ended
|
||||
SH.ADCx_IN9.ConfNb=1
|
||||
SH.S_TIM2_CH2.0=TIM2_CH2,PWM Generation2 CH2
|
||||
SH.S_TIM2_CH2.ConfNb=1
|
||||
SH.S_TIM2_CH3.0=TIM2_CH3,PWM Generation3 CH3
|
||||
SH.S_TIM2_CH3.ConfNb=1
|
||||
SH.S_TIM3_CH1.0=TIM3_CH1,PWM Generation1 CH1
|
||||
SH.S_TIM3_CH1.ConfNb=1
|
||||
SH.S_TIM3_CH4.0=TIM3_CH4,PWM Generation4 CH4
|
||||
SH.S_TIM3_CH4.ConfNb=1
|
||||
TIM2.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
||||
TIM2.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
|
||||
TIM2.IPParameters=Channel-PWM Generation2 CH2,Pulse-PWM Generation2 CH2,Period,Channel-PWM Generation3 CH3
|
||||
TIM2.IPParameters=Period,Channel-PWM Generation3 CH3
|
||||
TIM2.Period=65535
|
||||
TIM2.Pulse-PWM\ Generation2\ CH2=0
|
||||
TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
||||
TIM3.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4
|
||||
TIM3.IPParameters=Channel-PWM Generation4 CH4,Channel-PWM Generation1 CH1
|
||||
TIM6.IPParameters=Prescaler,Period,TIM_MasterOutputTrigger
|
||||
TIM6.Period=8000-1
|
||||
TIM6.Prescaler=400
|
||||
TIM6.TIM_MasterOutputTrigger=TIM_TRGO_UPDATE
|
||||
USART1.IPParameters=VirtualMode-Multiprocessor_communication
|
||||
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.Signal=SYS_VS_Systick
|
||||
VP_TIM6_VS_ClockSourceINT.Mode=Enable_Timer
|
||||
|
||||
@ -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_i2c.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_ex.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c \
|
||||
@ -86,7 +85,7 @@ PREFIX = arm-none-eabi-
|
||||
POSTFIX = "
|
||||
# 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.
|
||||
#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="/home/jasper/.config/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
|
||||
CXX = $(GCC_PATH)/$(PREFIX)g++$(POSTFIX)
|
||||
CC = $(GCC_PATH)/$(PREFIX)gcc$(POSTFIX)
|
||||
@ -120,7 +119,7 @@ MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
|
||||
|
||||
# macros for gcc
|
||||
# AS defines
|
||||
AS_DEFS =
|
||||
AS_DEFS =
|
||||
|
||||
# C defines
|
||||
C_DEFS = \
|
||||
@ -160,9 +159,9 @@ CXXFLAGS += -g -gdwarf -ggdb
|
||||
endif
|
||||
|
||||
# Add additional flags
|
||||
CFLAGS += -Wall -fdata-sections -ffunction-sections
|
||||
ASFLAGS += -Wall -fdata-sections -ffunction-sections
|
||||
CXXFLAGS +=
|
||||
CFLAGS += -Wall -fdata-sections -ffunction-sections
|
||||
ASFLAGS += -Wall -fdata-sections -ffunction-sections
|
||||
CXXFLAGS +=
|
||||
|
||||
# Generate dependency information
|
||||
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
|
||||
@ -175,12 +174,12 @@ CXXFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
|
||||
LDSCRIPT = STM32F302RBTx_FLASH.ld
|
||||
|
||||
# libraries
|
||||
LIBS = -lc -lm -lnosys
|
||||
LIBS = -lc -lm -lnosys
|
||||
LIBDIR = \
|
||||
|
||||
|
||||
# Additional LD Flags from config file
|
||||
ADDITIONALLDFLAGS = -specs=nano.specs
|
||||
ADDITIONALLDFLAGS = -specs=nano.specs
|
||||
|
||||
LDFLAGS = $(MCU) $(ADDITIONALLDFLAGS) -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
|
||||
|
||||
@ -207,13 +206,13 @@ OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(UPPER_CASE_ASM_SOURCES:.S=.o)))
|
||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(LOWER_CASE_ASM_SOURCES:.s=.o)))
|
||||
vpath %.s $(sort $(dir $(ASM_SOURCES)))
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp STM32Make.make | $(BUILD_DIR)
|
||||
$(BUILD_DIR)/%.o: %.cpp STM32Make.make | $(BUILD_DIR)
|
||||
$(CXX) -c $(CXXFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.cpp=.lst)) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cxx STM32Make.make | $(BUILD_DIR)
|
||||
$(BUILD_DIR)/%.o: %.cxx STM32Make.make | $(BUILD_DIR)
|
||||
$(CXX) -c $(CXXFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.cxx=.lst)) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c STM32Make.make | $(BUILD_DIR)
|
||||
$(BUILD_DIR)/%.o: %.c STM32Make.make | $(BUILD_DIR)
|
||||
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s STM32Make.make | $(BUILD_DIR)
|
||||
@ -239,29 +238,29 @@ $(BUILD_DIR):
|
||||
# flash
|
||||
#######################################
|
||||
flash: $(BUILD_DIR)/$(TARGET).elf
|
||||
openocd -f ./openocd.cfg -c "program $(BUILD_DIR)/$(TARGET).elf verify reset exit"
|
||||
"/home/jasper/.config/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.12.0-3.1/.content/bin/openocd" -f ./openocd.cfg -c "program $(BUILD_DIR)/$(TARGET).elf verify reset exit"
|
||||
|
||||
#######################################
|
||||
# erase
|
||||
#######################################
|
||||
erase: $(BUILD_DIR)/$(TARGET).elf
|
||||
openocd -f ./openocd.cfg -c "init; reset halt; stm32f3x mass_erase 0; exit"
|
||||
"/home/jasper/.config/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.12.0-3.1/.content/bin/openocd" -f ./openocd.cfg -c "init; reset halt; stm32f3x mass_erase 0; exit"
|
||||
|
||||
#######################################
|
||||
# clean up
|
||||
#######################################
|
||||
clean:
|
||||
rm -r $(BUILD_DIR)
|
||||
-rm -fR $(BUILD_DIR)
|
||||
|
||||
#######################################
|
||||
# custom makefile rules
|
||||
#######################################
|
||||
|
||||
|
||||
|
||||
|
||||
#######################################
|
||||
# dependencies
|
||||
#######################################
|
||||
-include $(wildcard $(BUILD_DIR)/*.d)
|
||||
|
||||
# *** EOF ***
|
||||
# *** EOF ***
|
||||
Reference in New Issue
Block a user