start servo

This commit is contained in:
eddyem 2019-03-11 00:11:56 +03:00
parent 83080900bf
commit e5f7e0e16d
36 changed files with 21441 additions and 6 deletions

View File

@ -3,13 +3,15 @@ Samples for STM32F042-nucleo and chinese STM32F030-based devboard
This directory contains examples for F0 without any library
- Chiller - chiller controller
- Servo - simple servo (like SG-90) controller
- blink - simple LED blink
- canbus - CAN bus on STM32F042C6T6
- htu21d_nucleo - operaing with HTU-21D in STM32F042-nucleo
- morze - for STM32F030, echo data from USART1 on TIM3CH1 (PA6) as Morze code
- pl2303 - CDC template (emulation of PL2303)
- tsys01_nucleo - read two TSYS01 sensors using STM32F042
- uart - USART over DMA with hardware end-of-string detection
- uart_blink - code for STM32F030F4, echo data on USART1 and blink LEDS on PA4 and PA5
- uart_nucleo - USART over DMA for STM32F042-nucleo
- usbcdc - CDC for STM32F042 (emulation of PL2303) with working CAN bus
- pl2303 - CDC template (emulation of PL2303)

134
F0-nolib/Servo/Makefile Normal file
View File

@ -0,0 +1,134 @@
BINARY = servo
BOOTPORT ?= /dev/ttyUSB0
BOOTSPEED ?= 115200
# MCU FAMILY
FAMILY = F0
# MCU code
MCU = F030x4
DEFS = -DEBUG
# change this linking script depending on particular MCU model,
# for example, if you have STM32F103VBT6, you should write:
LDSCRIPT = stm32f030f.ld
INDEPENDENT_HEADERS=
FP_FLAGS ?= -msoft-float
ASM_FLAGS = -mthumb -mcpu=cortex-m0 -march=armv6-m -mtune=cortex-m0
ARCH_FLAGS = $(ASM_FLAGS) $(FP_FLAGS)
###############################################################################
# Executables
PREFIX ?= /opt/bin/arm-none-eabi
RM := rm -f
RMDIR := rmdir
CC := $(PREFIX)-gcc
LD := $(PREFIX)-gcc
AR := $(PREFIX)-ar
AS := $(PREFIX)-as
OBJCOPY := $(PREFIX)-objcopy
OBJDUMP := $(PREFIX)-objdump
GDB := $(PREFIX)-gdb
STFLASH := $(shell which st-flash)
STBOOT := $(shell which stm32flash)
###############################################################################
# Source files
OBJDIR = mk
LDSCRIPT ?= $(BINARY).ld
SRC := $(wildcard *.c)
OBJS := $(addprefix $(OBJDIR)/, $(SRC:%.c=%.o))
STARTUP = $(OBJDIR)/startup.o
OBJS += $(STARTUP)
DEPS := $(OBJS:.o=.d)
INC_DIR ?= ../inc
INCLUDE := -I$(INC_DIR)/Fx -I$(INC_DIR)/cm
LIB_DIR := $(INC_DIR)/ld
###############################################################################
# C flags
CFLAGS += -O2 -g -MD -D__thumb2__=1
CFLAGS += -Wall -Werror -Wextra -Wshadow -Wimplicit-function-declaration
CFLAGS += -Wredundant-decls $(INCLUDE)
# -Wmissing-prototypes -Wstrict-prototypes
CFLAGS += -fno-common -ffunction-sections -fdata-sections
###############################################################################
# Linker flags
LDFLAGS += --static -nostartfiles
#--specs=nano.specs
LDFLAGS += -L$(LIB_DIR)
LDFLAGS += -T$(LDSCRIPT)
LDFLAGS += -Wl,-Map=$(OBJDIR)/$(BINARY).map
LDFLAGS += -Wl,--gc-sections
###############################################################################
# Used libraries
LDLIBS += -Wl,--start-group -lc -lgcc -Wl,--end-group
LDLIBS += $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
DEFS += -DSTM32$(FAMILY) -DSTM32$(MCU)
#.SUFFIXES: .elf .bin .hex .srec .list .map .images
#.SECONDEXPANSION:
#.SECONDARY:
ELF := $(OBJDIR)/$(BINARY).elf
LIST := $(OBJDIR)/$(BINARY).list
BIN := $(BINARY).bin
HEX := $(BINARY).hex
all: bin list
elf: $(ELF)
bin: $(BIN)
hex: $(HEX)
list: $(LIST)
ifneq ($(MAKECMDGOALS),clean)
-include $(DEPS)
endif
$(OBJDIR):
mkdir $(OBJDIR)
$(STARTUP): $(INC_DIR)/startup/vector.c
$(CC) $(CFLAGS) $(DEFS) $(INCLUDE) $(ARCH_FLAGS) -o $@ -c $<
$(OBJDIR)/%.o: %.c
@echo " CC $<"
$(CC) $(CFLAGS) $(DEFS) $(INCLUDE) $(ARCH_FLAGS) -o $@ -c $<
$(BIN): $(ELF)
@echo " OBJCOPY $(BIN)"
$(OBJCOPY) -Obinary $(ELF) $(BIN)
$(HEX): $(ELF)
@echo " OBJCOPY $(HEX)"
$(OBJCOPY) -Oihex $(ELF) $(HEX)
$(LIST): $(ELF)
@echo " OBJDUMP $(LIST)"
$(OBJDUMP) -S $(ELF) > $(LIST)
$(ELF): $(OBJDIR) $(OBJS)
@echo " LD $(ELF)"
$(LD) $(LDFLAGS) $(ARCH_FLAGS) $(OBJS) $(LDLIBS) -o $(ELF)
clean:
@echo " CLEAN"
$(RM) $(OBJS) $(DEPS) $(ELF) $(HEX) $(LIST) $(OBJDIR)/*.map
@rmdir $(OBJDIR) 2>/dev/null || true
flash: $(BIN)
@echo " FLASH $(BIN)"
$(STFLASH) write $(BIN) 0x8000000
boot: $(BIN)
@echo " LOAD $(BIN) through bootloader"
$(STBOOT) -b$(BOOTSPEED) $(BOOTPORT) -w $(BIN)
.PHONY: clean flash boot

47
F0-nolib/Servo/Readme.md Normal file
View File

@ -0,0 +1,47 @@
Servo motors SG-90 management
=============================
## GPIO
- PA0 - (ADC_IN0) - Servo1 control,
- PA1 - (ADC_IN1) - Servo2 control,
- PA2 - (ADC_IN2) - Servo3 control,
- PA3 - (ADC_IN3) - external analogue signal,
- PA4 - (PullUp in) - ext. input 0,
- PA5 - (PullUp in) - ext. input 1,
- PA6 - (TIM3_CH1) - Servo1,
- PA7 - (TIM3_CH2) - Servo2,
- PA9 - (USART_Tx) - TX,
- PA10 - (USART_Rx) - RX,
- PA13 - (PullUp in) - Jumper 0,
- PA14 - (PullUp in) - Jumper 1,
- PB1 - (TIM3_CH4) - Servo3,
- PF0 - (OpenDrain) - Buzzer,
- PF1 - (OpenDrain) - External LED (or weak laser module).
## UART
115200N1, not more than 100ms between data bytes in command.
To turn ON human terminal (without timeout) send "####".
## Protocol
All commands are in brackets: `[ command line ]`.
'[' clears earlier input; '\n', '\r', ' ', '\t' are ignored.
All messages are asynchronous!
## Commands
* **d** - debugging commands:
* **A** - get raw ADC values,
* **w** - watchdog test;
* **R** - reset;
* **t** - get MCU temperature;
* **V** - get VDD value.
## Messages
## Servos
The board controls up to three servos like SG-90.
Three timer's outputs used for this purpose. Timer frequency 50Hz, pulse width from 500 to 2400us.

View File

@ -0,0 +1,5 @@
// Add predefined macros for your project here. For example:
// #define THE_ANSWER 42
#define EBUG 1
#define STM32F0
#define STM32F030x4

View File

@ -0,0 +1 @@
[General]

View File

@ -0,0 +1,204 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.8.0, 2019-03-10T11:39:00. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{7bd84e39-ca37-46d3-be9d-99ebea85bc0d}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">KOI8-R</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">false</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{65a14f9e-e008-4c1b-89df-4eaa4774b6e3}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Big/Data/00__Electronics/STM32/F0-nolib/Servo</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">false</value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments"></value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand"></value>
<value type="bool" key="GenericProjectManager.GenericMakeStep.OverrideMakeflags">false</value>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">false</value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments"></value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand"></value>
<value type="bool" key="GenericProjectManager.GenericMakeStep.OverrideMakeflags">false</value>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">По умолчанию</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">По умолчанию</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Установка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Конфигурация установки</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Особая программа</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default"></value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">20</value>
</data>
<data>
<variable>Version</variable>
<value type="int">20</value>
</data>
</qtcreator>

View File

@ -0,0 +1,12 @@
Makefile
adc.c
adc.h
hardware.c
hardware.h
main.c
mainloop.c
mainloop.h
protocol.c
protocol.h
usart.c
usart.h

View File

@ -0,0 +1,4 @@
.
../inc
../inc/Fx
../inc/cm

74
F0-nolib/Servo/adc.c Normal file
View File

@ -0,0 +1,74 @@
/*
* This file is part of the Chiller project.
* Copyright 2018 Edward V. Emelianov <edward.emelianoff@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "adc.h"
/**
* @brief ADC_array - array for ADC channels with median filtering:
* 0..3 - external NTC
* 4 - internal Tsens
* 5 - Vref
*/
#define TSENS_CHAN (4)
#define VREF_CHAN (5)
uint16_t ADC_array[NUMBER_OF_ADC_CHANNELS*9];
/**
* @brief getADCval - calculate median value for `nch` channel
* @param nch - number of channel
* @return
*/
uint16_t getADCval(int nch){
int i, addr = nch;
register uint16_t temp;
#define PIX_SORT(a,b) { if ((a)>(b)) PIX_SWAP((a),(b)); }
#define PIX_SWAP(a,b) { temp=(a);(a)=(b);(b)=temp; }
uint16_t p[9];
for(i = 0; i < 9; ++i, addr += NUMBER_OF_ADC_CHANNELS) // first we should prepare array for optmed
p[i] = ADC_array[addr];
PIX_SORT(p[1], p[2]) ; PIX_SORT(p[4], p[5]) ; PIX_SORT(p[7], p[8]) ;
PIX_SORT(p[0], p[1]) ; PIX_SORT(p[3], p[4]) ; PIX_SORT(p[6], p[7]) ;
PIX_SORT(p[1], p[2]) ; PIX_SORT(p[4], p[5]) ; PIX_SORT(p[7], p[8]) ;
PIX_SORT(p[0], p[3]) ; PIX_SORT(p[5], p[8]) ; PIX_SORT(p[4], p[7]) ;
PIX_SORT(p[3], p[6]) ; PIX_SORT(p[1], p[4]) ; PIX_SORT(p[2], p[5]) ;
PIX_SORT(p[4], p[7]) ; PIX_SORT(p[4], p[2]) ; PIX_SORT(p[6], p[4]) ;
PIX_SORT(p[4], p[2]) ;
return p[4];
#undef PIX_SORT
#undef PIX_SWAP
}
// return MCU temperature (degrees of celsius * 10)
int32_t getMCUtemp(){
getVdd();
// make correction on Vdd value
// int32_t temperature = (int32_t)ADC_array[4] * VddValue / 330;
int32_t ADval = getADCval(TSENS_CHAN);
int32_t temperature = (int32_t) *TEMP30_CAL_ADDR - ADval;
temperature *= (int32_t)(1100 - 300);
temperature /= (int32_t)(*TEMP30_CAL_ADDR - *TEMP110_CAL_ADDR);
temperature += 300;
return(temperature);
}
// return Vdd * 100 (V)
uint32_t getVdd(){
uint32_t vdd = ((uint32_t) *VREFINT_CAL_ADDR) * (uint32_t)330; // 3.3V
vdd /= getADCval(VREF_CHAN);
return vdd;
}

29
F0-nolib/Servo/adc.h Normal file
View File

