mirror of
https://github.com/eddyem/stm32samples.git
synced 2025-12-06 02:35:23 +03:00
add SSI->SPI on NUCLEO042
This commit is contained in:
parent
6f29257a28
commit
52236f2cf1
Binary file not shown.
Binary file not shown.
593
F0:F030,F042,F072/CANbus_stepper/kicad/stm32-rescue.lib
Normal file
593
F0:F030,F042,F072/CANbus_stepper/kicad/stm32-rescue.lib
Normal file
@ -0,0 +1,593 @@
|
||||
EESchema-LIBRARY Version 2.4
|
||||
#encoding utf-8
|
||||
#
|
||||
# +3.3V-power
|
||||
#
|
||||
DEF +3.3V-power #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -150 50 H I C CNN
|
||||
F1 "+3.3V-power" 0 140 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
P 2 0 1 0 -30 50 0 100 N
|
||||
P 2 0 1 0 0 0 0 100 N
|
||||
P 2 0 1 0 0 100 30 50 N
|
||||
X +3V3 1 0 0 0 U 50 50 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# +5V-power
|
||||
#
|
||||
DEF +5V-power #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -150 50 H I C CNN
|
||||
F1 "+5V-power" 0 140 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
P 2 0 1 0 -30 50 0 100 N
|
||||
P 2 0 1 0 0 0 0 100 N
|
||||
P 2 0 1 0 0 100 30 50 N
|
||||
X +5V 1 0 0 0 U 50 50 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CP-Device
|
||||
#
|
||||
DEF CP-Device C 0 10 N Y 1 F N
|
||||
F0 "C" 25 100 50 H V L CNN
|
||||
F1 "CP-Device" 25 -100 50 H V L CNN
|
||||
F2 "" 38 -150 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
CP_*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -90 20 90 40 0 1 0 N
|
||||
P 2 0 1 0 -70 90 -30 90 N
|
||||
P 2 0 1 0 -50 110 -50 70 N
|
||||
S 90 -20 -90 -40 0 1 0 F
|
||||
X ~ 1 0 150 110 D 50 50 1 1 P
|
||||
X ~ 2 0 -150 110 U 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Conn_01x01-Connector_Generic
|
||||
#
|
||||
DEF Conn_01x01-Connector_Generic J 0 40 Y N 1 F N
|
||||
F0 "J" 0 100 50 H V C CNN
|
||||
F1 "Conn_01x01-Connector_Generic" 0 -100 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
Connector*:*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -50 5 0 -5 1 1 6 N
|
||||
S -50 50 50 -50 1 1 10 f
|
||||
X Pin_1 1 -200 0 150 R 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Conn_01x06-Connector_Generic
|
||||
#
|
||||
DEF Conn_01x06-Connector_Generic J 0 40 Y N 1 F N
|
||||
F0 "J" 0 300 50 H V C CNN
|
||||
F1 "Conn_01x06-Connector_Generic" 0 -400 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
Connector*:*_1x??_*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -50 -295 0 -305 1 1 6 N
|
||||
S -50 -195 0 -205 1 1 6 N
|
||||
S -50 -95 0 -105 1 1 6 N
|
||||
S -50 5 0 -5 1 1 6 N
|
||||
S -50 105 0 95 1 1 6 N
|
||||
S -50 205 0 195 1 1 6 N
|
||||
S -50 250 50 -350 1 1 10 f
|
||||
X Pin_1 1 -200 200 150 R 50 50 1 1 P
|
||||
X Pin_2 2 -200 100 150 R 50 50 1 1 P
|
||||
X Pin_3 3 -200 0 150 R 50 50 1 1 P
|
||||
X Pin_4 4 -200 -100 150 R 50 50 1 1 P
|
||||
X Pin_5 5 -200 -200 150 R 50 50 1 1 P
|
||||
X Pin_6 6 -200 -300 150 R 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Conn_01x08_Female-Connector
|
||||
#
|
||||
DEF Conn_01x08_Female-Connector J 0 40 Y N 1 F N
|
||||
F0 "J" 0 400 50 H V C CNN
|
||||
F1 "Conn_01x08_Female-Connector" 0 -500 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
Connector*:*_1x??_*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
A 0 -400 20 901 -901 1 1 6 N 0 -380 0 -420
|
||||
A 0 -300 20 901 -901 1 1 6 N 0 -280 0 -320
|
||||
A 0 -200 20 901 -901 1 1 6 N 0 -180 0 -220
|
||||
A 0 -100 20 901 -901 1 1 6 N 0 -80 0 -120
|
||||
P 2 1 1 6 -50 -400 -20 -400 N
|
||||
P 2 1 1 6 -50 -300 -20 -300 N
|
||||
P 2 1 1 6 -50 -200 -20 -200 N
|
||||
P 2 1 1 6 -50 -100 -20 -100 N
|
||||
P 2 1 1 6 -50 0 -20 0 N
|
||||
P 2 1 1 6 -50 100 -20 100 N
|
||||
P 2 1 1 6 -50 200 -20 200 N
|
||||
P 2 1 1 6 -50 300 -20 300 N
|
||||
A 0 0 20 901 -901 1 1 6 N 0 20 0 -20
|
||||
A 0 100 20 901 -901 1 1 6 N 0 120 0 80
|
||||
A 0 200 20 901 -901 1 1 6 N 0 220 0 180
|
||||
A 0 300 20 901 -901 1 1 6 N 0 320 0 280
|
||||
X Pin_1 1 -200 300 150 R 50 50 1 1 P
|
||||
X Pin_2 2 -200 200 150 R 50 50 1 1 P
|
||||
X Pin_3 3 -200 100 150 R 50 50 1 1 P
|
||||
X Pin_4 4 -200 0 150 R 50 50 1 1 P
|
||||
X Pin_5 5 -200 -100 150 R 50 50 1 1 P
|
||||
X Pin_6 6 -200 -200 150 R 50 50 1 1 P
|
||||
X Pin_7 7 -200 -300 150 R 50 50 1 1 P
|
||||
X Pin_8 8 -200 -400 150 R 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# DB9_Female-Connector
|
||||
#
|
||||
DEF DB9_Female-Connector J 0 40 Y N 1 F N
|
||||
F0 "J" 0 550 50 H V C CNN
|
||||
F1 "DB9_Female-Connector" 0 -575 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
DSUB*Female*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
C -70 -400 30 0 1 0 N
|
||||
C -70 -200 30 0 1 0 N
|
||||
C -70 0 30 0 1 0 N
|
||||
C -70 200 30 0 1 0 N
|
||||
C -70 400 30 0 1 0 N
|
||||
P 2 0 1 0 -150 -400 -100 -400 N
|
||||
P 2 0 1 0 -150 -300 20 -300 N
|
||||
P 2 0 1 0 -150 -200 -100 -200 N
|
||||
P 2 0 1 0 -150 -100 20 -100 N
|
||||
P 2 0 1 0 -150 0 -100 0 N
|
||||
P 2 0 1 0 -150 100 20 100 N
|
||||
P 2 0 1 0 -150 200 -100 200 N
|
||||
P 2 0 1 0 -150 300 20 300 N
|
||||
P 2 0 1 0 -150 400 -100 400 N
|
||||
P 5 0 1 10 -150 525 -150 -525 150 -375 150 375 -150 525 f
|
||||
C 50 -300 30 0 1 0 N
|
||||
C 50 -100 30 0 1 0 N
|
||||
C 50 100 30 0 1 0 N
|
||||
C 50 300 30 0 1 0 N
|
||||
X 1 1 -300 400 150 R 50 50 1 1 P
|
||||
X 2 2 -300 200 150 R 50 50 1 1 P
|
||||
X 3 3 -300 0 150 R 50 50 1 1 P
|
||||
X 4 4 -300 -200 150 R 50 50 1 1 P
|
||||
X 5 5 -300 -400 150 R 50 50 1 1 P
|
||||
X 6 6 -300 300 150 R 50 50 1 1 P
|
||||
X 7 7 -300 100 150 R 50 50 1 1 P
|
||||
X 8 8 -300 -100 150 R 50 50 1 1 P
|
||||
X 9 9 -300 -300 150 R 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# DB9_Male-Connector
|
||||
#
|
||||
DEF DB9_Male-Connector J 0 40 Y N 1 F N
|
||||
F0 "J" 0 550 50 H V C CNN
|
||||
F1 "DB9_Male-Connector" 0 -575 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
DSUB*Male*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
C -70 -400 30 0 1 0 F
|
||||
C -70 -200 30 0 1 0 F
|
||||
C -70 0 30 0 1 0 F
|
||||
C -70 200 30 0 1 0 F
|
||||
C -70 400 30 0 1 0 F
|
||||
P 2 0 1 0 -150 -400 -100 -400 N
|
||||
P 2 0 1 0 -150 -300 20 -300 N
|
||||
P 2 0 1 0 -150 -200 -100 -200 N
|
||||
P 2 0 1 0 -150 -100 20 -100 N
|
||||
P 2 0 1 0 -150 0 -100 0 N
|
||||
P 2 0 1 0 -150 100 20 100 N
|
||||
P 2 0 1 0 -150 200 -100 200 N
|
||||
P 2 0 1 0 -150 300 20 300 N
|
||||
P 2 0 1 0 -150 400 -100 400 N
|
||||
P 5 0 1 10 -150 -525 -150 525 150 375 150 -375 -150 -525 f
|
||||
C 50 -300 30 0 1 0 F
|
||||
C 50 -100 30 0 1 0 F
|
||||
C 50 100 30 0 1 0 F
|
||||
C 50 300 30 0 1 0 F
|
||||
X 1 1 -300 -400 150 R 50 50 1 1 P
|
||||
X 2 2 -300 -200 150 R 50 50 1 1 P
|
||||
X 3 3 -300 0 150 R 50 50 1 1 P
|
||||
X 4 4 -300 200 150 R 50 50 1 1 P
|
||||
X 5 5 -300 400 150 R 50 50 1 1 P
|
||||
X 6 6 -300 -300 150 R 50 50 1 1 P
|
||||
X 7 7 -300 -100 150 R 50 50 1 1 P
|
||||
X 8 8 -300 100 150 R 50 50 1 1 P
|
||||
X 9 9 -300 300 150 R 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# GND-power
|
||||
#
|
||||
DEF GND-power #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -250 50 H I C CNN
|
||||
F1 "GND-power" 0 -150 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
|
||||
X GND 1 0 0 0 D 50 50 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# ISO1050DUB-Interface_CAN_LIN
|
||||
#
|
||||
DEF ISO1050DUB-Interface_CAN_LIN U 0 20 Y Y 1 F N
|
||||
F0 "U" -250 250 50 H V C CNN
|
||||
F1 "ISO1050DUB-Interface_CAN_LIN" 100 250 50 H V C CNN
|
||||
F2 "Package_SO:SOP-8_6.62x9.15mm_P2.54mm" 0 -350 50 H I C CIN
|
||||
F3 "" 0 -50 50 H I C CNN
|
||||
$FPLIST
|
||||
SOP*6.62x9.15mm*P2.54mm*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -300 200 300 -300 0 1 10 f
|
||||
P 2 0 1 0 0 -200 0 -250 N
|
||||
P 2 0 1 0 0 -100 0 -150 N
|
||||
P 2 0 1 0 0 0 0 -50 N
|
||||
P 2 0 1 0 0 100 0 50 N
|
||||
P 2 0 1 0 0 200 0 150 N
|
||||
X VCC1 1 -400 100 100 R 50 50 1 1 W
|
||||
X RXD 2 -400 0 100 R 50 50 1 1 O
|
||||
X TXD 3 -400 -100 100 R 50 50 1 1 I
|
||||
X GND1 4 -400 -200 100 R 50 50 1 1 W
|
||||
X GND2 5 400 -200 100 L 50 50 1 1 W
|
||||
X CANL 6 400 -100 100 L 50 50 1 1 B
|
||||
X CANH 7 400 0 100 L 50 50 1 1 B
|
||||
X VCC2 8 400 100 100 L 50 50 1 1 W
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# LM1117-3.3-Regulator_Linear
|
||||
#
|
||||
DEF LM1117-3.3-Regulator_Linear U 0 10 Y Y 1 F N
|
||||
F0 "U" -150 125 50 H V C CNN
|
||||
F1 "LM1117-3.3-Regulator_Linear" 0 125 50 H V L CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
SOT?223*
|
||||
TO?263*
|
||||
TO?252*
|
||||
TO?220*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -200 -200 200 75 0 1 10 f
|
||||
X GND 1 0 -300 100 U 50 50 1 1 W
|
||||
X VO 2 300 0 100 L 50 50 1 1 w
|
||||
X VI 3 -300 0 100 R 50 50 1 1 W
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# MAX3485-Interface_UART
|
||||
#
|
||||
DEF MAX3485-Interface_UART U 0 20 Y Y 1 F N
|
||||
F0 "U" -240 450 50 H V C CNN
|
||||
F1 "MAX3485-Interface_UART" 30 450 50 H V L CNN
|
||||
F2 "" 0 -700 50 H I C CNN
|
||||
F3 "" 0 50 50 H I C CNN
|
||||
$FPLIST
|
||||
DIP*W7.62mm*
|
||||
SOIC*3.9x4.9mm*P1.27mm*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -300 400 300 -500 0 1 10 f
|
||||
C -12 -145 14 0 1 10 F
|
||||
C -1 59 14 0 1 10 F
|
||||
P 2 0 1 10 -160 -200 -75 -200 N
|
||||
P 2 0 1 10 -160 100 -50 100 N
|
||||
P 2 0 1 10 -50 -126 -50 -136 N
|
||||
P 2 0 1 10 -25 -200 210 -200 N
|
||||
P 3 0 1 10 -160 -100 -50 -100 -50 -125 N
|
||||
P 3 0 1 10 0 50 0 0 -160 0 N
|
||||
P 3 0 1 10 50 125 150 125 150 -200 N
|
||||
P 3 0 1 10 100 75 100 -150 0 -150 N
|
||||
P 4 0 1 10 -75 -125 -75 -225 25 -175 -75 -125 N
|
||||
P 4 0 1 10 -50 100 50 150 50 50 -50 100 N
|
||||
P 4 0 1 10 75 75 175 75 175 100 210 100 N
|
||||
S 50 125 50 125 0 1 0 N
|
||||
C 65 75 14 0 1 10 F
|
||||
X RO 1 -400 100 100 R 50 50 1 1 O
|
||||
X ~{RE} 2 -400 0 100 R 50 50 1 1 I
|
||||
X DE 3 -400 -100 100 R 50 50 1 1 I
|
||||
X DI 4 -400 -200 100 R 50 50 1 1 I
|
||||
X GND 5 0 -600 100 U 50 50 1 1 W
|
||||
X A 6 400 -200 100 L 50 50 1 1 B
|
||||
X B 7 400 100 100 L 50 50 1 1 B
|
||||
X VCC 8 0 500 100 D 50 50 1 1 W
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# MCP2551-I-SN-Interface_CAN_LIN
|
||||
#
|
||||
DEF MCP2551-I-SN-Interface_CAN_LIN U 0 40 Y Y 1 F N
|
||||
F0 "U" -400 350 50 H V L CNN
|
||||
F1 "MCP2551-I-SN-Interface_CAN_LIN" 100 350 50 H V L CNN
|
||||
F2 "Package_SO:SOIC-8_3.9x4.9mm_P1.27mm" 0 -500 50 H I C CIN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
SOIC*P1.27mm*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -400 300 400 -300 0 1 10 f
|
||||
X TXD 1 -500 200 100 R 50 50 1 1 I
|
||||
X VSS 2 0 -400 100 U 50 50 1 1 W
|
||||
X VDD 3 0 400 100 D 50 50 1 1 W
|
||||
X RXD 4 -500 100 100 R 50 50 1 1 O
|
||||
X Vref 5 -500 -100 100 R 50 50 1 1 w
|
||||
X CANL 6 500 -100 100 L 50 50 1 1 B
|
||||
X CANH 7 500 100 100 L 50 50 1 1 B
|
||||
X Rs 8 -500 -200 100 R 50 50 1 1 I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# PESD3V3L4UG-Power_Protection
|
||||
#
|
||||
DEF PESD3V3L4UG-Power_Protection D 0 20 N N 4 L N
|
||||
F0 "D" 0 100 50 H V C CNN
|
||||
F1 "PESD3V3L4UG-Power_Protection" 0 -100 50 H V C CNN
|
||||
F2 "Package_TO_SOT_SMD:SOT-353_SC-70-5" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
SOT?353*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 0 -40 0 40 0 N
|
||||
P 3 0 1 0 -40 40 -40 -40 -20 -40 N
|
||||
P 4 0 1 0 40 40 -40 0 40 -40 40 40 N
|
||||
X K1 1 -100 0 100 R 50 50 1 1 P
|
||||
X A 2 100 0 100 L 50 50 1 1 P
|
||||
X K2 3 -100 0 100 R 50 50 2 1 P
|
||||
X K3 4 -100 0 100 R 50 50 3 1 P
|
||||
X K4 6 -100 0 100 R 50 50 4 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# PWR_FLAG-power
|
||||
#
|
||||
DEF PWR_FLAG-power #FLG 0 0 N N 1 F P
|
||||
F0 "#FLG" 0 75 50 H I C CNN
|
||||
F1 "PWR_FLAG-power" 0 150 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
P 6 0 1 0 0 0 0 50 -40 75 0 100 40 75 0 50 N
|
||||
X pwr 1 0 0 0 U 50 50 0 0 w
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# STM32F072CBTx-MCU_ST_STM32F0
|
||||
#
|
||||
DEF STM32F072CBTx-MCU_ST_STM32F0 U 0 20 Y Y 1 F N
|
||||
F0 "U" -600 1450 50 H V L CNN
|
||||
F1 "STM32F072CBTx-MCU_ST_STM32F0" 300 1450 50 H V L CNN
|
||||
F2 "Package_QFP:LQFP-48_7x7mm_P0.5mm" -600 -1400 50 H I R CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
LQFP*7x7mm*P0.5mm*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -600 -1400 500 1400 0 1 10 f
|
||||
X VBAT 1 -200 1500 100 D 50 50 1 1 W
|
||||
X PA0 10 600 200 100 L 50 50 1 1 B
|
||||
X PA1 11 600 100 100 L 50 50 1 1 B
|
||||
X PA2 12 600 0 100 L 50 50 1 1 B
|
||||
X PA3 13 600 -100 100 L 50 50 1 1 B
|
||||
X PA4 14 600 -200 100 L 50 50 1 1 B
|
||||
X PA5 15 600 -300 100 L 50 50 1 1 B
|
||||
X PA6 16 600 -400 100 L 50 50 1 1 B
|
||||
X PA7 17 600 -500 100 L 50 50 1 1 B
|
||||
X PB0 18 -700 200 100 R 50 50 1 1 B
|
||||
X PB1 19 -700 100 100 R 50 50 1 1 B
|
||||
X PC13 2 -700 600 100 R 50 50 1 1 B
|
||||
X PB2 20 -700 0 100 R 50 50 1 1 B
|
||||
X PB10 21 -700 -800 100 R 50 50 1 1 B
|
||||
X PB11 22 -700 -900 100 R 50 50 1 1 B
|
||||
X VSS 23 -200 -1500 100 U 50 50 1 1 W
|
||||
X VDD 24 -100 1500 100 D 50 50 1 1 W
|
||||
X PB12 25 -700 -1000 100 R 50 50 1 1 B
|
||||
X PB13 26 -700 -1100 100 R 50 50 1 1 B
|
||||
X PB14 27 -700 -1200 100 R 50 50 1 1 B
|
||||
X PB15 28 -700 -1300 100 R 50 50 1 1 B
|
||||
X PA8 29 600 -600 100 L 50 50 1 1 B
|
||||
X PC14 3 -700 500 100 R 50 50 1 1 B
|
||||
X PA9 30 600 -700 100 L 50 50 1 1 B
|
||||
X PA10 31 600 -800 100 L 50 50 1 1 B
|
||||
X PA11 32 600 -900 100 L 50 50 1 1 B
|
||||
X PA12 33 600 -1000 100 L 50 50 1 1 B
|
||||
X PA13 34 600 -1100 100 L 50 50 1 1 B
|
||||
X VSS 35 -100 -1500 100 U 50 50 1 1 W
|
||||
X VDDIO2 36 200 1500 100 D 50 50 1 1 W
|
||||
X PA14 37 600 -1200 100 L 50 50 1 1 B
|
||||
X PA15 38 600 -1300 100 L 50 50 1 1 B
|
||||
X PB3 39 -700 -100 100 R 50 50 1 1 B
|
||||
X PC15 4 -700 400 100 R 50 50 1 1 B
|
||||
X PB4 40 -700 -200 100 R 50 50 1 1 B
|
||||
X PB5 41 -700 -300 100 R 50 50 1 1 B
|
||||
X PB6 42 -700 -400 100 R 50 50 1 1 B
|
||||
X PB7 43 -700 -500 100 R 50 50 1 1 B
|
||||
X BOOT0 44 -700 1100 100 R 50 50 1 1 I
|
||||
X PB8 45 -700 -600 100 R 50 50 1 1 B
|
||||
X PB9 46 -700 -700 100 R 50 50 1 1 B
|
||||
X VSS 47 0 -1500 100 U 50 50 1 1 W
|
||||
X VDD 48 0 1500 100 D 50 50 1 1 W
|
||||
X PF0 5 -700 900 100 R 50 50 1 1 I
|
||||
X PF1 6 -700 800 100 R 50 50 1 1 I
|
||||
X NRST 7 -700 1300 100 R 50 50 1 1 I
|
||||
X VSSA 8 100 -1500 100 U 50 50 1 1 W
|
||||
X VDDA 9 100 1500 100 D 50 50 1 1 W
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# SW_DIP_x01-Switch
|
||||
#
|
||||
DEF SW_DIP_x01-Switch SW 0 0 Y N 1 F N
|
||||
F0 "SW" 0 150 50 H V C CNN
|
||||
F1 "SW_DIP_x01-Switch" 0 -150 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
SW?DIP?x1*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
C -80 0 20 0 0 0 N
|
||||
P 2 0 0 0 -60 5 93 46 N
|
||||
C 80 0 20 0 0 0 N
|
||||
S -150 100 150 -100 0 1 10 f
|
||||
X ~ 1 -300 0 200 R 50 50 1 1 P
|
||||
X ~ 2 300 0 200 L 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# SW_DIP_x04-Switch
|
||||
#
|
||||
DEF SW_DIP_x04-Switch SW 0 0 Y N 1 F N
|
||||
F0 "SW" 0 350 50 H V C CNN
|
||||
F1 "SW_DIP_x04-Switch" 0 -250 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
SW?DIP?x4*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
C -80 -100 20 0 0 0 N
|
||||
C -80 0 20 0 0 0 N
|
||||
C -80 100 20 0 0 0 N
|
||||
C -80 200 20 0 0 0 N
|
||||
P 2 0 0 0 -60 -94 93 -53 N
|
||||
P 2 0 0 0 -60 5 93 46 N
|
||||
P 2 0 0 0 -60 105 93 146 N
|
||||
P 2 0 0 0 -60 205 93 246 N
|
||||
C 80 -100 20 0 0 0 N
|
||||
C 80 0 20 0 0 0 N
|
||||
C 80 100 20 0 0 0 N
|
||||
C 80 200 20 0 0 0 N
|
||||
S -150 300 150 -200 0 1 10 f
|
||||
X ~ 1 -300 200 200 R 50 50 1 1 P
|
||||
X ~ 2 -300 100 200 R 50 50 1 1 P
|
||||
X ~ 3 -300 0 200 R 50 50 1 1 P
|
||||
X ~ 4 -300 -100 200 R 50 50 1 1 P
|
||||
X ~ 5 300 -100 200 L 50 50 1 1 P
|
||||
X ~ 6 300 0 200 L 50 50 1 1 P
|
||||
X ~ 7 300 100 200 L 50 50 1 1 P
|
||||
X ~ 8 300 200 200 L 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Screw_Terminal_01x02-Connector
|
||||
#
|
||||
DEF Screw_Terminal_01x02-Connector J 0 40 Y N 1 F N
|
||||
F0 "J" 0 100 50 H V C CNN
|
||||
F1 "Screw_Terminal_01x02-Connector" 0 -200 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
TerminalBlock*:*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -50 50 50 -150 1 1 10 f
|
||||
C 0 -100 25 1 1 6 N
|
||||
P 2 1 1 6 -21 -87 13 -120 N
|
||||
P 2 1 1 6 -21 13 13 -20 N
|
||||
P 2 1 1 6 -14 -80 20 -113 N
|
||||
P 2 1 1 6 -14 20 20 -13 N
|
||||
C 0 0 25 1 1 6 N
|
||||
X Pin_1 1 -200 0 150 R 50 50 1 1 P
|
||||
X Pin_2 2 -200 -100 150 R 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# TestPoint-Connector
|
||||
#
|
||||
DEF TestPoint-Connector TP 0 30 N N 1 F N
|
||||
F0 "TP" 0 270 50 H V C CNN
|
||||
F1 "TestPoint-Connector" 0 200 50 H V C CNN
|
||||
F2 "" 200 0 50 H I C CNN
|
||||
F3 "" 200 0 50 H I C CNN
|
||||
$FPLIST
|
||||
Pin*
|
||||
Test*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
C 0 130 30 0 1 0 N
|
||||
X 1 1 0 0 100 U 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# USB6B1-Power_Protection
|
||||
#
|
||||
DEF USB6B1-Power_Protection U 0 20 Y Y 1 F N
|
||||
F0 "U" 250 250 50 H V C CNN
|
||||
F1 "USB6B1-Power_Protection" 200 -250 50 H V C CNN
|
||||
F2 "Package_SO:SOIC-8_3.9x4.9mm_P1.27mm" 0 0 50 H I C CNN
|
||||
F3 "" -950 -100 50 H I C CNN
|
||||
$FPLIST
|
||||
SOIC*3.9x4.9mm*P1.27mm*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -300 -200 300 200 0 1 10 f
|
||||
X VBUS 1 0 300 100 D 50 50 1 1 P N
|
||||
X I/O1 2 -400 100 100 R 50 50 1 1 P
|
||||
X I/O2 3 -400 -100 100 R 50 50 1 1 P
|
||||
X GND 4 0 -300 100 U 50 50 1 1 P N
|
||||
X GND 5 0 -300 100 U 50 50 1 1 P
|
||||
X I/O2 6 400 -100 100 L 50 50 1 1 P
|
||||
X I/O1 7 400 100 100 L 50 50 1 1 P
|
||||
X VBUS 8 0 300 100 D 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# USB_B-Connector
|
||||
#
|
||||
DEF USB_B-Connector J 0 40 Y Y 1 F N
|
||||
F0 "J" -200 450 50 H V L CNN
|
||||
F1 "USB_B-Connector" -200 350 50 H V L CNN
|
||||
F2 "" 150 -50 50 H I C CNN
|
||||
F3 "" 150 -50 50 H I C CNN
|
||||
$FPLIST
|
||||
USB*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -200 -300 200 300 0 1 10 f
|
||||
C -150 85 25 0 1 10 F
|
||||
S -150 220 -100 180 0 1 0 F
|
||||
C -25 135 15 0 1 10 F
|
||||
S -5 -300 5 -270 0 1 0 N
|
||||
P 2 0 1 10 -75 85 25 85 N
|
||||
P 4 0 1 10 -125 85 -100 85 -50 135 -25 135 N
|
||||
P 4 0 1 10 -100 85 -75 85 -50 35 0 35 N
|
||||
P 4 0 1 10 25 110 25 60 75 85 25 110 F
|
||||
P 7 0 1 0 -160 170 -90 170 -90 225 -105 240 -145 240 -160 225 -160 170 N
|
||||
S 10 50 -20 20 0 1 10 F
|
||||
S 200 -105 170 -95 0 1 0 N
|
||||
S 200 -5 170 5 0 1 0 N
|
||||
S 200 195 170 205 0 1 0 N
|
||||
X VBUS 1 300 200 100 L 50 50 1 1 w
|
||||
X D- 2 300 -100 100 L 50 50 1 1 P
|
||||
X D+ 3 300 0 100 L 50 50 1 1 P
|
||||
X GND 4 0 -400 100 U 50 50 1 1 w
|
||||
X Shield 5 -100 -400 100 U 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
75
F0:F030,F042,F072/CANbus_stepper/kicad/stm32.kicad_prl
Normal file
75
F0:F030,F042,F072/CANbus_stepper/kicad/stm32.kicad_prl
Normal file
@ -0,0 +1,75 @@
|
||||
{
|
||||
"board": {
|
||||
"active_layer": 0,
|
||||
"active_layer_preset": "",
|
||||
"auto_track_width": true,
|
||||
"hidden_nets": [],
|
||||
"high_contrast_mode": 0,
|
||||
"net_color_mode": 1,
|
||||
"opacity": {
|
||||
"pads": 1.0,
|
||||
"tracks": 1.0,
|
||||
"vias": 1.0,
|
||||
"zones": 0.6
|
||||
},
|
||||
"ratsnest_display_mode": 0,
|
||||
"selection_filter": {
|
||||
"dimensions": true,
|
||||
"footprints": true,
|
||||
"graphics": true,
|
||||
"keepouts": true,
|
||||
"lockedItems": true,
|
||||
"otherItems": true,
|
||||
"pads": true,
|
||||
"text": true,
|
||||
"tracks": true,
|
||||
"vias": true,
|
||||
"zones": true
|
||||
},
|
||||
"visible_items": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27,
|
||||
28,
|
||||
29,
|
||||
30,
|
||||
32,
|
||||
33,
|
||||
34,
|
||||
35,
|
||||
36
|
||||
],
|
||||
"visible_layers": "fffffff_ffffffff",
|
||||
"zone_display_mode": 0
|
||||
},
|
||||
"meta": {
|
||||
"filename": "stm32.kicad_prl",
|
||||
"version": 3
|
||||
},
|
||||
"project": {
|
||||
"files": []
|
||||
}
|
||||
}
|
||||
373
F0:F030,F042,F072/CANbus_stepper/kicad/stm32.kicad_pro
Normal file
373
F0:F030,F042,F072/CANbus_stepper/kicad/stm32.kicad_pro
Normal file
@ -0,0 +1,373 @@
|
||||
{
|
||||
"board": {
|
||||
"design_settings": {
|
||||
"defaults": {
|
||||
"board_outline_line_width": 0.15,
|
||||
"copper_line_width": 0.2,
|
||||
"copper_text_italic": false,
|
||||
"copper_text_size_h": 1.5,
|
||||
"copper_text_size_v": 1.5,
|
||||
"copper_text_thickness": 0.3,
|
||||
"copper_text_upright": true,
|
||||
"courtyard_line_width": 0.05,
|
||||
"other_line_width": 0.15,
|
||||
"other_text_italic": false,
|
||||
"other_text_size_h": 1.0,
|
||||
"other_text_size_v": 1.0,
|
||||
"other_text_thickness": 0.15,
|
||||
"other_text_upright": true,
|
||||
"silk_line_width": 0.15,
|
||||
"silk_text_italic": false,
|
||||
"silk_text_size_h": 1.0,
|
||||
"silk_text_size_v": 1.0,
|
||||
"silk_text_thickness": 0.15,
|
||||
"silk_text_upright": true
|
||||
},
|
||||
"diff_pair_dimensions": [
|
||||
{
|
||||
"gap": 0.25,
|
||||
"via_gap": 0.25,
|
||||
"width": 0.2
|
||||
}
|
||||
],
|
||||
"drc_exclusions": [],
|
||||
"rule_severitieslegacy_courtyards_overlap": true,
|
||||
"rule_severitieslegacy_no_courtyard_defined": false,
|
||||
"rules": {
|
||||
"allow_blind_buried_vias": false,
|
||||
"allow_microvias": false,
|
||||
"min_hole_to_hole": 0.25,
|
||||
"min_microvia_diameter": 0.2,
|
||||
"min_microvia_drill": 0.09999999999999999,
|
||||
"min_through_hole_diameter": 0.5,
|
||||
"min_track_width": 0.2,
|
||||
"min_via_diameter": 0.7999999999999999,
|
||||
"solder_mask_clearance": 0.2,
|
||||
"solder_mask_min_width": 0.0,
|
||||
"solder_paste_clearance": 0.0,
|
||||
"solder_paste_margin_ratio": -0.0
|
||||
},
|
||||
"track_widths": [
|
||||
0.2,
|
||||
0.2,
|
||||
0.3,
|
||||
0.5,
|
||||
1.0,
|
||||
2.0
|
||||
],
|
||||
"via_dimensions": [
|
||||
{
|
||||
"diameter": 1.0,
|
||||
"drill": 0.6
|
||||
},
|
||||
{
|
||||
"diameter": 1.0,
|
||||
"drill": 0.6
|
||||
},
|
||||
{
|
||||
"diameter": 1.5,
|
||||
"drill": 0.8
|
||||
}
|
||||
]
|
||||
},
|
||||
"layer_presets": []
|
||||
},
|
||||
"boards": [],
|
||||
"cvpcb": {
|
||||
"equivalence_files": []
|
||||
},
|
||||
"erc": {
|
||||
"erc_exclusions": [],
|
||||
"meta": {
|
||||
"version": 0
|
||||
},
|
||||
"pin_map": [
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
]
|
||||
],
|
||||
"rule_severities": {
|
||||
"bus_definition_conflict": "error",
|
||||
"bus_entry_needed": "error",
|
||||
"bus_label_syntax": "error",
|
||||
"bus_to_bus_conflict": "error",
|
||||
"bus_to_net_conflict": "error",
|
||||
"different_unit_footprint": "error",
|
||||
"different_unit_net": "error",
|
||||
"duplicate_reference": "error",
|
||||
"duplicate_sheet_names": "error",
|
||||
"extra_units": "error",
|
||||
"global_label_dangling": "warning",
|
||||
"hier_label_mismatch": "error",
|
||||
"label_dangling": "error",
|
||||
"lib_symbol_issues": "warning",
|
||||
"multiple_net_names": "warning",
|
||||
"net_not_bus_member": "warning",
|
||||
"no_connect_connected": "warning",
|
||||
"no_connect_dangling": "warning",
|
||||
"pin_not_connected": "error",
|
||||
"pin_not_driven": "error",
|
||||
"pin_to_pin": "warning",
|
||||
"power_pin_not_driven": "error",
|
||||
"similar_labels": "warning",
|
||||
"unannotated": "error",
|
||||
"unit_value_mismatch": "error",
|
||||
"unresolved_variable": "error",
|
||||
"wire_dangling": "error"
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"pinned_footprint_libs": [],
|
||||
"pinned_symbol_libs": []
|
||||
},
|
||||
"meta": {
|
||||
"filename": "stm32.kicad_pro",
|
||||
"version": 1
|
||||
},
|
||||
"net_settings": {
|
||||
"classes": [
|
||||
{
|
||||
"bus_width": 12.0,
|
||||
"clearance": 0.2,
|
||||
"diff_pair_gap": 0.25,
|
||||
"diff_pair_via_gap": 0.25,
|
||||
"diff_pair_width": 0.2,
|
||||
"line_style": 0,
|
||||
"microvia_diameter": 0.3,
|
||||
"microvia_drill": 0.1,
|
||||
"name": "Default",
|
||||
"pcb_color": "rgba(0, 0, 0, 0.000)",
|
||||
"schematic_color": "rgba(0, 0, 0, 0.000)",
|
||||
"track_width": 0.25,
|
||||
"via_diameter": 0.8,
|
||||
"via_drill": 0.4,
|
||||
"wire_width": 6.0
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"version": 2
|
||||
},
|
||||
"net_colors": null
|
||||
},
|
||||
"pcbnew": {
|
||||
"last_paths": {
|
||||
"gencad": "",
|
||||
"idf": "",
|
||||
"netlist": "stm32.net",
|
||||
"specctra_dsn": "",
|
||||
"step": "",
|
||||
"vrml": ""
|
||||
},
|
||||
"page_layout_descr_file": ""
|
||||
},
|
||||
"schematic": {
|
||||
"annotate_start_num": 0,
|
||||
"drawing": {
|
||||
"default_line_thickness": 6.0,
|
||||
"default_text_size": 50.0,
|
||||
"field_names": [],
|
||||
"intersheets_ref_own_page": false,
|
||||
"intersheets_ref_prefix": "",
|
||||
"intersheets_ref_short": false,
|
||||
"intersheets_ref_show": false,
|
||||
"intersheets_ref_suffix": "",
|
||||
"junction_size_choice": 3,
|
||||
"label_size_ratio": 0.25,
|
||||
"pin_symbol_size": 0.0,
|
||||
"text_offset_ratio": 0.08
|
||||
},
|
||||
"legacy_lib_dir": "",
|
||||
"legacy_lib_list": [],
|
||||
"meta": {
|
||||
"version": 1
|
||||
},
|
||||
"net_format_name": "Pcbnew",
|
||||
"ngspice": {
|
||||
"fix_include_paths": true,
|
||||
"fix_passive_vals": false,
|
||||
"meta": {
|
||||
"version": 0
|
||||
},
|
||||
"model_mode": 0,
|
||||
"workbook_filename": ""
|
||||
},
|
||||
"page_layout_descr_file": "",
|
||||
"plot_directory": "",
|
||||
"spice_adjust_passive_values": false,
|
||||
"spice_external_command": "spice \"%I\"",
|
||||
"subpart_first_id": 49,
|
||||
"subpart_id_separator": 46
|
||||
},
|
||||
"sheets": [
|
||||
[
|
||||
"99e5cbe8-ca46-48a4-a6fc-cabce62e3612",
|
||||
""
|
||||
]
|
||||
],
|
||||
"text_variables": {}
|
||||
}
|
||||
6055
F0:F030,F042,F072/CANbus_stepper/kicad/stm32.kicad_sch
Normal file
6055
F0:F030,F042,F072/CANbus_stepper/kicad/stm32.kicad_sch
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,4 @@
|
||||
(sym_lib_table
|
||||
(lib (name elements)(type Legacy)(uri ${KIPRJMOD}/elements.lib)(options "")(descr ""))
|
||||
(lib (name "elements")(type "Legacy")(uri "${KIPRJMOD}/elements.lib")(options "")(descr ""))
|
||||
(lib (name "stm32-rescue")(type "Legacy")(uri "${KIPRJMOD}/stm32-rescue.lib")(options "")(descr ""))
|
||||
)
|
||||
|
||||
137
F0:F030,F042,F072/NUCLEO_SPI/Makefile
Normal file
137
F0:F030,F042,F072/NUCLEO_SPI/Makefile
Normal file
@ -0,0 +1,137 @@
|
||||
BINARY = usart
|
||||
BOOTPORT ?= /dev/ttyUSB0
|
||||
BOOTSPEED ?= 115200
|
||||
# MCU FAMILY
|
||||
FAMILY = F0
|
||||
# MCU code
|
||||
MCU = F042x6
|
||||
DEFS += -DEBUG
|
||||
# change this linking script depending on particular MCU model,
|
||||
# for example, if you have STM32F103VBT6, you should write:
|
||||
LDSCRIPT = stm32f042k.ld
|
||||
|
||||
INDEPENDENT_HEADERS=
|
||||
|
||||
FP_FLAGS ?= -msoft-float
|
||||
ASM_FLAGS = -mthumb -mcpu=cortex-m0 -march=armv6-m -mtune=cortex-m0
|
||||
ARCH_FLAGS = $(ASM_FLAGS) $(FP_FLAGS)
|
||||
|
||||
###############################################################################
|
||||
# Executables
|
||||
PREFIX ?= /opt/bin/arm-none-eabi
|
||||
|
||||
RM := rm -f
|
||||
RMDIR := rmdir
|
||||
CC := $(PREFIX)-gcc
|
||||
LD := $(PREFIX)-gcc
|
||||
AR := $(PREFIX)-ar
|
||||
AS := $(PREFIX)-as
|
||||
OBJCOPY := $(PREFIX)-objcopy
|
||||
OBJDUMP := $(PREFIX)-objdump
|
||||
GDB := $(PREFIX)-gdb
|
||||
STFLASH := $(shell which st-flash)
|
||||
STBOOT := $(shell which stm32flash)
|
||||
|
||||
###############################################################################
|
||||
# Source files
|
||||
OBJDIR = mk
|
||||
LDSCRIPT ?= $(BINARY).ld
|
||||
SRC := $(wildcard *.c)
|
||||
OBJS := $(addprefix $(OBJDIR)/, $(SRC:%.c=%.o))
|
||||
STARTUP = $(OBJDIR)/startup.o
|
||||
OBJS += $(STARTUP)
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
INC_DIR ?= ../inc
|
||||
|
||||
INCLUDE := -I$(INC_DIR)/F0 -I$(INC_DIR)/cm
|
||||
LIB_DIR := $(INC_DIR)/ld
|
||||
|
||||
###############################################################################
|
||||
# C flags
|
||||
CFLAGS += -O2 -g -MD -D__thumb2__=1
|
||||
CFLAGS += -Wall -Werror -Wextra -Wshadow -Wimplicit-function-declaration
|
||||
CFLAGS += -Wredundant-decls $(INCLUDE)
|
||||
# -Wmissing-prototypes -Wstrict-prototypes
|
||||
CFLAGS += -fno-common -ffunction-sections -fdata-sections
|
||||
|
||||
###############################################################################
|
||||
# Linker flags
|
||||
LDFLAGS += --static -nostartfiles
|
||||
#--specs=nano.specs
|
||||
LDFLAGS += -L$(LIB_DIR)
|
||||
LDFLAGS += -T$(LDSCRIPT)
|
||||
LDFLAGS += -Wl,-Map=$(OBJDIR)/$(BINARY).map
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
###############################################################################
|
||||
# Used libraries
|
||||
LDLIBS += -Wl,--start-group -lc -lgcc -Wl,--end-group
|
||||
LDLIBS += $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
||||
|
||||
DEFS += -DSTM32$(FAMILY) -DSTM32$(MCU)
|
||||
|
||||
#.SUFFIXES: .elf .bin .hex .srec .list .map .images
|
||||
#.SECONDEXPANSION:
|
||||
#.SECONDARY:
|
||||
|
||||
ELF := $(OBJDIR)/$(BINARY).elf
|
||||
LIST := $(OBJDIR)/$(BINARY).list
|
||||
BIN := $(BINARY).bin
|
||||
HEX := $(BINARY).hex
|
||||
|
||||
all: bin list
|
||||
|
||||
elf: $(ELF)
|
||||
bin: $(BIN)
|
||||
hex: $(HEX)
|
||||
list: $(LIST)
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
-include $(DEPS)
|
||||
endif
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
$(STARTUP): $(INC_DIR)/startup/vector.c
|
||||
$(CC) $(CFLAGS) $(DEFS) $(INCLUDE) $(ARCH_FLAGS) -o $@ -c $<
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
@echo " CC $<"
|
||||
$(CC) $(CFLAGS) $(DEFS) $(INCLUDE) $(ARCH_FLAGS) -o $@ -c $<
|
||||
|
||||
#$(OBJDIR)/%.d: %.c $(OBJDIR)
|
||||
# $(CC) -MM -MG $< | sed -e 's,^\([^:]*\)\.o[ ]*:,$(@D)/\1.o $(@D)/\1.d:,' >$@
|
||||
|
||||
$(BIN): $(ELF)
|
||||
@echo " OBJCOPY $(BIN)"
|
||||
$(OBJCOPY) -Obinary $(ELF) $(BIN)
|
||||
|
||||
$(HEX): $(ELF)
|
||||
@echo " OBJCOPY $(HEX)"
|
||||
$(OBJCOPY) -Oihex $(ELF) $(HEX)
|
||||
|
||||
$(LIST): $(ELF)
|
||||
@echo " OBJDUMP $(LIST)"
|
||||
$(OBJDUMP) -S $(ELF) > $(LIST)
|
||||
|
||||
$(ELF): $(OBJDIR) $(OBJS)
|
||||
@echo " LD $(ELF)"
|
||||
$(LD) $(LDFLAGS) $(ARCH_FLAGS) $(OBJS) $(LDLIBS) -o $(ELF)
|
||||
|
||||
clean:
|
||||
@echo " CLEAN"
|
||||
$(RM) $(OBJS) $(DEPS) $(ELF) $(HEX) $(LIST) $(OBJDIR)/*.map
|
||||
@rmdir $(OBJDIR) 2>/dev/null || true
|
||||
|
||||
|
||||
flash: $(BIN)
|
||||
@echo " FLASH $(BIN)"
|
||||
$(STFLASH) write $(BIN) 0x8000000
|
||||
|
||||
boot: $(BIN)
|
||||
@echo " LOAD $(BIN) through bootloader"
|
||||
$(STBOOT) -b$(BOOTSPEED) $(BOOTPORT) -w $(BIN)
|
||||
|
||||
.PHONY: clean flash boot
|
||||
9
F0:F030,F042,F072/NUCLEO_SPI/Readme
Normal file
9
F0:F030,F042,F072/NUCLEO_SPI/Readme
Normal file
@ -0,0 +1,9 @@
|
||||
This is a simple USART over DMA application with software end of string control.
|
||||
Speed 115200. Received string echoes back.
|
||||
run
|
||||
DEFS=-DCHECK_TMOUT make
|
||||
to add timeout 1.5s for each letter
|
||||
|
||||
DEFS="-DCHECK_TMOUT -DTIMEOUT_MS=xx" make
|
||||
to make another timeout
|
||||
|
||||
101
F0:F030,F042,F072/NUCLEO_SPI/main.c
Normal file
101
F0:F030,F042,F072/NUCLEO_SPI/main.c
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* main.c
|
||||
*
|
||||
* Copyright 2017 Edward V. Emelianoff <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stm32f0.h>
|
||||
#include "spi.h"
|
||||
#include "usart.h"
|
||||
|
||||
volatile uint32_t Tms = 0;
|
||||
|
||||
/* Called when systick fires */
|
||||
void sys_tick_handler(void){
|
||||
++Tms;
|
||||
}
|
||||
|
||||
static void gpio_setup(void){
|
||||
// Set green led (PB3) as output - no, PB3 is SCK!
|
||||
//RCC->AHBENR |= RCC_AHBENR_GPIOBEN;
|
||||
//GPIOB->MODER = GPIO_MODER_MODER3_O;
|
||||
}
|
||||
|
||||
static void printuhex(uint8_t *arr, uint8_t l){
|
||||
if(l > 32 || l == 0) return;
|
||||
char buf[70] = "0x";
|
||||
int8_t i, j, bidx = 2;
|
||||
for(i = 0; i < l; ++i, ++arr){
|
||||
for(j = 1; j > -1; --j){
|
||||
uint8_t half = (*arr >> (4*j)) & 0x0f;
|
||||
if(half < 10) buf[bidx++] = half + '0';
|
||||
else buf[bidx++] = half - 10 + 'a';
|
||||
}
|
||||
}
|
||||
buf[bidx++] = '\n';
|
||||
SEND(buf, bidx);
|
||||
}
|
||||
|
||||
static void print14bit(uint8_t *arr){
|
||||
uint8_t _16[2];
|
||||
_16[0] = (arr[0]>>4)&3; _16[1] = (arr[0]<<4) | (arr[1] >> 4);
|
||||
printuhex(_16, 2);
|
||||
//SEND("\n\n", 2);
|
||||
}
|
||||
|
||||
int main(void){
|
||||
uint32_t /*lastT = 0,*/ dctr = 0;
|
||||
int16_t L = 0;
|
||||
uint8_t buf[SPIBUFSZ], len;
|
||||
char *txt;
|
||||
sysreset();
|
||||
SysTick_Config(6000, 1);
|
||||
gpio_setup();
|
||||
spi_setup();
|
||||
usart2_setup();
|
||||
|
||||
while (1){
|
||||
/* if(Tms - lastT > 499){
|
||||
pin_toggle(GPIOB, 1<<3); // blink by onboard LED once per second
|
||||
lastT = Tms;
|
||||
}*/
|
||||
|
||||
if(usart2rx()){ // usart1 received data, store in in buffer
|
||||
L = usart2_getline(&txt);
|
||||
// do something with received data
|
||||
}
|
||||
if(L){ // text waits for sending
|
||||
if(ALL_OK == usart2_send(txt, L)){
|
||||
L = 0;
|
||||
}
|
||||
}
|
||||
len = SPIBUFSZ;
|
||||
uint8_t a = SPI_getdata(buf, &len);
|
||||
if(a){
|
||||
//printuhex(buf, len);
|
||||
print14bit(buf);
|
||||
}
|
||||
if(Tms - dctr > 999){// once per 1 second
|
||||
dctr = Tms;
|
||||
//SEND("pre\n", 4);
|
||||
SPI_prep_receive();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
119
F0:F030,F042,F072/NUCLEO_SPI/spi.c
Normal file
119
F0:F030,F042,F072/NUCLEO_SPI/spi.c
Normal file
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* This file is part of the F0testbrd project.
|
||||
* Copyright 2021 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h> // memcpy
|
||||
#include "usart.h"
|
||||
#include "spi.h"
|
||||
|
||||
|
||||
// buffers for DMA rx/tx
|
||||
static uint8_t inbuff[SPIBUFSZ], outbuff[SPIBUFSZ];
|
||||
static uint8_t rxrdy = 0;
|
||||
|
||||
// SPI1 (AF0): PB3 - SCK, PB4 - MISO, PB5 - MOSI; RxDMA - ch2
|
||||
void spi_setup(){
|
||||
RCC->AHBENR |= RCC_AHBENR_GPIOBEN; // uncomment in common case
|
||||
/* (1) Select AF mode on pins */
|
||||
/* (2) AF0 for SPI1 signals */
|
||||
GPIOB->MODER = (GPIOB->MODER & ~(GPIO_MODER_MODER3 | GPIO_MODER_MODER4)) |
|
||||
GPIO_MODER_MODER3_AF | GPIO_MODER_MODER4_AF; /* (1) */
|
||||
GPIOB->AFR[0] = (GPIOB->AFR[0] & ~(GPIO_AFRL_AFRL3 | GPIO_AFRL_AFRL4)); /* (2) */
|
||||
// enable clocking
|
||||
RCC->AHBENR |= RCC_AHBENR_DMA1EN;
|
||||
RCC->APB2ENR |= RCC_APB2ENR_SPI1EN;
|
||||
// Configure DMA SPI
|
||||
/* SPI_RX DMA config */
|
||||
/* (1) Peripheral address */
|
||||
/* (2) Memory address */
|
||||
/* (3) Data size */
|
||||
/* (4) Memory increment */
|
||||
/* Peripheral to memory */
|
||||
/* 8-bit transfer */
|
||||
/* Overflow IR */
|
||||
DMA1_Channel2->CCR &= ~DMA_CCR_EN;
|
||||
DMA1_Channel2->CPAR = (uint32_t)&(SPI1->DR); /* (1) */
|
||||
DMA1_Channel2->CMAR = (uint32_t)inbuff; /* (2) */
|
||||
DMA1_Channel2->CNDTR = SPIBUFSZ; /* (3) */
|
||||
DMA1_Channel2->CCR |= DMA_CCR_MINC | DMA_CCR_EN; /* (4) */
|
||||
/* (5) Peripheral address */
|
||||
/* (6) Memory address */
|
||||
/* (7) Memory increment */
|
||||
/* Memory to peripheral*/
|
||||
/* 8-bit transfer */
|
||||
/* Transfer complete IT */
|
||||
DMA1_Channel3->CCR &= ~DMA_CCR_EN;
|
||||
DMA1_Channel3->CPAR = (uint32_t)&(SPI1->DR); /* (5) */
|
||||
DMA1_Channel3->CMAR = (uint32_t)outbuff; /* (6) */
|
||||
DMA1_Channel3->CCR |= DMA_CCR_MINC | DMA_CCR_TCIE | DMA_CCR_DIR; /* (7) */
|
||||
NVIC_SetPriority(DMA1_Channel2_3_IRQn, 0);
|
||||
NVIC_EnableIRQ(DMA1_Channel2_3_IRQn);
|
||||
/* Configure SPI */
|
||||
/* (1) Master selection, BR: Fpclk/256 CPOL and CPHA at zero (rising first edge) */
|
||||
/* (1a) software slave management (SSI inactive) */
|
||||
/* (2) TX and RX with DMA, 8-bit Rx fifo */
|
||||
/* (3) Enable SPI */
|
||||
SPI1->CR1 = SPI_CR1_MSTR | SPI_CR1_BR | SPI_CR1_SSM | SPI_CR1_SSI; /* (1) */
|
||||
SPI1->CR2 = SPI_CR2_TXDMAEN | SPI_CR2_RXDMAEN | SPI_CR2_FRXTH | SPI_CR2_DS_2 | SPI_CR2_DS_1 | SPI_CR2_DS_0; /* (2) */
|
||||
SPI1->CR1 |= SPI_CR1_SPE; /* (3) */
|
||||
SPI_prep_receive();
|
||||
}
|
||||
|
||||
// prepare to receive data
|
||||
void SPI_prep_receive(){
|
||||
DMA1_Channel3->CCR &= ~DMA_CCR_EN;
|
||||
DMA1_Channel2->CCR &= ~DMA_CCR_EN;
|
||||
rxrdy = 0;
|
||||
(void)SPI1->DR; // read DR and SR to clear OVR flag
|
||||
(void)SPI1->SR;
|
||||
DMA1_Channel2->CNDTR = SPIBUFSZ;
|
||||
DMA1_Channel3->CNDTR = SPIBUFSZ;
|
||||
DMA1_Channel2->CCR |= DMA_CCR_EN;
|
||||
DMA1_Channel3->CCR |= DMA_CCR_EN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SPI_getdata - get data received by DMA & reload receiver
|
||||
* @param buf - buffer for data (with length maxlen) or NULL
|
||||
* @param maxlen - (I) - amount of received bytes (or 0 if buffer is empty),
|
||||
* (O) - amount of real bytes amount in buffer (could be > maxlen if maxlen < SPIBUFSZ)
|
||||
* @return 1 if got data
|
||||
*/
|
||||
uint8_t SPI_getdata(uint8_t *buf, uint8_t *maxlen){
|
||||
if(!rxrdy) return 0;
|
||||
//SEND("def\n", 4);
|
||||
uint8_t remain = DMA1_Channel2->CNDTR;
|
||||
if(remain) return 0;
|
||||
rxrdy = 0;
|
||||
if(maxlen){
|
||||
if(buf && *maxlen) memcpy(buf, inbuff, *maxlen);
|
||||
*maxlen = SPIBUFSZ; // bytes received
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void dma1_channel2_3_isr(){
|
||||
if(DMA1->ISR & DMA_ISR_TCIF3){
|
||||
DMA1->IFCR |= DMA_IFCR_CTCIF3;
|
||||
DMA1_Channel3->CCR &= ~DMA_CCR_EN;
|
||||
rxrdy = 1;
|
||||
}
|
||||
if(DMA1->ISR & DMA_ISR_TEIF2){ // receiver overflow
|
||||
DMA1->IFCR |= DMA_IFCR_CTEIF2;
|
||||
DMA1_Channel2->CCR &= ~DMA_CCR_EN;
|
||||
}
|
||||
}
|
||||
41
F0:F030,F042,F072/NUCLEO_SPI/spi.h
Normal file
41
F0:F030,F042,F072/NUCLEO_SPI/spi.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* This file is part of the F0testbrd project.
|
||||
* Copyright 2021 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef SPI_H__
|
||||
#define SPI_H__
|
||||
|
||||
#include <stm32f0.h>
|
||||
|
||||
// 5 bytes == 40 bits
|
||||
#define SPIBUFSZ (2)
|
||||
|
||||
typedef enum{
|
||||
SPI_NOTREADY,
|
||||
SPI_READY,
|
||||
SPI_BUSY
|
||||
} spiStatus;
|
||||
|
||||
extern spiStatus SPI_status[];
|
||||
extern volatile uint8_t SPIoverfl[];
|
||||
|
||||
void spi_setup();
|
||||
void SPI_prep_receive();
|
||||
uint8_t SPI_getdata(uint8_t *buf, uint8_t *maxlen);
|
||||
|
||||
#endif // SPI_H__
|
||||
BIN
F0:F030,F042,F072/NUCLEO_SPI/usart.bin
Executable file
BIN
F0:F030,F042,F072/NUCLEO_SPI/usart.bin
Executable file
Binary file not shown.
153
F0:F030,F042,F072/NUCLEO_SPI/usart.c
Normal file
153
F0:F030,F042,F072/NUCLEO_SPI/usart.c
Normal file
@ -0,0 +1,153 @@
|
||||
/*
|
||||
* usart.c
|
||||
*
|
||||
* Copyright 2017 Edward V. Emelianoff <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
#include <stm32f0.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "usart.h"
|
||||
|
||||
extern volatile uint32_t Tms;
|
||||
static int datalen[2] = {0,0}; // received data line length (including '\n')
|
||||
|
||||
int linerdy = 0, // received data ready
|
||||
dlen = 0, // length of data (including '\n') in current buffer
|
||||
bufovr = 0, // input buffer overfull
|
||||
txrdy = 1 // transmission done
|
||||
;
|
||||
|
||||
|
||||
int rbufno = 0; // current rbuf number
|
||||
static char rbuf[UARTBUFSZ][2], tbuf[UARTBUFSZ]; // receive & transmit buffers
|
||||
static char *recvdata = NULL;
|
||||
|
||||
/**
|
||||
* return length of received data (without trailing zero
|
||||
*/
|
||||
int usart2_getline(char **line){
|
||||
if(bufovr){
|
||||
bufovr = 0;
|
||||
linerdy = 0;
|
||||
return 0;
|
||||
}
|
||||
*line = recvdata;
|
||||
linerdy = 0;
|
||||
return dlen;
|
||||
}
|
||||
|
||||
TXstatus usart2_send(const char *str, int len){
|
||||
if(!txrdy) return LINE_BUSY;
|
||||
if(len > UARTBUFSZ) return STR_TOO_LONG;
|
||||
txrdy = 0;
|
||||
memcpy(tbuf, str, len);
|
||||
DMA1_Channel4->CCR &= ~DMA_CCR_EN;
|
||||
DMA1_Channel4->CNDTR = len;
|
||||
DMA1_Channel4->CCR |= DMA_CCR_EN; // start transmission
|
||||
return ALL_OK;
|
||||
}
|
||||
|
||||
TXstatus usart2_send_blocking(const char *str, int len){
|
||||
if(!txrdy) return LINE_BUSY;
|
||||
int i;
|
||||
bufovr = 0;
|
||||
for(i = 0; i < len; ++i){
|
||||
USART2->TDR = *str++;
|
||||
while(!(USART2->ISR & USART_ISR_TXE));
|
||||
}
|
||||
txrdy = 1;
|
||||
return ALL_OK;
|
||||
}
|
||||
|
||||
|
||||
// Nucleo's USART2 connected to VCP proxy of st-link
|
||||
void usart2_setup(){
|
||||
// setup pins: PA2 (Tx - AF1), PA15 (Rx - AF1)
|
||||
RCC->AHBENR |= RCC_AHBENR_GPIOAEN | RCC_AHBENR_DMAEN;
|
||||
// AF mode (AF1)
|
||||
GPIOA->MODER = (GPIOA->MODER & ~(GPIO_MODER_MODER2|GPIO_MODER_MODER15))\
|
||||
| (GPIO_MODER_MODER2_1 | GPIO_MODER_MODER15_1);
|
||||
GPIOA->AFR[0] = (GPIOA->AFR[0] &~GPIO_AFRH_AFRH2) | 1 << (2 * 4); // PA2
|
||||
GPIOA->AFR[1] = (GPIOA->AFR[1] &~GPIO_AFRH_AFRH7) | 1 << (7 * 4); // PA15
|
||||
// DMA: Tx - Ch4
|
||||
DMA1_Channel4->CPAR = (uint32_t) &USART2->TDR; // periph
|
||||
DMA1_Channel4->CMAR = (uint32_t) tbuf; // mem
|
||||
DMA1_Channel4->CCR |= DMA_CCR_MINC | DMA_CCR_DIR | DMA_CCR_TCIE; // 8bit, mem++, mem->per, transcompl irq
|
||||
// Tx CNDTR set @ each transmission due to data size
|
||||
NVIC_SetPriority(DMA1_Channel4_5_IRQn, 3);
|
||||
NVIC_EnableIRQ(DMA1_Channel4_5_IRQn);
|
||||
NVIC_SetPriority(USART2_IRQn, 0);
|
||||
// setup usart2
|
||||
RCC->APB1ENR |= RCC_APB1ENR_USART2EN; // clock
|
||||
// oversampling by16, 115200bps (fck=48mHz)
|
||||
//USART2_BRR = 0x1a1; // 48000000 / 115200
|
||||
USART2->BRR = 480000 / 1152;
|
||||
USART2->CR3 = USART_CR3_DMAT; // enable DMA Tx
|
||||
USART2->CR1 = USART_CR1_TE | USART_CR1_RE | USART_CR1_UE; // 1start,8data,nstop; enable Rx,Tx,USART
|
||||
while(!(USART2->ISR & USART_ISR_TC)); // polling idle frame Transmission
|
||||
USART2->ICR |= USART_ICR_TCCF; // clear TC flag
|
||||
USART2->CR1 |= USART_CR1_RXNEIE;
|
||||
NVIC_EnableIRQ(USART2_IRQn);
|
||||
}
|
||||
|
||||
|
||||
void dma1_channel4_5_isr(){
|
||||
if(DMA1->ISR & DMA_ISR_TCIF4){ // Tx
|
||||
DMA1->IFCR |= DMA_IFCR_CTCIF4; // clear TC flag
|
||||
txrdy = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void usart2_isr(){
|
||||
#ifdef CHECK_TMOUT
|
||||
static uint32_t tmout = 0;
|
||||
#endif
|
||||
if(USART2->ISR & USART_ISR_RXNE){ // RX not emty - receive next char
|
||||
#ifdef CHECK_TMOUT
|
||||
if(tmout && Tms >= tmout){ // set overflow flag
|
||||
bufovr = 1;
|
||||
datalen[rbufno] = 0;
|
||||
}
|
||||
tmout = Tms + TIMEOUT_MS;
|
||||
if(!tmout) tmout = 1; // prevent 0
|
||||
#endif
|
||||
// read RDR clears flag
|
||||
uint8_t rb = USART2->RDR;
|
||||
if(datalen[rbufno] < UARTBUFSZ){ // put next char into buf
|
||||
rbuf[rbufno][datalen[rbufno]++] = rb;
|
||||
if(rb == '\n'){ // got newline - line ready
|
||||
linerdy = 1;
|
||||
dlen = datalen[rbufno];
|
||||
recvdata = rbuf[rbufno];
|
||||
// prepare other buffer
|
||||
rbufno = !rbufno;
|
||||
datalen[rbufno] = 0;
|
||||
#ifdef CHECK_TMOUT
|
||||
// clear timeout at line end
|
||||
tmout = 0;
|
||||
#endif
|
||||
}
|
||||
}else{ // buffer overrun
|
||||
bufovr = 1;
|
||||
datalen[rbufno] = 0;
|
||||
#ifdef CHECK_TMOUT
|
||||
tmout = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
50
F0:F030,F042,F072/NUCLEO_SPI/usart.h
Normal file
50
F0:F030,F042,F072/NUCLEO_SPI/usart.h
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* usart.h
|
||||
*
|
||||
* Copyright 2017 Edward V. Emelianoff <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef __USART_H__
|
||||
#define __USART_H__
|
||||
|
||||
// input and output buffers size
|
||||
#define UARTBUFSZ (64)
|
||||
// timeout between data bytes
|
||||
#ifndef TIMEOUT_MS
|
||||
#define TIMEOUT_MS (1500)
|
||||
#endif
|
||||
|
||||
typedef enum{
|
||||
ALL_OK,
|
||||
LINE_BUSY,
|
||||
STR_TOO_LONG
|
||||
} TXstatus;
|
||||
|
||||
#define SEND(s, l) do{}while(ALL_OK != usart2_send(s, l))
|
||||
|
||||
#define usart2rx() (linerdy)
|
||||
#define usart2ovr() (bufovr)
|
||||
|
||||
extern int linerdy, bufovr, txrdy;
|
||||
|
||||
void usart2_setup();
|
||||
int usart2_getline(char **line);
|
||||
TXstatus usart2_send(const char *str, int len);
|
||||
TXstatus usart2_send_blocking(const char *str, int len);
|
||||
|
||||
#endif // __USART_H__
|
||||
Binary file not shown.
75
F0:F030,F042,F072/canbus/kicad/stm32.kicad_prl
Normal file
75
F0:F030,F042,F072/canbus/kicad/stm32.kicad_prl
Normal file
@ -0,0 +1,75 @@
|
||||
{
|
||||
"board": {
|
||||
"active_layer": 0,
|
||||
"active_layer_preset": "",
|
||||
"auto_track_width": true,
|
||||
"hidden_nets": [],
|
||||
"high_contrast_mode": 0,
|
||||
"net_color_mode": 1,
|
||||
"opacity": {
|
||||
"pads": 1.0,
|
||||
"tracks": 1.0,
|
||||
"vias": 1.0,
|
||||
"zones": 0.6
|
||||
},
|
||||
"ratsnest_display_mode": 0,
|
||||
"selection_filter": {
|
||||
"dimensions": true,
|
||||
"footprints": true,
|
||||
"graphics": true,
|
||||
"keepouts": true,
|
||||
"lockedItems": true,
|
||||
"otherItems": true,
|
||||
"pads": true,
|
||||
"text": true,
|
||||
"tracks": true,
|
||||
"vias": true,
|
||||
"zones": true
|
||||
},
|
||||
"visible_items": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27,
|
||||
28,
|
||||
29,
|
||||
30,
|
||||
32,
|
||||
33,
|
||||
34,
|
||||
35,
|
||||
36
|
||||
],
|
||||
"visible_layers": "fffffff_ffffffff",
|
||||
"zone_display_mode": 0
|
||||
},
|
||||
"meta": {
|
||||
"filename": "stm32.kicad_prl",
|
||||
"version": 3
|
||||
},
|
||||
"project": {
|
||||
"files": []
|
||||
}
|
||||
}
|
||||
320
F0:F030,F042,F072/canbus/kicad/stm32.kicad_pro
Normal file
320
F0:F030,F042,F072/canbus/kicad/stm32.kicad_pro
Normal file
@ -0,0 +1,320 @@
|
||||
{
|
||||
"board": {
|
||||
"design_settings": {
|
||||
"defaults": {
|
||||
"board_outline_line_width": 0.1,
|
||||
"copper_line_width": 0.2,
|
||||
"copper_text_size_h": 1.5,
|
||||
"copper_text_size_v": 1.5,
|
||||
"copper_text_thickness": 0.3,
|
||||
"other_line_width": 0.15,
|
||||
"silk_line_width": 0.15,
|
||||
"silk_text_size_h": 1.0,
|
||||
"silk_text_size_v": 1.0,
|
||||
"silk_text_thickness": 0.15
|
||||
},
|
||||
"diff_pair_dimensions": [],
|
||||
"drc_exclusions": [],
|
||||
"rules": {
|
||||
"solder_mask_clearance": 0.0,
|
||||
"solder_mask_min_width": 0.0
|
||||
},
|
||||
"track_widths": [],
|
||||
"via_dimensions": []
|
||||
},
|
||||
"layer_presets": []
|
||||
},
|
||||
"boards": [],
|
||||
"cvpcb": {
|
||||
"equivalence_files": []
|
||||
},
|
||||
"erc": {
|
||||
"erc_exclusions": [],
|
||||
"meta": {
|
||||
"version": 0
|
||||
},
|
||||
"pin_map": [
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
]
|
||||
],
|
||||
"rule_severities": {
|
||||
"bus_definition_conflict": "error",
|
||||
"bus_entry_needed": "error",
|
||||
"bus_label_syntax": "error",
|
||||
"bus_to_bus_conflict": "error",
|
||||
"bus_to_net_conflict": "error",
|
||||
"different_unit_footprint": "error",
|
||||
"different_unit_net": "error",
|
||||
"duplicate_reference": "error",
|
||||
"duplicate_sheet_names": "error",
|
||||
"extra_units": "error",
|
||||
"global_label_dangling": "warning",
|
||||
"hier_label_mismatch": "error",
|
||||
"label_dangling": "error",
|
||||
"lib_symbol_issues": "warning",
|
||||
"multiple_net_names": "warning",
|
||||
"net_not_bus_member": "warning",
|
||||
"no_connect_connected": "warning",
|
||||
"no_connect_dangling": "warning",
|
||||
"pin_not_connected": "error",
|
||||
"pin_not_driven": "error",
|
||||
"pin_to_pin": "warning",
|
||||
"power_pin_not_driven": "error",
|
||||
"similar_labels": "warning",
|
||||
"unannotated": "error",
|
||||
"unit_value_mismatch": "error",
|
||||
"unresolved_variable": "error",
|
||||
"wire_dangling": "error"
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"pinned_footprint_libs": [],
|
||||
"pinned_symbol_libs": []
|
||||
},
|
||||
"meta": {
|
||||
"filename": "stm32.kicad_pro",
|
||||
"version": 1
|
||||
},
|
||||
"net_settings": {
|
||||
"classes": [
|
||||
{
|
||||
"bus_width": 12.0,
|
||||
"clearance": 0.2,
|
||||
"diff_pair_gap": 0.25,
|
||||
"diff_pair_via_gap": 0.25,
|
||||
"diff_pair_width": 0.2,
|
||||
"line_style": 0,
|
||||
"microvia_diameter": 0.3,
|
||||
"microvia_drill": 0.1,
|
||||
"name": "Default",
|
||||
"pcb_color": "rgba(0, 0, 0, 0.000)",
|
||||
"schematic_color": "rgba(0, 0, 0, 0.000)",
|
||||
"track_width": 0.25,
|
||||
"via_diameter": 0.8,
|
||||
"via_drill": 0.4,
|
||||
"wire_width": 6.0
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"version": 2
|
||||
},
|
||||
"net_colors": null
|
||||
},
|
||||
"pcbnew": {
|
||||
"last_paths": {
|
||||
"gencad": "",
|
||||
"idf": "",
|
||||
"netlist": "",
|
||||
"specctra_dsn": "",
|
||||
"step": "",
|
||||
"vrml": ""
|
||||
},
|
||||
"page_layout_descr_file": ""
|
||||
},
|
||||
"schematic": {
|
||||
"annotate_start_num": 0,
|
||||
"drawing": {
|
||||
"default_line_thickness": 6.0,
|
||||
"default_text_size": 50.0,
|
||||
"field_names": [],
|
||||
"intersheets_ref_own_page": false,
|
||||
"intersheets_ref_prefix": "",
|
||||
"intersheets_ref_short": false,
|
||||
"intersheets_ref_show": false,
|
||||
"intersheets_ref_suffix": "",
|
||||
"junction_size_choice": 3,
|
||||
"label_size_ratio": 0.25,
|
||||
"pin_symbol_size": 0.0,
|
||||
"text_offset_ratio": 0.08
|
||||
},
|
||||
"legacy_lib_dir": "",
|
||||
"legacy_lib_list": [],
|
||||
"meta": {
|
||||
"version": 1
|
||||
},
|
||||
"net_format_name": "",
|
||||
"ngspice": {
|
||||
"fix_include_paths": true,
|
||||
"fix_passive_vals": false,
|
||||
"meta": {
|
||||
"version": 0
|
||||
},
|
||||
"model_mode": 0,
|
||||
"workbook_filename": ""
|
||||
},
|
||||
"page_layout_descr_file": "",
|
||||
"plot_directory": "",
|
||||
"spice_adjust_passive_values": false,
|
||||
"spice_external_command": "spice \"%I\"",
|
||||
"subpart_first_id": 65,
|
||||
"subpart_id_separator": 0
|
||||
},
|
||||
"sheets": [],
|
||||
"text_variables": {}
|
||||
}
|
||||
Binary file not shown.
@ -314,6 +314,7 @@
|
||||
],
|
||||
"rule_severities": {
|
||||
"bus_definition_conflict": "error",
|
||||
"bus_entry_needed": "error",
|
||||
"bus_label_syntax": "error",
|
||||
"bus_to_bus_conflict": "error",
|
||||
"bus_to_net_conflict": "error",
|
||||
@ -406,7 +407,7 @@
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"version": 0
|
||||
"version": 2
|
||||
},
|
||||
"net_colors": null
|
||||
},
|
||||
@ -422,6 +423,7 @@
|
||||
"page_layout_descr_file": ""
|
||||
},
|
||||
"schematic": {
|
||||
"annotate_start_num": 0,
|
||||
"drawing": {
|
||||
"default_bus_thickness": 12.0,
|
||||
"default_junction_size": 40.0,
|
||||
@ -435,20 +437,24 @@
|
||||
"intersheets_ref_show": false,
|
||||
"intersheets_ref_suffix": "",
|
||||
"junction_size_choice": 3,
|
||||
"label_size_ratio": 0.3,
|
||||
"pin_symbol_size": 25.0,
|
||||
"text_offset_ratio": 0.3
|
||||
},
|
||||
"legacy_lib_dir": "",
|
||||
"legacy_lib_list": [],
|
||||
"meta": {
|
||||
"version": 0
|
||||
"version": 1
|
||||
},
|
||||
"net_format_name": "Pcbnew",
|
||||
"ngspice": {
|
||||
"fix_include_paths": true,
|
||||
"fix_passive_vals": false,
|
||||
"meta": {
|
||||
"version": 0
|
||||
},
|
||||
"model_mode": 0
|
||||
"model_mode": 0,
|
||||
"workbook_filename": ""
|
||||
},
|
||||
"page_layout_descr_file": "",
|
||||
"plot_directory": "",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user