mirror of
https://gitea.ecohim.ru:3000/RS485_Relay/RS485_Relay2_fw.git
synced 2025-08-07 16:20:30 +03:00
WIP: Add new features for board version 2
This commit is contained in:
2
.project
2
.project
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>Relay_RS485</name>
|
<name>Relay_RS485_V2</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#ifndef BOARD_LOGIC_H_
|
#ifndef BOARD_LOGIC_H_
|
||||||
#define BOARD_LOGIC_H_
|
#define BOARD_LOGIC_H_
|
||||||
|
|
||||||
#define MODBUS_FIRMWARE_VERSION ( /*major*/ 10 + /*minor*/ 1 * 0x100)
|
#define MODBUS_FIRMWARE_VERSION ( /*major*/ 11 + /*minor*/ 0 * 0x100)
|
||||||
#define MODBUS_BOARD_TYPE (8) //Relay Module board ID
|
#define MODBUS_BOARD_TYPE (8) //Relay Module board ID
|
||||||
|
|
||||||
#define REL_MAIN_BIT (1u<<0)
|
#define REL_MAIN_BIT (1u<<0)
|
||||||
@@ -16,7 +16,11 @@
|
|||||||
#define MOTOR_MAX 255
|
#define MOTOR_MAX 255
|
||||||
|
|
||||||
|
|
||||||
|
void estop_reset(void);
|
||||||
|
void board_init(void);
|
||||||
|
void set_pwm(uint8_t unit, uint16_t duty);
|
||||||
void loop_iterate();
|
void loop_iterate();
|
||||||
void timer1_ovf_isr(void);
|
void timer1_ovf_isr(void);
|
||||||
|
void update_service_indication(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -59,6 +59,16 @@ void Error_Handler(void);
|
|||||||
/* USER CODE END EFP */
|
/* USER CODE END EFP */
|
||||||
|
|
||||||
/* Private defines -----------------------------------------------------------*/
|
/* Private defines -----------------------------------------------------------*/
|
||||||
|
#define WATER_Pin GPIO_PIN_0
|
||||||
|
#define WATER_GPIO_Port GPIOA
|
||||||
|
#define WATER_EXTI_IRQn EXTI0_1_IRQn
|
||||||
|
#define ESTOP_Pin GPIO_PIN_1
|
||||||
|
#define ESTOP_GPIO_Port GPIOA
|
||||||
|
#define ESTOP_EXTI_IRQn EXTI0_1_IRQn
|
||||||
|
#define LIGHTS_Pin GPIO_PIN_4
|
||||||
|
#define LIGHTS_GPIO_Port GPIOA
|
||||||
|
#define RL_EN_Pin GPIO_PIN_5
|
||||||
|
#define RL_EN_GPIO_Port GPIOA
|
||||||
#define LED_AUX_Pin GPIO_PIN_6
|
#define LED_AUX_Pin GPIO_PIN_6
|
||||||
#define LED_AUX_GPIO_Port GPIOA
|
#define LED_AUX_GPIO_Port GPIOA
|
||||||
#define LED_MAIN_Pin GPIO_PIN_7
|
#define LED_MAIN_Pin GPIO_PIN_7
|
||||||
@@ -67,6 +77,9 @@ void Error_Handler(void);
|
|||||||
#define LED_ERR_GPIO_Port GPIOB
|
#define LED_ERR_GPIO_Port GPIOB
|
||||||
#define LED_ACT_Pin GPIO_PIN_1
|
#define LED_ACT_Pin GPIO_PIN_1
|
||||||
#define LED_ACT_GPIO_Port GPIOB
|
#define LED_ACT_GPIO_Port GPIOB
|
||||||
|
#define LIGHTS_SW_Pin GPIO_PIN_8
|
||||||
|
#define LIGHTS_SW_GPIO_Port GPIOA
|
||||||
|
#define LIGHTS_SW_EXTI_IRQn EXTI4_15_IRQn
|
||||||
#define TXEN_Pin GPIO_PIN_11
|
#define TXEN_Pin GPIO_PIN_11
|
||||||
#define TXEN_GPIO_Port GPIOA
|
#define TXEN_GPIO_Port GPIOA
|
||||||
#define RL_AUX_Pin GPIO_PIN_15
|
#define RL_AUX_Pin GPIO_PIN_15
|
||||||
|
@@ -51,6 +51,8 @@ void HardFault_Handler(void);
|
|||||||
void SVC_Handler(void);
|
void SVC_Handler(void);
|
||||||
void PendSV_Handler(void);
|
void PendSV_Handler(void);
|
||||||
void SysTick_Handler(void);
|
void SysTick_Handler(void);
|
||||||
|
void EXTI0_1_IRQHandler(void);
|
||||||
|
void EXTI4_15_IRQHandler(void);
|
||||||
void DMA1_Channel2_3_IRQHandler(void);
|
void DMA1_Channel2_3_IRQHandler(void);
|
||||||
void TIM1_BRK_UP_TRG_COM_IRQHandler(void);
|
void TIM1_BRK_UP_TRG_COM_IRQHandler(void);
|
||||||
void TIM1_CC_IRQHandler(void);
|
void TIM1_CC_IRQHandler(void);
|
||||||
|
@@ -12,8 +12,10 @@
|
|||||||
|
|
||||||
#define BOARD_DESC_LEN (16)
|
#define BOARD_DESC_LEN (16)
|
||||||
|
|
||||||
|
extern TIM_HandleTypeDef htim1;
|
||||||
extern TIM_HandleTypeDef htim3;
|
extern TIM_HandleTypeDef htim3;
|
||||||
static const char board_description[BOARD_DESC_LEN] = "RS485_Relay V1R1";
|
extern TIM_HandleTypeDef htim14;
|
||||||
|
static const char board_description[BOARD_DESC_LEN] = "RS485_Relay V2R1";
|
||||||
extern uint16_t tranfer_errors_count;
|
extern uint16_t tranfer_errors_count;
|
||||||
extern uint16_t last_rx_time;
|
extern uint16_t last_rx_time;
|
||||||
|
|
||||||
@@ -28,11 +30,59 @@ extern uint16_t last_rx_time;
|
|||||||
#define LED_ACT_ON HAL_GPIO_WritePin(LED_ACT_GPIO_Port, LED_ACT_Pin, GPIO_PIN_SET)
|
#define LED_ACT_ON HAL_GPIO_WritePin(LED_ACT_GPIO_Port, LED_ACT_Pin, GPIO_PIN_SET)
|
||||||
#define LED_ACT_OFF HAL_GPIO_WritePin(LED_ACT_GPIO_Port, LED_ACT_Pin, GPIO_PIN_RESET)
|
#define LED_ACT_OFF HAL_GPIO_WritePin(LED_ACT_GPIO_Port, LED_ACT_Pin, GPIO_PIN_RESET)
|
||||||
|
|
||||||
uint16_t relays=0;
|
|
||||||
uint16_t motor_pwm=0;
|
|
||||||
uint16_t led_time_act=0;
|
|
||||||
|
|
||||||
void update_service_indication(void);
|
uint16_t relays = 0;
|
||||||
|
uint16_t status = 0;
|
||||||
|
uint16_t motor1_pwm = 0;
|
||||||
|
uint16_t motor2_pwm = 0;
|
||||||
|
uint16_t lights_pwm = 0;
|
||||||
|
uint16_t led_time_act = 0;
|
||||||
|
|
||||||
|
void estop_reset(void) {
|
||||||
|
HAL_GPIO_WritePin(RL_EN_GPIO_Port, RL_EN_Pin, GPIO_PIN_RESET);
|
||||||
|
HAL_Delay(1);
|
||||||
|
HAL_GPIO_WritePin(RL_EN_GPIO_Port, RL_EN_Pin, GPIO_PIN_SET);
|
||||||
|
}
|
||||||
|
|
||||||
|
void board_init(void) {
|
||||||
|
// Activate (normalize) E-STOP trigger
|
||||||
|
estop_reset();
|
||||||
|
|
||||||
|
// 1ms timer start
|
||||||
|
HAL_TIM_Base_Start_IT(&htim1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_pwm(uint8_t unit, uint16_t duty) {
|
||||||
|
uint32_t channel;
|
||||||
|
TIM_HandleTypeDef* tim;
|
||||||
|
|
||||||
|
switch (unit) {
|
||||||
|
case 1: // motor 1
|
||||||
|
tim = &htim3;
|
||||||
|
channel = TIM_CHANNEL_1;
|
||||||
|
break;
|
||||||
|
case 2: // motor 2
|
||||||
|
tim = &htim3;
|
||||||
|
channel = TIM_CHANNEL_2;
|
||||||
|
break;
|
||||||
|
case 3: // lights
|
||||||
|
tim = &htim14;
|
||||||
|
channel = TIM_CHANNEL_1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (duty > MOTOR_MAX) duty = MOTOR_MAX;
|
||||||
|
if (duty < MOTOR_MIN) duty = MOTOR_MIN;
|
||||||
|
if (duty == 0)
|
||||||
|
HAL_TIM_PWM_Stop(tim, channel);
|
||||||
|
else {
|
||||||
|
HAL_TIM_PWM_Start(tim, channel);
|
||||||
|
__HAL_TIM_SetCompare(tim, channel, duty);
|
||||||
|
HAL_Delay(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void loop_iterate()
|
void loop_iterate()
|
||||||
{
|
{
|
||||||
@@ -82,22 +132,13 @@ void timer1_ovf_isr(void) //1 ms
|
|||||||
|
|
||||||
void update_service_indication(void)
|
void update_service_indication(void)
|
||||||
{
|
{
|
||||||
if(led_time_act)
|
if (led_time_act) {
|
||||||
{
|
|
||||||
LED_ACT_ON;
|
LED_ACT_ON;
|
||||||
led_time_act--;
|
led_time_act--;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
LED_ACT_OFF;
|
LED_ACT_OFF;
|
||||||
/*
|
|
||||||
if(led_time_g)
|
|
||||||
{
|
|
||||||
LED_G_ON;
|
|
||||||
led_time_g--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
LED_G_OFF;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -125,9 +166,22 @@ uint8_t read_register(uint16_t address, uint16_t* value)
|
|||||||
{
|
{
|
||||||
*value = relays;
|
*value = relays;
|
||||||
}
|
}
|
||||||
else if (address == 0x2002) //Read motor pwm
|
else if (address == 0x2002) //Read motor 1 pwm
|
||||||
{
|
{
|
||||||
*value = motor_pwm;
|
*value = motor1_pwm;
|
||||||
|
}
|
||||||
|
else if (address == 0x2003) //Read motor 2 pwm
|
||||||
|
{
|
||||||
|
*value = motor2_pwm;
|
||||||
|
}
|
||||||
|
else if (address == 0x2004) //Read Lights pwm
|
||||||
|
{
|
||||||
|
*value = lights_pwm;
|
||||||
|
}
|
||||||
|
else if (address == 0x2004) //Read status
|
||||||
|
{
|
||||||
|
*value = status;
|
||||||
|
status &= 0b011; // Reset light button press event status
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
@@ -137,7 +191,7 @@ uint8_t read_register(uint16_t address, uint16_t* value)
|
|||||||
uint8_t write_register(uint16_t address, uint16_t value)
|
uint8_t write_register(uint16_t address, uint16_t value)
|
||||||
{
|
{
|
||||||
uint8_t ret;
|
uint8_t ret;
|
||||||
ret=0;
|
ret = 0;
|
||||||
#ifdef UART_DEBUG
|
#ifdef UART_DEBUG
|
||||||
printf("Write A=0x%X D=0x%X\n\r",address,value);
|
printf("Write A=0x%X D=0x%X\n\r",address,value);
|
||||||
#endif
|
#endif
|
||||||
@@ -146,15 +200,21 @@ uint8_t write_register(uint16_t address, uint16_t value)
|
|||||||
relays = value;
|
relays = value;
|
||||||
break;
|
break;
|
||||||
case 0x2002:
|
case 0x2002:
|
||||||
motor_pwm = value;
|
motor1_pwm = value;
|
||||||
if(motor_pwm>MOTOR_MAX)motor_pwm=MOTOR_MAX;
|
set_pwm(1, motor1_pwm);
|
||||||
if(motor_pwm<MOTOR_MIN)motor_pwm=MOTOR_MIN;
|
break;
|
||||||
if(motor_pwm==0)
|
case 0x2003:
|
||||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1);
|
motor2_pwm = value;
|
||||||
else {
|
set_pwm(2, motor2_pwm);
|
||||||
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
|
break;
|
||||||
__HAL_TIM_SetCompare(&htim3, TIM_CHANNEL_1, motor_pwm);
|
case 0x2004:
|
||||||
HAL_Delay(5);
|
lights_pwm = value;
|
||||||
|
set_pwm(3, lights_pwm);
|
||||||
|
break;
|
||||||
|
case 0x2020:
|
||||||
|
if (value == 1) {
|
||||||
|
estop_reset();
|
||||||
|
status &= 0b101;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -163,3 +223,17 @@ uint8_t write_register(uint16_t address, uint16_t value)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pin external interrupts handler
|
||||||
|
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
|
{
|
||||||
|
if(GPIO_Pin == ESTOP_Pin) {
|
||||||
|
status = status | 0b010;
|
||||||
|
}
|
||||||
|
if(GPIO_Pin == LIGHTS_SW_Pin) {
|
||||||
|
status |= 0b100; // Set "lights switch pressed" status bit
|
||||||
|
}
|
||||||
|
if(GPIO_Pin == WATER_Pin) {
|
||||||
|
// Set or reset "water" status bit
|
||||||
|
status |= HAL_GPIO_ReadPin(WATER_GPIO_Port, WATER_Pin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
TIM_HandleTypeDef htim1;
|
TIM_HandleTypeDef htim1;
|
||||||
TIM_HandleTypeDef htim3;
|
TIM_HandleTypeDef htim3;
|
||||||
|
TIM_HandleTypeDef htim14;
|
||||||
|
|
||||||
UART_HandleTypeDef huart1;
|
UART_HandleTypeDef huart1;
|
||||||
DMA_HandleTypeDef hdma_usart1_rx;
|
DMA_HandleTypeDef hdma_usart1_rx;
|
||||||
@@ -61,6 +62,7 @@ static void MX_DMA_Init(void);
|
|||||||
static void MX_TIM3_Init(void);
|
static void MX_TIM3_Init(void);
|
||||||
static void MX_USART1_UART_Init(void);
|
static void MX_USART1_UART_Init(void);
|
||||||
static void MX_TIM1_Init(void);
|
static void MX_TIM1_Init(void);
|
||||||
|
static void MX_TIM14_Init(void);
|
||||||
/* USER CODE BEGIN PFP */
|
/* USER CODE BEGIN PFP */
|
||||||
|
|
||||||
/* USER CODE END PFP */
|
/* USER CODE END PFP */
|
||||||
@@ -102,8 +104,9 @@ int main(void)
|
|||||||
MX_TIM3_Init();
|
MX_TIM3_Init();
|
||||||
MX_USART1_UART_Init();
|
MX_USART1_UART_Init();
|
||||||
MX_TIM1_Init();
|
MX_TIM1_Init();
|
||||||
|
MX_TIM14_Init();
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
HAL_TIM_Base_Start_IT(&htim1);
|
board_init();
|
||||||
|
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
@@ -183,9 +186,9 @@ static void MX_TIM1_Init(void)
|
|||||||
|
|
||||||
/* USER CODE END TIM1_Init 1 */
|
/* USER CODE END TIM1_Init 1 */
|
||||||
htim1.Instance = TIM1;
|
htim1.Instance = TIM1;
|
||||||
htim1.Init.Prescaler = 479;
|
htim1.Init.Prescaler = 480-1;
|
||||||
htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
|
htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||||
htim1.Init.Period = 100;
|
htim1.Init.Period = 100-1;
|
||||||
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||||
htim1.Init.RepetitionCounter = 0;
|
htim1.Init.RepetitionCounter = 0;
|
||||||
htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||||
@@ -229,7 +232,7 @@ static void MX_TIM3_Init(void)
|
|||||||
|
|
||||||
/* USER CODE END TIM3_Init 1 */
|
/* USER CODE END TIM3_Init 1 */
|
||||||
htim3.Instance = TIM3;
|
htim3.Instance = TIM3;
|
||||||
htim3.Init.Prescaler = 239;
|
htim3.Init.Prescaler = 240-1;
|
||||||
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||||
htim3.Init.Period = 255;
|
htim3.Init.Period = 255;
|
||||||
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||||
@@ -252,6 +255,10 @@ static void MX_TIM3_Init(void)
|
|||||||
{
|
{
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
}
|
}
|
||||||
|
if (HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_2) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
/* USER CODE BEGIN TIM3_Init 2 */
|
/* USER CODE BEGIN TIM3_Init 2 */
|
||||||
|
|
||||||
/* USER CODE END TIM3_Init 2 */
|
/* USER CODE END TIM3_Init 2 */
|
||||||
@@ -259,6 +266,52 @@ static void MX_TIM3_Init(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TIM14 Initialization Function
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static void MX_TIM14_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM14_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM14_Init 0 */
|
||||||
|
|
||||||
|
TIM_OC_InitTypeDef sConfigOC = {0};
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM14_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM14_Init 1 */
|
||||||
|
htim14.Instance = TIM14;
|
||||||
|
htim14.Init.Prescaler = 6-1;
|
||||||
|
htim14.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||||
|
htim14.Init.Period = 255;
|
||||||
|
htim14.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||||
|
htim14.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||||
|
if (HAL_TIM_Base_Init(&htim14) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
if (HAL_TIM_PWM_Init(&htim14) != 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(&htim14, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN TIM14_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM14_Init 2 */
|
||||||
|
HAL_TIM_MspPostInit(&htim14);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USART1 Initialization Function
|
* @brief USART1 Initialization Function
|
||||||
* @param None
|
* @param None
|
||||||
@@ -326,14 +379,31 @@ 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(RL_EN_GPIO_Port, RL_EN_Pin, GPIO_PIN_SET);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOA, LED_AUX_Pin|LED_MAIN_Pin|TXEN_Pin|RL_AUX_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(GPIOA, LED_AUX_Pin|LED_MAIN_Pin|TXEN_Pin|RL_AUX_Pin, GPIO_PIN_RESET);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOB, LED_ERR_Pin|LED_ACT_Pin|RL_MAIN_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(GPIOB, LED_ERR_Pin|LED_ACT_Pin|RL_MAIN_Pin, GPIO_PIN_RESET);
|
||||||
|
|
||||||
/*Configure GPIO pins : LED_AUX_Pin LED_MAIN_Pin TXEN_Pin RL_AUX_Pin */
|
/*Configure GPIO pin : WATER_Pin */
|
||||||
GPIO_InitStruct.Pin = LED_AUX_Pin|LED_MAIN_Pin|TXEN_Pin|RL_AUX_Pin;
|
GPIO_InitStruct.Pin = WATER_Pin;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
HAL_GPIO_Init(WATER_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/*Configure GPIO pins : ESTOP_Pin LIGHTS_SW_Pin */
|
||||||
|
GPIO_InitStruct.Pin = ESTOP_Pin|LIGHTS_SW_Pin;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/*Configure GPIO pins : RL_EN_Pin LED_AUX_Pin LED_MAIN_Pin TXEN_Pin
|
||||||
|
RL_AUX_Pin */
|
||||||
|
GPIO_InitStruct.Pin = RL_EN_Pin|LED_AUX_Pin|LED_MAIN_Pin|TXEN_Pin
|
||||||
|
|RL_AUX_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
@@ -346,6 +416,13 @@ static void MX_GPIO_Init(void)
|
|||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* EXTI interrupt init*/
|
||||||
|
HAL_NVIC_SetPriority(EXTI0_1_IRQn, 0, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(EXTI0_1_IRQn);
|
||||||
|
|
||||||
|
HAL_NVIC_SetPriority(EXTI4_15_IRQn, 0, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(EXTI4_15_IRQn);
|
||||||
|
|
||||||
/* USER CODE BEGIN MX_GPIO_Init_2 */
|
/* USER CODE BEGIN MX_GPIO_Init_2 */
|
||||||
/* USER CODE END MX_GPIO_Init_2 */
|
/* USER CODE END MX_GPIO_Init_2 */
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ extern DMA_HandleTypeDef hdma_usart1_tx;
|
|||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
|
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
|
||||||
/**
|
/**
|
||||||
* Initializes the Global MSP.
|
* Initializes the Global MSP.
|
||||||
*/
|
*/
|
||||||
void HAL_MspInit(void)
|
void HAL_MspInit(void)
|
||||||
@@ -106,6 +106,17 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
|
|||||||
|
|
||||||
/* USER CODE END TIM1_MspInit 1 */
|
/* USER CODE END TIM1_MspInit 1 */
|
||||||
}
|
}
|
||||||
|
else if(htim_base->Instance==TIM14)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM14_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM14_MspInit 0 */
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_TIM14_CLK_ENABLE();
|
||||||
|
/* USER CODE BEGIN TIM14_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM14_MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,12 +150,12 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
|
|||||||
/* USER CODE BEGIN TIM3_MspPostInit 0 */
|
/* USER CODE BEGIN TIM3_MspPostInit 0 */
|
||||||
|
|
||||||
/* USER CODE END TIM3_MspPostInit 0 */
|
/* USER CODE END TIM3_MspPostInit 0 */
|
||||||
|
|
||||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
/**TIM3 GPIO Configuration
|
/**TIM3 GPIO Configuration
|
||||||
PB4 ------> TIM3_CH1
|
PB4 ------> TIM3_CH1
|
||||||
|
PB5 ------> TIM3_CH2
|
||||||
*/
|
*/
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_4;
|
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
@@ -155,6 +166,27 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
|
|||||||
|
|
||||||
/* USER CODE END TIM3_MspPostInit 1 */
|
/* USER CODE END TIM3_MspPostInit 1 */
|
||||||
}
|
}
|
||||||
|
else if(htim->Instance==TIM14)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM14_MspPostInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM14_MspPostInit 0 */
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
/**TIM14 GPIO Configuration
|
||||||
|
PA4 ------> TIM14_CH1
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LIGHTS_Pin;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF4_TIM14;
|
||||||
|
HAL_GPIO_Init(LIGHTS_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM14_MspPostInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM14_MspPostInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -180,6 +212,17 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
|
|||||||
|
|
||||||
/* USER CODE END TIM1_MspDeInit 1 */
|
/* USER CODE END TIM1_MspDeInit 1 */
|
||||||
}
|
}
|
||||||
|
else if(htim_base->Instance==TIM14)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM14_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM14_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_TIM14_CLK_DISABLE();
|
||||||
|
/* USER CODE BEGIN TIM14_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM14_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -143,6 +143,35 @@ void SysTick_Handler(void)
|
|||||||
/* please refer to the startup file (startup_stm32f0xx.s). */
|
/* please refer to the startup file (startup_stm32f0xx.s). */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles EXTI line 0 and 1 interrupts.
|
||||||
|
*/
|
||||||
|
void EXTI0_1_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN EXTI0_1_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END EXTI0_1_IRQn 0 */
|
||||||
|
HAL_GPIO_EXTI_IRQHandler(WATER_Pin);
|
||||||
|
HAL_GPIO_EXTI_IRQHandler(ESTOP_Pin);
|
||||||
|
/* USER CODE BEGIN EXTI0_1_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END EXTI0_1_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles EXTI line 4 to 15 interrupts.
|
||||||
|
*/
|
||||||
|
void EXTI4_15_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN EXTI4_15_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END EXTI4_15_IRQn 0 */
|
||||||
|
HAL_GPIO_EXTI_IRQHandler(LIGHTS_SW_Pin);
|
||||||
|
/* USER CODE BEGIN EXTI4_15_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END EXTI4_15_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles DMA1 channel 2 and 3 interrupts.
|
* @brief This function handles DMA1 channel 2 and 3 interrupts.
|
||||||
*/
|
*/
|
||||||
|
@@ -24,7 +24,7 @@ Dma.USART1_TX.1.PeriphInc=DMA_PINC_DISABLE
|
|||||||
Dma.USART1_TX.1.Priority=DMA_PRIORITY_LOW
|
Dma.USART1_TX.1.Priority=DMA_PRIORITY_LOW
|
||||||
Dma.USART1_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
|
Dma.USART1_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
|
||||||
File.Version=6
|
File.Version=6
|
||||||
GPIO.groupedBy=
|
GPIO.groupedBy=Group By Peripherals
|
||||||
KeepUserPlacement=false
|
KeepUserPlacement=false
|
||||||
Mcu.CPN=STM32F030K6T6
|
Mcu.CPN=STM32F030K6T6
|
||||||
Mcu.Family=STM32F0
|
Mcu.Family=STM32F0
|
||||||
@@ -34,33 +34,43 @@ Mcu.IP2=RCC
|
|||||||
Mcu.IP3=SYS
|
Mcu.IP3=SYS
|
||||||
Mcu.IP4=TIM1
|
Mcu.IP4=TIM1
|
||||||
Mcu.IP5=TIM3
|
Mcu.IP5=TIM3
|
||||||
Mcu.IP6=USART1
|
Mcu.IP6=TIM14
|
||||||
Mcu.IPNb=7
|
Mcu.IP7=USART1
|
||||||
|
Mcu.IPNb=8
|
||||||
Mcu.Name=STM32F030K6Tx
|
Mcu.Name=STM32F030K6Tx
|
||||||
Mcu.Package=LQFP32
|
Mcu.Package=LQFP32
|
||||||
Mcu.Pin0=PF0-OSC_IN
|
Mcu.Pin0=PF0-OSC_IN
|
||||||
Mcu.Pin1=PF1-OSC_OUT
|
Mcu.Pin1=PF1-OSC_OUT
|
||||||
Mcu.Pin10=PA14
|
Mcu.Pin10=PA8
|
||||||
Mcu.Pin11=PA15
|
Mcu.Pin11=PA9
|
||||||
Mcu.Pin12=PB3
|
Mcu.Pin12=PA10
|
||||||
Mcu.Pin13=PB4
|
Mcu.Pin13=PA11
|
||||||
Mcu.Pin14=VP_SYS_VS_Systick
|
Mcu.Pin14=PA13
|
||||||
Mcu.Pin15=VP_TIM1_VS_ClockSourceINT
|
Mcu.Pin15=PA14
|
||||||
Mcu.Pin2=PA6
|
Mcu.Pin16=PA15
|
||||||
Mcu.Pin3=PA7
|
Mcu.Pin17=PB3
|
||||||
Mcu.Pin4=PB0
|
Mcu.Pin18=PB4
|
||||||
Mcu.Pin5=PB1
|
Mcu.Pin19=PB5
|
||||||
Mcu.Pin6=PA9
|
Mcu.Pin2=PA0
|
||||||
Mcu.Pin7=PA10
|
Mcu.Pin20=VP_SYS_VS_Systick
|
||||||
Mcu.Pin8=PA11
|
Mcu.Pin21=VP_TIM1_VS_ClockSourceINT
|
||||||
Mcu.Pin9=PA13
|
Mcu.Pin22=VP_TIM14_VS_ClockSourceINT
|
||||||
Mcu.PinsNb=16
|
Mcu.Pin3=PA1
|
||||||
|
Mcu.Pin4=PA4
|
||||||
|
Mcu.Pin5=PA5
|
||||||
|
Mcu.Pin6=PA6
|
||||||
|
Mcu.Pin7=PA7
|
||||||
|
Mcu.Pin8=PB0
|
||||||
|
Mcu.Pin9=PB1
|
||||||
|
Mcu.PinsNb=23
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32F030K6Tx
|
Mcu.UserName=STM32F030K6Tx
|
||||||
MxCube.Version=6.9.2
|
MxCube.Version=6.10.0
|
||||||
MxDb.Version=DB.6.0.92
|
MxDb.Version=DB.6.0.100
|
||||||
NVIC.DMA1_Channel2_3_IRQn=true\:2\:0\:true\:false\:true\:false\:true\:true
|
NVIC.DMA1_Channel2_3_IRQn=true\:2\:0\:true\:false\:true\:false\:true\:true
|
||||||
|
NVIC.EXTI0_1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||||
|
NVIC.EXTI4_15_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||||
NVIC.ForceEnableDMAVector=true
|
NVIC.ForceEnableDMAVector=true
|
||||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
@@ -70,6 +80,16 @@ NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:false
|
|||||||
NVIC.TIM1_BRK_UP_TRG_COM_IRQn=true\:3\:0\:true\:false\:true\:true\:true\:true
|
NVIC.TIM1_BRK_UP_TRG_COM_IRQn=true\:3\:0\:true\:false\:true\:true\:true\:true
|
||||||
NVIC.TIM1_CC_IRQn=true\:3\:0\:true\:false\:true\:true\:true\:true
|
NVIC.TIM1_CC_IRQn=true\:3\:0\:true\:false\:true\:true\:true\:true
|
||||||
NVIC.USART1_IRQn=true\:1\:0\:true\:false\:true\:true\:true\:true
|
NVIC.USART1_IRQn=true\:1\:0\:true\:false\:true\:true\:true\:true
|
||||||
|
PA0.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI
|
||||||
|
PA0.GPIO_Label=WATER
|
||||||
|
PA0.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING
|
||||||
|
PA0.Locked=true
|
||||||
|
PA0.Signal=GPXTI0
|
||||||
|
PA1.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI
|
||||||
|
PA1.GPIO_Label=ESTOP
|
||||||
|
PA1.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
|
||||||
|
PA1.Locked=true
|
||||||
|
PA1.Signal=GPXTI1
|
||||||
PA10.Locked=true
|
PA10.Locked=true
|
||||||
PA10.Mode=Asynchronous
|
PA10.Mode=Asynchronous
|
||||||
PA10.Signal=USART1_RX
|
PA10.Signal=USART1_RX
|
||||||
@@ -85,6 +105,14 @@ PA15.GPIOParameters=GPIO_Label
|
|||||||
PA15.GPIO_Label=RL_AUX
|
PA15.GPIO_Label=RL_AUX
|
||||||
PA15.Locked=true
|
PA15.Locked=true
|
||||||
PA15.Signal=GPIO_Output
|
PA15.Signal=GPIO_Output
|
||||||
|
PA4.GPIOParameters=GPIO_Label
|
||||||
|
PA4.GPIO_Label=LIGHTS
|
||||||
|
PA4.Signal=S_TIM14_CH1
|
||||||
|
PA5.GPIOParameters=PinState,GPIO_Label
|
||||||
|
PA5.GPIO_Label=RL_EN
|
||||||
|
PA5.Locked=true
|
||||||
|
PA5.PinState=GPIO_PIN_SET
|
||||||
|
PA5.Signal=GPIO_Output
|
||||||
PA6.GPIOParameters=GPIO_Label
|
PA6.GPIOParameters=GPIO_Label
|
||||||
PA6.GPIO_Label=LED_AUX
|
PA6.GPIO_Label=LED_AUX
|
||||||
PA6.Locked=true
|
PA6.Locked=true
|
||||||
@@ -93,6 +121,11 @@ PA7.GPIOParameters=GPIO_Label
|
|||||||
PA7.GPIO_Label=LED_MAIN
|
PA7.GPIO_Label=LED_MAIN
|
||||||
PA7.Locked=true
|
PA7.Locked=true
|
||||||
PA7.Signal=GPIO_Output
|
PA7.Signal=GPIO_Output
|
||||||
|
PA8.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI
|
||||||
|
PA8.GPIO_Label=LIGHTS_SW
|
||||||
|
PA8.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
|
||||||
|
PA8.Locked=true
|
||||||
|
PA8.Signal=GPXTI8
|
||||||
PA9.Locked=true
|
PA9.Locked=true
|
||||||
PA9.Mode=Asynchronous
|
PA9.Mode=Asynchronous
|
||||||
PA9.Signal=USART1_TX
|
PA9.Signal=USART1_TX
|
||||||
@@ -110,6 +143,7 @@ PB3.Locked=true
|
|||||||
PB3.Signal=GPIO_Output
|
PB3.Signal=GPIO_Output
|
||||||
PB4.Locked=true
|
PB4.Locked=true
|
||||||
PB4.Signal=S_TIM3_CH1
|
PB4.Signal=S_TIM3_CH1
|
||||||
|
PB5.Signal=S_TIM3_CH2
|
||||||
PF0-OSC_IN.Mode=HSE-External-Oscillator
|
PF0-OSC_IN.Mode=HSE-External-Oscillator
|
||||||
PF0-OSC_IN.Signal=RCC_OSC_IN
|
PF0-OSC_IN.Signal=RCC_OSC_IN
|
||||||
PF1-OSC_OUT.Mode=HSE-External-Oscillator
|
PF1-OSC_OUT.Mode=HSE-External-Oscillator
|
||||||
@@ -135,8 +169,8 @@ ProjectManager.MainLocation=Core/Src
|
|||||||
ProjectManager.NoMain=false
|
ProjectManager.NoMain=false
|
||||||
ProjectManager.PreviousToolchain=STM32CubeIDE
|
ProjectManager.PreviousToolchain=STM32CubeIDE
|
||||||
ProjectManager.ProjectBuild=false
|
ProjectManager.ProjectBuild=false
|
||||||
ProjectManager.ProjectFileName=Relay_RS485.ioc
|
ProjectManager.ProjectFileName=Relay_RS485_V2.ioc
|
||||||
ProjectManager.ProjectName=Relay_RS485
|
ProjectManager.ProjectName=Relay_RS485_V2
|
||||||
ProjectManager.ProjectStructure=
|
ProjectManager.ProjectStructure=
|
||||||
ProjectManager.RegisterCallBack=
|
ProjectManager.RegisterCallBack=
|
||||||
ProjectManager.StackSize=0x400
|
ProjectManager.StackSize=0x400
|
||||||
@@ -145,7 +179,7 @@ ProjectManager.ToolChainLocation=
|
|||||||
ProjectManager.UAScriptAfterPath=
|
ProjectManager.UAScriptAfterPath=
|
||||||
ProjectManager.UAScriptBeforePath=
|
ProjectManager.UAScriptBeforePath=
|
||||||
ProjectManager.UnderRoot=true
|
ProjectManager.UnderRoot=true
|
||||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true,5-MX_USART1_UART_Init-USART1-false-HAL-true,6-MX_TIM1_Init-TIM1-false-HAL-true
|
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true,5-MX_USART1_UART_Init-USART1-false-HAL-true,6-MX_TIM1_Init-TIM1-false-HAL-true,7-MX_TIM14_Init-TIM14-false-HAL-true
|
||||||
RCC.AHBFreq_Value=48000000
|
RCC.AHBFreq_Value=48000000
|
||||||
RCC.APB1Freq_Value=48000000
|
RCC.APB1Freq_Value=48000000
|
||||||
RCC.APB1TimFreq_Value=48000000
|
RCC.APB1TimFreq_Value=48000000
|
||||||
@@ -163,20 +197,38 @@ RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
|||||||
RCC.TimSysFreq_Value=48000000
|
RCC.TimSysFreq_Value=48000000
|
||||||
RCC.USART1Freq_Value=48000000
|
RCC.USART1Freq_Value=48000000
|
||||||
RCC.VCOOutput2Freq_Value=8000000
|
RCC.VCOOutput2Freq_Value=8000000
|
||||||
|
SH.GPXTI0.0=GPIO_EXTI0
|
||||||
|
SH.GPXTI0.ConfNb=1
|
||||||
|
SH.GPXTI1.0=GPIO_EXTI1
|
||||||
|
SH.GPXTI1.ConfNb=1
|
||||||
|
SH.GPXTI8.0=GPIO_EXTI8
|
||||||
|
SH.GPXTI8.ConfNb=1
|
||||||
|
SH.S_TIM14_CH1.0=TIM14_CH1,PWM Generation1 CH1
|
||||||
|
SH.S_TIM14_CH1.ConfNb=1
|
||||||
SH.S_TIM3_CH1.0=TIM3_CH1,PWM Generation1 CH1
|
SH.S_TIM3_CH1.0=TIM3_CH1,PWM Generation1 CH1
|
||||||
SH.S_TIM3_CH1.ConfNb=1
|
SH.S_TIM3_CH1.ConfNb=1
|
||||||
|
SH.S_TIM3_CH2.0=TIM3_CH2,PWM Generation2 CH2
|
||||||
|
SH.S_TIM3_CH2.ConfNb=1
|
||||||
TIM1.IPParameters=Prescaler,Period
|
TIM1.IPParameters=Prescaler,Period
|
||||||
TIM1.Period=100
|
TIM1.Period=100-1
|
||||||
TIM1.Prescaler=479
|
TIM1.Prescaler=480-1
|
||||||
|
TIM14.Channel=TIM_CHANNEL_1
|
||||||
|
TIM14.IPParameters=Channel,Prescaler,Period,OCMode_PWM
|
||||||
|
TIM14.OCMode_PWM=TIM_OCMODE_PWM1
|
||||||
|
TIM14.Period=255
|
||||||
|
TIM14.Prescaler=6-1
|
||||||
TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
||||||
TIM3.IPParameters=Channel-PWM Generation1 CH1,Prescaler,Period
|
TIM3.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
||||||
|
TIM3.IPParameters=Channel-PWM Generation1 CH1,Prescaler,Period,Channel-PWM Generation2 CH2
|
||||||
TIM3.Period=255
|
TIM3.Period=255
|
||||||
TIM3.Prescaler=239
|
TIM3.Prescaler=240-1
|
||||||
USART1.BaudRate=9600
|
USART1.BaudRate=9600
|
||||||
USART1.IPParameters=VirtualMode-Asynchronous,BaudRate
|
USART1.IPParameters=VirtualMode-Asynchronous,BaudRate
|
||||||
USART1.VirtualMode-Asynchronous=VM_ASYNC
|
USART1.VirtualMode-Asynchronous=VM_ASYNC
|
||||||
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_TIM14_VS_ClockSourceINT.Mode=Enable_Timer
|
||||||
|
VP_TIM14_VS_ClockSourceINT.Signal=TIM14_VS_ClockSourceINT
|
||||||
VP_TIM1_VS_ClockSourceINT.Mode=Internal
|
VP_TIM1_VS_ClockSourceINT.Mode=Internal
|
||||||
VP_TIM1_VS_ClockSourceINT.Signal=TIM1_VS_ClockSourceINT
|
VP_TIM1_VS_ClockSourceINT.Signal=TIM1_VS_ClockSourceINT
|
||||||
board=custom
|
board=custom
|
12
V1-V2_HW_changes.txt
Normal file
12
V1-V2_HW_changes.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
New in Relay_V2 MCU:
|
||||||
|
|
||||||
|
PA0 - INPUT - Water level (HIGH - we have water)
|
||||||
|
PA1 - INPUT - E-STOP button (HIGH - normal state. should be interrupt-driven on falling edge detection)
|
||||||
|
PA2 \
|
||||||
|
PA3 ---------- Test points TP4, TP5 (ADC / USART1 / GPIO)
|
||||||
|
PA4 - OUTPUT - LED Lights TIM14 CH1 PWM output
|
||||||
|
PA5 - OUTPUT - RL_EN. Sets E-STOP trigger to controllable state (resets to normal state). LOW to activate. Should be HIGH by default.
|
||||||
|
PA8 - INPUT - LED Lights switch
|
||||||
|
PB5 - OUTPUT - Second DC motor channel. TIM3 CH2 PWM
|
||||||
|
PB6 \
|
||||||
|
PB7 ---------- Test points TP1, TP2 (USART1, I2C1, GPIO)
|
Reference in New Issue
Block a user