@ -0,0 +1,29 @@
/*
* This file is part of the Chiller project.
* Copyright 2018 Edward V. Emelianov <edward.emelianoff@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ADC_H
#define ADC_H
#include "stm32f0.h"
#define NUMBER_OF_ADC_CHANNELS (6)
extern uint16_t ADC_array[];
int32_t getMCUtemp();
uint32_t getVdd();
uint16_t getADCval(int nch);
#endif // ADC_H

201
F0-nolib/Servo/hardware.c Normal file
View File

@ -0,0 +1,201 @@
/*
* This file is part of the Chiller project.
* Copyright 2018 Edward V. Emelianov <edward.emelianoff@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hardware.h"
#include "usart.h"
#include "adc.h"
static inline void iwdg_setup(){
/* Enable the peripheral clock RTC */
/* (1) Enable the LSI (40kHz) */
/* (2) Wait while it is not ready */
RCC->CSR |= RCC_CSR_LSION; /* (1) */
while((RCC->CSR & RCC_CSR_LSIRDY) != RCC_CSR_LSIRDY); /* (2) */
/* Configure IWDG */
/* (1) Activate IWDG (not needed if done in option bytes) */
/* (2) Enable write access to IWDG registers */
/* (3) Set prescaler by 64 (1.6ms for each tick) */
/* (4) Set reload value to have a rollover each 1s */
/* (5) Check if flags are reset */
/* (6) Refresh counter */
IWDG->KR = IWDG_START; /* (1) */
IWDG->KR = IWDG_WRITE_ACCESS; /* (2) */
IWDG->PR = IWDG_PR_PR_1; /* (3) */
IWDG->RLR = 625; /* (4) */
while(IWDG->SR); /* (5) */
IWDG->KR = IWDG_REFRESH; /* (6) */
}
static inline void adc_setup(){
uint16_t ctr = 0; // 0xfff0 - more than 1.3ms
// Enable clocking
/* (1) Enable the peripheral clock of the ADC */
/* (2) Start HSI14 RC oscillator */
/* (3) Wait HSI14 is ready */
RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; /* (1) */
RCC->CR2 |= RCC_CR2_HSI14ON; /* (2) */
while ((RCC->CR2 & RCC_CR2_HSI14RDY) == 0 && ++ctr < 0xfff0){}; /* (3) */
// calibration
/* (1) Ensure that ADEN = 0 */
/* (2) Clear ADEN */
/* (3) Launch the calibration by setting ADCAL */
/* (4) Wait until ADCAL=0 */
if ((ADC1->CR & ADC_CR_ADEN) != 0){ /* (1) */
ADC1->CR &= (uint32_t)(~ADC_CR_ADEN); /* (2) */
}
ADC1->CR |= ADC_CR_ADCAL; /* (3) */
ctr = 0; // ADC calibration time is 5.9us
while ((ADC1->CR & ADC_CR_ADCAL) != 0 && ++ctr < 0xfff0){}; /* (4) */
// enable ADC
ctr = 0;
do{
ADC1->CR |= ADC_CR_ADEN;
}while ((ADC1->ISR & ADC_ISR_ADRDY) == 0 && ++ctr < 0xfff0);
// configure ADC
/* (1) Select HSI14 by writing 00 in CKMODE (reset value) */
/* (2) Select the continuous mode */
/* (3) Select CHSEL0..3 - ADC inputs, 16,17 - t. sensor and vref */
/* (4) Select a sampling mode of 111 i.e. 239.5 ADC clk to be greater than 17.1us */
/* (5) Wake-up the VREFINT and Temperature sensor (only for VBAT, Temp sensor and VRefInt) */
// ADC1->CFGR2 &= ~ADC_CFGR2_CKMODE; /* (1) */
ADC1->CFGR1 |= ADC_CFGR1_CONT; /* (2)*/
ADC1->CHSELR = ADC_CHSELR_CHSEL0 | ADC_CHSELR_CHSEL1 | ADC_CHSELR_CHSEL2 |
ADC_CHSELR_CHSEL3 | ADC_CHSELR_CHSEL16 | ADC_CHSELR_CHSEL17; /* (3)*/
ADC1->SMPR |= ADC_SMPR_SMP_0 | ADC_SMPR_SMP_1 | ADC_SMPR_SMP_2; /* (4) */
ADC->CCR |= ADC_CCR_TSEN | ADC_CCR_VREFEN; /* (5) */
// configure DMA for ADC
// DMA for AIN
/* (1) Enable the peripheral clock on DMA */
/* (2) Enable DMA transfer on ADC and circular mode */
/* (3) Configure the peripheral data register address */
/* (4) Configure the memory address */
/* (5) Configure the number of DMA tranfer to be performs on DMA channel 1 */
/* (6) Configure increment, size, interrupts and circular mode */
/* (7) Enable DMA Channel 1 */
RCC->AHBENR |= RCC_AHBENR_DMA1EN; /* (1) */
ADC1->CFGR1 |= ADC_CFGR1_DMAEN | ADC_CFGR1_DMACFG; /* (2) */
DMA1_Channel1->CPAR = (uint32_t) (&(ADC1->DR)); /* (3) */
DMA1_Channel1->CMAR = (uint32_t)(ADC_array); /* (4) */
DMA1_Channel1->CNDTR = NUMBER_OF_ADC_CHANNELS * 9; /* (5) */
DMA1_Channel1->CCR |= DMA_CCR_MINC | DMA_CCR_MSIZE_0 | DMA_CCR_PSIZE_0 | DMA_CCR_CIRC; /* (6) */
DMA1_Channel1->CCR |= DMA_CCR_EN; /* (7) */
ADC1->CR |= ADC_CR_ADSTART; /* start the ADC conversions */
}
/**
* @brief gpio_setup - setup GPIOs for external IO
* GPIO pinout:
* PA5 - floating input - Ef of TLE5205
* PA13 - open drain - IN1 of TLE5205
* PA14 - open drain - IN2 of TLE5205
* PF0 - floating input - water level alert
* PF1 - push-pull - external alarm
* PA0..PA3 - ADC_IN0..3
* PA4, PA6, PA7 - PWM outputs
* Registers
* MODER - input/output/alternate/analog (2 bit)
* OTYPER - 0 pushpull, 1 opendrain
* OSPEEDR - x0 low, 01 medium, 11 high
* PUPDR - no/pullup/pulldown/resr (2 bit)
* IDR - input
* ODR - output
* BSRR - 0..15 - set, 16..31 - reset
* BRR - 0..15 - reset
* AFRL/AFRH - alternate functions (4 bit, AF: 0..7); L - AFR0..7, H - ARF8..15
*/
static inline void gpio_setup(){
// Enable clocks to the GPIO subsystems
RCC->AHBENR |= RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN | RCC_AHBENR_GPIOFEN;
GPIOA->MODER =
GPIO_MODER_MODER13_O | GPIO_MODER_MODER14_O |
GPIO_MODER_MODER4_AF | GPIO_MODER_MODER6_AF |
GPIO_MODER_MODER7_AF |
GPIO_MODER_MODER0_AI | GPIO_MODER_MODER1_AI |
GPIO_MODER_MODER2_AI | GPIO_MODER_MODER3_AI;
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN; // enable syscfg clock for EXTI
GPIOA->OTYPER = 3 << 13; // 13/14 opendrain
GPIOF->MODER = GPIO_MODER_MODER1_O;
// PB1 - interrupt input
/* (2) Select Port B for pin 1 external interrupt by writing 0001 in EXTI1*/
/* (3) Configure the corresponding mask bit in the EXTI_IMR register */
/* (4) Configure the Trigger Selection bits of the Interrupt line on rising edge*/
/* (5) Configure the Trigger Selection bits of the Interrupt line on falling edge*/
SYSCFG->EXTICR[0] = SYSCFG_EXTICR1_EXTI1_PB; /* (2) */
EXTI->IMR = EXTI_IMR_MR1; /* (3) */
//EXTI->RTSR = 0x0000; /* (4) */
EXTI->FTSR = EXTI_FTSR_TR1; /* (5) */
/* (6) Enable Interrupt on EXTI0_1 */
/* (7) Set priority for EXTI0_1 */
NVIC_EnableIRQ(EXTI0_1_IRQn); /* (6) */
NVIC_SetPriority(EXTI0_1_IRQn, 3); /* (7) */
// alternate functions:
// PA4 - TIM14_CH1 (AF4)
// PA6 - TIM16_CH1 (AF5), PA7 - TIM17_CH1 (AF5)
GPIOA->AFR[0] = (GPIOA->AFR[0] &~ (GPIO_AFRL_AFRL4 | GPIO_AFRL_AFRL6 | GPIO_AFRL_AFRL7)) \
| (4 << (4 * 4)) | (5 << (6 * 4)) | (5 << (7 * 4));
}
static inline void timers_setup(){
// timer 14 ch1 - cooler PWM
// timer 16 ch1 - heater PWM
// timer 17 ch1 - pump PWM
RCC->APB1ENR |= RCC_APB1ENR_TIM3EN | RCC_APB1ENR_TIM14EN; // enable clocking for timers 3 and 14
RCC->APB2ENR |= RCC_APB2ENR_TIM16EN | RCC_APB2ENR_TIM17EN; // & timers 16/17
// PWM mode 1 (active -> inactive)
TIM14->CCMR1 = TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1;
TIM16->CCMR1 = TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1;
TIM17->CCMR1 = TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1;
// frequency
TIM14->PSC = 59; // 0.8MHz for 3kHz PWM
TIM16->PSC = 18749; // 2.56kHz for 10Hz PWM
TIM17->PSC = 5; // 8MHz for 31kHz PWM
// ARR for 8-bit PWM
TIM14->ARR = 254;
TIM16->ARR = 254;
TIM17->ARR = 254;
// start in OFF state
// TIM14->CCR1 = 0; and so on
// enable main output
TIM14->BDTR |= TIM_BDTR_MOE;
TIM16->BDTR |= TIM_BDTR_MOE;
TIM17->BDTR |= TIM_BDTR_MOE;
// enable PWM output
TIM14->CCER = TIM_CCER_CC1E;
TIM16->CCER = TIM_CCER_CC1E;
TIM17->CCER = TIM_CCER_CC1E;
// enable timers
TIM14->CR1 |= TIM_CR1_CEN;
TIM16->CR1 |= TIM_CR1_CEN;
TIM17->CR1 |= TIM_CR1_CEN;
}
void hw_setup(){
sysreset();
gpio_setup();
adc_setup();
timers_setup();
USART1_config();
iwdg_setup();
}
void exti0_1_isr(){
if (EXTI->PR & EXTI_PR_PR1){
EXTI->PR |= EXTI_PR_PR1; /* Clear the pending bit */
;
}
}

78
F0-nolib/Servo/hardware.h Normal file
View File

@ -0,0 +1,78 @@
/*
* This file is part of the Chiller project.
* Copyright 2018 Edward V. Emelianov <edward.emelianoff@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef HARDWARE_H
#define HARDWARE_H
#include "stm32f0.h"
// measure flow sensor data each 1 second
#define FLOW_RATE_MS (999)
// previous as string constant
#define FLOWRATESTR "1"
// each TMEASURE_MS ms calculate temperatures & check them
#define TMEASURE_MS (1000)
// each TCHECK_MS ms check cooler state and regulate temperature
#define TCHECK_MS (10000)
/*
temperature limits and tolerances
*/
// tolerance: +-1.5degrC
#define TEMP_TOLERANCE (15)
// dT tolerance: +-0.5degrC
#define DT_TOLERANCE (5)
// maximal heater temperature - 80degrC; normal - <60
#define MAX_HEATER_T (800)
#define NORMAL_HEATER_T (600)
// maximal output temperature - 45degrC; minimal - 10
#define MAX_OUTPUT_T (450)
#define MIN_OUTPUT_T (100)
// temperature working values: from 15 to 30degrC
#define OUTPUT_T_H (300)
#define OUTPUT_T_L (150)
/*
other limits & tolerances
*/
// minimal flow rate - 0.2l per minute
#define MIN_FLOW_RATE (20)
// normal flow rate
#define NORMAL_FLOW_RATE (30)
// minimal PWM values when motors should work
#define MIN_PUMP_PWM (90)
#define MIN_COOLER_PWM (90)
// PWM setters and getters
#define SET_COOLER_PWM(N) do{TIM14->CCR1 = (uint32_t)N;}while(0)
#define GET_COOLER_PWM() (uint16_t)(TIM14->CCR1)
#define SET_HEATER_PWM(N) do{TIM16->CCR1 = (uint32_t)N;}while(0)
#define GET_HEATER_PWM() (uint16_t)(TIM16->CCR1)
#define SET_PUMP_PWM(N) do{TIM17->CCR1 = (uint32_t)N;}while(0)
#define GET_PUMP_PWM() (uint16_t)(TIM17->CCR1)
// ext. alarm states
#define ALARM_ON() pin_set(GPIOF, 2)
#define ALARM_OFF() pin_clear(GPIOF, 2)
#define ALARM_STATE() pin_read(GPIOF, 2)
extern volatile uint32_t Tms;
void hw_setup(void);
#endif // HARDWARE_H

View File

