From 4667dcd8ad1b1b5b79b9198bf001f2e8119e1375 Mon Sep 17 00:00:00 2001 From: Anton Mukhin Date: Sun, 29 Jan 2023 20:57:41 +0300 Subject: [PATCH] LCD_CS pin change --- firmware/PCB-Heater/Core/Inc/main.h | 4 +- firmware/PCB-Heater/Core/Src/gpio.c | 27 ++++---------- firmware/PCB-Heater/PCB-Heater.ioc | 54 +++++++++++++-------------- kicad/pcb-heater/pcb-heater.kicad_sch | 22 +++++------ 4 files changed, 48 insertions(+), 59 deletions(-) diff --git a/firmware/PCB-Heater/Core/Inc/main.h b/firmware/PCB-Heater/Core/Inc/main.h index ed2c7a0..dc5eb00 100644 --- a/firmware/PCB-Heater/Core/Inc/main.h +++ b/firmware/PCB-Heater/Core/Inc/main.h @@ -65,6 +65,8 @@ void Error_Handler(void); #define LCD_LED_GPIO_Port GPIOC #define LED_Status_Pin GPIO_PIN_2 #define LED_Status_GPIO_Port GPIOC +#define LCD_CS_Pin GPIO_PIN_3 +#define LCD_CS_GPIO_Port GPIOC #define LCD_D0_Pin GPIO_PIN_0 #define LCD_D0_GPIO_Port GPIOA #define LCD_D1_Pin GPIO_PIN_1 @@ -101,8 +103,6 @@ void Error_Handler(void); #define TIM1_ZC_GPIO_Port GPIOA #define TIM1_GC_Pin GPIO_PIN_9 #define TIM1_GC_GPIO_Port GPIOA -#define LCD_CS_Pin GPIO_PIN_4 -#define LCD_CS_GPIO_Port GPIOD #define BUZZER_Pin GPIO_PIN_9 #define BUZZER_GPIO_Port GPIOB /* USER CODE BEGIN Private defines */ diff --git a/firmware/PCB-Heater/Core/Src/gpio.c b/firmware/PCB-Heater/Core/Src/gpio.c index 9179d96..ada0691 100644 --- a/firmware/PCB-Heater/Core/Src/gpio.c +++ b/firmware/PCB-Heater/Core/Src/gpio.c @@ -49,10 +49,9 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOF_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); - __HAL_RCC_GPIOD_CLK_ENABLE(); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(GPIOC, LED_Status_Pin|LCD_RD_Pin|LCD_RST_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOC, LED_Status_Pin|LCD_CS_Pin|LCD_RD_Pin|LCD_RST_Pin, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(GPIOA, LCD_D0_Pin|LCD_D1_Pin|LCD_D2_Pin|LCD_D3_Pin @@ -64,9 +63,6 @@ void MX_GPIO_Init(void) /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(MAX_CS_GPIO_Port, MAX_CS_Pin, GPIO_PIN_SET); - /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(LCD_CS_GPIO_Port, LCD_CS_Pin, GPIO_PIN_RESET); - /*Configure GPIO pin : PtPin */ GPIO_InitStruct.Pin = btnSTOP_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; @@ -80,6 +76,13 @@ void MX_GPIO_Init(void) GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(LED_Status_GPIO_Port, &GPIO_InitStruct); + /*Configure GPIO pins : PCPin PCPin PCPin */ + GPIO_InitStruct.Pin = LCD_CS_Pin|LCD_RD_Pin|LCD_RST_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + /*Configure GPIO pins : PAPin PAPin PAPin PAPin PAPin PAPin PAPin PAPin */ GPIO_InitStruct.Pin = LCD_D0_Pin|LCD_D1_Pin|LCD_D2_Pin|LCD_D3_Pin @@ -89,13 +92,6 @@ void MX_GPIO_Init(void) GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); - /*Configure GPIO pins : PCPin PCPin */ - GPIO_InitStruct.Pin = LCD_RD_Pin|LCD_RST_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); - /*Configure GPIO pins : PBPin PBPin */ GPIO_InitStruct.Pin = LCD_RS_Pin|LCD_WR_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; @@ -110,13 +106,6 @@ void MX_GPIO_Init(void) GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); - /*Configure GPIO pin : PtPin */ - GPIO_InitStruct.Pin = LCD_CS_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - HAL_GPIO_Init(LCD_CS_GPIO_Port, &GPIO_InitStruct); - } /* USER CODE BEGIN 2 */ diff --git a/firmware/PCB-Heater/PCB-Heater.ioc b/firmware/PCB-Heater/PCB-Heater.ioc index a1bbae6..4da7247 100644 --- a/firmware/PCB-Heater/PCB-Heater.ioc +++ b/firmware/PCB-Heater/PCB-Heater.ioc @@ -42,25 +42,25 @@ Mcu.Name=STM32G070RBTx Mcu.Package=LQFP64 Mcu.Pin0=PC12 Mcu.Pin1=PC13 -Mcu.Pin10=PA4 -Mcu.Pin11=PA5 -Mcu.Pin12=PA6 -Mcu.Pin13=PA7 -Mcu.Pin14=PC4 -Mcu.Pin15=PC5 -Mcu.Pin16=PB0 -Mcu.Pin17=PB1 -Mcu.Pin18=PB2 -Mcu.Pin19=PB10 +Mcu.Pin10=PA3 +Mcu.Pin11=PA4 +Mcu.Pin12=PA5 +Mcu.Pin13=PA6 +Mcu.Pin14=PA7 +Mcu.Pin15=PC4 +Mcu.Pin16=PC5 +Mcu.Pin17=PB0 +Mcu.Pin18=PB1 +Mcu.Pin19=PB2 Mcu.Pin2=PF0-OSC_IN (PF0) -Mcu.Pin20=PB13 -Mcu.Pin21=PB14 -Mcu.Pin22=PB15 -Mcu.Pin23=PA8 -Mcu.Pin24=PA9 -Mcu.Pin25=PA13 -Mcu.Pin26=PA14-BOOT0 -Mcu.Pin27=PD4 +Mcu.Pin20=PB10 +Mcu.Pin21=PB13 +Mcu.Pin22=PB14 +Mcu.Pin23=PB15 +Mcu.Pin24=PA8 +Mcu.Pin25=PA9 +Mcu.Pin26=PA13 +Mcu.Pin27=PA14-BOOT0 Mcu.Pin28=PB6 Mcu.Pin29=PB7 Mcu.Pin3=PF1-OSC_OUT (PF1) @@ -77,10 +77,10 @@ Mcu.Pin39=VP_TIM17_VS_ClockSourceINT Mcu.Pin4=PC1 Mcu.Pin40=VP_TIM17_VS_OPM Mcu.Pin5=PC2 -Mcu.Pin6=PA0 -Mcu.Pin7=PA1 -Mcu.Pin8=PA2 -Mcu.Pin9=PA3 +Mcu.Pin6=PC3 +Mcu.Pin7=PA0 +Mcu.Pin8=PA1 +Mcu.Pin9=PA2 Mcu.PinsNb=41 Mcu.ThirdPartyNb=0 Mcu.UserConstants= @@ -210,6 +210,11 @@ PC2.GPIO_Label=LED_Status PC2.GPIO_Speed=GPIO_SPEED_FREQ_HIGH PC2.Locked=true PC2.Signal=GPIO_Output +PC3.GPIOParameters=GPIO_Speed,GPIO_Label +PC3.GPIO_Label=LCD_CS +PC3.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH +PC3.Locked=true +PC3.Signal=GPIO_Output PC4.GPIOParameters=GPIO_Speed,GPIO_Label PC4.GPIO_Label=LCD_RD PC4.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH @@ -220,11 +225,6 @@ PC5.GPIO_Label=LCD_RST PC5.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH PC5.Locked=true PC5.Signal=GPIO_Output -PD4.GPIOParameters=GPIO_Speed,GPIO_Label -PD4.GPIO_Label=LCD_CS -PD4.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH -PD4.Locked=true -PD4.Signal=GPIO_Output PF0-OSC_IN\ (PF0).Mode=HSE-External-Oscillator PF0-OSC_IN\ (PF0).Signal=RCC_OSC_IN PF1-OSC_OUT\ (PF1).Mode=HSE-External-Oscillator diff --git a/kicad/pcb-heater/pcb-heater.kicad_sch b/kicad/pcb-heater/pcb-heater.kicad_sch index 0d58eb3..0be0ddd 100644 --- a/kicad/pcb-heater/pcb-heater.kicad_sch +++ b/kicad/pcb-heater/pcb-heater.kicad_sch @@ -2943,7 +2943,7 @@ ) (no_connect (at 71.755 114.935) (uuid 02a0e8ca-1285-40f1-830a-fd6772d26e9e)) - (no_connect (at 71.755 104.775) (uuid 120c25cd-b48f-4118-8a11-8d340ac5b9ec)) + (no_connect (at 104.775 107.315) (uuid 120c25cd-b48f-4118-8a11-8d340ac5b9ec)) (no_connect (at 71.755 125.095) (uuid 13c8acdf-a53f-4840-8513-f27fcda50062)) (no_connect (at 71.755 84.455) (uuid 231fb950-1955-44dc-88c0-205679e6be90)) (no_connect (at 132.715 128.27) (uuid 29ccae83-b57f-48a8-abd1-e3ee2ed14c2b)) @@ -3616,6 +3616,10 @@ (stroke (width 0) (type default) (color 0 0 0 0)) (uuid a719748e-c167-4cbd-a303-b623175f4864) ) + (wire (pts (xy 70.485 104.775) (xy 71.755 104.775)) + (stroke (width 0) (type default) (color 0 0 0 0)) + (uuid a7aed86a-c825-4d23-aa12-f32854e26c3c) + ) (wire (pts (xy 125.095 123.19) (xy 132.715 123.19)) (stroke (width 0) (type default) (color 0 0 0 0)) (uuid a92b851f-63bd-4242-be3a-98e755389568) @@ -3836,10 +3840,6 @@ (stroke (width 0) (type default) (color 0 0 0 0)) (uuid e027bee9-2d8d-40fc-9cd8-554080f81565) ) - (wire (pts (xy 106.045 107.315) (xy 104.775 107.315)) - (stroke (width 0) (type default) (color 0 0 0 0)) - (uuid e143539c-79f0-4709-9b6e-daee1bcdca87) - ) (wire (pts (xy 125.095 125.73) (xy 132.715 125.73)) (stroke (width 0) (type default) (color 0 0 0 0)) (uuid e1ffa673-62e0-40c0-9394-6dff55210ba0) @@ -4339,11 +4339,11 @@ (effects (font (size 1.27 1.27)) hide) ) ) - (global_label "LCD_CS" (shape input) (at 106.045 107.315 0) (fields_autoplaced) - (effects (font (size 1.27 1.27)) (justify left)) + (global_label "LCD_CS" (shape input) (at 70.485 104.775 180) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify right)) (uuid c8bce37e-35c5-439e-ac35-a34a51156ee5) - (property "Intersheet References" "${INTERSHEET_REFS}" (id 0) (at 8.255 6.35 0) - (effects (font (size 1.27 1.27)) hide) + (property "Intersheet References" "${INTERSHEET_REFS}" (id 0) (at 168.275 3.81 0) + (effects (font (size 1.27 1.27)) (justify left) hide) ) ) (global_label "LCD_MOSI" (shape input) (at 34.925 79.375 0) (fields_autoplaced) @@ -5898,7 +5898,7 @@ (symbol (lib_id "power:GND") (at 198.12 122.555 0) (unit 1) (in_bom yes) (on_board yes) (uuid 48746e66-b986-4397-8a4b-4108255b9fbc) - (property "Reference" "#PWR?" (id 0) (at 198.12 128.905 0) + (property "Reference" "#PWR0103" (id 0) (at 198.12 128.905 0) (effects (font (size 1.27 1.27)) hide) ) (property "Value" "GND" (id 1) (at 198.12 125.73 0)) @@ -6701,7 +6701,7 @@ (reference "#PWR0102") (unit 1) (value "GND") (footprint "") ) (path "/48746e66-b986-4397-8a4b-4108255b9fbc" - (reference "#PWR?") (unit 1) (value "GND") (footprint "") + (reference "#PWR0103") (unit 1) (value "GND") (footprint "") ) (path "/00000000-0000-0000-0000-000061d3d7cb" (reference "BZ1") (unit 1) (value "5020 buzzer") (footprint "my_additions:Buzzer_5020")