mirror of
https://github.com/eddyem/STM8_samples.git
synced 2026-03-21 09:11:02 +03:00
copy
This commit is contained in:
39
stepper/Makefile
Normal file
39
stepper/Makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
NAME=testproj
|
||||
SDCC=sdcc
|
||||
HEX2BIN=hex2bin
|
||||
|
||||
CCFLAGS=-DSTM8S105 -I../ -I/usr/share/sdcc/include -mstm8 --out-fmt-ihx
|
||||
LDFLAGS= -mstm8 --out-fmt-ihx -lstm8
|
||||
FLASHFLAGS=-cstlinkv2 -pstm8s105
|
||||
|
||||
SRC=$(wildcard *.c)
|
||||
# ATTENTION: FIRST in list should be file with main()
|
||||
OBJ=$(SRC:%.c=%.rel)
|
||||
TRASH=$(OBJ) $(SRC:%.c=%.rst) $(SRC:%.c=%.asm) $(SRC:%.c=%.lst)
|
||||
TRASH+=$(SRC:%.c=%.sym) $(NAME).ihx $(NAME).lk $(NAME).map
|
||||
INDEPENDENT_HEADERS=../stm8l.h Makefile
|
||||
|
||||
all: $(NAME).bin
|
||||
|
||||
$(SRC) : %.c : %.h $(INDEPENDENT_HEADERS)
|
||||
@touch $@
|
||||
@echo $@
|
||||
|
||||
%.h: ;
|
||||
|
||||
clean:
|
||||
rm -f $(TRASH)
|
||||
|
||||
load: $(NAME).bin
|
||||
stm8flash $(FLASHFLAGS) -wf $(NAME).bin
|
||||
|
||||
%.rel: %.c
|
||||
$(SDCC) $(CCFLAGS) -c $<
|
||||
|
||||
$(NAME).ihx: $(OBJ)
|
||||
$(SDCC) $(LDFLAGS) $(OBJ) -o $(NAME).ihx
|
||||
|
||||
$(NAME).bin: $(NAME).ihx
|
||||
$(HEX2BIN) -p 00 $<
|
||||
|
||||
.PHONY: all
|
||||
22
stepper/client-term/Makefile
Normal file
22
stepper/client-term/Makefile
Normal file
@@ -0,0 +1,22 @@
|
||||
PROGRAM = client
|
||||
LDFLAGS =
|
||||
SRCS = client.c
|
||||
CC = gcc
|
||||
DEFINES = -D_XOPEN_SOURCE=501
|
||||
CXX = gcc
|
||||
CFLAGS = -Wall -Werror $(DEFINES)
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
all : $(PROGRAM) clean
|
||||
$(PROGRAM) : $(OBJS)
|
||||
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(PROGRAM)
|
||||
|
||||
# some addition dependencies
|
||||
# %.o: %.c
|
||||
# $(CC) $(LDFLAGS) $(CFLAGS) $< -o $@
|
||||
#$(SRCS) : %.c : %.h $(INDEPENDENT_HEADERS)
|
||||
# @touch $@
|
||||
|
||||
clean:
|
||||
/bin/rm -f *.o *~
|
||||
depend:
|
||||
$(CXX) -MM $(CXX.SRCS)
|
||||
222
stepper/client-term/client.c
Normal file
222
stepper/client-term/client.c
Normal file
@@ -0,0 +1,222 @@
|
||||
/*
|
||||
* client.c - simple terminal client
|
||||
*
|
||||
* Copyright 2013 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 <termios.h> // tcsetattr
|
||||
#include <unistd.h> // tcsetattr, close, read, write
|
||||
#include <sys/ioctl.h> // ioctl
|
||||
#include <stdio.h> // printf, getchar, fopen, perror
|
||||
#include <stdlib.h> // exit
|
||||
#include <sys/stat.h> // read
|
||||
#include <fcntl.h> // read
|
||||
#include <signal.h> // signal
|
||||
#include <time.h> // time
|
||||
#include <string.h> // memcpy
|
||||
#include <stdint.h> // int types
|
||||
#include <sys/time.h> // gettimeofday
|
||||
|
||||
double t0; // start time
|
||||
|
||||
FILE *fout = NULL; // file for messages duplicating
|
||||
char *comdev = "/dev/ttyUSB0";
|
||||
int BAUD_RATE = B57600;
|
||||
struct termio oldtty, tty; // TTY flags
|
||||
struct termios oldt, newt; // terminal flags
|
||||
int comfd; // TTY fd
|
||||
|
||||
/**
|
||||
* function for different purposes that need to know time intervals
|
||||
* @return double value: time in seconds
|
||||
*/
|
||||
double dtime(){
|
||||
double t;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
t = tv.tv_sec + ((double)tv.tv_usec)/1e6;
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit & return terminal to old state
|
||||
* @param ex_stat - status (return code)
|
||||
*/
|
||||
void quit(int ex_stat){
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &oldt); // return terminal to previous state
|
||||
ioctl(comfd, TCSANOW, &oldtty ); // return TTY to previous state
|
||||
close(comfd);
|
||||
if(fout) fclose(fout);
|
||||
printf("Exit! (%d)\n", ex_stat);
|
||||
exit(ex_stat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open & setup TTY, terminal
|
||||
*/
|
||||
void tty_init(){
|
||||
// terminal without echo
|
||||
tcgetattr(STDIN_FILENO, &oldt);
|
||||
newt = oldt;
|
||||
newt.c_lflag &= ~(ICANON | ECHO);
|
||||
if(tcsetattr(STDIN_FILENO, TCSANOW, &newt) < 0) quit(-2);
|
||||
printf("\nOpen port...\n");
|
||||
if ((comfd = open(comdev,O_RDWR|O_NOCTTY|O_NONBLOCK)) < 0){
|
||||
fprintf(stderr,"Can't use port %s\n",comdev);
|
||||
quit(1);
|
||||
}
|
||||
printf(" OK\nGet current settings...\n");
|
||||
if(ioctl(comfd,TCGETA,&oldtty) < 0) exit(-1); // Get settings
|
||||
tty = oldtty;
|
||||
tty.c_lflag = 0; // ~(ICANON | ECHO | ECHOE | ISIG)
|
||||
tty.c_oflag = 0;
|
||||
tty.c_cflag = BAUD_RATE|CS8|CREAD|CLOCAL; // 9.6k, 8N1, RW, ignore line ctrl
|
||||
tty.c_cc[VMIN] = 0; // non-canonical mode
|
||||
tty.c_cc[VTIME] = 5;
|
||||
if(ioctl(comfd,TCSETA,&tty) < 0) exit(-1); // set new mode
|
||||
printf(" OK\n");
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read character from console without echo
|
||||
* @return char readed
|
||||
*/
|
||||
int read_console(){
|
||||
int rb;
|
||||
struct timeval tv;
|
||||
int retval;
|
||||
fd_set rfds;
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(STDIN_FILENO, &rfds);
|
||||
tv.tv_sec = 0; tv.tv_usec = 10000;
|
||||
retval = select(1, &rfds, NULL, NULL, &tv);
|
||||
if(!retval) rb = 0;
|
||||
else {
|
||||
if(FD_ISSET(STDIN_FILENO, &rfds)) rb = getchar();
|
||||
else rb = 0;
|
||||
}
|
||||
return rb;
|
||||
}
|
||||
|
||||
/**
|
||||
* getchar() without echo
|
||||
* wait until at least one character pressed
|
||||
* @return character readed
|
||||
*/
|
||||
int mygetchar(){ // аналог getchar() без необходимости жать Enter
|
||||
int ret;
|
||||
do ret = read_console();
|
||||
while(ret == 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read data from TTY
|
||||
* @param buff (o) - buffer for data read
|
||||
* @param length - buffer len
|
||||
* @return amount of readed bytes
|
||||
*/
|
||||
size_t read_tty(uint8_t *buff, size_t length){
|
||||
ssize_t L = 0;
|
||||
fd_set rfds;
|
||||
struct timeval tv;
|
||||
int retval;
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(comfd, &rfds);
|
||||
tv.tv_sec = 0; tv.tv_usec = 10000; // wait for 10ms
|
||||
retval = select(comfd + 1, &rfds, NULL, NULL, &tv);
|
||||
if (!retval) return 0;
|
||||
if(FD_ISSET(comfd, &rfds)){
|
||||
if((L = read(comfd, buff, length)) < 1) return 0;
|
||||
}
|
||||
return (size_t)L;
|
||||
}
|
||||
|
||||
void help(){
|
||||
printf("Use this commands:\n"
|
||||
"h\tShow this help\n"
|
||||
"q\tQuit\n"
|
||||
);
|
||||
}
|
||||
|
||||
#define dup_pr(...) do{printf(__VA_ARGS__); if(fout) fprintf(fout, __VA_ARGS__);}while(0)
|
||||
|
||||
void con_sig(int rb){
|
||||
uint8_t cmd;
|
||||
if(rb < 1) return;
|
||||
if(rb == 'q') quit(0); // q == exit
|
||||
cmd = (uint8_t) rb;
|
||||
write(comfd, &cmd, 1);
|
||||
/*switch(rb){
|
||||
case 'h':
|
||||
help();
|
||||
break;
|
||||
default:
|
||||
cmd = (uint8_t) rb;
|
||||
write(comfd, &cmd, 1);
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Get integer value from buffer
|
||||
* @param buff (i) - buffer with int
|
||||
* @param len - length of data in buffer (could be 2 or 4)
|
||||
* @return
|
||||
*/
|
||||
uint32_t get_int(uint8_t *buff, size_t len){
|
||||
if(len != 2 && len != 4){
|
||||
fprintf(stdout, "Bad data length!\n");
|
||||
return 0xffffffff;
|
||||
}
|
||||
uint32_t data = 0;
|
||||
uint8_t *i8 = (uint8_t*) &data;
|
||||
if(len == 2) memcpy(i8, buff, 2);
|
||||
else memcpy(i8, buff, 4);
|
||||
return data;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
int rb;
|
||||
uint8_t buff[128];
|
||||
size_t L;
|
||||
if(argc == 2){
|
||||
fout = fopen(argv[1], "a");
|
||||
if(!fout){
|
||||
perror("Can't open output file");
|
||||
exit(-1);
|
||||
}
|
||||
setbuf(fout, NULL);
|
||||
}
|
||||
tty_init();
|
||||
signal(SIGTERM, quit); // kill (-15)
|
||||
signal(SIGINT, quit); // ctrl+C
|
||||
signal(SIGQUIT, SIG_IGN); // ctrl+\ .
|
||||
signal(SIGTSTP, SIG_IGN); // ctrl+Z
|
||||
setbuf(stdout, NULL);
|
||||
t0 = dtime();
|
||||
while(1){
|
||||
rb = read_console();
|
||||
if(rb > 0) con_sig(rb);
|
||||
L = read_tty(buff, 127);
|
||||
if(L){
|
||||
buff[L] = 0;
|
||||
printf("%s", buff);
|
||||
if(fout) fprintf(fout, "%zd\t%s\n", time(NULL), buff);
|
||||
}
|
||||
}
|
||||
}
|
||||
169
stepper/interrupts.c
Normal file
169
stepper/interrupts.c
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* interrupts.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "ports_definition.h"
|
||||
#include "main.h"
|
||||
#include "stepper.h"
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_HANDLER(TLI_IRQHandler, 0){}
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_HANDLER(AWU_IRQHandler, 1){}
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_HANDLER(CLK_IRQHandler, 2){}
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3){}
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4){}
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5){}
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6){
|
||||
}
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8){}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8){}
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9){}
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_HANDLER(SPI_IRQHandler, 10){}
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){
|
||||
if(TIM1_SR1 & TIM_SR1_UIF){ // update interrupt
|
||||
Global_time++; // increase timer
|
||||
}
|
||||
TIM1_SR1 = 0; // clear all interrupt flags
|
||||
}
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13){}
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14){}
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13){ // generate pulses for stepper CLK
|
||||
if(TIM2_SR1 & TIM_SR1_UIF){
|
||||
TIM2_SR1 &= ~TIM_SR1_UIF;
|
||||
if(--Nsteps == 0){
|
||||
stop_motor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14){
|
||||
}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15){}
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16){}
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17){}
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18){}
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_HANDLER(I2C_IRQHandler, 19){}
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20){}
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21){
|
||||
U8 rb;
|
||||
if(UART2_SR & UART_SR_RXNE){ // data received
|
||||
rb = UART2_DR; // read received byte & clear RXNE flag
|
||||
while(!(UART2_SR & UART_SR_TXE));
|
||||
UART2_DR = rb; // echo received symbol
|
||||
UART_rx[UART_rx_cur_i++] = rb; // put received byte into cycled buffer
|
||||
if(UART_rx_cur_i == UART_rx_start_i){ // Oops: buffer overflow! Just forget old data
|
||||
UART_rx_start_i++;
|
||||
check_UART_pointer(UART_rx_start_i);
|
||||
}
|
||||
check_UART_pointer(UART_rx_cur_i);
|
||||
}
|
||||
}
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20){}
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21){}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_HANDLER(ADC2_IRQHandler, 22){}
|
||||
#else
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_HANDLER(ADC1_IRQHandler, 22){
|
||||
}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23){}
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23){}
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24){}
|
||||
144
stepper/interrupts.h
Normal file
144
stepper/interrupts.h
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* interrupts.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __INTERRUPTS_H__
|
||||
#define __INTERRUPTS_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_DEFINITION(TLI_IRQHandler, 0);
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_DEFINITION(AWU_IRQHandler, 1);
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_DEFINITION(CLK_IRQHandler, 2);
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_DEFINITION(EXTI_PORTA_IRQHandler, 3);
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_DEFINITION(EXTI_PORTB_IRQHandler, 4);
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_DEFINITION(EXTI_PORTC_IRQHandler, 5);
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_DEFINITION(EXTI_PORTD_IRQHandler, 6);
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_DEFINITION(EXTI_PORTE_IRQHandler, 7);
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_DEFINITION(EXTI_PORTF_IRQHandler, 8);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_RX_IRQHandler, 8);
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_TX_IRQHandler, 9);
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_DEFINITION(SPI_IRQHandler, 10);
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11);
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_DEFINITION(TIM1_CAP_COM_IRQHandler, 12);
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13);
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_CAP_COM_IRQHandler, 14);
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_UPD_OVF_BRK_IRQHandler, 13);
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_CAP_COM_IRQHandler, 14);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_UPD_OVF_BRK_IRQHandler, 15);
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_CAP_COM_IRQHandler, 16);
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_TX_IRQHandler, 17);
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_RX_IRQHandler, 18);
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_DEFINITION(I2C_IRQHandler, 19);
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_TX_IRQHandler, 20);
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_RX_IRQHandler, 21);
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_TX_IRQHandler, 20);
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_RX_IRQHandler, 21);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_DEFINITION(ADC2_IRQHandler, 22);
|
||||
#else // STM8S105, STM8S103 or STM8S903 or STM8AF626x
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_DEFINITION(ADC1_IRQHandler, 22);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM6_UPD_OVF_TRG_IRQHandler, 23);
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_DEFINITION(TIM4_UPD_OVF_IRQHandler, 23);
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_DEFINITION(EEPROM_EEC_IRQHandler, 24);
|
||||
|
||||
#endif // __INTERRUPTS_H__
|
||||
396
stepper/main.c
Normal file
396
stepper/main.c
Normal file
@@ -0,0 +1,396 @@
|
||||
/*
|
||||
* blinky.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "ports_definition.h"
|
||||
#include "interrupts.h"
|
||||
#include "main.h"
|
||||
#include "stepper.h"
|
||||
|
||||
/*
|
||||
* 0 0000
|
||||
* 1 0001
|
||||
* 2 0010
|
||||
* 3 0011
|
||||
* 4 0100
|
||||
* 5 0101
|
||||
* 6 0110
|
||||
* 7 0111
|
||||
* 8 1000
|
||||
* 9 1001
|
||||
* a 1010
|
||||
* b 1011
|
||||
* c 1100
|
||||
* d 1101
|
||||
* e 1110
|
||||
* f 1111
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* Internal timer (HSI) ********************
|
||||
* on startup: HSI = 2MHz (16/8)
|
||||
* HSI divisor: CLK_CKDIVR: bits 4,3: f_{HSI}/2^x; bits2..0: f_{CPU}=f/2^x (page 93)
|
||||
* CLK_PCKENR1/2 - enable periph clocking (page 94,95) reset value: all enabled
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* Timer1 ********************
|
||||
* prescaler: TIM1_PSCRH/L, f = f_{in}/(TIM1_PSCR + 1)
|
||||
* other registers:
|
||||
* TIM1_CR1 (page 185): | ARPE | CMS[1:0] | DIR | OPM | URS | UDIS | CEN |
|
||||
* ARPE - Auto-reload preload enable (for TIM1_ARR)
|
||||
* CMS[1:0]: Center-aligned mode selection (0 - simple counter up/down)
|
||||
* DIR: Direction (0 - up, 1 - down)
|
||||
* OPM: One-pulse mode (1 - opm enabled)
|
||||
* URS: Update request source (When enabled by the UDIS bit, 1 - interrupt only on counter overflow/underflow)
|
||||
* UDIS: Update disable (1 - disable update int)
|
||||
* CEN: Counter enable (1 - enable)
|
||||
* TIM1_CR2 (page 187): | - | MMS [2:0] | - | COMS | - | CCPS |
|
||||
* MMS[2:0]: Master mode selection (for ADC or other timers)
|
||||
* COMS: Capture/compare control update selection
|
||||
* CCPC: Capture/compare preloaded control
|
||||
* TIM1_IER (page 191): | BIE | TIE | COMIE | CC4IE | CC3IE | CC2IE | CC1IE | UIE |
|
||||
* B - break; T - trigger; COM - commutation; CC - comp/capt; U - update <--
|
||||
* TIM1_SR1 (page 192): similar (but instead of IE -> IF)
|
||||
* interrupt flags
|
||||
* TIM1_CNTRH, TIM1_CNTRL - counter value (automatical)
|
||||
* TIM1_PSCRH, TIM1_PSCRL - prescaler value
|
||||
* TIM1_ARRH, TIM1_ARRL - auto-reload value (while zero, timer is stopped) (page 206)
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* External interrupts (page 69) ********************
|
||||
* EXTI_CR1: | PDIS[1:0] | PCIS[1:0] | PBIS[1:0] | PAIS[1:0] |
|
||||
* per-port sensivity bits:
|
||||
* 00: Falling edge and low level
|
||||
* 01: Rising edge only
|
||||
* 10: Falling edge only
|
||||
* 11: Rising and falling edge
|
||||
* EXTI_CR2: | -reserved[7:3]- | TLIS | PEIS[1:0] |
|
||||
* TLIS: Top level interrupt sensitivity (0: Falling edge, 1 - Rising)
|
||||
* PEIS[1:0]: Port E external interrupt sensitivity bits
|
||||
* after config run enableInterrupts()
|
||||
* ports:
|
||||
* 5 lines on Port A: PA[6:2]
|
||||
* 8 lines on Port B: PB[7:0]
|
||||
* 8 lines on Port C: PC[7:0]
|
||||
* 7 lines on Port D: PD[6:0]
|
||||
* 8 lines on Port E: PE[7:0]
|
||||
* PD7 is the Top Level Interrupt source (TLI), except for 20-pin packages
|
||||
* on which the Top Level Interrupt source (TLI) can be available on the
|
||||
* PC3 pin using an alternate function remapping option bit
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* GPIO (page 111) ********************
|
||||
* Px_ODR - Output data register bits
|
||||
* Px_IDR - Pin input values
|
||||
* Px_DDR - Data direction bits (1 - output)
|
||||
* Px_CR1 - DDR=0: 0 - floating, 1 - pull-up input; DDR=1: 0 - pseudo-open-drain, 1 - push-pull output [not for "T"]
|
||||
* Px_CR2 - DDR=0: 0/1 - EXTI disabled/enabled; DDR=1: 0/1 - 2/10MHz
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* UART ********************
|
||||
* ALGO:
|
||||
* 1. Program the M bit in UART_CR1 to define the word length [M=0, PCEN=0 - 8bit without parity]
|
||||
* 2. Program the number of stop bits in UART_CR3
|
||||
* 3. Select the desired baud rate (UART_BRR1/2) [57600 on 16MHz: BRR1=0x11, BRR2=0x06]
|
||||
* 4. Set the TEN bit in UART_CR2 to enable transmitter mode
|
||||
* 5. Write the data to send in the UART_DR register (this clears the TXE bit)
|
||||
* 6. Once the last data is written to the UART_DR register, wait until TC is set to ‘1’, which indicates that the last data transmission is complete
|
||||
* baud rate: regs UART_BRR1/2 !!!VERY STUPID!!!
|
||||
* f_{UART} = f_{master} / UART_DIV
|
||||
* if UART_DIV = 0xABCD then
|
||||
* UART_BRR1 = UART_DIV[11:4] = 0xBC;
|
||||
* UART_BRR2 = UART_DIV[15:12|3:0] = 0xAD
|
||||
* registers
|
||||
* UART_SR: | TXE | TC | RXNE | IDLE | OR/LHE | NF | FE | PE |
|
||||
* TXE: Transmit data register empty
|
||||
* TC: Transmission complete
|
||||
* RXNE: Read data register not empty
|
||||
* IDLE: IDLE line detected
|
||||
* OR: Overrun error / LHE: LIN Header Error (LIN slave mode)
|
||||
* NF: Noise flag
|
||||
* FE: Framing error
|
||||
* PE: Parity error
|
||||
* UART_DR: data register (when readed returns coming byte, when writed fills output shift register)
|
||||
* UART_BRR1 / UART_BRR2 - see upper
|
||||
* UART_CR1: | R8 | T8 | UARTD | M | WAKE | PCEN | PS | PIEN |
|
||||
* R8, T8 - ninth bit (in 9-bit mode)
|
||||
* UARTD: UART Disable (for low power consumption)
|
||||
* M: word length (0 - 8bits, 1 - 9bits)
|
||||
* WAKE: Wakeup method
|
||||
* PCEN: Parity control enable
|
||||
* PS: Parity selection (0 - even)
|
||||
* PIEN: Parity interrupt enable
|
||||
* UART_CR2: | TIEN | TCEN | RIEN | ILIEN | TEN | REN | RWU | SBK |
|
||||
* TIEN: Transmitter interrupt enable
|
||||
* TCIEN: Transmission complete interrupt enable
|
||||
* RIEN: Receiver interrupt enable
|
||||
* ILIEN: IDLE Line interrupt enable
|
||||
* TEN: Transmitter enable <----------------------------------------
|
||||
* REN: Receiver enable <----------------------------------------
|
||||
* RWU: Receiver wakeup
|
||||
* SBK: Send break
|
||||
* UART_CR3: | - | LINEN | STOP[1:0] | CLCEN | CPOL | CPHA | LBCL |
|
||||
* LINEN: LIN mode enable
|
||||
* STOP: STOP bits
|
||||
* CLKEN: Clock enable (CLC pin)
|
||||
* CPOL: Clock polarity
|
||||
* CPHA: Clock phase
|
||||
* LBCL: Last bit clock pulse
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* ADC (page 413) ********************
|
||||
* ADC_DBxRH / ADC_DRH: 9:2 data bits in left-aligned or 9:8 bits in right-aligned mode
|
||||
* ADC_DBxRL / ADC_DRL: 1:0 data bits in left-aligned or 7:0 bits in right-aligned mode
|
||||
* ADC_CSR: | EOC | AWD | EOCIE | AWDIE | CH[3:0] |
|
||||
* EOC: End of conversion
|
||||
* AWD: Analog Watchdog flag
|
||||
* EOCIE: Interrupt enable for EOC
|
||||
* AWDIE: Analog watchdog interrupt enable
|
||||
* CH[3:0]: Channel selection bits (0..15)
|
||||
* ADC_CR1: | - | SPSEL[2:0] | - | - | CONT | ADON |
|
||||
* SPSEL[2:0]: Prescaler selection
|
||||
* CONT: Continuous conversion (0 for single)
|
||||
* ADON: A/D Converter on/off <----------------------------------------
|
||||
* ADC_CR2: | - | EXTTRIG | EXTSEL[1:0] | ALIGN | - | SCAN | - |
|
||||
* EXTTRIG: External trigger enable
|
||||
* EXTSEL[1:0]: External event selection
|
||||
* ALIGN: Data alignment (1 - right alignment, first read ADC_DRL)
|
||||
* SCAN: Scan mode enable
|
||||
* ADC_CR3: | DBUF | OVR | reserved[5:0] |
|
||||
* DBUF: Data buffer enable (on buffered mode data stored not in ADC_DBhl but in ADC_DBxRhl)
|
||||
* OVR: Overrun flag
|
||||
* ADC_TDRH/L - trigger shmidt disable (1 - disable)
|
||||
*/
|
||||
|
||||
unsigned long Global_time = 0L; // global time in ms
|
||||
U16 paused_val = 500; // interval between LED flashing
|
||||
|
||||
U8 UART_rx[UART_BUF_LEN]; // cycle buffer for received data
|
||||
U8 UART_rx_start_i = 0; // started index of received data (from which reading starts)
|
||||
U8 UART_rx_cur_i = 0; // index of current first byte in rx array (to which data will be written)
|
||||
|
||||
/**
|
||||
* Send one byte through UART
|
||||
* @param byte - data to send
|
||||
*/
|
||||
void UART_send_byte(U8 byte){
|
||||
while(!(UART2_SR & UART_SR_TXE)); // wait until previous byte transmitted
|
||||
UART2_DR = byte;
|
||||
}
|
||||
|
||||
void uart_write(char *str){
|
||||
while(*str){
|
||||
while(!(UART2_SR & UART_SR_TXE));
|
||||
UART2_CR2 |= UART_CR2_TEN;
|
||||
UART2_DR = *str++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read one byte from Rx buffer
|
||||
* @param byte - where to store readed data
|
||||
* @return 1 in case of non-empty buffer
|
||||
*/
|
||||
U8 UART_read_byte(U8 *byte){
|
||||
if(UART_rx_start_i == UART_rx_cur_i) // buffer is empty
|
||||
return 0;
|
||||
*byte = UART_rx[UART_rx_start_i++];
|
||||
check_UART_pointer(UART_rx_start_i);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void printUint(U8 *val, U8 len){
|
||||
unsigned long Number = 0;
|
||||
U8 i = len;
|
||||
char ch;
|
||||
U8 decimal_buff[12]; // max len of U32 == 10 + \n + \0
|
||||
if(len > 4 || len == 3 || len == 0) return;
|
||||
for(i = 0; i < 12; i++)
|
||||
decimal_buff[i] = 0;
|
||||
decimal_buff[10] = '\n';
|
||||
ch = 9;
|
||||
switch(len){
|
||||
case 1:
|
||||
Number = *((U8*)val);
|
||||
break;
|
||||
case 2:
|
||||
Number = *((U16*)val);
|
||||
break;
|
||||
case 4:
|
||||
Number = *((unsigned long*)val);
|
||||
break;
|
||||
}
|
||||
do{
|
||||
i = Number % 10L;
|
||||
decimal_buff[ch--] = i + '0';
|
||||
Number /= 10L;
|
||||
}while(Number && ch > -1);
|
||||
uart_write((char*)&decimal_buff[ch+1]);
|
||||
}
|
||||
|
||||
U8 readInt(int *val){
|
||||
unsigned long T = Global_time;
|
||||
unsigned long R = 0;
|
||||
int readed;
|
||||
U8 sign = 0, rb, ret = 0, bad = 0;
|
||||
do{
|
||||
if(!UART_read_byte(&rb)) continue;
|
||||
if(rb == '-' && R == 0){ // negative number
|
||||
sign = 1;
|
||||
continue;
|
||||
}
|
||||
if(rb < '0' || rb > '9') break; // number ends with any non-digit symbol that will be omitted
|
||||
ret = 1; // there's at least one digit
|
||||
R = R * 10L + rb - '0';
|
||||
if(R > 0x7fff){ // bad value
|
||||
R = 0;
|
||||
bad = 0;
|
||||
}
|
||||
}while(Global_time - T < 10000); // wait no longer than 10s
|
||||
if(bad || !ret) return 0;
|
||||
readed = (int) R;
|
||||
if(sign) readed *= -1;
|
||||
*val = readed;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void error_msg(char *msg){
|
||||
uart_write("\nERROR: ");
|
||||
uart_write(msg);
|
||||
UART_send_byte('\n');
|
||||
}
|
||||
|
||||
int main() {
|
||||
unsigned long T = 0L;
|
||||
int Ival;
|
||||
U8 rb;
|
||||
CFG_GCR |= 1; // disable SWIM
|
||||
// Configure clocking
|
||||
CLK_CKDIVR = 0; // F_HSI = 16MHz, f_CPU = 16MHz
|
||||
|
||||
// Configure timer 1 - systick
|
||||
// prescaler = f_{in}/f_{tim1} - 1
|
||||
// set Timer1 to 1MHz: 1/1 - 1 = 15
|
||||
TIM1_PSCRH = 0;
|
||||
TIM1_PSCRL = 15; // LSB should be written last as it updates prescaler
|
||||
// auto-reload each 1ms: TIM_ARR = 1000 = 0x03E8
|
||||
TIM1_ARRH = 0x03;
|
||||
TIM1_ARRL = 0xE8;
|
||||
// interrupts: update
|
||||
TIM1_IER = TIM_IER_UIE;
|
||||
// auto-reload + interrupt on overflow + enable
|
||||
TIM1_CR1 = TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN;
|
||||
|
||||
// Configure pins
|
||||
// PC2 - PP output (on-board LED)
|
||||
PORT(LED_PORT, DDR) |= LED_PIN;
|
||||
PORT(LED_PORT, CR1) |= LED_PIN;
|
||||
// PD5 - UART2_TX
|
||||
PORT(UART_PORT, DDR) |= UART_TX_PIN;
|
||||
PORT(UART_PORT, CR1) |= UART_TX_PIN;
|
||||
|
||||
// Configure UART
|
||||
// 8 bit, no parity, 1 stop (UART_CR1/3 = 0 - reset value)
|
||||
// 57600 on 16MHz: BRR1=0x11, BRR2=0x06
|
||||
UART2_BRR1 = 0x11; UART2_BRR2 = 0x06;
|
||||
UART2_CR2 = UART_CR2_TEN | UART_CR2_REN | UART_CR2_RIEN; // Allow RX/TX, generate ints on rx
|
||||
|
||||
// enable all interrupts
|
||||
enableInterrupts();
|
||||
|
||||
set_stepper_speed(1000);
|
||||
setup_stepper_pins();
|
||||
|
||||
// Loop
|
||||
do{
|
||||
if((Global_time - T > paused_val) || (T > Global_time)){
|
||||
T = Global_time;
|
||||
PORT(LED_PORT, ODR) ^= LED_PIN; // blink on-board LED
|
||||
}
|
||||
if(UART_read_byte(&rb)){ // buffer isn't empty
|
||||
switch(rb){
|
||||
case 'h': // help
|
||||
case 'H':
|
||||
uart_write("\nPROTO:\n+/-\tLED period\nS/s\tset/get Mspeed\nm\tget steps\nx\tstop\np\tpause/resume\n0..4\tmove xth motor\na\tadd Nstps\n");
|
||||
break;
|
||||
case '+':
|
||||
paused_val += 100;
|
||||
if(paused_val > 10000)
|
||||
paused_val = 500; // but not more than 10s
|
||||
break;
|
||||
case '-':
|
||||
paused_val -= 100;
|
||||
if(paused_val < 100) // but not less than 0.1s
|
||||
paused_val = 500;
|
||||
break;
|
||||
case 'S': // set stepper speed
|
||||
if(readInt(&Ival) && Ival > MIN_STEP_LENGTH)
|
||||
set_stepper_speed(Ival);
|
||||
else
|
||||
error_msg("bad speed");
|
||||
break;
|
||||
case 's': // get stepper speed
|
||||
printUint((U8*)&Stepper_speed, 2);
|
||||
break;
|
||||
case 'm': // how much steps there is to the end of moving
|
||||
Ival = Nsteps >> Ustepping;
|
||||
printUint((U8*)&Ival, 2);
|
||||
break;
|
||||
case 'x': // stop
|
||||
stop_motor();
|
||||
break;
|
||||
case 'p': // pause/resume
|
||||
pause_resume();
|
||||
break;
|
||||
case 'a': // add N steps
|
||||
if(readInt(&Ival) && Ival){
|
||||
add_steps(Ival);
|
||||
}else{
|
||||
error_msg("bad value");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(rb >= '0' && rb <= '4'){ // motor
|
||||
if(Motor_number != 5){
|
||||
error_msg("moving!");
|
||||
break;
|
||||
}
|
||||
Motor_number = rb - '0';
|
||||
if(readInt(&Ival) && Ival)
|
||||
move_motor(Ival);
|
||||
else{
|
||||
error_msg("bad Nsteps");
|
||||
Motor_number = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}while(1);
|
||||
}
|
||||
|
||||
|
||||
41
stepper/main.h
Normal file
41
stepper/main.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* blinky.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
extern unsigned long Global_time; // global time in ms
|
||||
|
||||
#define UART_BUF_LEN 8 // max 7 bytes transmited in on operation
|
||||
#define MIN_STEP_LENGTH 125 // max speed == 1/(125us*16) = 500 steps per second
|
||||
|
||||
extern U8 UART_rx[];
|
||||
extern U8 UART_rx_start_i;
|
||||
extern U8 UART_rx_cur_i;
|
||||
|
||||
void UART_send_byte(U8 byte);
|
||||
void uart_write(char *str);
|
||||
void printUint(U8 *val, U8 len);
|
||||
void error_msg(char *msg);
|
||||
|
||||
#define check_UART_pointer(x) if(x == UART_BUF_LEN) x = 0;
|
||||
|
||||
#endif // __MAIN_H__
|
||||
50
stepper/ports_definition.h
Normal file
50
stepper/ports_definition.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* ports_definition.h - definition of ports pins & so on
|
||||
*
|
||||
* Copyright 2014 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 __PORTS_DEFINITION_H__
|
||||
#define __PORTS_DEFINITION_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
// macro for using in port constructions like PORT(LED_PORT, ODR) = xx
|
||||
#define CONCAT(a, b) a ## _ ## b
|
||||
#define PORT(a, b) CONCAT(a , b)
|
||||
|
||||
// on-board LED
|
||||
#define LED_PORT PC
|
||||
#define LED_PIN GPIO_PIN2
|
||||
|
||||
// UART2_TX
|
||||
#define UART_PORT PD
|
||||
#define UART_TX_PIN GPIO_PIN5
|
||||
|
||||
/***** Stepper motor *****/
|
||||
// Clocking
|
||||
#define STP_CLK_PORT PD
|
||||
#define STP_CLK_PIN GPIO_PIN4
|
||||
// EN -- PB0..4
|
||||
#define STP_EN_PORT PB
|
||||
#define STP_EN_MASK 0x1F // number & mask == enable!
|
||||
// DIR -- PB5
|
||||
#define STP_DIR_PORT PB
|
||||
#define STP_DIR_PIN GPIO_PIN5
|
||||
#endif // __PORTS_DEFINITION_H__
|
||||
82
stepper/schematic/kicad.pro
Normal file
82
stepper/schematic/kicad.pro
Normal file
@@ -0,0 +1,82 @@
|
||||
update=Вт 11 фев 2014 17:26:13
|
||||
version=1
|
||||
last_client=eeschema
|
||||
[cvpcb]
|
||||
version=1
|
||||
NetIExt=net
|
||||
[cvpcb/libraries]
|
||||
EquName1=devcms
|
||||
[pcbnew]
|
||||
version=1
|
||||
LastNetListRead=
|
||||
PadDrlX=320
|
||||
PadDimH=550
|
||||
PadDimV=550
|
||||
BoardThickness=620
|
||||
TxtPcbV=600
|
||||
TxtPcbH=600
|
||||
TxtModV=500
|
||||
TxtModH=500
|
||||
TxtModW=100
|
||||
VEgarde=100
|
||||
DrawLar=120
|
||||
EdgeLar=80
|
||||
TxtLar=120
|
||||
MSegLar=120
|
||||
[pcbnew/libraries]
|
||||
LibDir=
|
||||
LibName1=sockets
|
||||
LibName2=connect
|
||||
LibName3=discret
|
||||
LibName4=pin_array
|
||||
LibName5=divers
|
||||
LibName6=libcms
|
||||
LibName7=display
|
||||
LibName8=led
|
||||
LibName9=dip_sockets
|
||||
LibName10=pga_sockets
|
||||
LibName11=valves
|
||||
[general]
|
||||
version=1
|
||||
[eeschema]
|
||||
version=1
|
||||
LibDir=
|
||||
NetFmtName=
|
||||
RptD_X=0
|
||||
RptD_Y=100
|
||||
RptLab=1
|
||||
LabSize=60
|
||||
[eeschema/libraries]
|
||||
LibName1=power
|
||||
LibName2=device
|
||||
LibName3=transistors
|
||||
LibName4=conn
|
||||
LibName5=linear
|
||||
LibName6=regul
|
||||
LibName7=74xx
|
||||
LibName8=cmos4000
|
||||
LibName9=adc-dac
|
||||
LibName10=memory
|
||||
LibName11=xilinx
|
||||
LibName12=special
|
||||
LibName13=microcontrollers
|
||||
LibName14=dsp
|
||||
LibName15=microchip
|
||||
LibName16=analog_switches
|
||||
LibName17=motorola
|
||||
LibName18=texas
|
||||
LibName19=intel
|
||||
LibName20=audio
|
||||
LibName21=interface
|
||||
LibName22=digital-audio
|
||||
LibName23=philips
|
||||
LibName24=display
|
||||
LibName25=cypress
|
||||
LibName26=siliconi
|
||||
LibName27=opto
|
||||
LibName28=atmel
|
||||
LibName29=contrib
|
||||
LibName30=valves
|
||||
LibName31=stm8
|
||||
LibName32=st-microelectronics
|
||||
LibName33=stm8s105k4t6c
|
||||
237
stepper/schematic/stepper-cache.lib
Normal file
237
stepper/schematic/stepper-cache.lib
Normal file
@@ -0,0 +1,237 @@
|
||||
EESchema-LIBRARY Version 2.3 Date: Ср 12 фев 2014 12:09:00
|
||||
#encoding utf-8
|
||||
#
|
||||
# +3.3V
|
||||
#
|
||||
DEF +3.3V #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -40 30 H I C CNN
|
||||
F1 "+3.3V" 0 110 30 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS +3,3V
|
||||
DRAW
|
||||
X +3.3V 1 0 0 0 U 30 30 0 0 W N
|
||||
C 0 60 20 0 1 0 N
|
||||
P 3 0 1 0 0 0 0 40 0 40 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# C
|
||||
#
|
||||
DEF C C 0 10 N Y 1 F N
|
||||
F0 "C" 0 100 40 H V L CNN
|
||||
F1 "C" 6 -85 40 H V L CNN
|
||||
F2 "~" 38 -150 30 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
SM*
|
||||
C?
|
||||
C1-1
|
||||
$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 200 170 D 40 40 1 1 P
|
||||
X ~ 2 0 -200 170 U 40 40 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_14
|
||||
#
|
||||
DEF CONN_14 P 0 40 Y N 1 F N
|
||||
F0 "P" -30 0 60 V V C CNN
|
||||
F1 "CONN_14" 80 0 60 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 700 150 -700 0 1 0 N
|
||||
X P1 1 -350 650 250 R 50 50 1 1 P I
|
||||
X P2 2 -350 550 250 R 50 50 1 1 P I
|
||||
X P3 3 -350 450 250 R 50 50 1 1 P I
|
||||
X P4 4 -350 350 250 R 50 50 1 1 P I
|
||||
X P5 5 -350 250 250 R 50 50 1 1 P I
|
||||
X P6 6 -350 150 250 R 50 50 1 1 P I
|
||||
X P7 7 -350 50 250 R 50 50 1 1 P I
|
||||
X P8 8 -350 -50 250 R 50 50 1 1 P I
|
||||
X P9 9 -350 -150 250 R 50 50 1 1 P I
|
||||
X P10 10 -350 -250 250 R 50 50 1 1 P I
|
||||
X P11 11 -350 -350 250 R 50 50 1 1 P I
|
||||
X P12 12 -350 -450 250 R 50 50 1 1 P I
|
||||
X P13 13 -350 -550 250 R 50 50 1 1 P I
|
||||
X P14 14 -350 -650 250 R 50 50 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_3
|
||||
#
|
||||
DEF CONN_3 K 0 40 Y N 1 F N
|
||||
F0 "K" -50 0 50 V V C CNN
|
||||
F1 "CONN_3" 50 0 40 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 150 100 -150 0 1 0 N
|
||||
X P1 1 -350 100 250 R 60 60 1 1 P I
|
||||
X PM 2 -350 0 250 R 60 60 1 1 P I
|
||||
X P3 3 -350 -100 250 R 60 60 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_4
|
||||
#
|
||||
DEF CONN_4 P 0 40 Y N 1 F N
|
||||
F0 "P" -50 0 50 V V C CNN
|
||||
F1 "CONN_4" 50 0 50 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 200 100 -200 0 1 0 N
|
||||
X P1 1 -350 150 250 R 50 50 1 1 P I
|
||||
X P2 2 -350 50 250 R 50 50 1 1 P I
|
||||
X P3 3 -350 -50 250 R 50 50 1 1 P I
|
||||
X P4 4 -350 -150 250 R 50 50 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_6
|
||||
#
|
||||
DEF CONN_6 P 0 30 Y N 1 F N
|
||||
F0 "P" -50 0 60 V V C CNN
|
||||
F1 "CONN_6" 50 0 60 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 300 100 -300 0 1 0 N
|
||||
X 1 1 -350 250 250 R 60 60 1 1 P I
|
||||
X 2 2 -350 150 250 R 60 60 1 1 P I
|
||||
X 3 3 -350 50 250 R 60 60 1 1 P I
|
||||
X 4 4 -350 -50 250 R 60 60 1 1 P I
|
||||
X 5 5 -350 -150 250 R 60 60 1 1 P I
|
||||
X 6 6 -350 -250 250 R 60 60 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# GND
|
||||
#
|
||||
DEF ~GND #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 0 30 H I C CNN
|
||||
F1 "GND" 0 -70 30 H I C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N
|
||||
X GND 1 0 0 0 U 30 30 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# LED
|
||||
#
|
||||
DEF LED D 0 40 Y N 1 F N
|
||||
F0 "D" 0 100 50 H V C CNN
|
||||
F1 "LED" 0 -100 50 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
LED-3MM
|
||||
LED-5MM
|
||||
LED-10MM
|
||||
LED-0603
|
||||
LED-0805
|
||||
LED-1206
|
||||
LEDV
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 0 50 50 50 -50 N
|
||||
P 3 0 1 0 -50 50 50 0 -50 -50 F
|
||||
P 3 0 1 0 65 -40 110 -80 105 -55 N
|
||||
P 3 0 1 0 80 -25 125 -65 120 -40 N
|
||||
X A 1 -200 0 150 R 40 40 1 1 P
|
||||
X K 2 200 0 150 L 40 40 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# R
|
||||
#
|
||||
DEF R R 0 0 N Y 1 F N
|
||||
F0 "R" 80 0 40 V V C CNN
|
||||
F1 "R" 7 1 40 V V C CNN
|
||||
F2 "~" -70 0 30 V V C CNN
|
||||
F3 "~" 0 0 30 H V C CNN
|
||||
$FPLIST
|
||||
R?
|
||||
SM0603
|
||||
SM0805
|
||||
R?-*
|
||||
SM1206
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -40 150 40 -150 0 1 12 N
|
||||
X ~ 1 0 250 100 D 60 60 1 1 P
|
||||
X ~ 2 0 -250 100 U 60 60 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# STM8S105K4T6C
|
||||
#
|
||||
DEF STM8S105K4T6C U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 1050 60 H V C CNN
|
||||
F1 "STM8S105K4T6C" 50 -850 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS stm8s105*
|
||||
$FPLIST
|
||||
lqfp32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -1100 950 1100 -750 0 1 0 N
|
||||
X NRST 1 -1400 850 300 R 50 50 1 1 I
|
||||
X OSCIN/PA1 2 -1400 750 300 R 50 50 1 1 T
|
||||
X OSCOUT/PA2 3 -1400 650 300 R 50 50 1 1 T
|
||||
X VSS 4 -1400 550 300 R 50 50 1 1 W
|
||||
X VCAP 5 -1400 450 300 R 50 50 1 1 w
|
||||
X VDD(3.3-5v) 6 -1400 350 300 R 50 50 1 1 W
|
||||
X VDDio 7 -1400 250 300 R 50 50 1 1 W
|
||||
X PF4/AIN12 8 -1400 150 300 R 50 50 1 1 T
|
||||
X VDDA 9 -1400 50 300 R 50 50 1 1 W
|
||||
X VSSA 10 -1400 -50 300 R 50 50 1 1 W
|
||||
X PC3(HS)/TIM1_CH3 20 1400 -350 300 L 50 50 1 1 T
|
||||
X PD5/UART2_TX 30 1400 650 300 L 50 50 1 1 T
|
||||
X PB5/AIN5[I2X_SDA] 11 -1400 -150 300 R 50 50 1 1 T
|
||||
X PC4(HS)/TIM1_CH4 21 1400 -250 300 L 50 50 1 1 T
|
||||
X PD6/UART2_RX 31 1400 750 300 L 50 50 1 1 T
|
||||
X PB4/AIN4[I2C_SCL] 12 -1400 -250 300 R 50 50 1 1 T
|
||||
X PC5(HS)/SPI_SCK 22 1400 -150 300 L 50 50 1 1 T
|
||||
X PD7/TLI[TIM1_CH4] 32 1400 850 300 L 50 50 1 1 T
|
||||
X PB3/AIN3[TIM1_ETR] 13 -1400 -350 300 R 50 50 1 1 T
|
||||
X PC6(HS)/SPI_MOSI 23 1400 -50 300 L 50 50 1 1 T
|
||||
X PB2/AIN2[TIM1_CH3N] 14 -1400 -450 300 R 50 50 1 1 T
|
||||
X PC7(HS)/SPI_MISO 24 1400 50 300 L 50 50 1 1 T
|
||||
X PB1/AIN1_[TIM1_CH2N] 15 -1400 -550 300 R 50 50 1 1 T
|
||||
X PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO] 25 1400 150 300 L 50 50 1 1 T
|
||||
X PB0/AIN0_[TIM1_CH1N] 16 -1400 -650 300 R 50 50 1 1 T
|
||||
X PD1(HS)/SWIM 26 1400 250 300 L 50 50 1 1 T
|
||||
X PE5/SPI_NSS 17 1400 -650 300 L 50 50 1 1 T
|
||||
X PD2(HS)/TIM3_CH1[TIM2_CH3] 27 1400 350 300 L 50 50 1 1 T
|
||||
X PC1(HS)/TIM1_CH1 18 1400 -550 300 L 50 50 1 1 T
|
||||
X PD3(HS)/TIM2_CH2[ADC_ETR] 28 1400 450 300 L 50 50 1 1 T
|
||||
X PC2(HS)/TIM1_CH2 19 1400 -450 300 L 50 50 1 1 T
|
||||
X PD4(HS)/TIM2_CH1[BEEP] 29 1400 550 300 L 50 50 1 1 T
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# SW_PUSH
|
||||
#
|
||||
DEF SW_PUSH SW 0 40 N N 1 F N
|
||||
F0 "SW" 150 110 50 H V C CNN
|
||||
F1 "SW_PUSH" 0 -80 50 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -170 50 170 60 0 1 0 N
|
||||
P 4 0 1 0 -40 60 -30 90 30 90 40 60 N
|
||||
X 1 1 -300 0 200 R 60 60 0 1 P I
|
||||
X 2 2 300 0 200 L 60 60 0 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
108
stepper/schematic/stepper.cmp
Normal file
108
stepper/schematic/stepper.cmp
Normal file
@@ -0,0 +1,108 @@
|
||||
Cmp-Mod V01 Created by CvPcb (2013-feb-26)-stable date = Ср 12 фев 2014 12:08:54
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0413;
|
||||
Reference = C1;
|
||||
ValeurCmp = 1u;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0426;
|
||||
Reference = C2;
|
||||
ValeurCmp = 104;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0F99;
|
||||
Reference = C3;
|
||||
ValeurCmp = 104;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0DD3;
|
||||
Reference = D1;
|
||||
ValeurCmp = LED;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0ECD;
|
||||
Reference = D2;
|
||||
ValeurCmp = LED;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB2C32;
|
||||
Reference = K1;
|
||||
ValeurCmp = CONN_3;
|
||||
IdModule = SIL-3;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A6A;
|
||||
Reference = P1;
|
||||
ValeurCmp = CONN_14;
|
||||
IdModule = SIL-14;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A49;
|
||||
Reference = P2;
|
||||
ValeurCmp = CONN_4;
|
||||
IdModule = SIL-4;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A79;
|
||||
Reference = P3;
|
||||
ValeurCmp = CONN_14;
|
||||
IdModule = SIL-14;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB29A7;
|
||||
Reference = P4;
|
||||
ValeurCmp = CONN_5;
|
||||
IdModule = SIL-5;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0DE2;
|
||||
Reference = R1;
|
||||
ValeurCmp = 1k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0ED3;
|
||||
Reference = R2;
|
||||
ValeurCmp = 1k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0EFD;
|
||||
Reference = R3;
|
||||
ValeurCmp = 10k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0F3B;
|
||||
Reference = SW1;
|
||||
ValeurCmp = SW_PUSH;
|
||||
IdModule = SM2010;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB03A2;
|
||||
Reference = U1;
|
||||
ValeurCmp = STM8S105K4T6C;
|
||||
IdModule = TQFP32;
|
||||
EndCmp
|
||||
|
||||
EndListe
|
||||
361
stepper/schematic/stepper.net
Normal file
361
stepper/schematic/stepper.net
Normal file
@@ -0,0 +1,361 @@
|
||||
(export (version D)
|
||||
(design
|
||||
(source /home/eddy/Docs/SAO/ELECTRONICS/STM8/stepper/schematic/stepper.sch)
|
||||
(date "Ср 12 фев 2014 12:08:20")
|
||||
(tool "eeschema (2013-feb-26)-stable"))
|
||||
(components
|
||||
(comp (ref U1)
|
||||
(value STM8S105K4T6C)
|
||||
(libsource (lib stm8s105k4t6c) (part STM8S105K4T6C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB03A2))
|
||||
(comp (ref C1)
|
||||
(value 1u)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0413))
|
||||
(comp (ref C2)
|
||||
(value 104)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0426))
|
||||
(comp (ref P2)
|
||||
(value CONN_4)
|
||||
(libsource (lib conn) (part CONN_4))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A49))
|
||||
(comp (ref P1)
|
||||
(value CONN_14)
|
||||
(libsource (lib conn) (part CONN_14))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A6A))
|
||||
(comp (ref P3)
|
||||
(value CONN_14)
|
||||
(libsource (lib conn) (part CONN_14))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A79))
|
||||
(comp (ref D1)
|
||||
(value LED)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0DD3))
|
||||
(comp (ref R1)
|
||||
(value 1k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0DE2))
|
||||
(comp (ref D2)
|
||||
(value LED)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0ECD))
|
||||
(comp (ref R2)
|
||||
(value 1k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0ED3))
|
||||
(comp (ref R3)
|
||||
(value 10k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0EFD))
|
||||
(comp (ref SW1)
|
||||
(value SW_PUSH)
|
||||
(libsource (lib device) (part SW_PUSH))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0F3B))
|
||||
(comp (ref C3)
|
||||
(value 104)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0F99))
|
||||
(comp (ref P4)
|
||||
(value CONN_5)
|
||||
(libsource (lib conn) (part CONN_6))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB29A7))
|
||||
(comp (ref K1)
|
||||
(value CONN_3)
|
||||
(libsource (lib conn) (part CONN_3))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB2C32)))
|
||||
(libparts
|
||||
(libpart (lib device) (part C)
|
||||
(description "Condensateur non polarise")
|
||||
(footprints
|
||||
(fp SM*)
|
||||
(fp C?)
|
||||
(fp C1-1))
|
||||
(fields
|
||||
(field (name Reference) C)
|
||||
(field (name Value) C)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib device) (part LED)
|
||||
(footprints
|
||||
(fp LED-3MM)
|
||||
(fp LED-5MM)
|
||||
(fp LED-10MM)
|
||||
(fp LED-0603)
|
||||
(fp LED-0805)
|
||||
(fp LED-1206)
|
||||
(fp LEDV))
|
||||
(fields
|
||||
(field (name Reference) D)
|
||||
(field (name Value) LED)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name A) (type passive))
|
||||
(pin (num 2) (name K) (type passive))))
|
||||
(libpart (lib device) (part R)
|
||||
(description Resistance)
|
||||
(footprints
|
||||
(fp R?)
|
||||
(fp SM0603)
|
||||
(fp SM0805)
|
||||
(fp R?-*)
|
||||
(fp SM1206))
|
||||
(fields
|
||||
(field (name Reference) R)
|
||||
(field (name Value) R)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib device) (part SW_PUSH)
|
||||
(description "Push Button")
|
||||
(fields
|
||||
(field (name Reference) SW)
|
||||
(field (name Value) SW_PUSH)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))))
|
||||
(libpart (lib conn) (part CONN_14)
|
||||
(description "Symbole general de connexion")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_14))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))
|
||||
(pin (num 5) (name P5) (type passive))
|
||||
(pin (num 6) (name P6) (type passive))
|
||||
(pin (num 7) (name P7) (type passive))
|
||||
(pin (num 8) (name P8) (type passive))
|
||||
(pin (num 9) (name P9) (type passive))
|
||||
(pin (num 10) (name P10) (type passive))
|
||||
(pin (num 11) (name P11) (type passive))
|
||||
(pin (num 12) (name P12) (type passive))
|
||||
(pin (num 13) (name P13) (type passive))
|
||||
(pin (num 14) (name P14) (type passive))))
|
||||
(libpart (lib conn) (part CONN_3)
|
||||
(description "Symbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) K)
|
||||
(field (name Value) CONN_3))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name PM) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))))
|
||||
(libpart (lib conn) (part CONN_4)
|
||||
(description "Symbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_4))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))))
|
||||
(libpart (lib conn) (part CONN_6)
|
||||
(description "ymbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_6))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))
|
||||
(pin (num 3) (name 3) (type passive))
|
||||
(pin (num 4) (name 4) (type passive))
|
||||
(pin (num 5) (name 5) (type passive))
|
||||
(pin (num 6) (name 6) (type passive))))
|
||||
(libpart (lib stm8s105k4t6c) (part STM8S105K4T6C)
|
||||
(footprints
|
||||
(fp lqfp32*))
|
||||
(fields
|
||||
(field (name Reference) U)
|
||||
(field (name Value) STM8S105K4T6C)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name NRST) (type input))
|
||||
(pin (num 2) (name OSCIN/PA1) (type 3state))
|
||||
(pin (num 3) (name OSCOUT/PA2) (type 3state))
|
||||
(pin (num 4) (name VSS) (type power_in))
|
||||
(pin (num 5) (name VCAP) (type power_out))
|
||||
(pin (num 6) (name "VDD(3.3-5v)") (type power_in))
|
||||
(pin (num 7) (name VDDio) (type power_in))
|
||||
(pin (num 8) (name PF4/AIN12) (type 3state))
|
||||
(pin (num 9) (name VDDA) (type power_in))
|
||||
(pin (num 10) (name VSSA) (type power_in))
|
||||
(pin (num 11) (name PB5/AIN5[I2X_SDA]) (type 3state))
|
||||
(pin (num 12) (name PB4/AIN4[I2C_SCL]) (type 3state))
|
||||
(pin (num 13) (name PB3/AIN3[TIM1_ETR]) (type 3state))
|
||||
(pin (num 14) (name PB2/AIN2[TIM1_CH3N]) (type 3state))
|
||||
(pin (num 15) (name PB1/AIN1_[TIM1_CH2N]) (type 3state))
|
||||
(pin (num 16) (name PB0/AIN0_[TIM1_CH1N]) (type 3state))
|
||||
(pin (num 17) (name PE5/SPI_NSS) (type 3state))
|
||||
(pin (num 18) (name "PC1(HS)/TIM1_CH1") (type 3state))
|
||||
(pin (num 19) (name "PC2(HS)/TIM1_CH2") (type 3state))
|
||||
(pin (num 20) (name "PC3(HS)/TIM1_CH3") (type 3state))
|
||||
(pin (num 21) (name "PC4(HS)/TIM1_CH4") (type 3state))
|
||||
(pin (num 22) (name "PC5(HS)/SPI_SCK") (type 3state))
|
||||
(pin (num 23) (name "PC6(HS)/SPI_MOSI") (type 3state))
|
||||
(pin (num 24) (name "PC7(HS)/SPI_MISO") (type 3state))
|
||||
(pin (num 25) (name "PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO]") (type 3state))
|
||||
(pin (num 26) (name "PD1(HS)/SWIM") (type 3state))
|
||||
(pin (num 27) (name "PD2(HS)/TIM3_CH1[TIM2_CH3]") (type 3state))
|
||||
(pin (num 28) (name "PD3(HS)/TIM2_CH2[ADC_ETR]") (type 3state))
|
||||
(pin (num 29) (name "PD4(HS)/TIM2_CH1[BEEP]") (type 3state))
|
||||
(pin (num 30) (name PD5/UART2_TX) (type 3state))
|
||||
(pin (num 31) (name PD6/UART2_RX) (type 3state))
|
||||
(pin (num 32) (name PD7/TLI[TIM1_CH4]) (type 3state)))))
|
||||
(libraries
|
||||
(library (logical device)
|
||||
(uri /usr/share/kicad/library/device.lib))
|
||||
(library (logical conn)
|
||||
(uri /usr/share/kicad/library/conn.lib))
|
||||
(library (logical stm8s105k4t6c)
|
||||
(uri stm8s105k4t6c.lib)))
|
||||
(nets
|
||||
(net (code 1) (name +3.3V)
|
||||
(node (ref R3) (pin 1))
|
||||
(node (ref U1) (pin 6))
|
||||
(node (ref C2) (pin 2))
|
||||
(node (ref D1) (pin 1))
|
||||
(node (ref P2) (pin 1))
|
||||
(node (ref D2) (pin 1))
|
||||
(node (ref P1) (pin 1))
|
||||
(node (ref U1) (pin 7))
|
||||
(node (ref U1) (pin 9))
|
||||
(node (ref K1) (pin 1)))
|
||||
(net (code 2) (name "")
|
||||
(node (ref D1) (pin 2))
|
||||
(node (ref R1) (pin 1)))
|
||||
(net (code 3) (name "")
|
||||
(node (ref R2) (pin 1))
|
||||
(node (ref D2) (pin 2)))
|
||||
(net (code 4) (name GND)
|
||||
(node (ref C1) (pin 1))
|
||||
(node (ref SW1) (pin 1))
|
||||
(node (ref C3) (pin 2))
|
||||
(node (ref R2) (pin 2))
|
||||
(node (ref P2) (pin 4))
|
||||
(node (ref P1) (pin 2))
|
||||
(node (ref U1) (pin 10))
|
||||
(node (ref U1) (pin 4))
|
||||
(node (ref C2) (pin 1))
|
||||
(node (ref P4) (pin 6)))
|
||||
(net (code 5) (name /PC2)
|
||||
(node (ref R1) (pin 2))
|
||||
(node (ref U1) (pin 19))
|
||||
(node (ref P3) (pin 14)))
|
||||
(net (code 6) (name "")
|
||||
(node (ref U1) (pin 5))
|
||||
(node (ref C1) (pin 2)))
|
||||
(net (code 7) (name /PC1)
|
||||
(node (ref P1) (pin 14))
|
||||
(node (ref U1) (pin 18)))
|
||||
(net (code 8) (name /OSC1IN)
|
||||
(node (ref U1) (pin 2))
|
||||
(node (ref P1) (pin 4)))
|
||||
(net (code 9) (name /OSC2IN)
|
||||
(node (ref P1) (pin 5))
|
||||
(node (ref U1) (pin 3)))
|
||||
(net (code 10) (name /PF4)
|
||||
(node (ref P1) (pin 6))
|
||||
(node (ref U1) (pin 8)))
|
||||
(net (code 11) (name /PB5)
|
||||
(node (ref U1) (pin 11))
|
||||
(node (ref P1) (pin 7))
|
||||
(node (ref K1) (pin 2)))
|
||||
(net (code 12) (name /PB4)
|
||||
(node (ref U1) (pin 12))
|
||||
(node (ref P4) (pin 5))
|
||||
(node (ref P1) (pin 8)))
|
||||
(net (code 13) (name /PB3)
|
||||
(node (ref U1) (pin 13))
|
||||
(node (ref P1) (pin 9))
|
||||
(node (ref P4) (pin 4)))
|
||||
(net (code 14) (name /PB2)
|
||||
(node (ref P1) (pin 10))
|
||||
(node (ref P4) (pin 3))
|
||||
(node (ref U1) (pin 14)))
|
||||
(net (code 15) (name /PB1)
|
||||
(node (ref P4) (pin 2))
|
||||
(node (ref P1) (pin 11))
|
||||
(node (ref U1) (pin 15)))
|
||||
(net (code 16) (name /PB0)
|
||||
(node (ref P4) (pin 1))
|
||||
(node (ref U1) (pin 16))
|
||||
(node (ref P1) (pin 12)))
|
||||
(net (code 17) (name /PE5)
|
||||
(node (ref U1) (pin 17))
|
||||
(node (ref P1) (pin 13)))
|
||||
(net (code 18) (name /PD7)
|
||||
(node (ref U1) (pin 32))
|
||||
(node (ref P3) (pin 1)))
|
||||
(net (code 19) (name /PD6)
|
||||
(node (ref P3) (pin 2))
|
||||
(node (ref U1) (pin 31)))
|
||||
(net (code 20) (name /PD5)
|
||||
(node (ref U1) (pin 30))
|
||||
(node (ref P3) (pin 3)))
|
||||
(net (code 21) (name /PD4)
|
||||
(node (ref K1) (pin 3))
|
||||
(node (ref U1) (pin 29))
|
||||
(node (ref P3) (pin 4)))
|
||||
(net (code 22) (name /PD3)
|
||||
(node (ref U1) (pin 28))
|
||||
(node (ref P3) (pin 5)))
|
||||
(net (code 23) (name /PD2)
|
||||
(node (ref P3) (pin 6))
|
||||
(node (ref U1) (pin 27)))
|
||||
(net (code 24) (name /PD0)
|
||||
(node (ref U1) (pin 25))
|
||||
(node (ref P3) (pin 8)))
|
||||
(net (code 25) (name /PC7)
|
||||
(node (ref U1) (pin 24))
|
||||
(node (ref P3) (pin 9)))
|
||||
(net (code 26) (name /PC6)
|
||||
(node (ref P3) (pin 10))
|
||||
(node (ref U1) (pin 23)))
|
||||
(net (code 27) (name /PC5)
|
||||
(node (ref P3) (pin 11))
|
||||
(node (ref U1) (pin 22)))
|
||||
(net (code 28) (name /PC4)
|
||||
(node (ref U1) (pin 21))
|
||||
(node (ref P3) (pin 12)))
|
||||
(net (code 29) (name /PC3)
|
||||
(node (ref P3) (pin 13))
|
||||
(node (ref U1) (pin 20)))
|
||||
(net (code 30) (name /SWIM/PD1)
|
||||
(node (ref P2) (pin 2))
|
||||
(node (ref U1) (pin 26))
|
||||
(node (ref P3) (pin 7)))
|
||||
(net (code 31) (name /NRST)
|
||||
(node (ref R3) (pin 2))
|
||||
(node (ref P2) (pin 3))
|
||||
(node (ref SW1) (pin 2))
|
||||
(node (ref P1) (pin 3))
|
||||
(node (ref C3) (pin 1))
|
||||
(node (ref U1) (pin 1)))))
|
||||
42
stepper/schematic/stepper.pro
Normal file
42
stepper/schematic/stepper.pro
Normal file
@@ -0,0 +1,42 @@
|
||||
update=Ср 12 фев 2014 11:53:02
|
||||
last_client=eeschema
|
||||
[eeschema]
|
||||
version=1
|
||||
LibDir=
|
||||
NetFmtName=
|
||||
RptD_X=0
|
||||
RptD_Y=100
|
||||
RptLab=1
|
||||
LabSize=60
|
||||
[eeschema/libraries]
|
||||
LibName1=power
|
||||
LibName2=device
|
||||
LibName3=transistors
|
||||
LibName4=conn
|
||||
LibName5=linear
|
||||
LibName6=regul
|
||||
LibName7=74xx
|
||||
LibName8=cmos4000
|
||||
LibName9=adc-dac
|
||||
LibName10=memory
|
||||
LibName11=xilinx
|
||||
LibName12=special
|
||||
LibName13=microcontrollers
|
||||
LibName14=dsp
|
||||
LibName15=microchip
|
||||
LibName16=analog_switches
|
||||
LibName17=motorola
|
||||
LibName18=texas
|
||||
LibName19=intel
|
||||
LibName20=audio
|
||||
LibName21=interface
|
||||
LibName22=digital-audio
|
||||
LibName23=philips
|
||||
LibName24=display
|
||||
LibName25=cypress
|
||||
LibName26=siliconi
|
||||
LibName27=opto
|
||||
LibName28=atmel
|
||||
LibName29=contrib
|
||||
LibName30=valves
|
||||
LibName31=stm8s105k4t6c
|
||||
612
stepper/schematic/stepper.sch
Normal file
612
stepper/schematic/stepper.sch
Normal file
@@ -0,0 +1,612 @@
|
||||
EESchema Schematic File Version 2 date Ср 12 фев 2014 12:09:00
|
||||
LIBS:power
|
||||
LIBS:device
|
||||
LIBS:transistors
|
||||
LIBS:conn
|
||||
LIBS:linear
|
||||
LIBS:regul
|
||||
LIBS:74xx
|
||||
LIBS:cmos4000
|
||||
LIBS:adc-dac
|
||||
LIBS:memory
|
||||
LIBS:xilinx
|
||||
LIBS:special
|
||||
LIBS:microcontrollers
|
||||
LIBS:dsp
|
||||
LIBS:microchip
|
||||
LIBS:analog_switches
|
||||
LIBS:motorola
|
||||
LIBS:texas
|
||||
LIBS:intel
|
||||
LIBS:audio
|
||||
LIBS:interface
|
||||
LIBS:digital-audio
|
||||
LIBS:philips
|
||||
LIBS:display
|
||||
LIBS:cypress
|
||||
LIBS:siliconi
|
||||
LIBS:opto
|
||||
LIBS:atmel
|
||||
LIBS:contrib
|
||||
LIBS:valves
|
||||
LIBS:stm8s105k4t6c
|
||||
LIBS:stepper-cache
|
||||
EELAYER 27 0
|
||||
EELAYER END
|
||||
$Descr A4 11693 8268
|
||||
encoding utf-8
|
||||
Sheet 1 1
|
||||
Title ""
|
||||
Date "12 feb 2014"
|
||||
Rev ""
|
||||
Comp ""
|
||||
Comment1 ""
|
||||
Comment2 ""
|
||||
Comment3 ""
|
||||
Comment4 ""
|
||||
$EndDescr
|
||||
$Comp
|
||||
L STM8S105K4T6C U1
|
||||
U 1 1 52FB03A2
|
||||
P 4400 3100
|
||||
F 0 "U1" H 4400 4150 60 0000 C CNN
|
||||
F 1 "STM8S105K4T6C" H 4450 2250 60 0000 C CNN
|
||||
F 2 "~" H 4400 3100 60 0000 C CNN
|
||||
F 3 "~" H 4400 3100 60 0000 C CNN
|
||||
1 4400 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR01
|
||||
U 1 1 52FB03EF
|
||||
P 2750 3200
|
||||
F 0 "#PWR01" H 2750 3200 30 0001 C CNN
|
||||
F 1 "GND" H 2750 3130 30 0001 C CNN
|
||||
F 2 "" H 2750 3200 60 0000 C CNN
|
||||
F 3 "" H 2750 3200 60 0000 C CNN
|
||||
1 2750 3200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2750 3200 2750 3150
|
||||
Wire Wire Line
|
||||
2750 3150 3000 3150
|
||||
$Comp
|
||||
L GND #PWR02
|
||||
U 1 1 52FB0400
|
||||
P 2750 2600
|
||||
F 0 "#PWR02" H 2750 2600 30 0001 C CNN
|
||||
F 1 "GND" H 2750 2530 30 0001 C CNN
|
||||
F 2 "" H 2750 2600 60 0000 C CNN
|
||||
F 3 "" H 2750 2600 60 0000 C CNN
|
||||
1 2750 2600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2750 2600 2750 2550
|
||||
Wire Wire Line
|
||||
2750 2550 3000 2550
|
||||
$Comp
|
||||
L C C1
|
||||
U 1 1 52FB0413
|
||||
P 2250 2700
|
||||
F 0 "C1" H 2300 2800 50 0000 L CNN
|
||||
F 1 "1u" H 2300 2600 50 0000 L CNN
|
||||
F 2 "" H 2250 2700 60 0000 C CNN
|
||||
F 3 "" H 2250 2700 60 0000 C CNN
|
||||
1 2250 2700
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L C C2
|
||||
U 1 1 52FB0426
|
||||
P 2250 2950
|
||||
F 0 "C2" H 2300 3050 50 0000 L CNN
|
||||
F 1 "104" H 2300 2850 50 0000 L CNN
|
||||
F 2 "" H 2250 2950 60 0000 C CNN
|
||||
F 3 "" H 2250 2950 60 0000 C CNN
|
||||
1 2250 2950
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2450 2700 2850 2700
|
||||
Wire Wire Line
|
||||
2850 2700 2850 2650
|
||||
Wire Wire Line
|
||||
2850 2650 3000 2650
|
||||
Wire Wire Line
|
||||
3000 2750 3000 2850
|
||||
Wire Wire Line
|
||||
2450 2950 2450 2850
|
||||
Wire Wire Line
|
||||
2450 2850 3000 2850
|
||||
Wire Wire Line
|
||||
2050 2700 2050 3100
|
||||
$Comp
|
||||
L GND #PWR03
|
||||
U 1 1 52FB0453
|
||||
P 2050 3100
|
||||
F 0 "#PWR03" H 2050 3100 30 0001 C CNN
|
||||
F 1 "GND" H 2050 3030 30 0001 C CNN
|
||||
F 2 "" H 2050 3100 60 0000 C CNN
|
||||
F 3 "" H 2050 3100 60 0000 C CNN
|
||||
1 2050 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Connection ~ 2050 2800
|
||||
Connection ~ 2050 2950
|
||||
Text Label 3000 2250 2 60 ~ 0
|
||||
NRST
|
||||
Text Label 3000 2350 2 60 ~ 0
|
||||
OSC1IN
|
||||
Text Label 3000 2450 2 60 ~ 0
|
||||
OSC2IN
|
||||
Text Label 3000 2950 2 60 ~ 0
|
||||
PF4
|
||||
Text Label 3000 3250 2 60 ~ 0
|
||||
PB5
|
||||
Text Label 3000 3350 2 60 ~ 0
|
||||
PB4
|
||||
Text Label 3000 3450 2 60 ~ 0
|
||||
PB3
|
||||
Text Label 3000 3550 2 60 ~ 0
|
||||
PB2
|
||||
Text Label 3000 3650 2 60 ~ 0
|
||||
PB1
|
||||
Text Label 3000 3750 2 60 ~ 0
|
||||
PB0
|
||||
Text Label 5800 3750 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 5800 3650 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 5800 3550 0 60 ~ 0
|
||||
PC2
|
||||
Text Label 5800 3450 0 60 ~ 0
|
||||
PC3
|
||||
Text Label 5800 3350 0 60 ~ 0
|
||||
PC4
|
||||
Text Label 5800 3250 0 60 ~ 0
|
||||
PC5
|
||||
Text Label 5800 3150 0 60 ~ 0
|
||||
PC6
|
||||
Text Label 5800 3050 0 60 ~ 0
|
||||
PC7
|
||||
Text Label 5800 2950 0 60 ~ 0
|
||||
PD0
|
||||
Text Label 5800 2850 0 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 5800 2750 0 60 ~ 0
|
||||
PD2
|
||||
Text Label 5800 2650 0 60 ~ 0
|
||||
PD3
|
||||
Text Label 5800 2550 0 60 ~ 0
|
||||
PD4
|
||||
Text Label 5800 2450 0 60 ~ 0
|
||||
PD5
|
||||
Text Label 5800 2350 0 60 ~ 0
|
||||
PD6
|
||||
Text Label 5800 2250 0 60 ~ 0
|
||||
PD7
|
||||
$Comp
|
||||
L CONN_4 P2
|
||||
U 1 1 52FB0A49
|
||||
P 4350 1000
|
||||
F 0 "P2" V 4300 1000 50 0000 C CNN
|
||||
F 1 "CONN_4" V 4400 1000 50 0000 C CNN
|
||||
F 2 "" H 4350 1000 60 0000 C CNN
|
||||
F 3 "" H 4350 1000 60 0000 C CNN
|
||||
1 4350 1000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_14 P1
|
||||
U 1 1 52FB0A6A
|
||||
P 1250 1500
|
||||
F 0 "P1" V 1220 1500 60 0000 C CNN
|
||||
F 1 "CONN_14" V 1330 1500 60 0000 C CNN
|
||||
F 2 "" H 1250 1500 60 0000 C CNN
|
||||
F 3 "" H 1250 1500 60 0000 C CNN
|
||||
1 1250 1500
|
||||
-1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_14 P3
|
||||
U 1 1 52FB0A79
|
||||
P 7100 1500
|
||||
F 0 "P3" V 7070 1500 60 0000 C CNN
|
||||
F 1 "CONN_14" V 7180 1500 60 0000 C CNN
|
||||
F 2 "" H 7100 1500 60 0000 C CNN
|
||||
F 3 "" H 7100 1500 60 0000 C CNN
|
||||
1 7100 1500
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Text Label 1600 1150 0 60 ~ 0
|
||||
OSC1IN
|
||||
Text Label 1600 1250 0 60 ~ 0
|
||||
OSC2IN
|
||||
Text Label 1600 1350 0 60 ~ 0
|
||||
PF4
|
||||
Text Label 1600 1450 0 60 ~ 0
|
||||
PB5
|
||||
Text Label 1600 1550 0 60 ~ 0
|
||||
PB4
|
||||
Text Label 1600 1650 0 60 ~ 0
|
||||
PB3
|
||||
Text Label 1600 1750 0 60 ~ 0
|
||||
PB2
|
||||
Text Label 1600 1850 0 60 ~ 0
|
||||
PB1
|
||||
Text Label 1600 1950 0 60 ~ 0
|
||||
PB0
|
||||
Text Label 1600 2050 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 1600 2150 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 1600 1050 0 60 ~ 0
|
||||
NRST
|
||||
Text Label 4000 950 2 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 4000 1050 2 60 ~ 0
|
||||
NRST
|
||||
Text Label 6750 850 2 60 ~ 0
|
||||
PD7
|
||||
Text Label 6750 950 2 60 ~ 0
|
||||
PD6
|
||||
Text Label 6750 1050 2 60 ~ 0
|
||||
PD5
|
||||
Text Label 6750 1150 2 60 ~ 0
|
||||
PD4
|
||||
Text Label 6750 1250 2 60 ~ 0
|
||||
PD3
|
||||
Text Label 6750 1350 2 60 ~ 0
|
||||
PD2
|
||||
Text Label 6750 1450 2 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 6750 1550 2 60 ~ 0
|
||||
PD0
|
||||
Text Label 6750 1650 2 60 ~ 0
|
||||
PC7
|
||||
Text Label 6750 1750 2 60 ~ 0
|
||||
PC6
|
||||
Text Label 6750 1850 2 60 ~ 0
|
||||
PC5
|
||||
Text Label 6750 1950 2 60 ~ 0
|
||||
PC4
|
||||
Text Label 6750 2050 2 60 ~ 0
|
||||
PC3
|
||||
Text Label 6750 2150 2 60 ~ 0
|
||||
PC2
|
||||
$Comp
|
||||
L +3.3V #PWR04
|
||||
U 1 1 52FB0DC4
|
||||
P 950 2800
|
||||
F 0 "#PWR04" H 950 2760 30 0001 C CNN
|
||||
F 1 "+3.3V" H 950 2910 30 0000 C CNN
|
||||
F 2 "" H 950 2800 60 0000 C CNN
|
||||
F 3 "" H 950 2800 60 0000 C CNN
|
||||
1 950 2800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D1
|
||||
U 1 1 52FB0DD3
|
||||
P 950 3100
|
||||
F 0 "D1" H 950 3200 50 0000 C CNN
|
||||
F 1 "LED" H 950 3000 50 0000 C CNN
|
||||
F 2 "" H 950 3100 60 0000 C CNN
|
||||
F 3 "" H 950 3100 60 0000 C CNN
|
||||
1 950 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R1
|
||||
U 1 1 52FB0DE2
|
||||
P 950 3600
|
||||
F 0 "R1" V 1030 3600 50 0000 C CNN
|
||||
F 1 "1k" V 950 3600 50 0000 C CNN
|
||||
F 2 "" H 950 3600 60 0000 C CNN
|
||||
F 3 "" H 950 3600 60 0000 C CNN
|
||||
1 950 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
950 2800 950 2900
|
||||
Wire Wire Line
|
||||
950 3300 950 3350
|
||||
Wire Wire Line
|
||||
950 3850 950 3950
|
||||
$Comp
|
||||
L +3.3V #PWR05
|
||||
U 1 1 52FB0EC7
|
||||
P 1300 2800
|
||||
F 0 "#PWR05" H 1300 2760 30 0001 C CNN
|
||||
F 1 "+3.3V" H 1300 2910 30 0000 C CNN
|
||||
F 2 "" H 1300 2800 60 0000 C CNN
|
||||
F 3 "" H 1300 2800 60 0000 C CNN
|
||||
1 1300 2800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D2
|
||||
U 1 1 52FB0ECD
|
||||
P 1300 3100
|
||||
F 0 "D2" H 1300 3200 50 0000 C CNN
|
||||
F 1 "LED" H 1300 3000 50 0000 C CNN
|
||||
F 2 "" H 1300 3100 60 0000 C CNN
|
||||
F 3 "" H 1300 3100 60 0000 C CNN
|
||||
1 1300 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R2
|
||||
U 1 1 52FB0ED3
|
||||
P 1300 3600
|
||||
F 0 "R2" V 1380 3600 50 0000 C CNN
|
||||
F 1 "1k" V 1300 3600 50 0000 C CNN
|
||||
F 2 "" H 1300 3600 60 0000 C CNN
|
||||
F 3 "" H 1300 3600 60 0000 C CNN
|
||||
1 1300 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR06
|
||||
U 1 1 52FB0ED9
|
||||
P 1300 3950
|
||||
F 0 "#PWR06" H 1300 3950 30 0001 C CNN
|
||||
F 1 "GND" H 1300 3880 30 0001 C CNN
|
||||
F 2 "" H 1300 3950 60 0000 C CNN
|
||||
F 3 "" H 1300 3950 60 0000 C CNN
|
||||
1 1300 3950
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1300 2800 1300 2900
|
||||
Wire Wire Line
|
||||
1300 3300 1300 3350
|
||||
Wire Wire Line
|
||||
1300 3850 1300 3950
|
||||
Text Label 950 3950 2 60 ~ 0
|
||||
PC2
|
||||
$Comp
|
||||
L +3.3V #PWR07
|
||||
U 1 1 52FB0EF1
|
||||
P 6500 2550
|
||||
F 0 "#PWR07" H 6500 2510 30 0001 C CNN
|
||||
F 1 "+3.3V" H 6500 2660 30 0000 C CNN
|
||||
F 2 "" H 6500 2550 60 0000 C CNN
|
||||
F 3 "" H 6500 2550 60 0000 C CNN
|
||||
1 6500 2550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R3
|
||||
U 1 1 52FB0EFD
|
||||
P 6500 2900
|
||||
F 0 "R3" V 6580 2900 50 0000 C CNN
|
||||
F 1 "10k" V 6500 2900 50 0000 C CNN
|
||||
F 2 "" H 6500 2900 60 0000 C CNN
|
||||
F 3 "" H 6500 2900 60 0000 C CNN
|
||||
1 6500 2900
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR08
|
||||
U 1 1 52FB0F03
|
||||
P 6500 4050
|
||||
F 0 "#PWR08" H 6500 4050 30 0001 C CNN
|
||||
F 1 "GND" H 6500 3980 30 0001 C CNN
|
||||
F 2 "" H 6500 4050 60 0000 C CNN
|
||||
F 3 "" H 6500 4050 60 0000 C CNN
|
||||
1 6500 4050
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 2550 6500 2650
|
||||
Wire Wire Line
|
||||
6500 3850 6500 4050
|
||||
$Comp
|
||||
L SW_PUSH SW1
|
||||
U 1 1 52FB0F3B
|
||||
P 6500 3550
|
||||
F 0 "SW1" H 6650 3660 50 0000 C CNN
|
||||
F 1 "SW_PUSH" H 6500 3470 50 0000 C CNN
|
||||
F 2 "" H 6500 3550 60 0000 C CNN
|
||||
F 3 "" H 6500 3550 60 0000 C CNN
|
||||
1 6500 3550
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 3250 6500 3150
|
||||
$Comp
|
||||
L C C3
|
||||
U 1 1 52FB0F99
|
||||
P 6900 3550
|
||||
F 0 "C3" H 6950 3650 50 0000 L CNN
|
||||
F 1 "104" H 6950 3450 50 0000 L CNN
|
||||
F 2 "" H 6900 3550 60 0000 C CNN
|
||||
F 3 "" H 6900 3550 60 0000 C CNN
|
||||
1 6900 3550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6900 3200 6900 3350
|
||||
Wire Wire Line
|
||||
6900 3750 6900 3900
|
||||
Wire Wire Line
|
||||
6900 3900 6500 3900
|
||||
Connection ~ 6500 3900
|
||||
Wire Wire Line
|
||||
6500 3200 6900 3200
|
||||
Connection ~ 6500 3200
|
||||
Text Label 6500 3200 2 60 ~ 0
|
||||
NRST
|
||||
$Comp
|
||||
L +3.3V #PWR09
|
||||
U 1 1 52FB2273
|
||||
P 2150 850
|
||||
F 0 "#PWR09" H 2150 810 30 0001 C CNN
|
||||
F 1 "+3.3V" H 2150 960 30 0000 C CNN
|
||||
F 2 "" H 2150 850 60 0000 C CNN
|
||||
F 3 "" H 2150 850 60 0000 C CNN
|
||||
1 2150 850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 850 2150 850
|
||||
$Comp
|
||||
L GND #PWR010
|
||||
U 1 1 52FB2296
|
||||
P 2150 1000
|
||||
F 0 "#PWR010" H 2150 1000 30 0001 C CNN
|
||||
F 1 "GND" H 2150 930 30 0001 C CNN
|
||||
F 2 "" H 2150 1000 60 0000 C CNN
|
||||
F 3 "" H 2150 1000 60 0000 C CNN
|
||||
1 2150 1000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 950 2150 950
|
||||
Wire Wire Line
|
||||
2150 950 2150 1000
|
||||
Wire Wire Line
|
||||
2600 3050 3000 3050
|
||||
Wire Wire Line
|
||||
2750 3050 2750 2850
|
||||
Connection ~ 2750 2850
|
||||
$Comp
|
||||
L +3.3V #PWR011
|
||||
U 1 1 52FB26FA
|
||||
P 2600 3000
|
||||
F 0 "#PWR011" H 2600 2960 30 0001 C CNN
|
||||
F 1 "+3.3V" H 2600 3110 30 0000 C CNN
|
||||
F 2 "" H 2600 3000 60 0000 C CNN
|
||||
F 3 "" H 2600 3000 60 0000 C CNN
|
||||
1 2600 3000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2600 3000 2600 3050
|
||||
Connection ~ 2750 3050
|
||||
$Comp
|
||||
L +3.3V #PWR012
|
||||
U 1 1 52FB286D
|
||||
P 4000 750
|
||||
F 0 "#PWR012" H 4000 710 30 0001 C CNN
|
||||
F 1 "+3.3V" H 4000 860 30 0000 C CNN
|
||||
F 2 "" H 4000 750 60 0000 C CNN
|
||||
F 3 "" H 4000 750 60 0000 C CNN
|
||||
1 4000 750
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR013
|
||||
U 1 1 52FB287C
|
||||
P 4000 1300
|
||||
F 0 "#PWR013" H 4000 1300 30 0001 C CNN
|
||||
F 1 "GND" H 4000 1230 30 0001 C CNN
|
||||
F 2 "" H 4000 1300 60 0000 C CNN
|
||||
F 3 "" H 4000 1300 60 0000 C CNN
|
||||
1 4000 1300
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
4000 1300 4000 1150
|
||||
Wire Wire Line
|
||||
4000 850 4000 750
|
||||
$Comp
|
||||
L CONN_6 P4
|
||||
U 1 1 52FB29A7
|
||||
P 1050 5300
|
||||
F 0 "P4" V 1000 5300 50 0000 C CNN
|
||||
F 1 "CONN_5" V 1100 5300 50 0000 C CNN
|
||||
F 2 "" H 1050 5300 60 0000 C CNN
|
||||
F 3 "" H 1050 5300 60 0000 C CNN
|
||||
1 1050 5300
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Text Notes 800 5750 0 60 ~ 0
|
||||
Motor N enable
|
||||
Text Label 1400 5550 0 60 ~ 0
|
||||
PB0
|
||||
Text Label 1400 5450 0 60 ~ 0
|
||||
PB1
|
||||
Text Label 1400 5350 0 60 ~ 0
|
||||
PB2
|
||||
Text Label 1400 5250 0 60 ~ 0
|
||||
PB3
|
||||
Text Label 1400 5150 0 60 ~ 0
|
||||
PB4
|
||||
$Comp
|
||||
L GND #PWR014
|
||||
U 1 1 52FB2B4C
|
||||
P 1800 5150
|
||||
F 0 "#PWR014" H 1800 5150 30 0001 C CNN
|
||||
F 1 "GND" H 1800 5080 30 0001 C CNN
|
||||
F 2 "" H 1800 5150 60 0000 C CNN
|
||||
F 3 "" H 1800 5150 60 0000 C CNN
|
||||
1 1800 5150
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1400 5050 1800 5050
|
||||
Wire Wire Line
|
||||
1800 5050 1800 5150
|
||||
$Comp
|
||||
L CONN_3 K1
|
||||
U 1 1 52FB2C32
|
||||
P 1050 6100
|
||||
F 0 "K1" V 1000 6100 50 0000 C CNN
|
||||
F 1 "CONN_3" V 1100 6100 40 0000 C CNN
|
||||
F 2 "" H 1050 6100 60 0000 C CNN
|
||||
F 3 "" H 1050 6100 60 0000 C CNN
|
||||
1 1050 6100
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Text Notes 700 6400 0 60 ~ 0
|
||||
All motors DIR/CLK
|
||||
Text Label 1400 6000 0 60 ~ 0
|
||||
PD4
|
||||
Text Label 1400 6100 0 60 ~ 0
|
||||
PB5
|
||||
$Comp
|
||||
L +3.3V #PWR015
|
||||
U 1 1 52FB2C41
|
||||
P 1850 6200
|
||||
F 0 "#PWR015" H 1850 6160 30 0001 C CNN
|
||||
F 1 "+3.3V" H 1850 6310 30 0000 C CNN
|
||||
F 2 "" H 1850 6200 60 0000 C CNN
|
||||
F 3 "" H 1850 6200 60 0000 C CNN
|
||||
1 1850 6200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1400 6200 1850 6200
|
||||
Text Notes 750 6000 0 60 ~ 0
|
||||
CLK
|
||||
Text Notes 750 6100 0 60 ~ 0
|
||||
DIR
|
||||
Text Notes 750 6250 0 60 ~ 0
|
||||
VDD
|
||||
Text Notes 700 5050 0 60 ~ 0
|
||||
GND
|
||||
Text Notes 700 5150 0 60 ~ 0
|
||||
EN4
|
||||
Text Notes 700 5250 0 60 ~ 0
|
||||
EN3
|
||||
Text Notes 700 5350 0 60 ~ 0
|
||||
EN2
|
||||
Text Notes 700 5450 0 60 ~ 0
|
||||
EN1
|
||||
Text Notes 700 5550 0 60 ~ 0
|
||||
EN0
|
||||
Wire Notes Line
|
||||
600 500 600 4200
|
||||
Wire Notes Line
|
||||
600 4200 7500 4200
|
||||
Wire Notes Line
|
||||
7500 4200 7500 500
|
||||
Wire Notes Line
|
||||
7500 500 600 500
|
||||
Text Notes 3550 4450 0 118 ~ 0
|
||||
STM8 board
|
||||
$EndSCHEMATC
|
||||
9
stepper/schematic/stm8s105k4t6c.bck
Normal file
9
stepper/schematic/stm8s105k4t6c.bck
Normal file
@@ -0,0 +1,9 @@
|
||||
EESchema-DOCLIB Version 2.0 Date: Вт 11 фев 2014 17:09:58
|
||||
#
|
||||
$CMP STM8S003K3T
|
||||
D STM8S003K3T, LQFP32 (7x7, 0.8mm pitch), 16MHz, 8K Flash, 1K RAM, 128 EEPROM
|
||||
K STM8 Microcontroller Value Line
|
||||
F http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/DM00024550.pdf
|
||||
$ENDCMP
|
||||
#
|
||||
#End Doc Library
|
||||
13
stepper/schematic/stm8s105k4t6c.dcm
Normal file
13
stepper/schematic/stm8s105k4t6c.dcm
Normal file
@@ -0,0 +1,13 @@
|
||||
EESchema-DOCLIB Version 2.0 Date: Вт 11 фев 2014 17:26:38
|
||||
#
|
||||
$CMP STM8S003K3T
|
||||
D STM8S003K3T, LQFP32 (7x7, 0.8mm pitch), 16MHz, 8K Flash, 1K RAM, 128 EEPROM
|
||||
K STM8 Microcontroller Value Line
|
||||
F http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/DM00024550.pdf
|
||||
$ENDCMP
|
||||
#
|
||||
$CMP STM8S105K4T6C
|
||||
K stm8
|
||||
$ENDCMP
|
||||
#
|
||||
#End Doc Library
|
||||
99
stepper/schematic/stm8s105k4t6c.lib
Normal file
99
stepper/schematic/stm8s105k4t6c.lib
Normal file
@@ -0,0 +1,99 @@
|
||||
EESchema-LIBRARY Version 2.3 Date: Вт 11 фев 2014 17:26:38
|
||||
#encoding utf-8
|
||||
#
|
||||
# STM8S003K3T
|
||||
#
|
||||
DEF STM8S003K3T IC 0 40 Y Y 1 F N
|
||||
F0 "IC" -800 1150 60 H V C CNN
|
||||
F1 "STM8S003K3T" 550 -1100 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
LQFP32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -850 1100 850 -1050 0 1 10 f
|
||||
X NRST 1 -1000 1000 149 R 40 40 1 1 I
|
||||
X OSCI/PA1 2 1000 1000 149 L 40 40 1 1 B
|
||||
X OSCOUT/PA2 3 1000 900 149 L 40 40 1 1 B
|
||||
X VSS 4 0 -1200 149 U 40 40 1 1 W
|
||||
X Vcap 5 -1000 -950 149 R 40 40 1 1 I
|
||||
X VDD 6 0 1250 149 D 40 40 1 1 W
|
||||
X [SPI_NSS]TIM2_CH3/PA3 7 1000 800 149 L 40 40 1 1 B
|
||||
X PF4 8 -1000 -350 149 R 40 40 1 1 B
|
||||
X PB7 9 1000 -50 149 L 40 40 1 1 B
|
||||
X PB6 10 1000 50 149 L 40 40 1 1 B
|
||||
X TIM1_CH3/PC3 20 1000 -400 149 L 40 40 1 1 B
|
||||
X PD5/UART1_TX 30 -1000 150 149 R 40 40 1 1 B
|
||||
X I2C_SDA/PB5 11 1000 150 149 L 40 40 1 1 B
|
||||
X CLK_CCO/TIM1_CH4/PC4 21 1000 -500 149 L 40 40 1 1 B
|
||||
X PD6/UART1_RX 31 -1000 50 149 R 40 40 1 1 B
|
||||
X I2C_SCL/PB4 12 1000 250 149 L 40 40 1 1 B
|
||||
X SPI_SCK/PC5 22 1000 -600 149 L 40 40 1 1 B
|
||||
X PD7/TLI[TIM1_CH4] 32 -1000 -50 148 R 40 40 1 1 B
|
||||
X TIM1_ETR/AIN3/PB3 13 1000 350 149 L 40 40 1 1 B
|
||||
X PI_MOSI/PC6 23 1000 -700 149 L 40 40 1 1 B
|
||||
X TIM1_CH3N/AIN2/PB2 14 1000 450 149 L 40 40 1 1 B
|
||||
X PI_MISO/PC7 24 1000 -800 149 L 40 40 1 1 B
|
||||
X TIM1_CH2N/AIN1/PB1 15 1000 550 149 L 40 40 1 1 B
|
||||
X PD0/TIM1_BKIN[CLK_CCO] 25 -1000 650 148 R 40 40 1 1 B
|
||||
X TIM1_CH1N/AIN0/PB0 16 1000 650 149 L 40 40 1 1 B
|
||||
X PD1/SWIM 26 -1000 550 149 R 40 40 1 1 B
|
||||
X PE5/SPI_NSS 17 -1000 -200 148 R 40 40 1 1 B
|
||||
X PD2[TIM2_CH3] 27 -1000 450 149 R 40 40 1 1 B
|
||||
X UART1_CK/TIM1_CH1/PC1 18 1000 -200 149 L 40 40 1 1 B
|
||||
X PD3/ADC_ETR/TIM2_CH2 28 -1000 350 149 R 40 40 1 1 B
|
||||
X TIM1_CH2/PC2 19 1000 -300 149 L 40 40 1 1 B
|
||||
X PD4/BEEP/TIM2_CH1 29 -1000 250 149 R 40 40 1 1 B
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# STM8S105K4T6C
|
||||
#
|
||||
DEF STM8S105K4T6C U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 1050 60 H V C CNN
|
||||
F1 "STM8S105K4T6C" 50 -850 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS stm8s105*
|
||||
$FPLIST
|
||||
lqfp32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -1100 950 1100 -750 0 1 0 N
|
||||
X NRST 1 -1400 850 300 R 50 50 1 1 I
|
||||
X OSCIN/PA1 2 -1400 750 300 R 50 50 1 1 T
|
||||
X OSCOUT/PA2 3 -1400 650 300 R 50 50 1 1 T
|
||||
X VSS 4 -1400 550 300 R 50 50 1 1 W
|
||||
X VCAP 5 -1400 450 300 R 50 50 1 1 w
|
||||
X VDD(3.3-5v) 6 -1400 350 300 R 50 50 1 1 W
|
||||
X VDDio 7 -1400 250 300 R 50 50 1 1 W
|
||||
X PF4/AIN12 8 -1400 150 300 R 50 50 1 1 T
|
||||
X VDDA 9 -1400 50 300 R 50 50 1 1 W
|
||||
X VSSA 10 -1400 -50 300 R 50 50 1 1 W
|
||||
X PC3(HS)/TIM1_CH3 20 1400 -350 300 L 50 50 1 1 T
|
||||
X PD5/UART2_TX 30 1400 650 300 L 50 50 1 1 T
|
||||
X PB5/AIN5[I2X_SDA] 11 -1400 -150 300 R 50 50 1 1 T
|
||||
X PC4(HS)/TIM1_CH4 21 1400 -250 300 L 50 50 1 1 T
|
||||
X PD6/UART2_RX 31 1400 750 300 L 50 50 1 1 T
|
||||
X PB4/AIN4[I2C_SCL] 12 -1400 -250 300 R 50 50 1 1 T
|
||||
X PC5(HS)/SPI_SCK 22 1400 -150 300 L 50 50 1 1 T
|
||||
X PD7/TLI[TIM1_CH4] 32 1400 850 300 L 50 50 1 1 T
|
||||
X PB3/AIN3[TIM1_ETR] 13 -1400 -350 300 R 50 50 1 1 T
|
||||
X PC6(HS)/SPI_MOSI 23 1400 -50 300 L 50 50 1 1 T
|
||||
X PB2/AIN2[TIM1_CH3N] 14 -1400 -450 300 R 50 50 1 1 T
|
||||
X PC7(HS)/SPI_MISO 24 1400 50 300 L 50 50 1 1 T
|
||||
X PB1/AIN1_[TIM1_CH2N] 15 -1400 -550 300 R 50 50 1 1 T
|
||||
X PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO] 25 1400 150 300 L 50 50 1 1 T
|
||||
X PB0/AIN0_[TIM1_CH1N] 16 -1400 -650 300 R 50 50 1 1 T
|
||||
X PD1(HS)/SWIM 26 1400 250 300 L 50 50 1 1 T
|
||||
X PE5/SPI_NSS 17 1400 -650 300 L 50 50 1 1 T
|
||||
X PD2(HS)/TIM3_CH1[TIM2_CH3] 27 1400 350 300 L 50 50 1 1 T
|
||||
X PC1(HS)/TIM1_CH1 18 1400 -550 300 L 50 50 1 1 T
|
||||
X PD3(HS)/TIM2_CH2[ADC_ETR] 28 1400 450 300 L 50 50 1 1 T
|
||||
X PC2(HS)/TIM1_CH2 19 1400 -450 300 L 50 50 1 1 T
|
||||
X PD4(HS)/TIM2_CH1[BEEP] 29 1400 550 300 L 50 50 1 1 T
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
204
stepper/schematic/template-cache.lib
Normal file
204
stepper/schematic/template-cache.lib
Normal file
@@ -0,0 +1,204 @@
|
||||
EESchema-LIBRARY Version 2.3 Date: Ср 12 фев 2014 11:37:03
|
||||
#encoding utf-8
|
||||
#
|
||||
# +3.3V
|
||||
#
|
||||
DEF +3.3V #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -40 30 H I C CNN
|
||||
F1 "+3.3V" 0 110 30 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS +3,3V
|
||||
DRAW
|
||||
X +3.3V 1 0 0 0 U 30 30 0 0 W N
|
||||
C 0 60 20 0 1 0 N
|
||||
P 3 0 1 0 0 0 0 40 0 40 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# C
|
||||
#
|
||||
DEF C C 0 10 N Y 1 F N
|
||||
F0 "C" 0 100 40 H V L CNN
|
||||
F1 "C" 6 -85 40 H V L CNN
|
||||
F2 "~" 38 -150 30 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
SM*
|
||||
C?
|
||||
C1-1
|
||||
$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 200 170 D 40 40 1 1 P
|
||||
X ~ 2 0 -200 170 U 40 40 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_14
|
||||
#
|
||||
DEF CONN_14 P 0 40 Y N 1 F N
|
||||
F0 "P" -30 0 60 V V C CNN
|
||||
F1 "CONN_14" 80 0 60 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 700 150 -700 0 1 0 N
|
||||
X P1 1 -350 650 250 R 50 50 1 1 P I
|
||||
X P2 2 -350 550 250 R 50 50 1 1 P I
|
||||
X P3 3 -350 450 250 R 50 50 1 1 P I
|
||||
X P4 4 -350 350 250 R 50 50 1 1 P I
|
||||
X P5 5 -350 250 250 R 50 50 1 1 P I
|
||||
X P6 6 -350 150 250 R 50 50 1 1 P I
|
||||
X P7 7 -350 50 250 R 50 50 1 1 P I
|
||||
X P8 8 -350 -50 250 R 50 50 1 1 P I
|
||||
X P9 9 -350 -150 250 R 50 50 1 1 P I
|
||||
X P10 10 -350 -250 250 R 50 50 1 1 P I
|
||||
X P11 11 -350 -350 250 R 50 50 1 1 P I
|
||||
X P12 12 -350 -450 250 R 50 50 1 1 P I
|
||||
X P13 13 -350 -550 250 R 50 50 1 1 P I
|
||||
X P14 14 -350 -650 250 R 50 50 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_4
|
||||
#
|
||||
DEF CONN_4 P 0 40 Y N 1 F N
|
||||
F0 "P" -50 0 50 V V C CNN
|
||||
F1 "CONN_4" 50 0 50 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 200 100 -200 0 1 0 N
|
||||
X P1 1 -350 150 250 R 50 50 1 1 P I
|
||||
X P2 2 -350 50 250 R 50 50 1 1 P I
|
||||
X P3 3 -350 -50 250 R 50 50 1 1 P I
|
||||
X P4 4 -350 -150 250 R 50 50 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# GND
|
||||
#
|
||||
DEF ~GND #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 0 30 H I C CNN
|
||||
F1 "GND" 0 -70 30 H I C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N
|
||||
X GND 1 0 0 0 U 30 30 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# LED
|
||||
#
|
||||
DEF LED D 0 40 Y N 1 F N
|
||||
F0 "D" 0 100 50 H V C CNN
|
||||
F1 "LED" 0 -100 50 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
LED-3MM
|
||||
LED-5MM
|
||||
LED-10MM
|
||||
LED-0603
|
||||
LED-0805
|
||||
LED-1206
|
||||
LEDV
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 0 50 50 50 -50 N
|
||||
P 3 0 1 0 -50 50 50 0 -50 -50 F
|
||||
P 3 0 1 0 65 -40 110 -80 105 -55 N
|
||||
P 3 0 1 0 80 -25 125 -65 120 -40 N
|
||||
X A 1 -200 0 150 R 40 40 1 1 P
|
||||
X K 2 200 0 150 L 40 40 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# R
|
||||
#
|
||||
DEF R R 0 0 N Y 1 F N
|
||||
F0 "R" 80 0 40 V V C CNN
|
||||
F1 "R" 7 1 40 V V C CNN
|
||||
F2 "~" -70 0 30 V V C CNN
|
||||
F3 "~" 0 0 30 H V C CNN
|
||||
$FPLIST
|
||||
R?
|
||||
SM0603
|
||||
SM0805
|
||||
R?-*
|
||||
SM1206
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -40 150 40 -150 0 1 12 N
|
||||
X ~ 1 0 250 100 D 60 60 1 1 P
|
||||
X ~ 2 0 -250 100 U 60 60 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# STM8S105K4T6C
|
||||
#
|
||||
DEF STM8S105K4T6C U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 1050 60 H V C CNN
|
||||
F1 "STM8S105K4T6C" 50 -850 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS stm8s105*
|
||||
$FPLIST
|
||||
lqfp32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -1100 950 1100 -750 0 1 0 N
|
||||
X NRST 1 -1400 850 300 R 50 50 1 1 I
|
||||
X OSCIN/PA1 2 -1400 750 300 R 50 50 1 1 T
|
||||
X OSCOUT/PA2 3 -1400 650 300 R 50 50 1 1 T
|
||||
X VSS 4 -1400 550 300 R 50 50 1 1 W
|
||||
X VCAP 5 -1400 450 300 R 50 50 1 1 w
|
||||
X VDD(3.3-5v) 6 -1400 350 300 R 50 50 1 1 W
|
||||
X VDDio 7 -1400 250 300 R 50 50 1 1 W
|
||||
X PF4/AIN12 8 -1400 150 300 R 50 50 1 1 T
|
||||
X VDDA 9 -1400 50 300 R 50 50 1 1 W
|
||||
X VSSA 10 -1400 -50 300 R 50 50 1 1 W
|
||||
X PC3(HS)/TIM1_CH3 20 1400 -350 300 L 50 50 1 1 T
|
||||
X PD5/UART2_TX 30 1400 650 300 L 50 50 1 1 T
|
||||
X PB5/AIN5[I2X_SDA] 11 -1400 -150 300 R 50 50 1 1 T
|
||||
X PC4(HS)/TIM1_CH4 21 1400 -250 300 L 50 50 1 1 T
|
||||
X PD6/UART2_RX 31 1400 750 300 L 50 50 1 1 T
|
||||
X PB4/AIN4[I2C_SCL] 12 -1400 -250 300 R 50 50 1 1 T
|
||||
X PC5(HS)/SPI_SCK 22 1400 -150 300 L 50 50 1 1 T
|
||||
X PD7/TLI[TIM1_CH4] 32 1400 850 300 L 50 50 1 1 T
|
||||
X PB3/AIN3[TIM1_ETR] 13 -1400 -350 300 R 50 50 1 1 T
|
||||
X PC6(HS)/SPI_MOSI 23 1400 -50 300 L 50 50 1 1 T
|
||||
X PB2/AIN2[TIM1_CH3N] 14 -1400 -450 300 R 50 50 1 1 T
|
||||
X PC7(HS)/SPI_MISO 24 1400 50 300 L 50 50 1 1 T
|
||||
X PB1/AIN1_[TIM1_CH2N] 15 -1400 -550 300 R 50 50 1 1 T
|
||||
X PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO] 25 1400 150 300 L 50 50 1 1 T
|
||||
X PB0/AIN0_[TIM1_CH1N] 16 -1400 -650 300 R 50 50 1 1 T
|
||||
X PD1(HS)/SWIM 26 1400 250 300 L 50 50 1 1 T
|
||||
X PE5/SPI_NSS 17 1400 -650 300 L 50 50 1 1 T
|
||||
X PD2(HS)/TIM3_CH1[TIM2_CH3] 27 1400 350 300 L 50 50 1 1 T
|
||||
X PC1(HS)/TIM1_CH1 18 1400 -550 300 L 50 50 1 1 T
|
||||
X PD3(HS)/TIM2_CH2[ADC_ETR] 28 1400 450 300 L 50 50 1 1 T
|
||||
X PC2(HS)/TIM1_CH2 19 1400 -450 300 L 50 50 1 1 T
|
||||
X PD4(HS)/TIM2_CH1[BEEP] 29 1400 550 300 L 50 50 1 1 T
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# SW_PUSH
|
||||
#
|
||||
DEF SW_PUSH SW 0 40 N N 1 F N
|
||||
F0 "SW" 150 110 50 H V C CNN
|
||||
F1 "SW_PUSH" 0 -80 50 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -170 50 170 60 0 1 0 N
|
||||
P 4 0 1 0 -40 60 -30 90 30 90 40 60 N
|
||||
X 1 1 -300 0 200 R 60 60 0 1 P I
|
||||
X 2 2 300 0 200 L 60 60 0 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
94
stepper/schematic/template.cmp
Normal file
94
stepper/schematic/template.cmp
Normal file
@@ -0,0 +1,94 @@
|
||||
Cmp-Mod V01 Created by CvPcb (2013-feb-26)-stable date = Ср 12 фев 2014 11:23:52
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0413;
|
||||
Reference = C1;
|
||||
ValeurCmp = 1u;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0426;
|
||||
Reference = C2;
|
||||
ValeurCmp = 104;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0F99;
|
||||
Reference = C3;
|
||||
ValeurCmp = 104;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0DD3;
|
||||
Reference = D1;
|
||||
ValeurCmp = LED;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0ECD;
|
||||
Reference = D2;
|
||||
ValeurCmp = LED;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A6A;
|
||||
Reference = P1;
|
||||
ValeurCmp = CONN_14;
|
||||
IdModule = SIL-14;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A49;
|
||||
Reference = P2;
|
||||
ValeurCmp = CONN_4;
|
||||
IdModule = SIL-4;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A79;
|
||||
Reference = P3;
|
||||
ValeurCmp = CONN_14;
|
||||
IdModule = SIL-14;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0DE2;
|
||||
Reference = R1;
|
||||
ValeurCmp = 1k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0ED3;
|
||||
Reference = R2;
|
||||
ValeurCmp = 1k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0EFD;
|
||||
Reference = R3;
|
||||
ValeurCmp = 10k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0F3B;
|
||||
Reference = SW1;
|
||||
ValeurCmp = SW_PUSH;
|
||||
IdModule = SM2010;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB03A2;
|
||||
Reference = U1;
|
||||
ValeurCmp = STM8S105K4T6C;
|
||||
IdModule = TQFP32;
|
||||
EndCmp
|
||||
|
||||
EndListe
|
||||
321
stepper/schematic/template.net
Normal file
321
stepper/schematic/template.net
Normal file
@@ -0,0 +1,321 @@
|
||||
(export (version D)
|
||||
(design
|
||||
(source /home/eddy/Docs/SAO/ELECTRONICS/STM8/stepper/schematic/kicad.sch)
|
||||
(date "Ср 12 фев 2014 11:38:18")
|
||||
(tool "eeschema (2013-feb-26)-stable"))
|
||||
(components
|
||||
(comp (ref U1)
|
||||
(value STM8S105K4T6C)
|
||||
(libsource (lib stm8s105k4t6c) (part STM8S105K4T6C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB03A2))
|
||||
(comp (ref C1)
|
||||
(value 1u)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0413))
|
||||
(comp (ref C2)
|
||||
(value 104)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0426))
|
||||
(comp (ref P2)
|
||||
(value CONN_4)
|
||||
(libsource (lib conn) (part CONN_4))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A49))
|
||||
(comp (ref P1)
|
||||
(value CONN_14)
|
||||
(libsource (lib conn) (part CONN_14))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A6A))
|
||||
(comp (ref P3)
|
||||
(value CONN_14)
|
||||
(libsource (lib conn) (part CONN_14))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A79))
|
||||
(comp (ref D1)
|
||||
(value LED)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0DD3))
|
||||
(comp (ref R1)
|
||||
(value 1k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0DE2))
|
||||
(comp (ref D2)
|
||||
(value LED)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0ECD))
|
||||
(comp (ref R2)
|
||||
(value 1k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0ED3))
|
||||
(comp (ref R3)
|
||||
(value 10k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0EFD))
|
||||
(comp (ref SW1)
|
||||
(value SW_PUSH)
|
||||
(libsource (lib device) (part SW_PUSH))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0F3B))
|
||||
(comp (ref C3)
|
||||
(value 104)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0F99)))
|
||||
(libparts
|
||||
(libpart (lib device) (part C)
|
||||
(description "Condensateur non polarise")
|
||||
(footprints
|
||||
(fp SM*)
|
||||
(fp C?)
|
||||
(fp C1-1))
|
||||
(fields
|
||||
(field (name Reference) C)
|
||||
(field (name Value) C)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib device) (part LED)
|
||||
(footprints
|
||||
(fp LED-3MM)
|
||||
(fp LED-5MM)
|
||||
(fp LED-10MM)
|
||||
(fp LED-0603)
|
||||
(fp LED-0805)
|
||||
(fp LED-1206)
|
||||
(fp LEDV))
|
||||
(fields
|
||||
(field (name Reference) D)
|
||||
(field (name Value) LED)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name A) (type passive))
|
||||
(pin (num 2) (name K) (type passive))))
|
||||
(libpart (lib device) (part R)
|
||||
(description Resistance)
|
||||
(footprints
|
||||
(fp R?)
|
||||
(fp SM0603)
|
||||
(fp SM0805)
|
||||
(fp R?-*)
|
||||
(fp SM1206))
|
||||
(fields
|
||||
(field (name Reference) R)
|
||||
(field (name Value) R)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib device) (part SW_PUSH)
|
||||
(description "Push Button")
|
||||
(fields
|
||||
(field (name Reference) SW)
|
||||
(field (name Value) SW_PUSH)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))))
|
||||
(libpart (lib conn) (part CONN_14)
|
||||
(description "Symbole general de connexion")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_14))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))
|
||||
(pin (num 5) (name P5) (type passive))
|
||||
(pin (num 6) (name P6) (type passive))
|
||||
(pin (num 7) (name P7) (type passive))
|
||||
(pin (num 8) (name P8) (type passive))
|
||||
(pin (num 9) (name P9) (type passive))
|
||||
(pin (num 10) (name P10) (type passive))
|
||||
(pin (num 11) (name P11) (type passive))
|
||||
(pin (num 12) (name P12) (type passive))
|
||||
(pin (num 13) (name P13) (type passive))
|
||||
(pin (num 14) (name P14) (type passive))))
|
||||
(libpart (lib conn) (part CONN_4)
|
||||
(description "Symbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_4))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))))
|
||||
(libpart (lib stm8s105k4t6c) (part STM8S105K4T6C)
|
||||
(footprints
|
||||
(fp lqfp32*))
|
||||
(fields
|
||||
(field (name Reference) U)
|
||||
(field (name Value) STM8S105K4T6C)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name NRST) (type input))
|
||||
(pin (num 2) (name OSCIN/PA1) (type 3state))
|
||||
(pin (num 3) (name OSCOUT/PA2) (type 3state))
|
||||
(pin (num 4) (name VSS) (type power_in))
|
||||
(pin (num 5) (name VCAP) (type power_out))
|
||||
(pin (num 6) (name "VDD(3.3-5v)") (type power_in))
|
||||
(pin (num 7) (name VDDio) (type power_in))
|
||||
(pin (num 8) (name PF4/AIN12) (type 3state))
|
||||
(pin (num 9) (name VDDA) (type power_in))
|
||||
(pin (num 10) (name VSSA) (type power_in))
|
||||
(pin (num 11) (name PB5/AIN5[I2X_SDA]) (type 3state))
|
||||
(pin (num 12) (name PB4/AIN4[I2C_SCL]) (type 3state))
|
||||
(pin (num 13) (name PB3/AIN3[TIM1_ETR]) (type 3state))
|
||||
(pin (num 14) (name PB2/AIN2[TIM1_CH3N]) (type 3state))
|
||||
(pin (num 15) (name PB1/AIN1_[TIM1_CH2N]) (type 3state))
|
||||
(pin (num 16) (name PB0/AIN0_[TIM1_CH1N]) (type 3state))
|
||||
(pin (num 17) (name PE5/SPI_NSS) (type 3state))
|
||||
(pin (num 18) (name "PC1(HS)/TIM1_CH1") (type 3state))
|
||||
(pin (num 19) (name "PC2(HS)/TIM1_CH2") (type 3state))
|
||||
(pin (num 20) (name "PC3(HS)/TIM1_CH3") (type 3state))
|
||||
(pin (num 21) (name "PC4(HS)/TIM1_CH4") (type 3state))
|
||||
(pin (num 22) (name "PC5(HS)/SPI_SCK") (type 3state))
|
||||
(pin (num 23) (name "PC6(HS)/SPI_MOSI") (type 3state))
|
||||
(pin (num 24) (name "PC7(HS)/SPI_MISO") (type 3state))
|
||||
(pin (num 25) (name "PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO]") (type 3state))
|
||||
(pin (num 26) (name "PD1(HS)/SWIM") (type 3state))
|
||||
(pin (num 27) (name "PD2(HS)/TIM3_CH1[TIM2_CH3]") (type 3state))
|
||||
(pin (num 28) (name "PD3(HS)/TIM2_CH2[ADC_ETR]") (type 3state))
|
||||
(pin (num 29) (name "PD4(HS)/TIM2_CH1[BEEP]") (type 3state))
|
||||
(pin (num 30) (name PD5/UART2_TX) (type 3state))
|
||||
(pin (num 31) (name PD6/UART2_RX) (type 3state))
|
||||
(pin (num 32) (name PD7/TLI[TIM1_CH4]) (type 3state)))))
|
||||
(libraries
|
||||
(library (logical device)
|
||||
(uri /usr/share/kicad/library/device.lib))
|
||||
(library (logical conn)
|
||||
(uri /usr/share/kicad/library/conn.lib))
|
||||
(library (logical stm8s105k4t6c)
|
||||
(uri stm8s105k4t6c.lib)))
|
||||
(nets
|
||||
(net (code 1) (name +3.3V)
|
||||
(node (ref P1) (pin 1))
|
||||
(node (ref P2) (pin 1))
|
||||
(node (ref U1) (pin 9))
|
||||
(node (ref U1) (pin 7))
|
||||
(node (ref U1) (pin 6))
|
||||
(node (ref C2) (pin 2))
|
||||
(node (ref D2) (pin 1))
|
||||
(node (ref R3) (pin 1))
|
||||
(node (ref D1) (pin 1)))
|
||||
(net (code 2) (name "")
|
||||
(node (ref D1) (pin 2))
|
||||
(node (ref R1) (pin 1)))
|
||||
(net (code 3) (name /PD4)
|
||||
(node (ref U1) (pin 29))
|
||||
(node (ref P3) (pin 4)))
|
||||
(net (code 4) (name /PD3)
|
||||
(node (ref P3) (pin 5))
|
||||
(node (ref U1) (pin 28)))
|
||||
(net (code 5) (name /PD2)
|
||||
(node (ref U1) (pin 27))
|
||||
(node (ref P3) (pin 6)))
|
||||
(net (code 6) (name /SWIM/PD1)
|
||||
(node (ref U1) (pin 26))
|
||||
(node (ref P3) (pin 7))
|
||||
(node (ref P2) (pin 2)))
|
||||
(net (code 7) (name /PD0)
|
||||
(node (ref P3) (pin 8))
|
||||
(node (ref U1) (pin 25)))
|
||||
(net (code 8) (name /PC7)
|
||||
(node (ref P3) (pin 9))
|
||||
(node (ref U1) (pin 24)))
|
||||
(net (code 9) (name /PC6)
|
||||
(node (ref U1) (pin 23))
|
||||
(node (ref P3) (pin 10)))
|
||||
(net (code 10) (name /PC5)
|
||||
(node (ref P3) (pin 11))
|
||||
(node (ref U1) (pin 22)))
|
||||
(net (code 11) (name /PC4)
|
||||
(node (ref P3) (pin 12))
|
||||
(node (ref U1) (pin 21)))
|
||||
(net (code 12) (name /PC3)
|
||||
(node (ref U1) (pin 20))
|
||||
(node (ref P3) (pin 13)))
|
||||
(net (code 13) (name /PC2)
|
||||
(node (ref P3) (pin 14))
|
||||
(node (ref U1) (pin 19))
|
||||
(node (ref R1) (pin 2)))
|
||||
(net (code 14) (name GND)
|
||||
(node (ref P2) (pin 4))
|
||||
(node (ref C1) (pin 1))
|
||||
(node (ref C2) (pin 1))
|
||||
(node (ref U1) (pin 10))
|
||||
(node (ref U1) (pin 4))
|
||||
(node (ref R2) (pin 2))
|
||||
(node (ref SW1) (pin 1))
|
||||
(node (ref C3) (pin 2))
|
||||
(node (ref P1) (pin 2)))
|
||||
(net (code 15) (name "")
|
||||
(node (ref R2) (pin 1))
|
||||
(node (ref D2) (pin 2)))
|
||||
(net (code 16) (name /PD5)
|
||||
(node (ref P3) (pin 3))
|
||||
(node (ref U1) (pin 30)))
|
||||
(net (code 17) (name "")
|
||||
(node (ref C1) (pin 2))
|
||||
(node (ref U1) (pin 5)))
|
||||
(net (code 18) (name /OSC2IN)
|
||||
(node (ref P1) (pin 5))
|
||||
(node (ref U1) (pin 3)))
|
||||
(net (code 19) (name /NRST)
|
||||
(node (ref U1) (pin 1))
|
||||
(node (ref R3) (pin 2))
|
||||
(node (ref SW1) (pin 2))
|
||||
(node (ref C3) (pin 1))
|
||||
(node (ref P1) (pin 3))
|
||||
(node (ref P2) (pin 3)))
|
||||
(net (code 20) (name /OSC1IN)
|
||||
(node (ref U1) (pin 2))
|
||||
(node (ref P1) (pin 4)))
|
||||
(net (code 21) (name /PF4)
|
||||
(node (ref P1) (pin 6))
|
||||
(node (ref U1) (pin 8)))
|
||||
(net (code 22) (name /PB5)
|
||||
(node (ref P1) (pin 7))
|
||||
(node (ref U1) (pin 11)))
|
||||
(net (code 23) (name /PB4)
|
||||
(node (ref P1) (pin 8))
|
||||
(node (ref U1) (pin 12)))
|
||||
(net (code 24) (name /PB3)
|
||||
(node (ref U1) (pin 13))
|
||||
(node (ref P1) (pin 9)))
|
||||
(net (code 25) (name /PB2)
|
||||
(node (ref P1) (pin 10))
|
||||
(node (ref U1) (pin 14)))
|
||||
(net (code 26) (name /PB1)
|
||||
(node (ref P1) (pin 11))
|
||||
(node (ref U1) (pin 15)))
|
||||
(net (code 27) (name /PB0)
|
||||
(node (ref P1) (pin 12))
|
||||
(node (ref U1) (pin 16)))
|
||||
(net (code 28) (name /PE5)
|
||||
(node (ref P1) (pin 13))
|
||||
(node (ref U1) (pin 17)))
|
||||
(net (code 29) (name /PC1)
|
||||
(node (ref P1) (pin 14))
|
||||
(node (ref U1) (pin 18)))
|
||||
(net (code 30) (name /PD7)
|
||||
(node (ref U1) (pin 32))
|
||||
(node (ref P3) (pin 1)))
|
||||
(net (code 31) (name /PD6)
|
||||
(node (ref U1) (pin 31))
|
||||
(node (ref P3) (pin 2)))))
|
||||
518
stepper/schematic/template.sch
Normal file
518
stepper/schematic/template.sch
Normal file
@@ -0,0 +1,518 @@
|
||||
EESchema Schematic File Version 2 date Ср 12 фев 2014 11:37:03
|
||||
LIBS:power
|
||||
LIBS:device
|
||||
LIBS:transistors
|
||||
LIBS:conn
|
||||
LIBS:linear
|
||||
LIBS:regul
|
||||
LIBS:74xx
|
||||
LIBS:cmos4000
|
||||
LIBS:adc-dac
|
||||
LIBS:memory
|
||||
LIBS:xilinx
|
||||
LIBS:special
|
||||
LIBS:microcontrollers
|
||||
LIBS:dsp
|
||||
LIBS:microchip
|
||||
LIBS:analog_switches
|
||||
LIBS:motorola
|
||||
LIBS:texas
|
||||
LIBS:intel
|
||||
LIBS:audio
|
||||
LIBS:interface
|
||||
LIBS:digital-audio
|
||||
LIBS:philips
|
||||
LIBS:display
|
||||
LIBS:cypress
|
||||
LIBS:siliconi
|
||||
LIBS:opto
|
||||
LIBS:atmel
|
||||
LIBS:contrib
|
||||
LIBS:valves
|
||||
LIBS:stm8
|
||||
LIBS:st-microelectronics
|
||||
LIBS:stm8s105k4t6c
|
||||
LIBS:kicad-cache
|
||||
EELAYER 27 0
|
||||
EELAYER END
|
||||
$Descr A4 11693 8268
|
||||
encoding utf-8
|
||||
Sheet 1 1
|
||||
Title ""
|
||||
Date "12 feb 2014"
|
||||
Rev ""
|
||||
Comp ""
|
||||
Comment1 ""
|
||||
Comment2 ""
|
||||
Comment3 ""
|
||||
Comment4 ""
|
||||
$EndDescr
|
||||
$Comp
|
||||
L STM8S105K4T6C U1
|
||||
U 1 1 52FB03A2
|
||||
P 4400 3100
|
||||
F 0 "U1" H 4400 4150 60 0000 C CNN
|
||||
F 1 "STM8S105K4T6C" H 4450 2250 60 0000 C CNN
|
||||
F 2 "~" H 4400 3100 60 0000 C CNN
|
||||
F 3 "~" H 4400 3100 60 0000 C CNN
|
||||
1 4400 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR01
|
||||
U 1 1 52FB03EF
|
||||
P 2750 3200
|
||||
F 0 "#PWR01" H 2750 3200 30 0001 C CNN
|
||||
F 1 "GND" H 2750 3130 30 0001 C CNN
|
||||
F 2 "" H 2750 3200 60 0000 C CNN
|
||||
F 3 "" H 2750 3200 60 0000 C CNN
|
||||
1 2750 3200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2750 3200 2750 3150
|
||||
Wire Wire Line
|
||||
2750 3150 3000 3150
|
||||
$Comp
|
||||
L GND #PWR02
|
||||
U 1 1 52FB0400
|
||||
P 2750 2600
|
||||
F 0 "#PWR02" H 2750 2600 30 0001 C CNN
|
||||
F 1 "GND" H 2750 2530 30 0001 C CNN
|
||||
F 2 "" H 2750 2600 60 0000 C CNN
|
||||
F 3 "" H 2750 2600 60 0000 C CNN
|
||||
1 2750 2600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2750 2600 2750 2550
|
||||
Wire Wire Line
|
||||
2750 2550 3000 2550
|
||||
$Comp
|
||||
L C C1
|
||||
U 1 1 52FB0413
|
||||
P 2250 2700
|
||||
F 0 "C1" H 2300 2800 50 0000 L CNN
|
||||
F 1 "1u" H 2300 2600 50 0000 L CNN
|
||||
F 2 "" H 2250 2700 60 0000 C CNN
|
||||
F 3 "" H 2250 2700 60 0000 C CNN
|
||||
1 2250 2700
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L C C2
|
||||
U 1 1 52FB0426
|
||||
P 2250 2950
|
||||
F 0 "C2" H 2300 3050 50 0000 L CNN
|
||||
F 1 "104" H 2300 2850 50 0000 L CNN
|
||||
F 2 "" H 2250 2950 60 0000 C CNN
|
||||
F 3 "" H 2250 2950 60 0000 C CNN
|
||||
1 2250 2950
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2450 2700 2850 2700
|
||||
Wire Wire Line
|
||||
2850 2700 2850 2650
|
||||
Wire Wire Line
|
||||
2850 2650 3000 2650
|
||||
Wire Wire Line
|
||||
3000 2750 3000 2850
|
||||
Wire Wire Line
|
||||
2450 2950 2450 2850
|
||||
Wire Wire Line
|
||||
2450 2850 3000 2850
|
||||
Wire Wire Line
|
||||
2050 2700 2050 3100
|
||||
$Comp
|
||||
L GND #PWR03
|
||||
U 1 1 52FB0453
|
||||
P 2050 3100
|
||||
F 0 "#PWR03" H 2050 3100 30 0001 C CNN
|
||||
F 1 "GND" H 2050 3030 30 0001 C CNN
|
||||
F 2 "" H 2050 3100 60 0000 C CNN
|
||||
F 3 "" H 2050 3100 60 0000 C CNN
|
||||
1 2050 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Connection ~ 2050 2800
|
||||
Connection ~ 2050 2950
|
||||
Text Label 3000 2250 2 60 ~ 0
|
||||
NRST
|
||||
Text Label 3000 2350 2 60 ~ 0
|
||||
OSC1IN
|
||||
Text Label 3000 2450 2 60 ~ 0
|
||||
OSC2IN
|
||||
Text Label 3000 2950 2 60 ~ 0
|
||||
PF4
|
||||
Text Label 3000 3250 2 60 ~ 0
|
||||
PB5
|
||||
Text Label 3000 3350 2 60 ~ 0
|
||||
PB4
|
||||
Text Label 3000 3450 2 60 ~ 0
|
||||
PB3
|
||||
Text Label 3000 3550 2 60 ~ 0
|
||||
PB2
|
||||
Text Label 3000 3650 2 60 ~ 0
|
||||
PB1
|
||||
Text Label 3000 3750 2 60 ~ 0
|
||||
PB0
|
||||
Text Label 5800 3750 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 5800 3650 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 5800 3550 0 60 ~ 0
|
||||
PC2
|
||||
Text Label 5800 3450 0 60 ~ 0
|
||||
PC3
|
||||
Text Label 5800 3350 0 60 ~ 0
|
||||
PC4
|
||||
Text Label 5800 3250 0 60 ~ 0
|
||||
PC5
|
||||
Text Label 5800 3150 0 60 ~ 0
|
||||
PC6
|
||||
Text Label 5800 3050 0 60 ~ 0
|
||||
PC7
|
||||
Text Label 5800 2950 0 60 ~ 0
|
||||
PD0
|
||||
Text Label 5800 2850 0 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 5800 2750 0 60 ~ 0
|
||||
PD2
|
||||
Text Label 5800 2650 0 60 ~ 0
|
||||
PD3
|
||||
Text Label 5800 2550 0 60 ~ 0
|
||||
PD4
|
||||
Text Label 5800 2450 0 60 ~ 0
|
||||
PD5
|
||||
Text Label 5800 2350 0 60 ~ 0
|
||||
PD6
|
||||
Text Label 5800 2250 0 60 ~ 0
|
||||
PD7
|
||||
$Comp
|
||||
L CONN_4 P2
|
||||
U 1 1 52FB0A49
|
||||
P 4350 1000
|
||||
F 0 "P2" V 4300 1000 50 0000 C CNN
|
||||
F 1 "CONN_4" V 4400 1000 50 0000 C CNN
|
||||
F 2 "" H 4350 1000 60 0000 C CNN
|
||||
F 3 "" H 4350 1000 60 0000 C CNN
|
||||
1 4350 1000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_14 P1
|
||||
U 1 1 52FB0A6A
|
||||
P 1250 1500
|
||||
F 0 "P1" V 1220 1500 60 0000 C CNN
|
||||
F 1 "CONN_14" V 1330 1500 60 0000 C CNN
|
||||
F 2 "" H 1250 1500 60 0000 C CNN
|
||||
F 3 "" H 1250 1500 60 0000 C CNN
|
||||
1 1250 1500
|
||||
-1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_14 P3
|
||||
U 1 1 52FB0A79
|
||||
P 7100 1500
|
||||
F 0 "P3" V 7070 1500 60 0000 C CNN
|
||||
F 1 "CONN_14" V 7180 1500 60 0000 C CNN
|
||||
F 2 "" H 7100 1500 60 0000 C CNN
|
||||
F 3 "" H 7100 1500 60 0000 C CNN
|
||||
1 7100 1500
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Text Label 1600 1150 0 60 ~ 0
|
||||
OSC1IN
|
||||
Text Label 1600 1250 0 60 ~ 0
|
||||
OSC2IN
|
||||
Text Label 1600 1350 0 60 ~ 0
|
||||
PF4
|
||||
Text Label 1600 1450 0 60 ~ 0
|
||||
PB5
|
||||
Text Label 1600 1550 0 60 ~ 0
|
||||
PB4
|
||||
Text Label 1600 1650 0 60 ~ 0
|
||||
PB3
|
||||
Text Label 1600 1750 0 60 ~ 0
|
||||
PB2
|
||||
Text Label 1600 1850 0 60 ~ 0
|
||||
PB1
|
||||
Text Label 1600 1950 0 60 ~ 0
|
||||
PB0
|
||||
Text Label 1600 2050 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 1600 2150 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 1600 1050 0 60 ~ 0
|
||||
NRST
|
||||
Text Label 4000 950 2 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 4000 1050 2 60 ~ 0
|
||||
NRST
|
||||
Text Label 6750 850 2 60 ~ 0
|
||||
PD7
|
||||
Text Label 6750 950 2 60 ~ 0
|
||||
PD6
|
||||
Text Label 6750 1050 2 60 ~ 0
|
||||
PD5
|
||||
Text Label 6750 1150 2 60 ~ 0
|
||||
PD4
|
||||
Text Label 6750 1250 2 60 ~ 0
|
||||
PD3
|
||||
Text Label 6750 1350 2 60 ~ 0
|
||||
PD2
|
||||
Text Label 6750 1450 2 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 6750 1550 2 60 ~ 0
|
||||
PD0
|
||||
Text Label 6750 1650 2 60 ~ 0
|
||||
PC7
|
||||
Text Label 6750 1750 2 60 ~ 0
|
||||
PC6
|
||||
Text Label 6750 1850 2 60 ~ 0
|
||||
PC5
|
||||
Text Label 6750 1950 2 60 ~ 0
|
||||
PC4
|
||||
Text Label 6750 2050 2 60 ~ 0
|
||||
PC3
|
||||
Text Label 6750 2150 2 60 ~ 0
|
||||
PC2
|
||||
$Comp
|
||||
L +3.3V #PWR04
|
||||
U 1 1 52FB0DC4
|
||||
P 950 2800
|
||||
F 0 "#PWR04" H 950 2760 30 0001 C CNN
|
||||
F 1 "+3.3V" H 950 2910 30 0000 C CNN
|
||||
F 2 "" H 950 2800 60 0000 C CNN
|
||||
F 3 "" H 950 2800 60 0000 C CNN
|
||||
1 950 2800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D1
|
||||
U 1 1 52FB0DD3
|
||||
P 950 3100
|
||||
F 0 "D1" H 950 3200 50 0000 C CNN
|
||||
F 1 "LED" H 950 3000 50 0000 C CNN
|
||||
F 2 "" H 950 3100 60 0000 C CNN
|
||||
F 3 "" H 950 3100 60 0000 C CNN
|
||||
1 950 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R1
|
||||
U 1 1 52FB0DE2
|
||||
P 950 3600
|
||||
F 0 "R1" V 1030 3600 50 0000 C CNN
|
||||
F 1 "1k" V 950 3600 50 0000 C CNN
|
||||
F 2 "" H 950 3600 60 0000 C CNN
|
||||
F 3 "" H 950 3600 60 0000 C CNN
|
||||
1 950 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
950 2800 950 2900
|
||||
Wire Wire Line
|
||||
950 3300 950 3350
|
||||
Wire Wire Line
|
||||
950 3850 950 3950
|
||||
$Comp
|
||||
L +3.3V #PWR05
|
||||
U 1 1 52FB0EC7
|
||||
P 1300 2800
|
||||
F 0 "#PWR05" H 1300 2760 30 0001 C CNN
|
||||
F 1 "+3.3V" H 1300 2910 30 0000 C CNN
|
||||
F 2 "" H 1300 2800 60 0000 C CNN
|
||||
F 3 "" H 1300 2800 60 0000 C CNN
|
||||
1 1300 2800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D2
|
||||
U 1 1 52FB0ECD
|
||||
P 1300 3100
|
||||
F 0 "D2" H 1300 3200 50 0000 C CNN
|
||||
F 1 "LED" H 1300 3000 50 0000 C CNN
|
||||
F 2 "" H 1300 3100 60 0000 C CNN
|
||||
F 3 "" H 1300 3100 60 0000 C CNN
|
||||
1 1300 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R2
|
||||
U 1 1 52FB0ED3
|
||||
P 1300 3600
|
||||
F 0 "R2" V 1380 3600 50 0000 C CNN
|
||||
F 1 "1k" V 1300 3600 50 0000 C CNN
|
||||
F 2 "" H 1300 3600 60 0000 C CNN
|
||||
F 3 "" H 1300 3600 60 0000 C CNN
|
||||
1 1300 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR06
|
||||
U 1 1 52FB0ED9
|
||||
P 1300 3950
|
||||
F 0 "#PWR06" H 1300 3950 30 0001 C CNN
|
||||
F 1 "GND" H 1300 3880 30 0001 C CNN
|
||||
F 2 "" H 1300 3950 60 0000 C CNN
|
||||
F 3 "" H 1300 3950 60 0000 C CNN
|
||||
1 1300 3950
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1300 2800 1300 2900
|
||||
Wire Wire Line
|
||||
1300 3300 1300 3350
|
||||
Wire Wire Line
|
||||
1300 3850 1300 3950
|
||||
Text Label 950 3950 2 60 ~ 0
|
||||
PC2
|
||||
$Comp
|
||||
L +3.3V #PWR07
|
||||
U 1 1 52FB0EF1
|
||||
P 6500 2550
|
||||
F 0 "#PWR07" H 6500 2510 30 0001 C CNN
|
||||
F 1 "+3.3V" H 6500 2660 30 0000 C CNN
|
||||
F 2 "" H 6500 2550 60 0000 C CNN
|
||||
F 3 "" H 6500 2550 60 0000 C CNN
|
||||
1 6500 2550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R3
|
||||
U 1 1 52FB0EFD
|
||||
P 6500 2900
|
||||
F 0 "R3" V 6580 2900 50 0000 C CNN
|
||||
F 1 "10k" V 6500 2900 50 0000 C CNN
|
||||
F 2 "" H 6500 2900 60 0000 C CNN
|
||||
F 3 "" H 6500 2900 60 0000 C CNN
|
||||
1 6500 2900
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR08
|
||||
U 1 1 52FB0F03
|
||||
P 6500 4050
|
||||
F 0 "#PWR08" H 6500 4050 30 0001 C CNN
|
||||
F 1 "GND" H 6500 3980 30 0001 C CNN
|
||||
F 2 "" H 6500 4050 60 0000 C CNN
|
||||
F 3 "" H 6500 4050 60 0000 C CNN
|
||||
1 6500 4050
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 2550 6500 2650
|
||||
Wire Wire Line
|
||||
6500 3850 6500 4050
|
||||
$Comp
|
||||
L SW_PUSH SW1
|
||||
U 1 1 52FB0F3B
|
||||
P 6500 3550
|
||||
F 0 "SW1" H 6650 3660 50 0000 C CNN
|
||||
F 1 "SW_PUSH" H 6500 3470 50 0000 C CNN
|
||||
F 2 "" H 6500 3550 60 0000 C CNN
|
||||
F 3 "" H 6500 3550 60 0000 C CNN
|
||||
1 6500 3550
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 3250 6500 3150
|
||||
$Comp
|
||||
L C C3
|
||||
U 1 1 52FB0F99
|
||||
P 6900 3550
|
||||
F 0 "C3" H 6950 3650 50 0000 L CNN
|
||||
F 1 "104" H 6950 3450 50 0000 L CNN
|
||||
F 2 "" H 6900 3550 60 0000 C CNN
|
||||
F 3 "" H 6900 3550 60 0000 C CNN
|
||||
1 6900 3550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6900 3200 6900 3350
|
||||
Wire Wire Line
|
||||
6900 3750 6900 3900
|
||||
Wire Wire Line
|
||||
6900 3900 6500 3900
|
||||
Connection ~ 6500 3900
|
||||
Wire Wire Line
|
||||
6500 3200 6900 3200
|
||||
Connection ~ 6500 3200
|
||||
Text Label 6500 3200 2 60 ~ 0
|
||||
NRST
|
||||
$Comp
|
||||
L +3.3V #PWR09
|
||||
U 1 1 52FB2273
|
||||
P 2150 850
|
||||
F 0 "#PWR09" H 2150 810 30 0001 C CNN
|
||||
F 1 "+3.3V" H 2150 960 30 0000 C CNN
|
||||
F 2 "" H 2150 850 60 0000 C CNN
|
||||
F 3 "" H 2150 850 60 0000 C CNN
|
||||
1 2150 850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 850 2150 850
|
||||
$Comp
|
||||
L GND #PWR010
|
||||
U 1 1 52FB2296
|
||||
P 2150 1000
|
||||
F 0 "#PWR010" H 2150 1000 30 0001 C CNN
|
||||
F 1 "GND" H 2150 930 30 0001 C CNN
|
||||
F 2 "" H 2150 1000 60 0000 C CNN
|
||||
F 3 "" H 2150 1000 60 0000 C CNN
|
||||
1 2150 1000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 950 2150 950
|
||||
Wire Wire Line
|
||||
2150 950 2150 1000
|
||||
Wire Wire Line
|
||||
2600 3050 3000 3050
|
||||
Wire Wire Line
|
||||
2750 3050 2750 2850
|
||||
Connection ~ 2750 2850
|
||||
$Comp
|
||||
L +3.3V #PWR011
|
||||
U 1 1 52FB26FA
|
||||
P 2600 3000
|
||||
F 0 "#PWR011" H 2600 2960 30 0001 C CNN
|
||||
F 1 "+3.3V" H 2600 3110 30 0000 C CNN
|
||||
F 2 "" H 2600 3000 60 0000 C CNN
|
||||
F 3 "" H 2600 3000 60 0000 C CNN
|
||||
1 2600 3000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2600 3000 2600 3050
|
||||
Connection ~ 2750 3050
|
||||
$Comp
|
||||
L +3.3V #PWR012
|
||||
U 1 1 52FB286D
|
||||
P 4000 750
|
||||
F 0 "#PWR012" H 4000 710 30 0001 C CNN
|
||||
F 1 "+3.3V" H 4000 860 30 0000 C CNN
|
||||
F 2 "" H 4000 750 60 0000 C CNN
|
||||
F 3 "" H 4000 750 60 0000 C CNN
|
||||
1 4000 750
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR013
|
||||
U 1 1 52FB287C
|
||||
P 4000 1300
|
||||
F 0 "#PWR013" H 4000 1300 30 0001 C CNN
|
||||
F 1 "GND" H 4000 1230 30 0001 C CNN
|
||||
F 2 "" H 4000 1300 60 0000 C CNN
|
||||
F 3 "" H 4000 1300 60 0000 C CNN
|
||||
1 4000 1300
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
4000 1300 4000 1150
|
||||
Wire Wire Line
|
||||
4000 850 4000 750
|
||||
$EndSCHEMATC
|
||||
126
stepper/stepper.c
Normal file
126
stepper/stepper.c
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* stepper.c
|
||||
*
|
||||
* Copyright 2014 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 "ports_definition.h"
|
||||
#include "stepper.h"
|
||||
|
||||
U8 Ustepping = 4; // 2^Ustepping = N of microsteps
|
||||
volatile long Nsteps = 0; // Number of steps
|
||||
U8 Motor_number = 5; // Number of motor to move, 5 -- not moving
|
||||
U16 Stepper_speed = 0; // length of one MICROstep in us
|
||||
|
||||
/**
|
||||
* Setup pins of stepper motor (all - PP out)
|
||||
*/
|
||||
void setup_stepper_pins(){
|
||||
// CLK
|
||||
PORT(STP_CLK_PORT, DDR) |= STP_CLK_PIN;
|
||||
PORT(STP_CLK_PORT, CR1) |= STP_CLK_PIN;
|
||||
// EN
|
||||
PORT(STP_EN_PORT, DDR) |= STP_EN_MASK;
|
||||
PORT(STP_EN_PORT, CR1) |= STP_EN_MASK;
|
||||
// DIR
|
||||
PORT(STP_DIR_PORT, DDR) |= STP_DIR_PIN;
|
||||
PORT(STP_DIR_PORT, CR1) |= STP_DIR_PIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set speed of stepper motor
|
||||
* @param Sps - period (in us) of one MICROstep
|
||||
*/
|
||||
void set_stepper_speed(U16 SpS){
|
||||
Stepper_speed = SpS;
|
||||
// Configure timer 2 to generate signals for CLK
|
||||
TIM2_PSCR = 4; // 1MHz
|
||||
//SpS >>= Ustepping; // divide to microsteps
|
||||
TIM2_ARRH = SpS >> 8; // set speed
|
||||
TIM2_ARRL = SpS & 0xff;
|
||||
SpS >>= 1;// divide to 2 - 50% duty cycle
|
||||
TIM2_CCR1H = SpS >> 8;
|
||||
TIM2_CCR1L = SpS & 0xff;
|
||||
// channel 1 generates PWM pulses
|
||||
TIM2_CCMR1 = 0x60; // OC1M = 110b - PWM mode 1 ( 1 -> 0)
|
||||
TIM2_CCER1 = 1; // Channel 1 is on. Active is high
|
||||
//TIM2_IER = TIM_IER_UIE | TIM_IER_CC1IE; // update interrupt enable
|
||||
TIM2_IER = TIM_IER_UIE; // update interrupt enable
|
||||
TIM2_CR1 |= TIM_CR1_APRE | TIM_CR1_URS; // auto reload + interrupt on overflow & RUN
|
||||
}
|
||||
|
||||
void move_motor(int Steps){
|
||||
if(Motor_number > 4) return;
|
||||
if(Steps < 0){
|
||||
PORT(STP_DIR_PORT, ODR) &= ~STP_DIR_PIN; // dir to left
|
||||
Steps *= -1;
|
||||
}
|
||||
Nsteps = (long)Steps << Ustepping;
|
||||
PORT(STP_EN_PORT, ODR) |= 1 << Motor_number; // enable moving
|
||||
TIM2_CR1 |= TIM_CR1_CEN; // turn on timer
|
||||
}
|
||||
|
||||
void stop_motor(){
|
||||
TIM2_CR1 &= ~TIM_CR1_CEN; // Turn off timer
|
||||
PORT(STP_EN_PORT, ODR) &= ~STP_EN_MASK; // disable moving
|
||||
PORT(STP_DIR_PORT, ODR) |= STP_DIR_PIN; // turn off DIR
|
||||
Nsteps = 0;
|
||||
Motor_number = 5; // All OK. Motors are stopped
|
||||
uart_write("stop\n");
|
||||
}
|
||||
|
||||
void pause_resume(){
|
||||
if(Nsteps == 0) return; // motor is stopped
|
||||
if(TIM2_CR1 & TIM_CR1_CEN){ // pause
|
||||
TIM2_CR1 &= ~TIM_CR1_CEN;
|
||||
uart_write("pause\n");
|
||||
}else{ // resume
|
||||
TIM2_CR1 |= TIM_CR1_CEN;
|
||||
uart_write("resume\n");
|
||||
}
|
||||
}
|
||||
|
||||
void add_steps(int Steps){
|
||||
long S;
|
||||
U8 sign = 0;
|
||||
// pause
|
||||
TIM2_CR1 &= ~TIM_CR1_CEN;
|
||||
if(Motor_number == 5){ // motors are stopped - just move last active motor
|
||||
move_motor(Steps);
|
||||
return;
|
||||
}
|
||||
// if(PORT(STP_DIR_PORT, IDR) & STP_DIR_PIN) // left direction
|
||||
// Nsteps *= -1L;
|
||||
if(Steps < 0){
|
||||
sign = 1;
|
||||
Steps *= -1;
|
||||
}
|
||||
S = (long)Steps << Ustepping;
|
||||
if(sign)
|
||||
S *= -1L;
|
||||
Nsteps += S;
|
||||
// now change direction
|
||||
if(Nsteps < 0){
|
||||
uart_write("reverce\n");
|
||||
PORT(STP_DIR_PORT, ODR) ^= STP_DIR_PIN; // go to the opposite side
|
||||
Nsteps *= -1L;
|
||||
}
|
||||
// resume if Nsteps != 0
|
||||
if(Nsteps)
|
||||
TIM2_CR1 |= TIM_CR1_CEN;
|
||||
}
|
||||
41
stepper/stepper.h
Normal file
41
stepper/stepper.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* stepper.h
|
||||
*
|
||||
* Copyright 2014 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 __STEPPER_H__
|
||||
#define __STEPPER_H__
|
||||
|
||||
#include "ports_definition.h"
|
||||
#include "main.h"
|
||||
|
||||
extern U8 Ustepping;
|
||||
extern volatile long Nsteps;
|
||||
extern U8 Motor_number;
|
||||
extern U16 Stepper_speed;
|
||||
|
||||
void setup_stepper_pins();
|
||||
void set_stepper_speed(U16 SpS);
|
||||
void move_motor(int Steps);
|
||||
void stop_motor();
|
||||
void pause_resume();
|
||||
void add_steps(int Steps);
|
||||
|
||||
#endif // __STEPPER_H__
|
||||
BIN
stepper/testproj.bin
Normal file
BIN
stepper/testproj.bin
Normal file
Binary file not shown.
Reference in New Issue
Block a user