@ -0,0 +1,445 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# +12V-Chiller_control-rescue
#
DEF +12V-Chiller_control-rescue #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "+12V-Chiller_control-rescue" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X +12V 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# +3.3V-Chiller_control-rescue
#
DEF +3.3V-Chiller_control-rescue #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "+3.3V-Chiller_control-rescue" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X +3V3 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# +3.3VADC-Chiller_control-rescue
#
DEF +3.3VADC-Chiller_control-rescue #PWR 0 0 Y Y 1 F P
F0 "#PWR" 150 -50 50 H I C CNN
F1 "+3.3VADC-Chiller_control-rescue" 0 100 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 3 0 1 0 0 0 0 40 0 40 N
P 6 0 1 0 0 40 20 20 0 70 -20 20 0 40 0 40 N
X +3.3VADC 1 0 0 0 U 50 50 0 0 W N
ENDDRAW
ENDDEF
#
# +5V-power
#
DEF +5V-power #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "+5V-power" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X +5V 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# C-Chiller_control-rescue
#
DEF C-Chiller_control-rescue C 0 10 N Y 1 F N
F0 "C" 25 100 50 H V L CNN
F1 "C-Chiller_control-rescue" 25 -100 50 H V L CNN
F2 "" 38 -150 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
C_*
$ENDFPLIST
DRAW
P 2 0 1 20 -80 -30 80 -30 N
P 2 0 1 20 -80 30 80 30 N
X ~ 1 0 150 110 D 50 50 1 1 P
X ~ 2 0 -150 110 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# CP-Chiller_control-rescue
#
DEF CP-Chiller_control-rescue C 0 10 N Y 1 F N
F0 "C" 25 100 50 H V L CNN
F1 "CP-Chiller_control-rescue" 25 -100 50 H V L CNN
F2 "" 38 -150 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
CP_*
$ENDFPLIST
DRAW
S -90 20 -90 40 0 1 0 N
S -90 20 90 20 0 1 0 N
S 90 -20 -90 -40 0 1 0 F
S 90 40 -90 40 0 1 0 N
S 90 40 90 20 0 1 0 N
P 2 0 1 0 -70 90 -30 90 N
P 2 0 1 0 -50 110 -50 70 N
X ~ 1 0 150 110 D 50 50 1 1 P
X ~ 2 0 -150 110 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Conn_01x02-Chiller_control-rescue
#
DEF Conn_01x02-Chiller_control-rescue J 0 40 Y N 1 F N
F0 "J" 0 100 50 H V C CNN
F1 "Conn_01x02-Chiller_control-rescue" 0 -200 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_??x*mm*
Connector*:*1x??x*mm*
Pin?Header?Straight?1X*
Pin?Header?Angled?1X*
Socket?Strip?Straight?1X*
Socket?Strip?Angled?1X*
$ENDFPLIST
DRAW
S -50 -95 0 -105 1 1 6 N
S -50 5 0 -5 1 1 6 N
S -50 50 50 -150 1 1 10 f
X Pin_1 1 -200 0 150 R 50 50 1 1 P
X Pin_2 2 -200 -100 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# D-Chiller_control-rescue
#
DEF D-Chiller_control-rescue D 0 40 N N 1 F N
F0 "D" 0 100 50 H V C CNN
F1 "D-Chiller_control-rescue" 0 -100 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
TO-???*
*SingleDiode
*_Diode_*
*SingleDiode*
D_*
$ENDFPLIST
DRAW
P 2 0 1 8 -50 50 -50 -50 N
P 2 0 1 0 50 0 -50 0 N
P 4 0 1 8 50 50 50 -50 -50 0 50 50 N
X K 1 -150 0 100 R 50 50 1 1 P
X A 2 150 0 100 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# DB9_Female-Chiller_control-rescue
#
DEF DB9_Female-Chiller_control-rescue J 0 40 Y N 1 F N
F0 "J" 0 550 50 H V C CNN
F1 "DB9_Female-Chiller_control-rescue" 0 -575 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
DB*F*
$ENDFPLIST
DRAW
C -70 -400 30 0 1 0 N
C -70 -200 30 0 1 0 N
C -70 0 30 0 1 0 N
C -70 200 30 0 1 0 N
C -70 400 30 0 1 0 N
C 50 -300 30 0 1 0 N
C 50 -100 30 0 1 0 N
C 50 100 30 0 1 0 N
C 50 300 30 0 1 0 N
P 2 0 1 0 -150 -400 -100 -400 N
P 2 0 1 0 -150 -300 20 -300 N
P 2 0 1 0 -150 -200 -100 -200 N
P 2 0 1 0 -150 -100 20 -100 N
P 2 0 1 0 -150 0 -100 0 N
P 2 0 1 0 -150 100 20 100 N
P 2 0 1 0 -150 200 -100 200 N
P 2 0 1 0 -150 300 20 300 N
P 2 0 1 0 -150 400 -100 400 N
P 5 0 1 10 -150 525 -150 -525 150 -375 150 375 -150 525 f
X 1 1 -300 400 150 R 50 50 1 1 P
X 2 2 -300 200 150 R 50 50 1 1 P
X 3 3 -300 0 150 R 50 50 1 1 P
X 4 4 -300 -200 150 R 50 50 1 1 P
X 5 5 -300 -400 150 R 50 50 1 1 P
X 6 6 -300 300 150 R 50 50 1 1 P
X 7 7 -300 100 150 R 50 50 1 1 P
X 8 8 -300 -100 150 R 50 50 1 1 P
X 9 9 -300 -300 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# GND-Chiller_control-rescue
#
DEF GND-Chiller_control-rescue #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -250 50 H I C CNN
F1 "GND-Chiller_control-rescue" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
X GND 1 0 0 0 D 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# L-Chiller_control-rescue
#
DEF L-Chiller_control-rescue L 0 40 N N 1 F N
F0 "L" -50 0 50 V V C CNN
F1 "L-Chiller_control-rescue" 75 0 50 V V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Choke_*
*Coil*
Inductor_*
L_*
$ENDFPLIST
DRAW
A 0 -75 25 -899 899 0 1 0 N 0 -100 0 -50
A 0 -25 25 -899 899 0 1 0 N 0 -50 0 0
A 0 25 25 -899 899 0 1 0 N 0 0 0 50
A 0 75 25 -899 899 0 1 0 N 0 50 0 100
X 1 1 0 150 50 D 50 50 1 1 P
X 2 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# LM1117-3.3-Chiller_control-rescue
#
DEF LM1117-3.3-Chiller_control-rescue U 0 10 Y Y 1 F N
F0 "U" -150 125 50 H V C CNN
F1 "LM1117-3.3-Chiller_control-rescue" 0 125 50 H V L CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
SOT?223*
TO?263*
TO?252*
TO?220*
$ENDFPLIST
DRAW
S -200 -200 200 75 0 1 10 f
X GND 1 0 -300 100 U 50 50 1 1 W
X VO 2 300 0 100 L 50 50 1 1 w
X VI 3 -300 0 100 R 50 50 1 1 W
ENDDRAW
ENDDEF
#
# MAX3232-Chiller_control-rescue
#
DEF MAX3232-Chiller_control-rescue U 0 40 Y Y 1 F N
F0 "U" -100 1125 50 H V R CNN
F1 "MAX3232-Chiller_control-rescue" -100 1050 50 H V R CNN
F2 "" 50 -1050 50 H I L CNN
F3 "" 0 100 50 H I C CNN
$FPLIST
SOIC*Pitch1.27mm*
DIP*W7.62mm*
TSSOP*4.4x5mm*Pitch0.65mm*
$ENDFPLIST
DRAW
C -100 -700 25 0 1 10 N
C -100 -500 25 0 1 10 N
C 25 -300 25 0 1 10 N
C 25 -100 25 0 1 10 N
T 0 -450 -900 50 0 0 0 LOGIC Normal 0 C C
T 0 450 -900 50 0 0 0 RS232 Normal 0 C C
S -600 -1000 600 1000 0 1 10 f
P 2 0 1 10 -150 -300 -325 -300 N
P 2 0 1 10 -150 -100 -325 -100 N
P 2 0 1 10 -125 -700 -325 -700 N
P 2 0 1 10 -125 -500 -325 -500 N
P 2 0 1 10 50 -300 250 -300 N
P 2 0 1 10 50 -100 250 -100 N
P 2 0 1 10 75 -700 250 -700 N
P 2 0 1 10 75 -500 250 -500 N
P 4 0 1 10 -150 -225 -150 -375 0 -300 -150 -225 N
P 4 0 1 10 -150 -25 -150 -175 0 -100 -150 -25 N
P 4 0 1 10 75 -625 75 -775 -75 -700 75 -625 N
P 4 0 1 10 75 -425 75 -575 -75 -500 75 -425 N
X C1+ 1 -800 900 200 R 50 50 1 1 P
X T2IN 10 -800 -300 200 R 50 50 1 1 I
X T1IN 11 -800 -100 200 R 50 50 1 1 I
X R1OUT 12 -800 -500 200 R 50 50 1 1 O
X R1IN 13 800 -500 200 L 50 50 1 1 I
X T1OUT 14 800 -100 200 L 50 50 1 1 O
X GND 15 0 -1200 200 U 50 50 1 1 W
X VCC 16 0 1200 200 D 50 50 1 1 W
X VS+ 2 800 400 200 L 50 50 1 1 w
X C1- 3 -800 600 200 R 50 50 1 1 P
X C2+ 4 800 900 200 L 50 50 1 1 P
X C2- 5 800 600 200 L 50 50 1 1 P
X VS- 6 800 100 200 L 50 50 1 1 w
X T2OUT 7 800 -300 200 L 50 50 1 1 O
X R2IN 8 800 -700 200 L 50 50 1 1 I
X R2OUT 9 -800 -700 200 R 50 50 1 1 O
ENDDRAW
ENDDEF
#
# PWR_FLAG-Chiller_control-rescue
#
DEF PWR_FLAG-Chiller_control-rescue #FLG 0 0 N N 1 F P
F0 "#FLG" 0 75 50 H I C CNN
F1 "PWR_FLAG-Chiller_control-rescue" 0 150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 50 -40 75 0 100 40 75 0 50 N
X pwr 1 0 0 0 U 50 50 0 0 w
ENDDRAW
ENDDEF
#
# Q_NMOS_GDS-Chiller_control-rescue
#
DEF Q_NMOS_GDS-Chiller_control-rescue Q 0 0 Y N 1 F N
F0 "Q" 200 50 50 H V L CNN
F1 "Q_NMOS_GDS-Chiller_control-rescue" 200 -50 50 H V L CNN
F2 "" 200 100 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
C 65 0 111 0 1 10 N
C 100 -70 11 0 1 0 F
C 100 70 11 0 1 0 F
P 2 0 1 0 2 0 10 0 N
P 2 0 1 0 30 -70 100 -70 N
P 2 0 1 10 30 -50 30 -90 N
P 2 0 1 0 30 0 100 0 N
P 2 0 1 10 30 20 30 -20 N
P 2 0 1 0 30 70 100 70 N
P 2 0 1 10 30 90 30 50 N
P 2 0 1 0 100 -70 100 -100 N
P 2 0 1 0 100 -70 100 0 N
P 2 0 1 0 100 100 100 70 N
P 3 0 1 10 10 75 10 -75 10 -75 N
P 4 0 1 0 40 0 80 15 80 -15 40 0 F
P 4 0 1 0 100 -70 130 -70 130 70 100 70 N
P 4 0 1 0 110 20 115 15 145 15 150 10 N
P 4 0 1 0 130 15 115 -10 145 -10 130 15 N
X G 1 -200 0 200 R 50 50 1 1 I
X D 2 100 200 100 D 50 50 1 1 P
X S 3 100 -200 100 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Q_NMOS_GSD-Chiller_control-rescue
#
DEF Q_NMOS_GSD-Chiller_control-rescue Q 0 0 Y N 1 F N
F0 "Q" 200 50 50 H V L CNN
F1 "Q_NMOS_GSD-Chiller_control-rescue" 200 -50 50 H V L CNN
F2 "" 200 100 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
C 65 0 111 0 1 10 N
C 100 -70 11 0 1 0 F
C 100 70 11 0 1 0 F
P 2 0 1 0 2 0 10 0 N
P 2 0 1 0 30 -70 100 -70 N
P 2 0 1 10 30 -50 30 -90 N
P 2 0 1 0 30 0 100 0 N
P 2 0 1 10 30 20 30 -20 N
P 2 0 1 0 30 70 100 70 N
P 2 0 1 10 30 90 30 50 N
P 2 0 1 0 100 -70 100 -100 N
P 2 0 1 0 100 -70 100 0 N
P 2 0 1 0 100 100 100 70 N
P 3 0 1 10 10 75 10 -75 10 -75 N
P 4 0 1 0 40 0 80 15 80 -15 40 0 F
P 4 0 1 0 100 -70 130 -70 130 70 100 70 N
P 4 0 1 0 110 20 115 15 145 15 150 10 N
P 4 0 1 0 130 15 115 -10 145 -10 130 15 N
X G 1 -200 0 200 R 50 50 1 1 I
X S 2 100 -200 100 U 50 50 1 1 P
X D 3 100 200 100 D 50 50 1 1 P
ENDDRAW
ENDDEF
#
# R-Chiller_control-rescue
#
DEF R-Chiller_control-rescue R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN
F1 "R-Chiller_control-rescue" 0 0 50 V V C CNN
F2 "" -70 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
R_*
$ENDFPLIST
DRAW
S -40 -100 40 100 0 1 10 N
X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# STM32F030F4Px-Chiller_control-rescue
#
DEF STM32F030F4Px-Chiller_control-rescue U 0 40 Y Y 1 L N
F0 "U" -1600 925 50 H V L BNN
F1 "STM32F030F4Px-Chiller_control-rescue" 1600 925 50 H V R BNN
F2 "Housings_SSOP:TSSOP-20_4.4x6.5mm_Pitch0.65mm" 1600 875 50 H I R TNN
F3 "" 0 0 50 H I C CNN
DRAW
S -1600 -800 1600 900 0 1 10 f
X BOOT0 1 -1700 400 100 R 50 50 1 1 I
X ADC_IN4/SPI1_NSS/TIM14_CH1/USART1_CK/PA4 10 1700 200 100 L 50 50 1 1 B
X ADC_IN5/SPI1_SCK/PA5 11 1700 100 100 L 50 50 1 1 B
X ADC_IN6/SPI1_MISO/TIM16_CH1/TIM1_BKIN/TIM3_CH1/PA6 12 1700 0 100 L 50 50 1 1 B
X ADC_IN7/SPI1_MOSI/TIM14_CH1/TIM17_CH1/TIM1_CH1N/TIM3_CH2/PA7 13 1700 -100 100 L 50 50 1 1 B
X PB1/ADC_IN9/TIM14_CH1/TIM1_CH3N/TIM3_CH4 14 -1700 -500 100 R 50 50 1 1 B
X VSS 15 0 -900 100 U 50 50 1 1 W
X VDD 16 -100 1000 100 D 50 50 1 1 W
X I2C1_SCL/TIM1_CH2/USART1_TX/PA9 17 1700 -200 100 L 50 50 1 1 B
X I2C1_SDA/TIM17_BKIN/TIM1_CH3/USART1_RX/PA10 18 1700 -300 100 L 50 50 1 1 B
X IR_OUT/SYS_SWDIO/PA13 19 1700 -400 100 L 50 50 1 1 B
X PF0/RCC_OSC_IN 2 -1700 -200 100 R 50 50 1 1 I
X SYS_SWCLK/USART1_TX/PA14 20 1700 -500 100 L 50 50 1 1 B
X PF1/RCC_OSC_OUT 3 -1700 -300 100 R 50 50 1 1 I
X NRST 4 -1700 600 100 R 50 50 1 1 I
X VDDA 5 0 1000 100 D 50 50 1 1 W
X ADC_IN0/RTC_TAMP2/SYS_WKUP1/USART1_CTS/PA0 6 1700 600 100 L 50 50 1 1 B
X ADC_IN1/USART1_DE/USART1_RTS/PA1 7 1700 500 100 L 50 50 1 1 B
X ADC_IN2/USART1_TX/PA2 8 1700 400 100 L 50 50 1 1 B
X ADC_IN3/USART1_RX/PA3 9 1700 300 100 L 50 50 1 1 B
ENDDRAW
ENDDEF
#
# SW_Push-Chiller_control-rescue
#
DEF SW_Push-Chiller_control-rescue SW 0 40 N N 1 F N
F0 "SW" 50 100 50 H V L CNN
F1 "SW_Push-Chiller_control-rescue" 0 -60 50 H V C CNN
F2 "" 0 200 50 H I C CNN
F3 "" 0 200 50 H I C CNN
DRAW
C -80 0 20 0 1 0 N
C 80 0 20 0 1 0 N
P 2 0 1 0 0 50 0 120 N
P 2 0 1 0 100 50 -100 50 N
X 1 1 -200 0 100 R 50 50 0 1 P
X 2 2 200 0 100 L 50 50 0 1 P
ENDDRAW
ENDDEF
#
#End Library

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,869 @@
(export (version D)
(design
(source /Big/Data/00__Electronics/STM32/F0-nolib/Servo/kicad/Servo_control.sch)
(date "Пн 11 мар 2019 00:06:44")
(tool "Eeschema 5.0.1")
(sheet (number 1) (name /) (tstamps /)
(title_block
(title)
(company)
(rev)
(date)
(source Servo_control.sch)
(comment (number 1) (value ""))
(comment (number 2) (value ""))
(comment (number 3) (value ""))
(comment (number 4) (value "")))))
(components
(comp (ref C4)
(value 47u)
(footprint Capacitor_Tantalum_SMD:CP_EIA-3216-18_Kemet-A_Pad1.53x1.40mm_HandSolder)
(libsource (lib Servo_control-rescue) (part CP-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 58C454F6))
(comp (ref C3)
(value 0.1)
(footprint Capacitor_SMD:C_0603_1608Metric_Pad0.84x1.00mm_HandSolder)
(libsource (lib Servo_control-rescue) (part C-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 590D4150))
(comp (ref C2)
(value 0.1)
(footprint Capacitor_SMD:C_0603_1608Metric_Pad0.84x1.00mm_HandSolder)
(libsource (lib Servo_control-rescue) (part C-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 590D4832))
(comp (ref SW2)
(value Boot)
(footprint Button_Switch_SMD:SW_SPST_FSMSM)
(libsource (lib Servo_control-rescue) (part SW_Push-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5909F6B6))
(comp (ref SW1)
(value Reset)
(footprint Button_Switch_SMD:SW_SPST_FSMSM)
(libsource (lib Servo_control-rescue) (part SW_Push-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 590A0134))
(comp (ref C1)
(value 0.1)
(footprint Capacitor_SMD:C_0603_1608Metric_Pad0.84x1.00mm_HandSolder)
(libsource (lib Servo_control-rescue) (part C-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5A178C32))
(comp (ref U3)
(value STM32F030F4Px)
(footprint Package_SSOP:TSSOP-20_4.4x6.5mm_P0.65mm)
(libsource (lib Servo_control-rescue) (part STM32F030F4Px-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5A189F52))
(comp (ref C13)
(value 1u)
(footprint Capacitor_SMD:C_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part C-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5A1AB970))
(comp (ref U1)
(value LM1117-3.3)
(footprint Package_TO_SOT_SMD:SOT-223)
(libsource (lib Servo_control-rescue) (part LM1117-3.3-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5A2588E7))
(comp (ref C5)
(value 0.1)
(footprint Capacitor_SMD:C_0603_1608Metric_Pad0.84x1.00mm_HandSolder)
(libsource (lib Servo_control-rescue) (part C-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5BEE1D09))
(comp (ref L1)
(value "BMBA 0.1mH")
(footprint Inductor_SMD:L_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part L-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5BEE7949))
(comp (ref C14)
(value 10u)
(footprint Capacitor_SMD:C_1206_3216Metric_Pad1.24x1.80mm_HandSolder)
(libsource (lib Servo_control-rescue) (part C-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5BEE8065))
(comp (ref R15)
(value 10k)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5BEEBD18))
(comp (ref R12)
(value 510)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5BEEBD1E))
(comp (ref Q3)
(value 2N7002)
(footprint Package_TO_SOT_SMD:SOT-23)
(libsource (lib Servo_control-rescue) (part Q_NMOS_GSD-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5BEEBD24))
(comp (ref Q2)
(value SI2300)
(footprint Package_TO_SOT_SMD:SOT-23)
(libsource (lib Servo_control-rescue) (part Q_NMOS_GSD-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5BEEB585))
(comp (ref BZ1)
(value Buzzer)
(footprint Buzzer_Beeper:Buzzer_12x9.5RM7.6)
(datasheet ~)
(libsource (lib Device) (part Buzzer) (description "Buzzer, polar"))
(sheetpath (names /) (tstamps /))
(tstamp 5C83133C))
(comp (ref Q4)
(value 2N7002)
(footprint Package_TO_SOT_SMD:SOT-23)
(libsource (lib Servo_control-rescue) (part Q_NMOS_GSD-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C8882AE))
(comp (ref Q5)
(value 2N7002)
(footprint Package_TO_SOT_SMD:SOT-23)
(libsource (lib Servo_control-rescue) (part Q_NMOS_GSD-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C888320))
(comp (ref J7)
(value Servo1)
(footprint Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical)
(datasheet ~)
(libsource (lib Connector_Generic) (part Conn_01x03) (description "Generic connector, single row, 01x03, script generated (kicad-library-utils/schlib/autogen/connector/)"))
(sheetpath (names /) (tstamps /))
(tstamp 5C88A162))
(comp (ref J8)
(value Servo2)
(footprint Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical)
(datasheet ~)
(libsource (lib Connector_Generic) (part Conn_01x03) (description "Generic connector, single row, 01x03, script generated (kicad-library-utils/schlib/autogen/connector/)"))
(sheetpath (names /) (tstamps /))
(tstamp 5C83F212))
(comp (ref J9)
(value Servo3)
(footprint Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical)
(datasheet ~)
(libsource (lib Connector_Generic) (part Conn_01x03) (description "Generic connector, single row, 01x03, script generated (kicad-library-utils/schlib/autogen/connector/)"))
(sheetpath (names /) (tstamps /))
(tstamp 5C83F4E9))
(comp (ref R13)
(value 510)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C84B03F))
(comp (ref R14)
(value 510)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C84B0D1))
(comp (ref R16)
(value 10k)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C84B278))
(comp (ref R17)
(value 10k)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C84B3BD))
(comp (ref D2)
(value SP0504BAHT)
(footprint Package_TO_SOT_SMD:SOT-23-5)
(datasheet http://www.littelfuse.com/~/media/files/littelfuse/technical%20resources/documents/data%20sheets/sp05xxba.pdf)
(libsource (lib Power_Protection) (part SP0504BAHT) (description "TVS Diode Array, 5.5V Standoff, 4 Channels, SOT-23-5 package"))
(sheetpath (names /) (tstamps /))
(tstamp 5C8580E1))
(comp (ref J2)
(value ADC_in)
(footprint Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical)
(datasheet ~)
(libsource (lib Connector_Generic) (part Conn_01x06) (description "Generic connector, single row, 01x06, script generated (kicad-library-utils/schlib/autogen/connector/)"))
(sheetpath (names /) (tstamps /))
(tstamp 5C85A71E))
(comp (ref R3)
(value 220)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Device) (part R) (description Resistor))
(sheetpath (names /) (tstamps /))
(tstamp 5C85BD06))
(comp (ref R4)
(value 220)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Device) (part R) (description Resistor))
(sheetpath (names /) (tstamps /))
(tstamp 5C85C1A1))
(comp (ref R5)
(value 220)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Device) (part R) (description Resistor))
(sheetpath (names /) (tstamps /))
(tstamp 5C85C24A))
(comp (ref R2)
(value 220)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Device) (part R) (description Resistor))
(sheetpath (names /) (tstamps /))
(tstamp 5C85C2A8))
(comp (ref C8)
(value 0.1)
(footprint Capacitor_SMD:C_0603_1608Metric_Pad0.84x1.00mm_HandSolder)
(libsource (lib Servo_control-rescue) (part C-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C86267B))
(comp (ref C10)
(value 0.1)
(footprint Capacitor_SMD:C_0603_1608Metric_Pad0.84x1.00mm_HandSolder)
(libsource (lib Servo_control-rescue) (part C-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C862E72))
(comp (ref C11)
(value 0.1)
(footprint Capacitor_SMD:C_0603_1608Metric_Pad0.84x1.00mm_HandSolder)
(libsource (lib Servo_control-rescue) (part C-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C862EDE))
(comp (ref C12)
(value 0.1)
(footprint Capacitor_SMD:C_0603_1608Metric_Pad0.84x1.00mm_HandSolder)
(libsource (lib Servo_control-rescue) (part C-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C864D09))
(comp (ref U2)
(value CH340G)
(footprint Package_SOIC:SOIC-16_3.9x9.9mm_P1.27mm)
(libsource (lib ch34x) (part CH340G) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C891E7A))
(comp (ref C6)
(value 0.1)
(footprint Capacitor_SMD:C_0603_1608Metric_Pad0.84x1.00mm_HandSolder)
(libsource (lib Servo_control-rescue) (part C-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C8AFE6B))
(comp (ref Y1)
(value 12MHz)
(footprint Crystal:Crystal_HC49-U_Vertical)
(libsource (lib Device) (part Crystal) (description "Two pin crystal"))
(sheetpath (names /) (tstamps /))
(tstamp 5C8CDA20))
(comp (ref C7)
(value 22p)
(footprint Capacitor_SMD:C_0603_1608Metric_Pad0.84x1.00mm_HandSolder)
(libsource (lib Device) (part C) (description "Unpolarized capacitor"))
(sheetpath (names /) (tstamps /))
(tstamp 5C8CDF63))
(comp (ref C9)
(value 22p)
(footprint Capacitor_SMD:C_0603_1608Metric_Pad0.84x1.00mm_HandSolder)
(libsource (lib Device) (part C) (description "Unpolarized capacitor"))
(sheetpath (names /) (tstamps /))
(tstamp 5C8CE285))
(comp (ref Q1)
(value 2N7002)
(footprint Package_TO_SOT_SMD:SOT-23)
(libsource (lib Servo_control-rescue) (part Q_NMOS_GSD-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C9233AA))
(comp (ref R8)
(value 510)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C924EC0))
(comp (ref R9)
(value 10k)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C924F9E))
(comp (ref R6)
(value 510)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C929CAD))
(comp (ref R7)
(value 10k)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C929D7F))
(comp (ref J6)
(value Ext_LED)
(footprint Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical)
(datasheet ~)
(libsource (lib Connector_Generic) (part Conn_01x02) (description "Generic connector, single row, 01x02, script generated (kicad-library-utils/schlib/autogen/connector/)"))
(sheetpath (names /) (tstamps /))
(tstamp 5C93CB05))
(comp (ref R1)
(value 10k)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C943CF3))
(comp (ref D3)
(value SMAJ5.0)
(footprint Diode_SMD:D_SMA_Handsoldering)
(libsource (lib Device) (part D) (description Diode))
(sheetpath (names /) (tstamps /))
(tstamp 5C95243A))
(comp (ref D4)
(value SMAJ5.0)
(footprint Diode_SMD:D_SMA_Handsoldering)
(libsource (lib Device) (part D) (description Diode))
(sheetpath (names /) (tstamps /))
(tstamp 5C952A1B))
(comp (ref R10)
(value 1k)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C957A49))
(comp (ref R11)
(value 1k)
(footprint Resistor_SMD:R_0805_2012Metric_Pad1.15x1.50mm_HandSolder)
(libsource (lib Servo_control-rescue) (part R-Chiller_control-rescue) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C957B70))
(comp (ref J5)
(value Conn_01x03)
(footprint Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical)
(datasheet ~)
(libsource (lib Connector_Generic) (part Conn_01x03) (description "Generic connector, single row, 01x03, script generated (kicad-library-utils/schlib/autogen/connector/)"))
(sheetpath (names /) (tstamps /))
(tstamp 5C9581BA))
(comp (ref J3)
(value Jumper0)
(footprint Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical)
(datasheet ~)
(libsource (lib Connector_Generic) (part Conn_01x02) (description "Generic connector, single row, 01x02, script generated (kicad-library-utils/schlib/autogen/connector/)"))
(sheetpath (names /) (tstamps /))
(tstamp 5C98F117))
(comp (ref J4)
(value Jumper1)
(footprint Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical)
(datasheet ~)
(libsource (lib Connector_Generic) (part Conn_01x02) (description "Generic connector, single row, 01x02, script generated (kicad-library-utils/schlib/autogen/connector/)"))
(sheetpath (names /) (tstamps /))
(tstamp 5C98F3D6))
(comp (ref J1)
(value USB_B_Micro)
(footprint Connector_USB:USB_Micro-B_Wuerth-629105150521)
(datasheet ~)
(libsource (lib Connector_Specialized) (part USB_B_Micro) (description "USB Micro Type B connector"))
(sheetpath (names /) (tstamps /))
(tstamp 5C8BC41C))
(comp (ref D1)
(value USB6B1)
(footprint Package_SOIC:SOIC-8_3.9x4.9mm_P1.27mm)
(libsource (lib elements) (part USB6B1) (description ""))
(sheetpath (names /) (tstamps /))
(tstamp 5C9BF24E)))
(libparts
(libpart (lib Connector_Generic) (part Conn_01x02)
(description "Generic connector, single row, 01x02, script generated (kicad-library-utils/schlib/autogen/connector/)")
(docs ~)
(footprints
(fp Connector*:*_1x??_*))
(fields
(field (name Reference) J)
(field (name Value) Conn_01x02))
(pins
(pin (num 1) (name Pin_1) (type passive))
(pin (num 2) (name Pin_2) (type passive))))
(libpart (lib Connector_Generic) (part Conn_01x03)
(description "Generic connector, single row, 01x03, script generated (kicad-library-utils/schlib/autogen/connector/)")
(docs ~)
(footprints
(fp Connector*:*_1x??_*))
(fields
(field (name Reference) J)
(field (name Value) Conn_01x03))
(pins
(pin (num 1) (name Pin_1) (type passive))
(pin (num 2) (name Pin_2) (type passive))
(pin (num 3) (name Pin_3) (type passive))))
(libpart (lib Connector_Generic) (part Conn_01x06)
(description "Generic connector, single row, 01x06, script generated (kicad-library-utils/schlib/autogen/connector/)")
(docs ~)
(footprints
(fp Connector*:*_1x??_*))
(fields
(field (name Reference) J)
(field (name Value) Conn_01x06))
(pins
(pin (num 1) (name Pin_1) (type passive))
(pin (num 2) (name Pin_2) (type passive))
(pin (num 3) (name Pin_3) (type passive))
(pin (num 4) (name Pin_4) (type passive))
(pin (num 5) (name Pin_5) (type passive))
(pin (num 6) (name Pin_6) (type passive))))
(libpart (lib Connector_Specialized) (part USB_B_Micro)
(aliases
(alias USB_B_Mini))
(description "USB Micro Type B connector")
(docs ~)
(footprints
(fp USB*))
(fields
(field (name Reference) J)
(field (name Value) USB_B_Micro))
(pins
(pin (num 1) (name VBUS) (type power_out))
(pin (num 2) (name D-) (type passive))
(pin (num 3) (name D+) (type passive))
(pin (num 4) (name ID) (type passive))
(pin (num 5) (name GND) (type power_out))
(pin (num 6) (name Shield) (type passive))))
(libpart (lib Device) (part Buzzer)
(description "Buzzer, polar")
(footprints
(fp *Buzzer*))
(fields
(field (name Reference) BZ)
(field (name Value) Buzzer))
(pins
(pin (num 1) (name -) (type passive))
(pin (num 2) (name +) (type passive))))
(libpart (lib Device) (part C)
(description "Unpolarized capacitor")
(footprints
(fp C_*))
(fields
(field (name Reference) C)
(field (name Value) C))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))))
(libpart (lib Device) (part Crystal)
(description "Two pin crystal")
(footprints
(fp Crystal*))
(fields
(field (name Reference) Y)
(field (name Value) Crystal))
(pins
(pin (num 1) (name 1) (type passive))
(pin (num 2) (name 2) (type passive))))
(libpart (lib Device) (part D)
(description Diode)
(footprints
(fp TO-???*)
(fp *SingleDiode)
(fp *_Diode_*)
(fp *SingleDiode*)
(fp D_*))
(fields
(field (name Reference) D)
(field (name Value) D))
(pins
(pin (num 1) (name K) (type passive))
(pin (num 2) (name A) (type passive))))
(libpart (lib Device) (part R)
(description Resistor)
(footprints
(fp R_*)
(fp R_*))
(fields
(field (name Reference) R)
(field (name Value) R))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))))
(libpart (lib Power_Protection) (part SP0504BAHT)
(description "TVS Diode Array, 5.5V Standoff, 4 Channels, SOT-23-5 package")
(docs http://www.littelfuse.com/~/media/files/littelfuse/technical%20resources/documents/data%20sheets/sp05xxba.pdf)
(footprints
(fp SOT?23*))
(fields
(field (name Reference) D)
(field (name Value) SP0504BAHT)
(field (name Footprint) Package_TO_SOT_SMD:SOT-23-5))
(pins
(pin (num 1) (name K) (type input))
(pin (num 2) (name A) (type input))
(pin (num 3) (name K) (type input))
(pin (num 4) (name K) (type input))
(pin (num 5) (name K) (type input))))
(libpart (lib Servo_control-rescue) (part C-Chiller_control-rescue)
(footprints
(fp C_*))
(fields
(field (name Reference) C)
(field (name Value) C-Chiller_control-rescue))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))))
(libpart (lib Servo_control-rescue) (part CP-Chiller_control-rescue)
(footprints
(fp CP_*))
(fields
(field (name Reference) C)
(field (name Value) CP-Chiller_control-rescue))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))))
(libpart (lib Servo_control-rescue) (part L-Chiller_control-rescue)
(footprints
(fp Choke_*)
(fp *Coil*)
(fp Inductor_*)
(fp L_*))
(fields
(field (name Reference) L)
(field (name Value) L-Chiller_control-rescue))
(pins
(pin (num 1) (name 1) (type passive))
(pin (num 2) (name 2) (type passive))))
(libpart (lib Servo_control-rescue) (part LM1117-3.3-Chiller_control-rescue)
(footprints
(fp SOT?223*)
(fp TO?263*)
(fp TO?252*)
(fp TO?220*))
(fields
(field (name Reference) U)
(field (name Value) LM1117-3.3-Chiller_control-rescue))
(pins
(pin (num 1) (name GND) (type power_in))
(pin (num 2) (name VO) (type power_out))
(pin (num 3) (name VI) (type power_in))))
(libpart (lib Servo_control-rescue) (part Q_NMOS_GSD-Chiller_control-rescue)
(fields
(field (name Reference) Q)
(field (name Value) Q_NMOS_GSD-Chiller_control-rescue))
(pins
(pin (num 1) (name G) (type input))
(pin (num 2) (name S) (type passive))
(pin (num 3) (name D) (type passive))))
(libpart (lib Servo_control-rescue) (part R-Chiller_control-rescue)
(footprints
(fp R_*)
(fp R_*))
(fields
(field (name Reference) R)
(field (name Value) R-Chiller_control-rescue))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))))
(libpart (lib Servo_control-rescue) (part STM32F030F4Px-Chiller_control-rescue)
(fields
(field (name Reference) U)
(field (name Value) STM32F030F4Px-Chiller_control-rescue)
(field (name Footprint) Housings_SSOP:TSSOP-20_4.4x6.5mm_Pitch0.65mm))
(pins
(pin (num 1) (name BOOT0) (type input))
(pin (num 2) (name PF0/RCC_OSC_IN) (type input))
(pin (num 3) (name PF1/RCC_OSC_OUT) (type input))
(pin (num 4) (name NRST) (type input))
(pin (num 5) (name VDDA) (type power_in))
(pin (num 6) (name ADC_IN0/RTC_TAMP2/SYS_WKUP1/USART1_CTS/PA0) (type BiDi))
(pin (num 7) (name ADC_IN1/USART1_DE/USART1_RTS/PA1) (type BiDi))
(pin (num 8) (name ADC_IN2/USART1_TX/PA2) (type BiDi))
(pin (num 9) (name ADC_IN3/USART1_RX/PA3) (type BiDi))
(pin (num 10) (name ADC_IN4/SPI1_NSS/TIM14_CH1/USART1_CK/PA4) (type BiDi))
(pin (num 11) (name ADC_IN5/SPI1_SCK/PA5) (type BiDi))
(pin (num 12) (name ADC_IN6/SPI1_MISO/TIM16_CH1/TIM1_BKIN/TIM3_CH1/PA6) (type BiDi))
(pin (num 13) (name ADC_IN7/SPI1_MOSI/TIM14_CH1/TIM17_CH1/TIM1_CH1N/TIM3_CH2/PA7) (type BiDi))
(pin (num 14) (name PB1/ADC_IN9/TIM14_CH1/TIM1_CH3N/TIM3_CH4) (type BiDi))
(pin (num 15) (name VSS) (type power_in))
(pin (num 16) (name VDD) (type power_in))
(pin (num 17) (name I2C1_SCL/TIM1_CH2/USART1_TX/PA9) (type BiDi))
(pin (num 18) (name I2C1_SDA/TIM17_BKIN/TIM1_CH3/USART1_RX/PA10) (type BiDi))
(pin (num 19) (name IR_OUT/SYS_SWDIO/PA13) (type BiDi))
(pin (num 20) (name SYS_SWCLK/USART1_TX/PA14) (type BiDi))))
(libpart (lib Servo_control-rescue) (part SW_Push-Chiller_control-rescue)
(fields
(field (name Reference) SW)
(field (name Value) SW_Push-Chiller_control-rescue))
(pins
(pin (num 1) (name 1) (type passive))
(pin (num 2) (name 2) (type passive))))
(libpart (lib ch34x) (part CH340G)
(fields
(field (name Reference) U)
(field (name Value) CH340G))
(pins
(pin (num 1) (name GND) (type power_in))
(pin (num 2) (name TX) (type output))
(pin (num 3) (name RX) (type input))
(pin (num 4) (name V3) (type passive))
(pin (num 5) (name D+) (type BiDi))
(pin (num 6) (name D-) (type BiDi))
(pin (num 7) (name XI) (type input))
(pin (num 8) (name XO) (type input))
(pin (num 9) (name CTS) (type output))
(pin (num 10) (name DSR) (type output))
(pin (num 11) (name RI) (type output))
(pin (num 12) (name DCD) (type output))
(pin (num 13) (name DTR) (type output))
(pin (num 14) (name RTS) (type output))
(pin (num 15) (name RS232) (type input))
(pin (num 16) (name VCC) (type power_in))))
(libpart (lib elements) (part USB6B1)
(footprints
(fp SO8))
(fields
(field (name Reference) D)
(field (name Value) USB6B1))
(pins
(pin (num 1) (name VCC) (type passive))
(pin (num 2) (name I/O1) (type passive))
(pin (num 3) (name I/O2) (type passive))
(pin (num 4) (name GND) (type passive))
(pin (num 5) (name GND) (type passive))
(pin (num 6) (name I/O2) (type passive))
(pin (num 7) (name I/O1) (type passive))
(pin (num 8) (name VCC) (type passive)))))
(libraries
(library (logical Connector_Generic)
(uri /usr/share/kicad/library/Connector_Generic.lib))
(library (logical Connector_Specialized)
(uri /usr/share/kicad/library/Connector_Specialized.lib))
(library (logical Device)
(uri /usr/share/kicad/library/Device.lib))
(library (logical Power_Protection)
(uri /usr/share/kicad/library/Power_Protection.lib))
(library (logical Servo_control-rescue)
(uri /Big/Data/00__Electronics/STM32/F0-nolib/Servo/kicad/Servo_control-rescue.lib))
(library (logical ch34x)
(uri /Big/Data/00__Electronics/STM32/F0-nolib/Servo/kicad/ch34x.lib))
(library (logical elements)
(uri /Big/Data/00__Electronics/STM32/F0-nolib/Servo/kicad/elements.lib)))
(nets
(net (code 1) (name "Net-(U2-Pad13)")
(node (ref U2) (pin 13)))
(net (code 2) (name "Net-(U2-Pad12)")
(node (ref U2) (pin 12)))
(net (code 3) (name "Net-(U2-Pad11)")
(node (ref U2) (pin 11)))
(net (code 4) (name "Net-(U2-Pad10)")
(node (ref U2) (pin 10)))
(net (code 5) (name "Net-(U2-Pad9)")
(node (ref U2) (pin 9)))
(net (code 6) (name +3V3)
(node (ref C13) (pin 1))
(node (ref C4) (pin 1))
(node (ref C5) (pin 1))
(node (ref U1) (pin 2))
(node (ref J2) (pin 6))
(node (ref SW2) (pin 2))
(node (ref U3) (pin 16))
(node (ref L1) (pin 1))
(node (ref BZ1) (pin 1))
(node (ref U2) (pin 16)))
(net (code 7) (name "Net-(U2-Pad15)")
(node (ref U2) (pin 15)))
(net (code 8) (name "Net-(U2-Pad14)")
(node (ref U2) (pin 14)))
(net (code 9) (name "Net-(C9-Pad1)")
(node (ref U2) (pin 8))
(node (ref C9) (pin 1))
(node (ref Y1) (pin 2)))
(net (code 10) (name "Net-(D1-Pad7)")
(node (ref D1) (pin 7))
(node (ref U2) (pin 5)))
(net (code 11) (name "Net-(C6-Pad1)")
(node (ref C6) (pin 1))
(node (ref U2) (pin 4)))
(net (code 12) (name /USART_Tx)
(node (ref U2) (pin 3))
(node (ref U3) (pin 17)))
(net (code 13) (name /USART_Rx)
(node (ref U2) (pin 2))
(node (ref U3) (pin 18)))
(net (code 14) (name GND)
(node (ref C14) (pin 1))
(node (ref R15) (pin 1))
(node (ref C5) (pin 2))
(node (ref D4) (pin 2))
(node (ref R7) (pin 1))
(node (ref R9) (pin 1))
(node (ref Q1) (pin 2))
(node (ref R1) (pin 1))
(node (ref J5) (pin 1))
(node (ref Q3) (pin 2))
(node (ref D3) (pin 2))
(node (ref J2) (pin 1))
(node (ref J9) (pin 1))
(node (ref J8) (pin 1))
(node (ref J7) (pin 1))
(node (ref D2) (pin 2))
(node (ref R17) (pin 1))
(node (ref R16) (pin 1))
(node (ref C3) (pin 2))
(node (ref U3) (pin 15))
(node (ref C1) (pin 2))
(node (ref SW1) (pin 2))
(node (ref Q2) (pin 2))
(node (ref C2) (pin 2))
(node (ref C4) (pin 2))
(node (ref C13) (pin 2))
(node (ref Q4) (pin 2))
(node (ref U1) (pin 1))
(node (ref Q5) (pin 2))
(node (ref D1) (pin 5))
(node (ref C12) (pin 2))
(node (ref C11) (pin 2))
(node (ref C10) (pin 2))
(node (ref C8) (pin 2))
(node (ref J3) (pin 1))
(node (ref J4) (pin 1))
(node (ref C9) (pin 2))
(node (ref U2) (pin 1))
(node (ref C7) (pin 2))
(node (ref C6) (pin 2)))
(net (code 15) (name "Net-(C7-Pad1)")
(node (ref C7) (pin 1))
(node (ref Y1) (pin 1))
(node (ref U2) (pin 7)))
(net (code 16) (name "Net-(J2-Pad3)")
(node (ref R4) (pin 2))
(node (ref J2) (pin 3)))
(net (code 17) (name "Net-(J2-Pad5)")
(node (ref J2) (pin 5))
(node (ref R2) (pin 2)))
(net (code 18) (name "Net-(J2-Pad4)")
(node (ref R3) (pin 2))
(node (ref J2) (pin 4)))
(net (code 19) (name "Net-(J2-Pad2)")
(node (ref J2) (pin 2))
(node (ref R5) (pin 2)))
(net (code 20) (name /Jumper1)
(node (ref J4) (pin 2))
(node (ref U3) (pin 20)))
(net (code 21) (name /DigIn1)
(node (ref R10) (pin 1))
(node (ref D4) (pin 1))
(node (ref U3) (pin 11)))
(net (code 22) (name /DigIn0)
(node (ref U3) (pin 10))
(node (ref R11) (pin 1))
(node (ref D3) (pin 1)))
(net (code 23) (name "Net-(J5-Pad3)")
(node (ref J5) (pin 3))
(node (ref R10) (pin 2)))
(net (code 24) (name "Net-(D1-Pad6)")
(node (ref D1) (pin 6))
(node (ref U2) (pin 6)))
(net (code 25) (name "Net-(D1-Pad3)")
(node (ref D1) (pin 3))
(node (ref J1) (pin 3)))
(net (code 26) (name "Net-(D1-Pad2)")
(node (ref J1) (pin 2))
(node (ref D1) (pin 2)))
(net (code 27) (name +5V)
(node (ref C1) (pin 1))
(node (ref U1) (pin 3))
(node (ref D1) (pin 8))
(node (ref J9) (pin 2))
(node (ref J7) (pin 2))
(node (ref J8) (pin 2))
(node (ref J6) (pin 1)))
(net (code 28) (name "Net-(J5-Pad2)")
(node (ref J5) (pin 2))
(node (ref R11) (pin 2)))
(net (code 29) (name "Net-(D1-Pad4)")
(node (ref D1) (pin 4))
(node (ref J1) (pin 5))
(node (ref J1) (pin 6)))
(net (code 30) (name "Net-(J1-Pad4)")
(node (ref J1) (pin 4)))
(net (code 31) (name "Net-(D1-Pad1)")
(node (ref J1) (pin 1))
(node (ref D1) (pin 1)))
(net (code 32) (name "Net-(Q1-Pad1)")
(node (ref R6) (pin 1))
(node (ref Q1) (pin 1)))
(net (code 33) (name "Net-(Q2-Pad1)")
(node (ref Q2) (pin 1))
(node (ref R8) (pin 1)))
(net (code 34) (name "Net-(BZ1-Pad2)")
(node (ref BZ1) (pin 2))
(node (ref Q1) (pin 3)))
(net (code 35) (name "Net-(J6-Pad2)")
(node (ref J6) (pin 2))
(node (ref Q2) (pin 3)))
(net (code 36) (name "Net-(J7-Pad3)")
(node (ref Q3) (pin 3))
(node (ref J7) (pin 3)))
(net (code 37) (name "Net-(Q3-Pad1)")
(node (ref R12) (pin 1))
(node (ref Q3) (pin 1)))
(net (code 38) (name +3.3VADC)
(node (ref U3) (pin 5))
(node (ref L1) (pin 2))
(node (ref C14) (pin 2)))
(net (code 39) (name /TIM3_CH1)
(node (ref R12) (pin 2))
(node (ref U3) (pin 12))
(node (ref R15) (pin 2)))
(net (code 40) (name /BOOT0)
(node (ref SW2) (pin 1))
(node (ref C3) (pin 1))
(node (ref R1) (pin 2))
(node (ref U3) (pin 1)))
(net (code 41) (name /ADC3)
(node (ref D2) (pin 5))
(node (ref U3) (pin 9))
(node (ref R5) (pin 1))
(node (ref C8) (pin 1)))
(net (code 42) (name /ADC2)
(node (ref D2) (pin 4))
(node (ref C10) (pin 1))
(node (ref R4) (pin 1))
(node (ref U3) (pin 8)))
(net (code 43) (name /ADC1)
(node (ref U3) (pin 7))
(node (ref C11) (pin 1))
(node (ref R3) (pin 1))
(node (ref D2) (pin 3)))
(net (code 44) (name /ADC0)
(node (ref U3) (pin 6))
(node (ref C12) (pin 1))
(node (ref D2) (pin 1))
(node (ref R2) (pin 1)))
(net (code 45) (name /NRST)
(node (ref U3) (pin 4))
(node (ref SW1) (pin 1))
(node (ref C2) (pin 1)))
(net (code 46) (name /DigOut1)
(node (ref R8) (pin 2))
(node (ref R9) (pin 2))
(node (ref U3) (pin 3)))
(net (code 47) (name /DigOut0)
(node (ref U3) (pin 2))
(node (ref R7) (pin 2))
(node (ref R6) (pin 2)))
(net (code 48) (name /Jumper0)
(node (ref U3) (pin 19))
(node (ref J3) (pin 2)))
(net (code 49) (name "Net-(J8-Pad3)")
(node (ref Q4) (pin 3))
(node (ref J8) (pin 3)))
(net (code 50) (name "Net-(J9-Pad3)")
(node (ref Q5) (pin 3))
(node (ref J9) (pin 3)))
(net (code 51) (name /TIM3_CH2)
(node (ref R16) (pin 2))
(node (ref R13) (pin 2))
(node (ref U3) (pin 13)))
(net (code 52) (name /TIM3_CH4)
(node (ref U3) (pin 14))
(node (ref R14) (pin 2))
(node (ref R17) (pin 2)))
(net (code 53) (name "Net-(Q5-Pad1)")
(node (ref R14) (pin 1))
(node (ref Q5) (pin 1)))
(net (code 54) (name "Net-(Q4-Pad1)")
(node (ref R13) (pin 1))
(node (ref Q4) (pin 1)))))

View File

@ -0,0 +1,100 @@
update=Вс 27 янв 2019 15:05:22
version=1
last_client=kicad
[cvpcb]
version=1
NetIExt=net
[general]
version=1
[schematic_editor]
version=1
PageLayoutDescrFile=
PlotDirectoryName=
SubpartIdSeparator=0
SubpartFirstId=65
NetFmtName=Pcbnew
SpiceForceRefPrefix=0
SpiceUseNetNumbers=0
LabSize=60
[eeschema]
version=1
LibDir=
[pcbnew]
version=1
PageLayoutDescrFile=
LastNetListRead=Chiller_control.net
CopperLayerCount=2
BoardThickness=1.6
AllowMicroVias=0
AllowBlindVias=0
RequireCourtyardDefinitions=0
ProhibitOverlappingCourtyards=1
MinTrackWidth=0.2
MinViaDiameter=0.4
MinViaDrill=0.3
MinMicroViaDiameter=0.2
MinMicroViaDrill=0.09999999999999999
MinHoleToHole=0.25
TrackWidth1=0.5
TrackWidth2=0.25
TrackWidth3=0.5
TrackWidth4=1
TrackWidth5=2
ViaDiameter1=1.2
ViaDrill1=0.6
ViaDiameter2=1.2
ViaDrill2=0.6
ViaDiameter3=1.5
ViaDrill3=0.8
ViaDiameter4=2.5
ViaDrill4=1
dPairWidth1=0.2
dPairGap1=0.25
dPairViaGap1=0.25
SilkLineWidth=0.15
SilkTextSizeV=1
SilkTextSizeH=1
SilkTextSizeThickness=0.15
SilkTextItalic=0
SilkTextUpright=1
CopperLineWidth=0.2
CopperTextSizeV=1.5
CopperTextSizeH=1.5
CopperTextThickness=0.3
CopperTextItalic=0
CopperTextUpright=1
EdgeCutLineWidth=0.15
CourtyardLineWidth=0.05
OthersLineWidth=0.15
OthersTextSizeV=1
OthersTextSizeH=1
OthersTextSizeThickness=0.15
OthersTextItalic=0
OthersTextUpright=1
SolderMaskClearance=0.2
SolderMaskMinWidth=0.25
SolderPasteClearance=0
SolderPasteRatio=-0
[pcbnew/Netclasses]
[pcbnew/Netclasses/1]
Name=power
Clearance=0.3
TrackWidth=1
ViaDiameter=2.5
ViaDrill=0.8
uViaDiameter=0.3
uViaDrill=0.1
dPairWidth=0.2
dPairGap=0.25
dPairViaGap=0.25
[pcbnew/Netclasses/2]
Name=wide
Clearance=0.5
TrackWidth=2
ViaDiameter=2.5
ViaDrill=0.8
uViaDiameter=0.3
uViaDrill=0.1
dPairWidth=0.2
dPairGap=0.25
dPairViaGap=0.25

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# CH340G
#
DEF CH340G U 0 40 Y Y 1 F N
F0 "U" 25 475 60 H V C CNN
F1 "CH340G" 0 -475 60 H V C CNN
F2 "" 100 -200 60 H V C CNN
F3 "" 100 -200 60 H V C CNN
DRAW
S -250 400 250 -400 0 1 0 N
X GND 1 -450 350 200 R 50 50 1 1 W
X TX 2 -450 250 200 R 50 50 1 1 O
X RX 3 -450 150 200 R 50 50 1 1 I
X V3 4 -450 50 200 R 50 50 1 1 P
X D+ 5 -450 -50 200 R 50 50 1 1 B
X D- 6 -450 -150 200 R 50 50 1 1 B
X XI 7 -450 -250 200 R 50 50 1 1 I
X XO 8 -450 -350 200 R 50 50 1 1 I
X CTS 9 450 -350 200 L 50 50 1 1 O
X DSR 10 450 -250 200 L 50 50 1 1 O
X RI 11 450 -150 200 L 50 50 1 1 O
X DCD 12 450 -50 200 L 50 50 1 1 O
X DTR 13 450 50 200 L 50 50 1 1 O
X RTS 14 450 150 200 L 50 50 1 1 O
X RS232 15 450 250 200 L 50 50 1 1 I
X VCC 16 450 350 200 L 50 50 1 1 W
ENDDRAW
ENDDEF
#
#End Library

View File

@ -0,0 +1,190 @@
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# 74HC4051
#
DEF 74HC4051 U 0 10 Y Y 1 F N
F0 "U" 0 0 50 H V C CNN
F1 "74HC4051" 0 -150 50 H V C CNN
F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
$FPLIST
SO16
TSSOP16
SSOP16
DHVQFN16
$ENDFPLIST
DRAW
S -400 450 400 -450 0 1 0 N
X Y4 1 700 -50 300 L 50 50 1 1 B
X Y6 2 700 -250 300 L 50 50 1 1 B
X Z 3 0 -750 300 U 50 50 1 1 B
X Y7 4 700 -350 300 L 50 50 1 1 B
X Y5 5 700 -150 300 L 50 50 1 1 B
X ~E 6 -700 -350 300 R 50 50 1 1 I I
X VEE 7 -700 0 300 R 50 50 1 1 W
X GND 8 -700 -200 300 R 50 50 1 1 W
X S2 9 -700 150 300 R 50 50 1 1 I
X S1 10 -700 250 300 R 50 50 1 1 I
X S0 11 -700 350 300 R 50 50 1 1 I
X Y3 12 700 50 300 L 50 50 1 1 B
X Y0 13 700 350 300 L 50 50 1 1 B
X Y1 14 700 250 300 L 50 50 1 1 B
X Y2 15 700 150 300 L 50 50 1 1 B
X VCC 16 -700 -100 300 R 50 50 1 1 W
ENDDRAW
ENDDEF
#
# D_Schottky_x2_ACom_AKK
#
DEF D_Schottky_x2_ACom_AKK D 0 30 Y N 1 F N
F0 "D" 50 -100 50 H V C CNN
F1 "D_Schottky_x2_ACom_AKK" 0 100 50 H V C CNN
F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
DRAW
P 2 0 1 0 -140 0 150 0 N
P 2 0 1 0 0 0 0 -100 N
P 3 0 1 8 -150 50 -150 -50 -150 -50 N
P 3 0 1 8 150 50 150 -50 150 -50 N
P 4 0 1 8 -150 50 -170 50 -170 40 -170 40 N
P 4 0 1 8 150 -50 170 -50 170 -40 170 -40 N
P 4 0 1 8 150 50 130 50 130 40 130 40 N
P 5 0 1 8 -130 -40 -130 -50 -150 -50 -150 -50 -150 -50 N
P 6 0 1 8 -50 -50 -150 0 -50 50 -50 -50 -50 -50 -50 -50 N
P 6 0 1 8 50 50 150 0 50 -50 50 50 50 50 50 50 N
X A 1 0 -200 100 U 50 50 0 1 P
X K 2 -300 0 150 R 50 50 0 1 P
X K 3 300 0 150 L 50 50 0 1 P
ENDDRAW
ENDDEF
#
# LM1117-ADJ
#
DEF LM1117-ADJ U 0 30 Y Y 1 F N
F0 "U" 100 -250 50 H V C CNN
F1 "LM1117-ADJ" 0 250 50 H V C CNN
F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
ALIAS LM1117-1.8 LM1117-2.5 LM1117-3.3 LM1117-5.0
$FPLIST
SOT-223*
TO-263*
TO-252*
$ENDFPLIST
DRAW
S -200 -200 200 200 0 1 10 f
X GND/ADJ 1 0 -300 100 U 50 50 1 1 W
X VO 2 300 0 100 L 50 50 1 1 w
X VI 3 -300 0 100 R 50 50 1 1 W
ENDDRAW
ENDDEF
#
# PESD1CAN
#
DEF PESD1CAN D 0 30 Y N 1 F N
F0 "D" 0 -350 50 H V C CNN
F1 "PESD1CAN" 50 150 50 H V C CNN
F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN
$FPLIST
SOT23
$ENDFPLIST
DRAW
S -200 100 300 -300 0 1 0 N
P 2 0 1 0 -140 -200 150 -200 N
P 2 0 1 0 -140 0 150 0 N
P 3 0 1 8 -150 -150 -150 -250 -150 -250 N
P 3 0 1 8 -150 50 -150 -50 -150 -50 N
P 3 0 1 8 150 -150 150 -250 150 -250 N
P 3 0 1 8 150 50 150 -50 150 -50 N
P 4 0 1 8 -150 -150 -170 -150 -170 -160 -170 -160 N
P 4 0 1 8 -150 50 -170 50 -170 40 -170 40 N
P 4 0 1 8 150 -250 170 -250 170 -240 170 -240 N
P 4 0 1 8 150 -150 130 -150 130 -160 130 -160 N
P 4 0 1 8 150 -50 170 -50 170 -40 170 -40 N
P 4 0 1 0 150 0 250 0 250 -200 150 -200 N
P 4 0 1 8 150 50 130 50 130 40 130 40 N
P 5 0 1 8 -130 -240 -130 -250 -150 -250 -150 -250 -150 -250 N
P 5 0 1 8 -130 -40 -130 -50 -150 -50 -150 -50 -150 -50 N
P 6 0 1 8 -50 -250 -150 -200 -50 -150 -50 -250 -50 -250 -50 -250 N
P 6 0 1 8 -50 -50 -150 0 -50 50 -50 -50 -50 -50 -50 -50 N
P 6 0 1 8 50 -150 150 -200 50 -250 50 -150 50 -150 50 -150 N
P 6 0 1 8 50 50 150 0 50 -50 50 50 50 50 50 50 N
X K 1 -300 0 150 R 50 50 0 1 P
X K 2 -300 -200 150 R 50 50 0 1 P
X O 3 400 -100 150 L 50 50 0 1 P
ENDDRAW
ENDDEF
#
# TPS2051
#
DEF TPS2051 U 0 40 Y Y 1 F N
F0 "U" 0 -300 60 H V C CNN
F1 "TPS2051" 0 300 60 H V C CNN
F2 "" 0 0 60 H I C CNN
F3 "" 0 0 60 H I C CNN
DRAW
S -250 250 250 -250 0 1 0 N
X GND 1 -450 150 200 R 50 50 1 1 W
X IN 2 -450 50 200 R 50 50 1 1 W
X IN 3 -450 -50 200 R 50 50 1 1 P
X EN 4 -450 -150 200 R 50 50 1 1 I
X ~OC 5 450 -150 200 L 50 50 1 1 O
X OUT 6 450 -50 200 L 50 50 1 1 P
X OUT 7 450 50 200 L 50 50 1 1 P
X OUT 8 450 150 200 L 50 50 1 1 w
ENDDRAW
ENDDEF
#
# USB6B1
#
DEF USB6B1 D 0 30 Y N 1 F N
F0 "D" 0 -450 50 H V C CNN
F1 "USB6B1" 0 400 50 H V C CNN
F2 "" 200 -100 50 V V C CNN
F3 "" 200 -100 50 V V C CNN
$FPLIST
SO8
$ENDFPLIST
DRAW
C -150 -300 7 0 1 0 N
C -150 100 7 0 1 0 N
C -150 300 7 0 1 0 N
C 0 -300 7 0 1 0 N
C 0 -100 7 0 1 0 N
C 0 300 7 0 1 0 N
C 200 -300 7 0 1 0 N
C 200 300 7 0 1 0 N
S -300 -100 300 -100 0 1 0 N
S -300 300 300 300 0 1 0 N
S -200 -150 -100 -150 0 1 0 N
S -200 250 -100 250 0 1 0 N
S -150 300 -150 -300 0 1 0 N
S -50 -150 50 -150 0 1 0 N
S -50 250 50 250 0 1 0 N
S 0 300 0 -300 0 1 0 N
S 200 300 200 -300 0 1 0 N
S 300 -300 -300 -300 0 1 0 N
S 300 100 -300 100 0 1 0 N
P 3 0 1 8 150 50 250 50 250 50 N
P 4 0 1 8 150 50 150 30 160 30 160 30 N
P 4 0 1 8 250 50 250 70 240 70 240 70 N
P 5 0 1 0 -250 350 300 350 300 -350 -250 -350 -250 350 N
P 6 0 1 8 -200 -250 -150 -150 -100 -250 -200 -250 -200 -250 -200 -250 N
P 6 0 1 8 -200 150 -150 250 -100 150 -200 150 -200 150 -200 150 N
P 6 0 1 8 -50 -250 0 -150 50 -250 -50 -250 -50 -250 -50 -250 N
P 6 0 1 8 -50 150 0 250 50 150 -50 150 -50 150 -50 150 N
P 6 0 1 8 150 -50 200 50 250 -50 150 -50 150 -50 150 -50 N
X VCC 1 -500 300 200 R 50 50 1 1 P
X I/O1 2 -500 100 200 R 50 50 1 1 P
X I/O2 3 -500 -100 200 R 50 50 1 1 P
X GND 4 -500 -300 200 R 50 50 1 1 P
X GND 5 500 -300 200 L 50 50 1 1 P
X I/O2 6 500 -100 200 L 50 50 1 1 P
X I/O1 7 500 100 200 L 50 50 1 1 P
X VCC 8 500 300 200 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
#End Library

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
(fp_lib_table
(lib (name modules)(type KiCad)(uri modules.pretty)(options "")(descr ""))
)

View File

@ -0,0 +1,31 @@
(module DB9-F (layer F.Cu) (tedit 546362FD)
(descr "Connecteur DB9 femelle couche")
(tags "CONN DB9")
(fp_text reference XP** (at -6.3 -5.3) (layer F.SilkS)
(effects (font (thickness 0.3048)))
)
(fp_text value DB9F (at 7.7 -5.1) (layer F.SilkS)
(effects (font (thickness 0.3048)))
)
(fp_line (start -16.129 2.286) (end 16.383 2.286) (layer F.SilkS) (width 0.3048))
(fp_line (start 16.383 2.286) (end 16.383 -9.494) (layer F.SilkS) (width 0.3048))
(fp_line (start 16.383 -9.494) (end -16.129 -9.494) (layer F.SilkS) (width 0.3048))
(fp_line (start -16.129 -9.494) (end -16.129 2.286) (layer F.SilkS) (width 0.3048))
(fp_line (start -9.017 -7.874) (end 9.271 -7.874) (layer F.SilkS) (width 0.3048))
(pad "" thru_hole circle (at 12.827 -1.27) (size 3.81 3.81) (drill 3.048) (layers *.Cu *.Mask F.SilkS))
(pad "" thru_hole circle (at -12.573 -1.27) (size 3.81 3.81) (drill 3.048) (layers *.Cu *.Mask F.SilkS))
(pad 1 thru_hole rect (at -5.461 1.27) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 2 thru_hole circle (at -2.667 1.27) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 3 thru_hole circle (at 0 1.27) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 4 thru_hole circle (at 2.794 1.27) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 5 thru_hole circle (at 5.588 1.27) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 6 thru_hole circle (at -4.064 -1.27) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 7 thru_hole circle (at -1.27 -1.27) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 8 thru_hole circle (at 1.397 -1.27) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 9 thru_hole circle (at 4.191 -1.27) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(model conn_DBxx/db9_female_pin90deg.wrl
(at (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)

View File

@ -0,0 +1,45 @@
(module TO-220-3_Horizontal_TabDown (layer F.Cu) (tedit 5BEBD722)
(descr "TO-220-3, Horizontal, RM 2.54mm, see https://www.vishay.com/docs/66542/to-220-1.pdf")
(tags "TO-220-3 Horizontal RM 2.54mm")
(fp_text reference Q1 (at 2.54 -20.58) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value IRL3303 (at 2.54 2) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_circle (center 2.54 -16.66) (end 4.39 -16.66) (layer F.Fab) (width 0.1))
(fp_line (start -2.46 -13.06) (end -2.46 -19.46) (layer F.Fab) (width 0.1))
(fp_line (start -2.46 -19.46) (end 7.54 -19.46) (layer F.Fab) (width 0.1))
(fp_line (start 7.54 -19.46) (end 7.54 -13.06) (layer F.Fab) (width 0.1))
(fp_line (start 7.54 -13.06) (end -2.46 -13.06) (layer F.Fab) (width 0.1))
(fp_line (start -2.46 -3.81) (end -2.46 -13.06) (layer F.Fab) (width 0.1))
(fp_line (start -2.46 -13.06) (end 7.54 -13.06) (layer F.Fab) (width 0.1))
(fp_line (start 7.54 -13.06) (end 7.54 -3.81) (layer F.Fab) (width 0.1))
(fp_line (start 7.54 -3.81) (end -2.46 -3.81) (layer F.Fab) (width 0.1))
(fp_line (start 0 -3.81) (end 0 0) (layer F.Fab) (width 0.1))
(fp_line (start 2.54 -3.81) (end 2.54 0) (layer F.Fab) (width 0.1))
(fp_line (start 5.08 -3.81) (end 5.08 0) (layer F.Fab) (width 0.1))
(fp_line (start -2.58 -3.69) (end 7.66 -3.69) (layer F.SilkS) (width 0.12))
(fp_line (start -2.58 -19.58) (end 7.66 -19.58) (layer F.SilkS) (width 0.12))
(fp_line (start -2.58 -19.58) (end -2.58 -3.69) (layer F.SilkS) (width 0.12))
(fp_line (start 7.66 -19.58) (end 7.66 -3.69) (layer F.SilkS) (width 0.12))
(fp_line (start 0 -3.69) (end 0 -1.15) (layer F.SilkS) (width 0.12))
(fp_line (start 2.54 -3.69) (end 2.54 -1.15) (layer F.SilkS) (width 0.12))
(fp_line (start 5.08 -3.69) (end 5.08 -1.15) (layer F.SilkS) (width 0.12))
(fp_line (start -2.71 -19.71) (end -2.71 1.25) (layer F.CrtYd) (width 0.05))
(fp_line (start -2.71 1.25) (end 7.79 1.25) (layer F.CrtYd) (width 0.05))
(fp_line (start 7.79 1.25) (end 7.79 -19.71) (layer F.CrtYd) (width 0.05))
(fp_line (start 7.79 -19.71) (end -2.71 -19.71) (layer F.CrtYd) (width 0.05))
(fp_text user %R (at 2.54 -20.58) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(pad 2 thru_hole rect (at 2.54 -16.66) (size 12 7) (drill 3.5) (layers *.Cu *.Mask))
(pad 1 thru_hole rect (at 0 0) (size 1.905 2) (drill 1.1) (layers *.Cu *.Mask))
(pad 2 thru_hole oval (at 2.54 0) (size 1.905 2) (drill 1.1) (layers *.Cu *.Mask))
(pad 3 thru_hole oval (at 5.08 0) (size 1.905 2) (drill 1.1) (layers *.Cu *.Mask))
(model ${KISYS3DMOD}/Package_TO_SOT_THT.3dshapes/TO-220-3_Horizontal_TabDown.wrl
(at (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)

View File

@ -0,0 +1,14 @@
(module hole_3mm (layer F.Cu) (tedit 5BF13739)
(fp_text reference hole_3mm (at 0 -2.54) (layer F.SilkS) hide
(effects (font (size 1.5 1.5) (thickness 0.3)))
)
(fp_text value Val** (at 0 3.175) (layer F.SilkS) hide
(effects (font (size 1.5 1.5) (thickness 0.3)))
)
(fp_line (start 0 2.5) (end 0 1.5) (layer F.SilkS) (width 0.3))
(fp_line (start -2.5 0) (end -1.5 0) (layer F.SilkS) (width 0.3))
(fp_line (start 2.5 0) (end 1.5 0) (layer F.SilkS) (width 0.3))
(fp_line (start 0 -1.5) (end 0 -2.5) (layer F.SilkS) (width 0.3))
(fp_circle (center 0 0) (end 2.5 0) (layer F.SilkS) (width 0.3))
(pad "" np_thru_hole circle (at 0 0) (size 3 3) (drill 1) (layers *.Cu *.Mask))
)

View File

@ -0,0 +1,6 @@
(sym_lib_table
(lib (name Chiller_control-rescue)(type Legacy)(uri ${KIPRJMOD}/Chiller_control-rescue.lib)(options "")(descr ""))
(lib (name Servo_control-rescue)(type Legacy)(uri ${KIPRJMOD}/Servo_control-rescue.lib)(options "")(descr ""))
(lib (name ch34x)(type Legacy)(uri ${KIPRJMOD}/ch34x.lib)(options "")(descr ""))
(lib (name elements)(type Legacy)(uri ${KIPRJMOD}/elements.lib)(options "")(descr ""))
)

63
F0-nolib/Servo/main.c Normal file
View File

@ -0,0 +1,63 @@
/*
* main.c
*
* Copyright 2018 Edward V. Emelianoff <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "adc.h"
#include "hardware.h"
#include "mainloop.h"
#include "protocol.h"
#include "usart.h"
#include <string.h> // memcpy
#include <stm32f0.h>
volatile uint32_t Tms = 0;
// Called when systick fires
void sys_tick_handler(void){
++Tms;
}
int main(void){
char *txt;
hw_setup();
SysTick_Config(6000, 1);
SEND_BLK("Servos controller v0.1\n");
if(RCC->CSR & RCC_CSR_IWDGRSTF){ // watchdog reset occured
SEND_BLK("WDGRESET=1");
}
if(RCC->CSR & RCC_CSR_SFTRSTF){ // software reset occured
SEND_BLK("SOFTRESET=1");
}
RCC->CSR |= RCC_CSR_RMVF; // remove reset flags
while (1){
IWDG->KR = IWDG_REFRESH;
if(usart1_getline(&txt)){ // usart1 received command, process it
txt = process_command(txt);
}else txt = NULL;
if(txt){ // text waits for sending
while(ALL_OK != usart1_send(txt, 0)){
IWDG->KR = IWDG_REFRESH;
}
}
mainloop();
IWDG->KR = IWDG_REFRESH;
usart1_sendbuf();
}
}

29
F0-nolib/Servo/mainloop.c Normal file
View File

@ -0,0 +1,29 @@
/*
* This file is part of the Chiller project.
* Copyright 2019 Edward V. Emelianov <edward.emelianoff@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "adc.h"
#include "hardware.h"
#include "mainloop.h"
/**
* @brief mainloop - the main servos loop
* by timer check current states & change them
*/
void mainloop(){
;
}

21
F0-nolib/Servo/mainloop.h Normal file
View File

@ -0,0 +1,21 @@
/*
* This file is part of the Chiller project.
* Copyright 2019 Edward V. Emelianov <edward.emelianoff@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stm32f0.h>
void mainloop();

99
F0-nolib/Servo/protocol.c Normal file
View File

@ -0,0 +1,99 @@
/*
* This file is part of the Chiller project.
* Copyright 2018 Edward V. Emelianov <edward.emelianoff@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hardware.h"
#include "protocol.h"
#include "usart.h"
#include "adc.h"
#include "mainloop.h"
extern uint8_t crit_error;
#ifdef EBUG
/**
* @brief debugging_proc - debugging functions
* @param command - rest of cmd
*/
static void debugging_proc(const char *command){
const char *ptr = command;
int i;
switch(*ptr++){
case 'w':
usart1_send("Test watchdog", 0);
while(1){nop();}
break;
case 'A': // raw ADC values depending on next symbol
i = *ptr++ - '0';
if(i < 0 || i > NUMBER_OF_ADC_CHANNELS){
usart1_send("Wrong channel nuber!", 0);
return;
}
put_string("ADC value: ");
put_uint(getADCval(i));
put_string(", ");
usart1_sendbuf();
break;
default:
break;
}
}
#endif
/**
* @brief process_command - command parser
* @param command - command text (all inside [] without spaces)
* @return text to send over terminal or NULL
*/
char *process_command(const char *command){
const char *ptr = command;
char *ret = NULL;
usart1_sendbuf(); // send buffer (if it is already filled)
switch(*ptr++){
case '?': // help
SEND_BLK(
"R - reset\n"
"t - get MCU temperature (approx.)\n"
"V - get Vdd"
);
#ifdef EBUG
SEND_BLK("d -> goto debug:\n"
"\tAx - get raw ADCx value\n"
"\tw - test watchdog"
);
#endif
break;
case 'R': // reset MCU
NVIC_SystemReset();
break;
case 't': // get mcu T
put_string("MCUTEMP10=");
put_int(getMCUtemp());
break;
case 'V': // get Vdd
put_string("VDD100=");
put_uint(getVdd());
break;
#ifdef EBUG
case 'd':
debugging_proc(ptr);
return NULL;
break;
#endif
}
usart1_sendbuf();
return ret;
}

24
F0-nolib/Servo/protocol.h Normal file
View File

@ -0,0 +1,24 @@
/*
* This file is part of the Chiller project.
* Copyright 2018 Edward V. Emelianov <edward.emelianoff@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PROTOCOL_C
#define PROTOCOL_C
#include <stm32f0.h>
char *process_command(const char *command);
#endif // PROTOCOL_C

BIN
F0-nolib/Servo/servo.bin Executable file

Binary file not shown.

294
F0-nolib/Servo/usart.c Normal file
View File

@ -0,0 +1,294 @@
/*
* usart.c
*
* Copyright 2018 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "usart.h"
#include <string.h> // memcpy
extern volatile uint32_t Tms;
static int datalen[2] = {0,0}; // received data line length (including '\n')
uint8_t bufovr = 0; // input buffer overfull
static uint8_t linerdy = 0 // received data ready
,dlen = 0 // length of data in current buffer
,txrdy = 1 // transmission done
;
static int rbufno = 0; // current rbuf number
static char rbuf[2][UARTBUFSZ+1], tbuf[UARTBUFSZ]; // receive & transmit buffers
static char *recvdata = NULL;
static char trbuf[UARTBUFSZ+1]; // auxiliary buffer for data transmission
static int trbufidx = 0;
int put_char(char c){
if(trbufidx >= UARTBUFSZ - 1){
if(ALL_OK != usart1_sendbuf()) return 1;
}
trbuf[trbufidx++] = c;
return 0;
}
// write zero-terminated string
int put_string(const char *str){
while(*str){
if(put_char(*str++)) return 1; //error! shouldn't be!!!
}
return 0; // all OK
}
/**
* Fill trbuf with integer value
* @param N - integer value
* @return 1 if buffer overflow; oterwise return 0
*/
int put_int(int32_t N){
if(N < 0){
if(put_char('-')) return 1;
N = -N;
}
return put_uint((uint32_t) N);
}
int put_uint(uint32_t N){
char buf[10];
int L = 0;
if(N){
while(N){
buf[L++] = N % 10 + '0';
N /= 10;
}
while(L--) if(put_char(buf[L])) return 1;
}else if(put_char('0')) return 1;
return 0;
}
/**
* @brief usart1_sendbuf - send temporary transmission buffer (trbuf) over USART
* @return Tx status
*/
TXstatus usart1_sendbuf(){
int len = trbufidx;
trbufidx = 0;
if(len == 0) return ALL_OK;
else if(len > UARTBUFSZ) len = UARTBUFSZ;
return usart1_send(trbuf, len);
}
void USART1_config(){
/* Enable the peripheral clock of GPIOA */
RCC->AHBENR |= RCC_AHBENR_GPIOAEN;
/* GPIO configuration for USART1 signals */
/* (1) Select AF mode (10) on PA9 and PA10 */
/* (2) AF1 for USART1 signals */
GPIOA->MODER = (GPIOA->MODER & ~(GPIO_MODER_MODER9|GPIO_MODER_MODER10))\
| (GPIO_MODER_MODER9_1 | GPIO_MODER_MODER10_1); /* (1) */
GPIOA->AFR[1] = (GPIOA->AFR[1] &~ (GPIO_AFRH_AFRH1 | GPIO_AFRH_AFRH2))\
| (1 << (1 * 4)) | (1 << (2 * 4)); /* (2) */
/* Enable the peripheral clock USART1 */
RCC->APB2ENR |= RCC_APB2ENR_USART1EN;
/* Configure USART1 */
/* (1) oversampling by 16, 115200 baud */
/* (2) 8 data bit, 1 start bit, 1 stop bit, no parity */
USART1->BRR = 480000 / 1152; /* (1) */
USART1->CR1 = USART_CR1_TE | USART_CR1_RE | USART_CR1_UE; /* (2) */
/* polling idle frame Transmission */
while(!(USART1->ISR & USART_ISR_TC)){}
USART1->ICR |= USART_ICR_TCCF; /* clear TC flag */
USART1->CR1 |= USART_CR1_RXNEIE; /* enable TC, TXE & RXNE interrupt */
RCC->AHBENR |= RCC_AHBENR_DMA1EN;
DMA1_Channel2->CPAR = (uint32_t) &(USART1->TDR); // periph
DMA1_Channel2->CMAR = (uint32_t) tbuf; // mem
DMA1_Channel2->CCR |= DMA_CCR_MINC | DMA_CCR_DIR | DMA_CCR_TCIE; // 8bit, mem++, mem->per, transcompl irq
USART1->CR3 = USART_CR3_DMAT;
NVIC_SetPriority(DMA1_Channel2_3_IRQn, 3);
NVIC_EnableIRQ(DMA1_Channel2_3_IRQn);
/* Configure IT */
/* (3) Set priority for USART1_IRQn */
/* (4) Enable USART1_IRQn */
NVIC_SetPriority(USART1_IRQn, 0); /* (3) */
NVIC_EnableIRQ(USART1_IRQn); /* (4) */
}
void usart1_isr(){
static uint8_t timeout = 1 // == 0 for human interface without timeout
,nctr = 0 // counter of '#' received
,incmd = 0 // ==1 - inside command
;
static uint32_t tmout = 0;
if(USART1->ISR & USART_ISR_RXNE){ // RX not emty - receive next char
// read RDR clears flag
uint8_t rb = USART1->RDR;
if(timeout && rb == '#'){ // chek '#' without timeout
if(++nctr == 4){ // "####" received - turn off timeout
timeout = 0;
nctr = 0;
datalen[rbufno] = 0; // reset all incoming data
incmd = 0;
return;
}
}else nctr = 0;
if(!incmd){
if(rb == '['){ // open command or reset previoud input
datalen[rbufno] = 0;
incmd = 1;
}
return;
}
if(timeout){ // check timeout only inside commands
if(tmout && Tms >= tmout){ // set overflow flag
bufovr = 1;
datalen[rbufno] = 0;
}else{
tmout = Tms + TIMEOUT_MS;
if(!tmout) tmout = 1; // prevent 0
}
}
switch(rb){
case '[':
datalen[rbufno] = 0;
tmout = 0;
break;
case ']': // close command - line ready!
dlen = datalen[rbufno];
if(dlen){
linerdy = 1;
incmd = 0;
recvdata = rbuf[rbufno];
rbuf[rbufno][dlen] = 0;
rbufno = !rbufno;
datalen[rbufno] = 0;
}
tmout = 0;
break;
case '\r':
case '\n':
case ' ':
case '\t':
return;
break;
default:
break;
}
if(datalen[rbufno] < UARTBUFSZ){ // put next char into buf
rbuf[rbufno][datalen[rbufno]++] = rb;
}else{ // buffer overrun
bufovr = 1;
datalen[rbufno] = 0;
incmd = 0;
tmout = 0;
}
}
}
void dma1_channel2_3_isr(){
if(DMA1->ISR & DMA_ISR_TCIF2){ // Tx
DMA1->IFCR |= DMA_IFCR_CTCIF2; // clear TC flag
txrdy = 1;
}
}
/**
* return length of received data (without trailing zero)
*/
int usart1_getline(char **line){
if(!linerdy) return 0;
linerdy = 0;
if(bufovr){
bufovr = 0;
return 0;
}
*line = recvdata;
return dlen;
}
/**
* @brief usart1_send send buffer `str` adding trailing '\n'
* @param str - string to send (without '\n' at end)
* @param len - its length or 0 to auto count
* @return
*/
TXstatus usart1_send(const char *str, int len){
if(!txrdy) return LINE_BUSY;
if(len > UARTBUFSZ - 1) return STR_TOO_LONG;
txrdy = 0;
if(len == 0){
const char *ptr = str;
while(*ptr++) ++len;
}
if(len == 0) return ALL_OK;
DMA1_Channel2->CCR &= ~DMA_CCR_EN;
memcpy(tbuf, str, len);
tbuf[len++] = '\n';
DMA1_Channel2->CNDTR = len;
DMA1_Channel2->CCR |= DMA_CCR_EN; // start transmission
return ALL_OK;
}
TXstatus usart1_send_blocking(const char *str, int len){
if(!txrdy) return LINE_BUSY;
if(len == 0){
const char *ptr = str;
while(*ptr++) ++len;
}
if(len == 0) return ALL_OK;
for(int i = 0; i < len; ++i){
USART1->TDR = *str++;
while(!(USART1->ISR & USART_ISR_TXE));
}
USART1->TDR = '\n';
while(!(USART1->ISR & USART_ISR_TC));
txrdy = 1;
return ALL_OK;
}
// read `buf` and get first integer `N` in it
// @return pointer to first non-number if all OK or NULL if first symbol isn't a space or number
char *getnum(const char *buf, int32_t *N){
char c;
int positive = -1;
int32_t val = 0;
//usart1_send_blocking(buf, 0);
while((c = *buf++)){
if(c == '\t' || c == ' '){
if(positive < 0) continue; // beginning spaces
else break; // spaces after number
}
if(c == '-'){
if(positive < 0){
positive = 0;
continue;
}else break; // there already was `-` or number
}
if(c < '0' || c > '9') break;
if(positive < 0) positive = 1;
val = val * 10 + (int32_t)(c - '0');
}
if(positive != -1){
if(positive == 0){
if(val == 0) return NULL; // single '-'
val = -val;
}
*N = val;
}else return NULL;
/* usart1_sendbuf();
put_uint(val);
put_char('\n');*/
return (char*)buf-1;
}

59
F0-nolib/Servo/usart.h Normal file
View File

@ -0,0 +1,59 @@
/*
* usart.h
*
* Copyright 2018 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#pragma once
#ifndef __USART_H__
#define __USART_H__
#include "stm32f0.h"
// input and output buffers size
#define UARTBUFSZ (64)
// timeout between data bytes
#define TIMEOUT_MS (100)
typedef enum{
ALL_OK,
LINE_BUSY,
STR_TOO_LONG
} TXstatus;
#define usart1ovr() (bufovr)
// send constant string
#define SEND_BLK(x) do{while(LINE_BUSY == usart1_send_blocking(x, sizeof(x)-1));}while(0)
#define SEND(x) do{while(LINE_BUSY == usart1_send(x, sizeof(x)-1));}while(0)
extern uint8_t bufovr;
void USART1_config();
int usart1_getline(char **line);
TXstatus usart1_send(const char *str, int len);
TXstatus usart1_send_blocking(const char *str, int len);
TXstatus usart1_sendbuf();
int put_char(char c);
int put_string(const char *str);
int put_int(int32_t N);
int put_uint(uint32_t N);
char *getnum(const char *buf, int32_t *N);
#endif // __USART_H__

View File

@ -0,0 +1 @@
0

View File

@ -1,4 +1,4 @@
update=Ср 30 янв 2019 22:57:36
update=Вс 10 мар 2019 23:57:48
version=1
last_client=kicad
[pcbnew]

View File

@ -105,19 +105,19 @@ TRUE_INLINE void sysreset(void){
/* Wait till PLL is used as system clock source */
while ((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_PLL){}
}
/* wrong
TRUE_INLINE void StartHSE(){
// disable PLL
RCC->CR &= ~RCC_CR_PLLON;
RCC->CR |= RCC_CR_HSEON;
while ((RCC->CIR & RCC_CIR_HSERDYF) != 0);
while ((RCC->CIR & RCC_CIR_HSERDYF) == 0);
RCC->CIR |= RCC_CIR_HSERDYC; // clear rdy flag
/* PLL configuration = (HSE) * 12 = ~48 MHz */
// PLL configuration = (HSE) * 12 = ~48 MHz
RCC->CFGR &= ~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLMUL);
RCC->CFGR |= RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR_PLLMUL12;
RCC->CR |= RCC_CR_PLLON;
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)RCC_CFGR_SWS_PLL){}
}
} */
#if !defined (STM32F030x4) && !defined (STM32F030x6) && !defined (STM32F030x8) && !defined (STM32F031x6) && !defined (STM32F038xx) && !defined (STM32F030xC)
TRUE_INLINE void StartHSI48(){