Isolate usb-serial-rs485 tree

This commit is contained in:
jaseg 2018-07-17 15:43:26 +02:00
parent 90ce052d82
commit 6df66b77ba
121 changed files with 165 additions and 51130 deletions

8
.gitignore vendored
View file

@ -1,8 +0,0 @@
*.bin
*.elf
*.pyc
swodump*.log
nbproject/
bin-*/
generated*

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "libopencm3"]
path = libopencm3
url = git@github.com:libopencm3/libopencm3.git

10
LICENSE
View file

@ -1,10 +0,0 @@
Code in _this_ repository should be considered under your choice of:
* Apache 2.0
* BSD 2 clause
* ISC
* MIT
* X11
* LGPL3+
libopencm3 itself has it's own license. (LGPL3+ at time of writing)

View file

@ -1,19 +0,0 @@
# Cross target tests for libopencm3
libopencm3(http://github.com/libopencm3/libopencm3) pull requests are often
hard to review. It can be hard to see the impact on "user" land code, it can
be hard to see how the behaviour changes from a->b.
This repository contains testing frameworks I've put together to help with
cross target testing, with the aim of making them as automated as possible.
General plan is something like....
1. make -C libopencm3 clean all -j8
2. make -C tests/xxx clean all flash test V=1
3. cd libopencm3
4. git checkout proposed-new-code
5. return to step 1
Mileage _will_ vary.

15
hw1/.gitignore vendored
View file

@ -1,15 +0,0 @@
*.bak
*.bck
*.kicad_pcb-bak
# kicad gerber output
*.gbl
*.gbs
*.gbo
*.gm1
*.gtl
*.gts
*.gbr
*.gto
*.drl

View file

@ -1,23 +0,0 @@
This is a board designed to receive nucleo64 (and maybe 32) boards
to be test TARGETS. The stm32l1 on _this_ board is reprogrammed via
one of the debug connectors, with appropriate software to be
master/slave/etc to correspond with the DUT. All (most) communication
lines between the two boards are tapped to a 10 pin connector matching
cheap FX2based logic analysers, allowing automatic tests to be written
that use sigrok to check that the signals on the wire match expectations.
Notes on assembly hw1-a:
* 16Mhz crystal, 15pf load caps, and 3k7 i2c pullups
(why don't I have 4k7 0603 resistors lying around? who knows!)
* A power LED wouldn't hurt.
* Adding a red/green user led wouldn't hurt for test pass/fail, even though
it's meant to be autotest
* maybe a fet to turn on/off the i2c pull ups programatically?
(maybe just a single jumper? is there really any need for individual control
of the pullups?)
* move stlink connector 90° or just down and tuck it in, so we can pull the
edge in. It overlaps the buttons on the nucleos, and requires longer
pins than necessary otherwise.
* Add some ground pads for test points, just in general. Test points good,
more test points better.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,12 +0,0 @@
(module Arduino_1pin (layer F.Cu) (tedit 0)
(descr "module 1 pin (ou trou mecanique de percage)")
(tags DEV)
(fp_text reference REF** (at 0 -3.048) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value 1pin (at 0 2.794) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_circle (center 0 0) (end 0 -2.286) (layer F.SilkS) (width 0.15))
(pad 1 thru_hole circle (at 0 0) (size 4.064 4.064) (drill 3.048) (layers *.Cu *.Mask F.SilkS))
)

View file

@ -1,32 +0,0 @@
(module Socket_Strip_Arduino_1x06 (layer F.Cu) (tedit 551AF7D9)
(descr "Through hole socket strip")
(tags "socket strip")
(fp_text reference REF** (at 0 -5.1) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value Socket_Strip_Arduino_1x06 (at 0 -3.1) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_line (start -1.75 -1.75) (end -1.75 1.75) (layer F.CrtYd) (width 0.05))
(fp_line (start 14.45 -1.75) (end 14.45 1.75) (layer F.CrtYd) (width 0.05))
(fp_line (start -1.75 -1.75) (end 14.45 -1.75) (layer F.CrtYd) (width 0.05))
(fp_line (start -1.75 1.75) (end 14.45 1.75) (layer F.CrtYd) (width 0.05))
(fp_line (start 1.27 1.27) (end 13.97 1.27) (layer F.SilkS) (width 0.15))
(fp_line (start 13.97 1.27) (end 13.97 -1.27) (layer F.SilkS) (width 0.15))
(fp_line (start 13.97 -1.27) (end 1.27 -1.27) (layer F.SilkS) (width 0.15))
(fp_line (start -1.55 1.55) (end 0 1.55) (layer F.SilkS) (width 0.15))
(fp_line (start 1.27 1.27) (end 1.27 -1.27) (layer F.SilkS) (width 0.15))
(fp_line (start 0 -1.55) (end -1.55 -1.55) (layer F.SilkS) (width 0.15))
(fp_line (start -1.55 -1.55) (end -1.55 1.55) (layer F.SilkS) (width 0.15))
(pad 1 thru_hole oval (at 0 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 2 thru_hole oval (at 2.54 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 3 thru_hole oval (at 5.08 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 4 thru_hole oval (at 7.62 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 5 thru_hole oval (at 10.16 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 6 thru_hole oval (at 12.7 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(model ${KIPRJMOD}/Socket_Arduino_Uno.3dshapes/Socket_header_Arduino_1x06.wrl
(at (xyz 0.25 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 180))
)
)

View file

@ -1,34 +0,0 @@
(module Socket_Strip_Arduino_1x08 (layer F.Cu) (tedit 551AF8B3)
(descr "Through hole socket strip")
(tags "socket strip")
(fp_text reference REF** (at 0 -5.1) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value Socket_Strip_Arduino_1x08 (at 0 -3.1) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_line (start -1.75 -1.75) (end -1.75 1.75) (layer F.CrtYd) (width 0.05))
(fp_line (start 19.55 -1.75) (end 19.55 1.75) (layer F.CrtYd) (width 0.05))
(fp_line (start -1.75 -1.75) (end 19.55 -1.75) (layer F.CrtYd) (width 0.05))
(fp_line (start -1.75 1.75) (end 19.55 1.75) (layer F.CrtYd) (width 0.05))
(fp_line (start 1.27 1.27) (end 19.05 1.27) (layer F.SilkS) (width 0.15))
(fp_line (start 19.05 1.27) (end 19.05 -1.27) (layer F.SilkS) (width 0.15))
(fp_line (start 19.05 -1.27) (end 1.27 -1.27) (layer F.SilkS) (width 0.15))
(fp_line (start -1.55 1.55) (end 0 1.55) (layer F.SilkS) (width 0.15))
(fp_line (start 1.27 1.27) (end 1.27 -1.27) (layer F.SilkS) (width 0.15))
(fp_line (start 0 -1.55) (end -1.55 -1.55) (layer F.SilkS) (width 0.15))
(fp_line (start -1.55 -1.55) (end -1.55 1.55) (layer F.SilkS) (width 0.15))
(pad 1 thru_hole oval (at 0 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 2 thru_hole oval (at 2.54 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 3 thru_hole oval (at 5.08 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 4 thru_hole oval (at 7.62 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 5 thru_hole oval (at 10.16 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 6 thru_hole oval (at 12.7 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 7 thru_hole oval (at 15.24 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 8 thru_hole oval (at 17.78 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(model ${KIPRJMOD}/Socket_Arduino_Uno.3dshapes/Socket_header_Arduino_1x08.wrl
(at (xyz 0.35 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 180))
)
)

View file

@ -1,36 +0,0 @@
(module Socket_Strip_Arduino_1x10 (layer F.Cu) (tedit 551AF8D9)
(descr "Through hole socket strip")
(tags "socket strip")
(fp_text reference REF** (at 0 -5.1) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value Socket_Strip_Arduino_1x10 (at 0 -3.1) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_line (start -1.75 -1.75) (end -1.75 1.75) (layer F.CrtYd) (width 0.05))
(fp_line (start 24.65 -1.75) (end 24.65 1.75) (layer F.CrtYd) (width 0.05))
(fp_line (start -1.75 -1.75) (end 24.65 -1.75) (layer F.CrtYd) (width 0.05))
(fp_line (start -1.75 1.75) (end 24.65 1.75) (layer F.CrtYd) (width 0.05))
(fp_line (start 1.27 1.27) (end 24.13 1.27) (layer F.SilkS) (width 0.15))
(fp_line (start 24.13 1.27) (end 24.13 -1.27) (layer F.SilkS) (width 0.15))
(fp_line (start 24.13 -1.27) (end 1.27 -1.27) (layer F.SilkS) (width 0.15))
(fp_line (start -1.55 1.55) (end 0 1.55) (layer F.SilkS) (width 0.15))
(fp_line (start 1.27 1.27) (end 1.27 -1.27) (layer F.SilkS) (width 0.15))
(fp_line (start 0 -1.55) (end -1.55 -1.55) (layer F.SilkS) (width 0.15))
(fp_line (start -1.55 -1.55) (end -1.55 1.55) (layer F.SilkS) (width 0.15))
(pad 1 thru_hole oval (at 0 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 2 thru_hole oval (at 2.54 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 3 thru_hole oval (at 5.08 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 4 thru_hole oval (at 7.62 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 5 thru_hole oval (at 10.16 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 6 thru_hole oval (at 12.7 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 7 thru_hole oval (at 15.24 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 8 thru_hole oval (at 17.78 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 9 thru_hole oval (at 20.32 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(pad 10 thru_hole oval (at 22.86 0) (size 1.7272 2.032) (drill 1.016) (layers *.Cu *.Mask F.SilkS))
(model ${KIPRJMOD}/Socket_Arduino_Uno.3dshapes/Socket_header_Arduino_1x10.wrl
(at (xyz 0.45 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 180))
)
)

View file

@ -1,144 +0,0 @@
#MicroXplorer Configuration settings - do not modify
ADC.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_TEMPSENSOR
ADC.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag
ADC.NbrOfConversionFlag=1
ADC.Rank-0\#ChannelRegularConversion=1
ADC.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_4CYCLES
File.Version=6
KeepUserPlacement=false
Mcu.Family=STM32L1
Mcu.IP0=ADC
Mcu.IP1=DAC
Mcu.IP2=I2C1
Mcu.IP3=NVIC
Mcu.IP4=RCC
Mcu.IP5=SPI2
Mcu.IP6=SYS
Mcu.IP7=USART2
Mcu.IP8=USB
Mcu.IPNb=9
Mcu.Name=STM32L151C(6-8-B)TxA
Mcu.Package=LQFP48
Mcu.Pin0=PH0-OSC_IN
Mcu.Pin1=PH1-OSC_OUT
Mcu.Pin10=PB0
Mcu.Pin11=PB1
Mcu.Pin12=PB12
Mcu.Pin13=PB13
Mcu.Pin14=PB14
Mcu.Pin15=PB15
Mcu.Pin16=PA8
Mcu.Pin17=PA11
Mcu.Pin18=PA12
Mcu.Pin19=PB8
Mcu.Pin2=PA0-WKUP1
Mcu.Pin20=PB9
Mcu.Pin21=VP_ADC_TempSens_Input
Mcu.Pin22=VP_ADC_Vref_Input
Mcu.Pin23=VP_SYS_VS_Systick
Mcu.Pin3=PA1
Mcu.Pin4=PA2
Mcu.Pin5=PA3
Mcu.Pin6=PA4
Mcu.Pin7=PA5
Mcu.Pin8=PA6
Mcu.Pin9=PA7
Mcu.PinsNb=24
Mcu.UserConstants=
Mcu.UserName=STM32L151C8TxA
MxCube.Version=4.13.1
MxDb.Version=DB.4.0.130
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SysTick_IRQn=true\:0\:0\:false
PA0-WKUP1.Mode=CTS_RTS
PA0-WKUP1.Signal=USART2_CTS
PA1.Mode=CTS_RTS
PA1.Signal=USART2_RTS
PA11.Mode=Device
PA11.Signal=USB_DM
PA12.Mode=Device
PA12.Signal=USB_DP
PA2.Mode=Asynchronous
PA2.Signal=USART2_TX
PA3.Mode=Asynchronous
PA3.Signal=USART2_RX
PA4.Signal=COMP_DAC1_group
PA5.Signal=COMP_DAC2_group
PA6.Mode=IN6
PA6.Signal=ADC_IN6
PA7.Mode=IN7
PA7.Signal=ADC_IN7
PA8.Mode=Clock-out
PA8.Signal=RCC_MCO
PB0.Mode=IN8
PB0.Signal=ADC_IN8
PB1.Mode=IN9
PB1.Signal=ADC_IN9
PB12.Mode=NSS_Signal_Hard_Input
PB12.Signal=SPI2_NSS
PB13.Mode=Full_Duplex_Master
PB13.Signal=SPI2_SCK
PB14.Mode=Full_Duplex_Master
PB14.Signal=SPI2_MISO
PB15.Mode=Full_Duplex_Master
PB15.Signal=SPI2_MOSI
PB8.Locked=true
PB8.Mode=I2C
PB8.Signal=I2C1_SCL
PB9.Locked=true
PB9.Mode=I2C
PB9.Signal=I2C1_SDA
PCC.Checker=true
PCC.Line=STM32L151/152
PCC.MCU=STM32L151C(6-8-B)TxA
PCC.MXVersion=4.13.1
PCC.PartNumber=STM32L151C8TxA
PCC.Seq0=0
PCC.Series=STM32L1
PCC.Temperature=25
PCC.Vdd=3.0
PH0-OSC_IN.Mode=HSE-External-Oscillator
PH0-OSC_IN.Signal=RCC_OSC_IN
PH1-OSC_OUT.Mode=HSE-External-Oscillator
PH1-OSC_OUT.Signal=RCC_OSC_OUT
RCC.AHBFreq_Value=32000000
RCC.APB1Freq_Value=32000000
RCC.APB1TimFreq_Value=32000000
RCC.APB2Freq_Value=32000000
RCC.APB2TimFreq_Value=32000000
RCC.FCLKCortexFreq_Value=32000000
RCC.FamilyName=M
RCC.HCLKFreq_Value=32000000
RCC.HSE_VALUE=24000000
RCC.HSI_VALUE=16000000
RCC.IPParameters=FamilyName,HSI_VALUE,LSI_VALUE,MSI_VALUE,HSE_VALUE,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,AHBFreq_Value,TIMFreq_Value,APB1Freq_Value,APB2Freq_Value,RTCFreq_Value,VCOOutputFreq_Value,PLLCLKFreq_Value,USBOutput,VCOInputFreq_Value,SYSCLKSource,PWRFreq_Value,HCLKFreq_Value,TimerFreq_Value,FCLKCortexFreq_Value,APB1TimFreq_Value,APB2TimFreq_Value,MCOPinFreq_Value,PLLDIV,PLLMUL
RCC.LSI_VALUE=37000
RCC.MCOPinFreq_Value=32000000
RCC.MSI_VALUE=2097000
RCC.PLLCLKFreq_Value=32000000
RCC.PLLDIV=RCC_PLL_DIV3
RCC.PLLMUL=RCC_PLL_MUL4
RCC.PWRFreq_Value=32000000
RCC.RTCFreq_Value=37000
RCC.RTCHSEDivFreq_Value=12000000
RCC.SYSCLKFreq_VALUE=32000000
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
RCC.TIMFreq_Value=32000000
RCC.TimerFreq_Value=32000000
RCC.USBOutput=48000000
RCC.VCOInputFreq_Value=24000000
RCC.VCOOutputFreq_Value=96000000
SH.COMP_DAC1_group.0=DAC_OUT1,DAC_OUT1
SH.COMP_DAC1_group.ConfNb=1
SH.COMP_DAC2_group.0=DAC_OUT2,DAC_OUT2
SH.COMP_DAC2_group.ConfNb=1
SPI2.CalculateBaudRate=16.0 MBits/s
SPI2.IPParameters=Mode,CalculateBaudRate,VirtualNSS
SPI2.Mode=SPI_MODE_MASTER
SPI2.VirtualNSS=VM_NSSHARD
VP_ADC_TempSens_Input.Mode=IN-TempSens
VP_ADC_TempSens_Input.Signal=ADC_TempSens_Input
VP_ADC_Vref_Input.Mode=IN-Vrefint
VP_ADC_Vref_Input.Signal=ADC_Vref_Input
VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick

View file

@ -1,419 +0,0 @@
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# +3V3
#
DEF +3V3 #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "+3V3" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
ALIAS +3.3V
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
#
DEF +5V #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "+5V" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X +5V 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# C
#
DEF C C 0 10 N Y 1 F N
F0 "C" 25 100 50 H V L CNN
F1 "C" 25 -100 50 H V L CNN
F2 "" 38 -150 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
C_*
$ENDFPLIST
DRAW
P 2 0 1 20 -80 -30 80 -30 N
P 2 0 1 20 -80 30 80 30 N
X ~ 1 0 150 110 D 50 50 1 1 P
X ~ 2 0 -150 110 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# CONN_01X02
#
DEF CONN_01X02 J 0 40 Y N 1 F N
F0 "J" 0 150 50 H V C CNN
F1 "CONN_01X02" 100 0 50 V V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Pin_Header_Straight_1X*
Pin_Header_Angled_1X*
Socket_Strip_Straight_1X*
Socket_Strip_Angled_1X*
$ENDFPLIST
DRAW
S -50 -45 10 -55 0 1 0 N
S -50 55 10 45 0 1 0 N
S -50 100 50 -100 0 1 0 N
X P1 1 -200 50 150 R 50 50 1 1 P
X P2 2 -200 -50 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# CONN_01X06
#
DEF CONN_01X06 J 0 40 Y N 1 F N
F0 "J" 0 350 50 H V C CNN
F1 "CONN_01X06" 100 0 50 V V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Pin_Header_Straight_1X*
Pin_Header_Angled_1X*
Socket_Strip_Straight_1X*
Socket_Strip_Angled_1X*
$ENDFPLIST
DRAW
S -50 -245 10 -255 0 1 0 N
S -50 -145 10 -155 0 1 0 N
S -50 -45 10 -55 0 1 0 N
S -50 55 10 45 0 1 0 N
S -50 155 10 145 0 1 0 N
S -50 255 10 245 0 1 0 N
S -50 300 50 -300 0 1 0 N
X P1 1 -200 250 150 R 50 50 1 1 P
X P2 2 -200 150 150 R 50 50 1 1 P
X P3 3 -200 50 150 R 50 50 1 1 P
X P4 4 -200 -50 150 R 50 50 1 1 P
X P5 5 -200 -150 150 R 50 50 1 1 P
X P6 6 -200 -250 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# CONN_01X08
#
DEF CONN_01X08 J 0 40 Y N 1 F N
F0 "J" 0 450 50 H V C CNN
F1 "CONN_01X08" 100 0 50 V V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Pin_Header_Straight_1X*
Pin_Header_Angled_1X*
Socket_Strip_Straight_1X*
Socket_Strip_Angled_1X*
$ENDFPLIST
DRAW
S -50 -400 50 400 0 1 0 N
S -50 -345 10 -355 0 1 0 N
S -50 -245 10 -255 0 1 0 N
S -50 -145 10 -155 0 1 0 N
S -50 -45 10 -55 0 1 0 N
S -50 55 10 45 0 1 0 N
S -50 155 10 145 0 1 0 N
S -50 255 10 245 0 1 0 N
S -50 355 10 345 0 1 0 N
X P1 1 -200 350 150 R 50 50 1 1 P
X P2 2 -200 250 150 R 50 50 1 1 P
X P3 3 -200 150 150 R 50 50 1 1 P
X P4 4 -200 50 150 R 50 50 1 1 P
X P5 5 -200 -50 150 R 50 50 1 1 P
X P6 6 -200 -150 150 R 50 50 1 1 P
X P7 7 -200 -250 150 R 50 50 1 1 P
X P8 8 -200 -350 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# CONN_01X10
#
DEF CONN_01X10 J 0 40 Y N 1 F N
F0 "J" 0 550 50 H V C CNN
F1 "CONN_01X10" 100 0 50 V V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Pin_Header_Straight_1X*
Pin_Header_Angled_1X*
Socket_Strip_Straight_1X*
Socket_Strip_Angled_1X*
$ENDFPLIST
DRAW
S -50 -445 10 -455 0 1 0 N
S -50 -345 10 -355 0 1 0 N
S -50 -245 10 -255 0 1 0 N
S -50 -145 10 -155 0 1 0 N
S -50 -45 10 -55 0 1 0 N
S -50 55 10 45 0 1 0 N
S -50 155 10 145 0 1 0 N
S -50 255 10 245 0 1 0 N
S -50 355 10 345 0 1 0 N
S -50 455 10 445 0 1 0 N
S -50 500 50 -500 0 1 0 N
X P1 1 -200 450 150 R 50 50 1 1 P
X P2 2 -200 350 150 R 50 50 1 1 P
X P3 3 -200 250 150 R 50 50 1 1 P
X P4 4 -200 150 150 R 50 50 1 1 P
X P5 5 -200 50 150 R 50 50 1 1 P
X P6 6 -200 -50 150 R 50 50 1 1 P
X P7 7 -200 -150 150 R 50 50 1 1 P
X P8 8 -200 -250 150 R 50 50 1 1 P
X P9 9 -200 -350 150 R 50 50 1 1 P
X P10 10 -200 -450 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# CONN_02X05
#
DEF CONN_02X05 J 0 1 Y N 1 F N
F0 "J" 0 300 50 H V C CNN
F1 "CONN_02X05" 0 -300 50 H V C CNN
F2 "" 0 -1200 50 H I C CNN
F3 "" 0 -1200 50 H I C CNN
$FPLIST
Pin_Header_Straight_2X*
Pin_Header_Angled_2X*
Socket_Strip_Straight_2X*
Socket_Strip_Angled_2X*
IDC_Header_Straight_*
$ENDFPLIST
DRAW
S -100 -195 -50 -205 0 1 0 N
S -100 -95 -50 -105 0 1 0 N
S -100 5 -50 -5 0 1 0 N
S -100 105 -50 95 0 1 0 N
S -100 205 -50 195 0 1 0 N
S -100 250 100 -250 0 1 0 N
S 50 -195 100 -205 0 1 0 N
S 50 -95 100 -105 0 1 0 N
S 50 5 100 -5 0 1 0 N
S 50 105 100 95 0 1 0 N
S 50 205 100 195 0 1 0 N
X P1 1 -250 200 150 R 50 50 1 1 P
X P2 2 250 200 150 L 50 50 1 1 P
X P3 3 -250 100 150 R 50 50 1 1 P
X P4 4 250 100 150 L 50 50 1 1 P
X P5 5 -250 0 150 R 50 50 1 1 P
X P6 6 250 0 150 L 50 50 1 1 P
X P7 7 -250 -100 150 R 50 50 1 1 P
X P8 8 250 -100 150 L 50 50 1 1 P
X P9 9 -250 -200 150 R 50 50 1 1 P
X P10 10 250 -200 150 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Crystal_GND24_Small
#
DEF Crystal_GND24_Small Y 0 40 Y N 1 F N
F0 "Y" 50 175 50 H V L CNN
F1 "Crystal_GND24_Small" 50 100 50 H V L CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Crystal*
$ENDFPLIST
DRAW
S -30 -60 30 60 0 1 0 N
P 2 0 1 15 -50 -30 -50 30 N
P 2 0 1 15 50 -30 50 30 N
P 4 0 1 0 -50 -50 -50 -75 50 -75 50 -50 N
P 4 0 1 0 -50 50 -50 75 50 75 50 50 N
X 1 1 -100 0 50 R 50 50 1 1 P
X 2 2 0 -125 50 U 50 50 1 1 P
X 3 3 100 0 50 L 50 50 1 1 P
X 4 4 0 125 50 D 50 50 1 1 P
ENDDRAW
ENDDEF
#
# GND
#
DEF GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -250 50 H I C CNN
F1 "GND" 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
#
# Jumper_NC_Small
#
DEF Jumper_NC_Small JP 0 30 N N 1 F N
F0 "JP" 0 80 50 H V C CNN
F1 "Jumper_NC_Small" 10 -60 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
A 0 -10 57 450 1350 0 1 0 N 40 30 -40 30
C -40 0 20 0 1 0 N
C 40 0 20 0 1 0 N
X 1 1 -100 0 40 R 50 50 0 1 P
X 2 2 100 0 40 L 50 50 0 1 P
ENDDRAW
ENDDEF
#
# MIC550x-3.3YM5
#
DEF MIC550x-3.3YM5 U 0 40 Y Y 1 F N
F0 "U" -250 200 50 H V L CNN
F1 "MIC550x-3.3YM5" 600 200 50 H V R CNN
F2 "TO_SOT_Packages_SMD:SOT-23-5" 650 -250 50 H I C CIN
F3 "" 0 0 50 H V C CNN
$FPLIST
SOT-23*
$ENDFPLIST
DRAW
S -250 150 250 -200 0 1 10 f
X VIN 1 -400 100 150 R 50 50 1 1 W
X GND 2 0 -300 100 U 50 50 1 1 W
X EN 3 -400 -100 150 R 50 50 1 1 I
X NC 4 400 -100 150 L 50 50 1 1 N
X VOUT 5 400 100 150 L 50 50 1 1 w
ENDDRAW
ENDDEF
#
# PWR_FLAG
#
DEF PWR_FLAG #FLG 0 0 N N 1 F P
F0 "#FLG" 0 75 50 H I C CNN
F1 "PWR_FLAG" 0 150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
X pwr 1 0 0 0 U 50 50 0 0 w
P 6 0 1 0 0 0 0 50 -40 75 0 100 40 75 0 50 N
ENDDRAW
ENDDEF
#
# R
#
DEF R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN
F1 "R" 0 0 50 V V C CNN
F2 "" -70 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
R_*
$ENDFPLIST
DRAW
S -40 -100 40 100 0 1 10 N
X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# STM32L151C6TxA
#
DEF STM32L151C6TxA U 0 40 Y Y 1 L N
F0 "U" -3500 1725 50 H V L BNN
F1 "STM32L151C6TxA" 3500 1725 50 H V R BNN
F2 "Housings_QFP:LQFP-48_7x7mm_Pitch0.5mm" 3500 1675 50 H I R TNN
F3 "" 0 0 50 H I C CNN
ALIAS STM32L151C8TxA STM32L151CBTxA
DRAW
S -3500 -1700 3500 1700 0 1 10 f
X VLCD 1 -3600 1000 100 R 50 50 1 1 W
X PC13/RTC_OUT_ALARM/RTC_OUT_CALIB/RTC_TAMP1/RTC_TS/SYS_WKUP2/TIMX_IC2 2 -3600 500 100 R 50 50 1 1 B
X PC14/RCC_OSC32_IN/TIMX_IC3 3 -3600 400 100 R 50 50 1 1 B
X PC15/ADC_EXTI15/RCC_OSC32_OUT/TIMX_IC4 4 -3600 300 100 R 50 50 1 1 B
X PH0/RCC_OSC_IN 5 -3600 800 100 R 50 50 1 1 I
X PH1/RCC_OSC_OUT 6 -3600 700 100 R 50 50 1 1 I
X NRST 7 -3600 1400 100 R 50 50 1 1 I
X VSSA 8 100 -1800 100 U 50 50 1 1 W
X VDDA 9 100 1800 100 D 50 50 1 1 W
X ADC_IN0/COMP1_INP/RTC_TAMP2/SYS_WKUP1/TIM2_CH1/TIM2_ETR/TIMX_IC1/TS_G1_IO1/USART2_CTS/PA0 10 3600 100 100 L 50 50 1 1 B
X PB2/BOOT1/COMP1_INP/TS_G3_IO3 20 -3600 -100 100 R 50 50 1 1 B
X DAC_EXTI9/TIMX_IC2/TS_G4_IO2/USART1_TX/PA9 30 3600 -800 100 L 50 50 1 1 B
X PB4/COMP2_INP/SPI1_MISO/SYS_JTRST/TIM3_CH1/TS_G6_IO1 40 -3600 -300 100 R 50 50 1 1 B
X ADC_IN1/COMP1_INP/TIM2_CH2/TIMX_IC2/TS_G1_IO2/USART2_RTS/PA1 11 3600 0 100 L 50 50 1 1 B
X PB10/I2C2_SCL/TIM2_CH3/USART3_TX 21 -3600 -900 100 R 50 50 1 1 B
X TIMX_IC3/TS_G4_IO3/USART1_RX/PA10 31 3600 -900 100 L 50 50 1 1 B
X PB5/COMP2_INP/I2C1_SMBA/SPI1_MOSI/TIM3_CH2/TS_G6_IO2 41 -3600 -400 100 R 50 50 1 1 B
X ADC_IN2/COMP1_INP/TIM2_CH3/TIM9_CH1/TIMX_IC3/TS_G1_IO3/USART2_TX/PA2 12 3600 -100 100 L 50 50 1 1 B
X PB11/ADC_EXTI11/I2C2_SDA/TIM2_CH4/USART3_RX 22 -3600 -1000 100 R 50 50 1 1 B
X ADC_EXTI11/SPI1_MISO/TIMX_IC4/USART1_CTS/USB_DM/PA11 32 3600 -1000 100 L 50 50 1 1 B
X PB6/I2C1_SCL/TIM4_CH1/TS_G6_IO3/USART1_TX 42 -3600 -500 100 R 50 50 1 1 B
X ADC_IN3/COMP1_INP/TIM2_CH4/TIM9_CH2/TIMX_IC4/TS_G1_IO4/USART2_RX/PA3 13 3600 -200 100 L 50 50 1 1 B
X VSS 23 -200 -1800 100 U 50 50 1 1 W
X SPI1_MOSI/TIMX_IC1/USART1_RTS/USB_DP/PA12 33 3600 -1100 100 L 50 50 1 1 B
X PB7/I2C1_SDA/SYS_PVD_IN/TIM4_CH2/TS_G6_IO4/USART1_RX 43 -3600 -600 100 R 50 50 1 1 B
X ADC_IN4/COMP1_INP/DAC_OUT1/SPI1_NSS/TIMX_IC1/USART2_CK/PA4 14 3600 -300 100 L 50 50 1 1 B
X VDD 24 -200 1800 100 D 50 50 1 1 W
X SYS_JTMS-SWDIO/TIMX_IC2/TS_G5_IO1/PA13 34 3600 -1200 100 L 50 50 1 1 B
X BOOT0 44 -3600 1200 100 R 50 50 1 1 I
X ADC_IN5/COMP1_INP/DAC_OUT2/SPI1_SCK/TIM2_CH1/TIM2_ETR/TIMX_IC2/PA5 15 3600 -400 100 L 50 50 1 1 B
X PB12/ADC_IN18/COMP1_INP/I2C2_SMBA/SPI2_NSS/TIM10_CH1/TS_G7_IO1/USART3_CK 25 -3600 -1100 100 R 50 50 1 1 B
X VSS 35 -100 -1800 100 U 50 50 1 1 W
X PB8/I2C1_SCL/TIM10_CH1/TIM4_CH3 45 -3600 -700 100 R 50 50 1 1 B
X ADC_IN6/COMP1_INP/SPI1_MISO/TIM10_CH1/TIM3_CH1/TIMX_IC3/TS_G2_IO1/PA6 16 3600 -500 100 L 50 50 1 1 B
X PB13/ADC_IN19/COMP1_INP/SPI2_SCK/TIM9_CH1/TS_G7_IO2/USART3_CTS 26 -3600 -1200 100 R 50 50 1 1 B
X VDD 36 -100 1800 100 D 50 50 1 1 W
X PB9/DAC_EXTI9/I2C1_SDA/TIM11_CH1/TIM4_CH4 46 -3600 -800 100 R 50 50 1 1 B
X ADC_IN7/COMP1_INP/SPI1_MOSI/TIM11_CH1/TIM3_CH2/TIMX_IC4/TS_G2_IO2/PA7 17 3600 -600 100 L 50 50 1 1 B
X PB14/ADC_IN20/COMP1_INP/SPI2_MISO/TIM9_CH2/TS_G7_IO3/USART3_RTS 27 -3600 -1300 100 R 50 50 1 1 B
X SYS_JTCK-SWCLK/TIMX_IC3/TS_G5_IO2/PA14 37 3600 -1300 100 L 50 50 1 1 B
X VSS 47 0 -1800 100 U 50 50 1 1 W
X PB0/ADC_IN8/COMP1_INP/SYS_V_REF_OUT/TIM3_CH3/TS_G3_IO1 18 -3600 100 100 R 50 50 1 1 B
X PB15/ADC_EXTI15/ADC_IN21/COMP1_INP/RTC_REFIN/SPI2_MOSI/TIM11_CH1/TS_G7_IO4 28 -3600 -1400 100 R 50 50 1 1 B
X ADC_EXTI15/SPI1_NSS/SYS_JTDI/TIM2_CH1/TIM2_ETR/TIMX_IC4/TS_G5_IO3/PA15 38 3600 -1400 100 L 50 50 1 1 B
X VDD 48 0 1800 100 D 50 50 1 1 W
X PB1/ADC_IN9/COMP1_INP/SYS_V_REF_OUT/TIM3_CH4/TS_G3_IO2 19 -3600 0 100 R 50 50 1 1 B
X RCC_MCO/TIMX_IC1/TS_G4_IO1/USART1_CK/PA8 29 3600 -700 100 L 50 50 1 1 B
X PB3/COMP2_INM/SPI1_SCK/SYS_JTDO-TRACESWO/TIM2_CH2 39 -3600 -200 100 R 50 50 1 1 B
ENDDRAW
ENDDEF
#
# TEST_1P
#
DEF TEST_1P J 0 30 N N 1 F N
F0 "J" 0 270 50 H V C CNN
F1 "TEST_1P" 0 200 50 H V C CNN
F2 "" 200 0 50 H I C CNN
F3 "" 200 0 50 H I C CNN
DRAW
C 0 130 30 0 1 0 N
X 1 1 0 0 100 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# USB_OTG-RESCUE-hw1
#
DEF USB_OTG-RESCUE-hw1 P 0 40 Y Y 1 F N
F0 "P" 325 -125 50 H V C CNN
F1 "USB_OTG-RESCUE-hw1" 0 200 50 H V C CNN
F2 "" -50 -100 50 V V C CNN
F3 "" -50 -100 50 V V C CNN
$FPLIST
USB*
$ENDFPLIST
DRAW
S -250 -150 250 150 0 1 0 N
S -205 -150 -195 -120 0 1 0 N
S -105 -150 -95 -120 0 1 0 N
S -5 -150 5 -120 0 1 0 N
S 95 -150 105 -120 0 1 0 N
S 195 -150 205 -120 0 1 0 N
X VBUS 1 -200 -300 150 U 50 50 1 1 w
X D- 2 -100 -300 150 U 50 50 1 1 P
X D+ 3 0 -300 150 U 50 50 1 1 P
X ID 4 100 -300 150 U 50 50 1 1 W
X GND 5 200 -300 150 U 50 50 1 1 W
X shield 6 400 100 150 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
#End Library

View file

@ -1,30 +0,0 @@
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# USB_OTG-RESCUE-hw1
#
DEF USB_OTG-RESCUE-hw1 P 0 40 Y Y 1 F N
F0 "P" 325 -125 50 H V C CNN
F1 "USB_OTG-RESCUE-hw1" 0 200 50 H V C CNN
F2 "" -50 -100 50 V V C CNN
F3 "" -50 -100 50 V V C CNN
$FPLIST
USB*
$ENDFPLIST
DRAW
S -250 -150 250 150 0 1 0 N
S -205 -150 -195 -120 0 1 0 N
S -105 -150 -95 -120 0 1 0 N
S -5 -150 5 -120 0 1 0 N
S 95 -150 105 -120 0 1 0 N
S 195 -150 205 -120 0 1 0 N
X VBUS 1 -200 -300 150 U 50 50 1 1 w
X D- 2 -100 -300 150 U 50 50 1 1 P
X D+ 3 0 -300 150 U 50 50 1 1 P
X ID 4 100 -300 150 U 50 50 1 1 W
X GND 5 200 -300 150 U 50 50 1 1 W
X shield 6 400 100 150 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
#End Library

View file

@ -1,59 +0,0 @@
Cmp-Mod V01 Created by Cvpcb (2015-03-25 BZR 5536)-product date = mer. 08 avril 2015 09:59:14 UTC
BeginCmp
TimeStamp = /5517C2C1;
Reference = P1;
ValeurCmp = Power;
IdModule = Socket_Arduino_Uno:Socket_Strip_Arduino_1x08;
EndCmp
BeginCmp
TimeStamp = /5517C323;
Reference = P2;
ValeurCmp = Analog;
IdModule = Socket_Arduino_Uno:Socket_Strip_Arduino_1x06;
EndCmp
BeginCmp
TimeStamp = /5517C46C;
Reference = P3;
ValeurCmp = Digital;
IdModule = Socket_Arduino_Uno:Socket_Strip_Arduino_1x10;
EndCmp
BeginCmp
TimeStamp = /5517C366;
Reference = P4;
ValeurCmp = Digital;
IdModule = Socket_Arduino_Uno:Socket_Strip_Arduino_1x08;
EndCmp
BeginCmp
TimeStamp = /551BBC06;
Reference = P5;
ValeurCmp = CONN_1;
IdModule = Socket_Arduino_Uno:Arduino_1pin;
EndCmp
BeginCmp
TimeStamp = /551BBD10;
Reference = P6;
ValeurCmp = CONN_1;
IdModule = Socket_Arduino_Uno:Arduino_1pin;
EndCmp
BeginCmp
TimeStamp = /551BBD30;
Reference = P7;
ValeurCmp = CONN_1;
IdModule = Socket_Arduino_Uno:Arduino_1pin;
EndCmp
BeginCmp
TimeStamp = /551BBD52;
Reference = P8;
ValeurCmp = CONN_1;
IdModule = Socket_Arduino_Uno:Arduino_1pin;
EndCmp
EndListe

View file

@ -1,36 +0,0 @@
Reference, Value, Footprint, Datasheet
"P1","Power","Socket_Arduino_Uno:Socket_Strip_Arduino_1x08",""
"P2","Analog","Socket_Arduino_Uno:Socket_Strip_Arduino_1x06",""
"P4","Digital","Socket_Arduino_Uno:Socket_Strip_Arduino_1x08",""
"P3","Digital","Socket_Arduino_Uno:Socket_Strip_Arduino_1x10",""
"U1","STM32L151C6TxA","Housings_QFP:TQFP-48_7x7mm_Pitch0.5mm",""
"P9","FX2LA","Socket_Strips:Socket_Strip_Angled_2x05_Pitch2.54mm",""
"P10","CONTROL","Connectors:USB_Micro-B_10103594-0001LF",""
"C2","100n","Capacitors_SMD:C_0603_HandSoldering",""
"C1","100n","Capacitors_SMD:C_0603_HandSoldering",""
"C3","100n","Capacitors_SMD:C_0603_HandSoldering",""
"C4","100n","Capacitors_SMD:C_0603_HandSoldering",""
"C5","100n","Capacitors_SMD:C_0603_HandSoldering",""
"U2","MIC550x-3.3YM5","TO_SOT_Packages_SMD:SOT-23-5_HandSoldering",""
"P11","CONN_01X06","Socket_Strips:Socket_Strip_Straight_1x06_Pitch2.54mm",""
"R1","4k7","Resistors_SMD:R_0603_HandSoldering",""
"R2","4k7","Resistors_SMD:R_0603_HandSoldering",""
"JP1","Jumper_NC_Small","Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm",""
"JP2","Jumper_NC_Small","Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm",""
"C6","100n","Capacitors_SMD:C_0603_HandSoldering",""
"C8","1u","Capacitors_SMD:C_0603_HandSoldering",""
"C7","1u","Capacitors_SMD:C_0603_HandSoldering",""
"Y1","Crystal_GND24_Small","Crystals:Crystal_SMD_SeikoEpson_FA238-4pin_3.2x2.5mm",""
"C10","18pf","Capacitors_SMD:C_0603_HandSoldering",""
"C9","18pf","Capacitors_SMD:C_0603_HandSoldering",""
"JP3","Jumper_NC_Small","Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm",""
"J1","CONN_01X02","Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm",""
"PB0","TEST_1P","Measurement_Points:Measurement_Point_Round-TH_Small",""
"PB1","TEST_1P","Measurement_Points:Measurement_Point_Round-TH_Small",""
"PB10","TEST_1P","Measurement_Points:Measurement_Point_Round-TH_Small",""
"PB11","TEST_1P","Measurement_Points:Measurement_Point_Round-TH_Small",""
"PA8","TEST_1P","Measurement_Points:Measurement_Point_Round-TH_Small",""
"PA9","TEST_1P","Measurement_Points:Measurement_Point_Round-TH_Small",""
"PA10","TEST_1P","Measurement_Points:Measurement_Point_Round-TH_Small",""
"PA0","TEST_1P","Measurement_Points:Measurement_Point_Round-TH_Small",""
"PA1","TEST_1P","Measurement_Points:Measurement_Point_Round-TH_Small",""
1 Reference Value Footprint Datasheet
2 P1 Power Socket_Arduino_Uno:Socket_Strip_Arduino_1x08
3 P2 Analog Socket_Arduino_Uno:Socket_Strip_Arduino_1x06
4 P4 Digital Socket_Arduino_Uno:Socket_Strip_Arduino_1x08
5 P3 Digital Socket_Arduino_Uno:Socket_Strip_Arduino_1x10
6 U1 STM32L151C6TxA Housings_QFP:TQFP-48_7x7mm_Pitch0.5mm
7 P9 FX2LA Socket_Strips:Socket_Strip_Angled_2x05_Pitch2.54mm
8 P10 CONTROL Connectors:USB_Micro-B_10103594-0001LF
9 C2 100n Capacitors_SMD:C_0603_HandSoldering
10 C1 100n Capacitors_SMD:C_0603_HandSoldering
11 C3 100n Capacitors_SMD:C_0603_HandSoldering
12 C4 100n Capacitors_SMD:C_0603_HandSoldering
13 C5 100n Capacitors_SMD:C_0603_HandSoldering
14 U2 MIC550x-3.3YM5 TO_SOT_Packages_SMD:SOT-23-5_HandSoldering
15 P11 CONN_01X06 Socket_Strips:Socket_Strip_Straight_1x06_Pitch2.54mm
16 R1 4k7 Resistors_SMD:R_0603_HandSoldering
17 R2 4k7 Resistors_SMD:R_0603_HandSoldering
18 JP1 Jumper_NC_Small Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm
19 JP2 Jumper_NC_Small Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm
20 C6 100n Capacitors_SMD:C_0603_HandSoldering
21 C8 1u Capacitors_SMD:C_0603_HandSoldering
22 C7 1u Capacitors_SMD:C_0603_HandSoldering
23 Y1 Crystal_GND24_Small Crystals:Crystal_SMD_SeikoEpson_FA238-4pin_3.2x2.5mm
24 C10 18pf Capacitors_SMD:C_0603_HandSoldering
25 C9 18pf Capacitors_SMD:C_0603_HandSoldering
26 JP3 Jumper_NC_Small Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm
27 J1 CONN_01X02 Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm
28 PB0 TEST_1P Measurement_Points:Measurement_Point_Round-TH_Small
29 PB1 TEST_1P Measurement_Points:Measurement_Point_Round-TH_Small
30 PB10 TEST_1P Measurement_Points:Measurement_Point_Round-TH_Small
31 PB11 TEST_1P Measurement_Points:Measurement_Point_Round-TH_Small
32 PA8 TEST_1P Measurement_Points:Measurement_Point_Round-TH_Small
33 PA9 TEST_1P Measurement_Points:Measurement_Point_Round-TH_Small
34 PA10 TEST_1P Measurement_Points:Measurement_Point_Round-TH_Small
35 PA0 TEST_1P Measurement_Points:Measurement_Point_Round-TH_Small
36 PA1 TEST_1P Measurement_Points:Measurement_Point_Round-TH_Small

File diff suppressed because it is too large Load diff

View file

@ -1,687 +0,0 @@
(export (version D)
(design
(source /home/karlp/src/libopencm3-tests/hw1/hw1.sch)
(date "Sat 30 Dec 2017 11:31:05 PM GMT")
(tool "Eeschema 4.0.6")
(sheet (number 1) (name /) (tstamps /)
(title_block
(title "test host")
(company libopencm3)
(rev)
(date "Autumn 2017")
(source hw1.sch)
(comment (number 1) (value ""))
(comment (number 2) (value ""))
(comment (number 3) (value ""))
(comment (number 4) (value "")))))
(components
(comp (ref P1)
(value Power)
(footprint Socket_Arduino_Uno:Socket_Strip_Arduino_1x08)
(libsource (lib conn) (part CONN_01X08))
(sheetpath (names /) (tstamps /))
(tstamp 56D70129))
(comp (ref P2)
(value Analog)
(footprint Socket_Arduino_Uno:Socket_Strip_Arduino_1x06)
(libsource (lib conn) (part CONN_01X06))
(sheetpath (names /) (tstamps /))
(tstamp 56D70DD8))
(comp (ref P4)
(value Digital)
(footprint Socket_Arduino_Uno:Socket_Strip_Arduino_1x08)
(libsource (lib conn) (part CONN_01X08))
(sheetpath (names /) (tstamps /))
(tstamp 56D7164F))
(comp (ref P3)
(value Digital)
(footprint Socket_Arduino_Uno:Socket_Strip_Arduino_1x10)
(libsource (lib conn) (part CONN_01X10))
(sheetpath (names /) (tstamps /))
(tstamp 56D721E0))
(comp (ref U1)
(value STM32L151C6TxA)
(footprint Housings_QFP:TQFP-48_7x7mm_Pitch0.5mm)
(libsource (lib stm32) (part STM32L151C6TxA))
(sheetpath (names /) (tstamps /))
(tstamp 58CEFE92))
(comp (ref P9)
(value FX2LA)
(footprint Socket_Strips:Socket_Strip_Angled_2x05_Pitch2.54mm)
(libsource (lib conn) (part CONN_02X05))
(sheetpath (names /) (tstamps /))
(tstamp 58CF048F))
(comp (ref P10)
(value CONTROL)
(footprint Connectors:USB_Micro-B_10103594-0001LF)
(libsource (lib hw1-rescue) (part USB_OTG-RESCUE-hw1))
(sheetpath (names /) (tstamps /))
(tstamp 58CF10AD))
(comp (ref C2)
(value 100n)
(footprint Capacitors_SMD:C_0603_HandSoldering)
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 58CF43FF))
(comp (ref C1)
(value 100n)
(footprint Capacitors_SMD:C_0603_HandSoldering)
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 58CF4B65))
(comp (ref C3)
(value 100n)
(footprint Capacitors_SMD:C_0603_HandSoldering)
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 58CF69A9))
(comp (ref C4)
(value 100n)
(footprint Capacitors_SMD:C_0603_HandSoldering)
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 58CF69F1))
(comp (ref C5)
(value 100n)
(footprint Capacitors_SMD:C_0603_HandSoldering)
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 58CF6A3A))
(comp (ref U2)
(value MIC550x-3.3YM5)
(footprint TO_SOT_Packages_SMD:SOT-23-5_HandSoldering)
(libsource (lib karlp-klibs) (part MIC550x-3.3YM5))
(sheetpath (names /) (tstamps /))
(tstamp 59F7B611))
(comp (ref P11)
(value CONN_01X06)
(footprint Socket_Strips:Socket_Strip_Straight_1x06_Pitch2.54mm)
(libsource (lib conn) (part CONN_01X06))
(sheetpath (names /) (tstamps /))
(tstamp 59F7E088))
(comp (ref R1)
(value 4k7)
(footprint Resistors_SMD:R_0603_HandSoldering)
(libsource (lib device) (part R))
(sheetpath (names /) (tstamps /))
(tstamp 5A0F8D14))
(comp (ref R2)
(value 4k7)
(footprint Resistors_SMD:R_0603_HandSoldering)
(libsource (lib device) (part R))
(sheetpath (names /) (tstamps /))
(tstamp 5A0F8EF5))
(comp (ref JP1)
(value Jumper_NC_Small)
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
(libsource (lib device) (part Jumper_NC_Small))
(sheetpath (names /) (tstamps /))
(tstamp 5A0F91B9))
(comp (ref JP2)
(value Jumper_NC_Small)
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
(libsource (lib device) (part Jumper_NC_Small))
(sheetpath (names /) (tstamps /))
(tstamp 5A0F9269))
(comp (ref C6)
(value 100n)
(footprint Capacitors_SMD:C_0603_HandSoldering)
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 5A0FB867))
(comp (ref C8)
(value 1u)
(footprint Capacitors_SMD:C_0603_HandSoldering)
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 5A0FC660))
(comp (ref C7)
(value 1u)
(footprint Capacitors_SMD:C_0603_HandSoldering)
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 5A0FC76D))
(comp (ref Y1)
(value Crystal_GND24_Small)
(footprint Crystals:Crystal_SMD_SeikoEpson_FA238-4pin_3.2x2.5mm)
(libsource (lib device) (part Crystal_GND24_Small))
(sheetpath (names /) (tstamps /))
(tstamp 5A137095))
(comp (ref C10)
(value 18pf)
(footprint Capacitors_SMD:C_0603_HandSoldering)
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 5A1373B8))
(comp (ref C9)
(value 18pf)
(footprint Capacitors_SMD:C_0603_HandSoldering)
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 5A137455))
(comp (ref JP3)
(value Jumper_NC_Small)
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
(libsource (lib device) (part Jumper_NC_Small))
(sheetpath (names /) (tstamps /))
(tstamp 5A36E60E))
(comp (ref J1)
(value CONN_01X02)
(footprint Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm)
(libsource (lib conn) (part CONN_01X02))
(sheetpath (names /) (tstamps /))
(tstamp 5A36EBE0))
(comp (ref PB0)
(value TEST_1P)
(footprint Measurement_Points:Measurement_Point_Round-TH_Small)
(libsource (lib conn) (part TEST_1P))
(sheetpath (names /) (tstamps /))
(tstamp 5A43D04F))
(comp (ref PB1)
(value TEST_1P)
(footprint Measurement_Points:Measurement_Point_Round-TH_Small)
(libsource (lib conn) (part TEST_1P))
(sheetpath (names /) (tstamps /))
(tstamp 5A43D328))
(comp (ref PB10)
(value TEST_1P)
(footprint Measurement_Points:Measurement_Point_Round-TH_Small)
(libsource (lib conn) (part TEST_1P))
(sheetpath (names /) (tstamps /))
(tstamp 5A43D40B))
(comp (ref PB11)
(value TEST_1P)
(footprint Measurement_Points:Measurement_Point_Round-TH_Small)
(libsource (lib conn) (part TEST_1P))
(sheetpath (names /) (tstamps /))
(tstamp 5A43D49D))
(comp (ref PA8)
(value TEST_1P)
(footprint Measurement_Points:Measurement_Point_Round-TH_Small)
(libsource (lib conn) (part TEST_1P))
(sheetpath (names /) (tstamps /))
(tstamp 5A43EE7B))
(comp (ref PA9)
(value TEST_1P)
(footprint Measurement_Points:Measurement_Point_Round-TH_Small)
(libsource (lib conn) (part TEST_1P))
(sheetpath (names /) (tstamps /))
(tstamp 5A43F060))
(comp (ref PA10)
(value TEST_1P)
(footprint Measurement_Points:Measurement_Point_Round-TH_Small)
(libsource (lib conn) (part TEST_1P))
(sheetpath (names /) (tstamps /))
(tstamp 5A43F0E2))
(comp (ref PA0)
(value TEST_1P)
(footprint Measurement_Points:Measurement_Point_Round-TH_Small)
(libsource (lib conn) (part TEST_1P))
(sheetpath (names /) (tstamps /))
(tstamp 5A43FB1F))
(comp (ref PA1)
(value TEST_1P)
(footprint Measurement_Points:Measurement_Point_Round-TH_Small)
(libsource (lib conn) (part TEST_1P))
(sheetpath (names /) (tstamps /))
(tstamp 5A43FBC5)))
(libparts
(libpart (lib device) (part C)
(description "Unpolarized capacitor")
(footprints
(fp C_*))
(fields
(field (name Reference) C)
(field (name Value) C))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))))
(libpart (lib conn) (part CONN_01X02)
(description "Connector, single row, 01x02, pin header")
(footprints
(fp Pin_Header_Straight_1X*)
(fp Pin_Header_Angled_1X*)
(fp Socket_Strip_Straight_1X*)
(fp Socket_Strip_Angled_1X*))
(fields
(field (name Reference) J)
(field (name Value) CONN_01X02))
(pins
(pin (num 1) (name P1) (type passive))
(pin (num 2) (name P2) (type passive))))
(libpart (lib conn) (part CONN_01X06)
(description "Connector, single row, 01x06, pin header")
(footprints
(fp Pin_Header_Straight_1X*)
(fp Pin_Header_Angled_1X*)
(fp Socket_Strip_Straight_1X*)
(fp Socket_Strip_Angled_1X*))
(fields
(field (name Reference) J)
(field (name Value) CONN_01X06))
(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))))
(libpart (lib conn) (part CONN_01X08)
(description "Connector, single row, 01x08, pin header")
(footprints
(fp Pin_Header_Straight_1X*)
(fp Pin_Header_Angled_1X*)
(fp Socket_Strip_Straight_1X*)
(fp Socket_Strip_Angled_1X*))
(fields
(field (name Reference) J)
(field (name Value) CONN_01X08))
(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))))
(libpart (lib conn) (part CONN_01X10)
(description "Connector, single row, 01x10, pin header")
(footprints
(fp Pin_Header_Straight_1X*)
(fp Pin_Header_Angled_1X*)
(fp Socket_Strip_Straight_1X*)
(fp Socket_Strip_Angled_1X*))
(fields
(field (name Reference) J)
(field (name Value) CONN_01X10))
(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))))
(libpart (lib conn) (part CONN_02X05)
(description "Connector, double row, 02x05, pin header")
(footprints
(fp Pin_Header_Straight_2X*)
(fp Pin_Header_Angled_2X*)
(fp Socket_Strip_Straight_2X*)
(fp Socket_Strip_Angled_2X*)
(fp IDC_Header_Straight_*))
(fields
(field (name Reference) J)
(field (name Value) CONN_02X05))
(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))))
(libpart (lib device) (part Crystal_GND24_Small)
(description "Two pin crystal, two ground/package pins (pin2 and 4) small symbol")
(footprints
(fp Crystal*))
(fields
(field (name Reference) Y)
(field (name Value) Crystal_GND24_Small))
(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))))
(libpart (lib device) (part Jumper_NC_Small)
(description "Jumper, normally closed")
(fields
(field (name Reference) JP)
(field (name Value) Jumper_NC_Small))
(pins
(pin (num 1) (name 1) (type passive))
(pin (num 2) (name 2) (type passive))))
(libpart (lib karlp-klibs) (part MIC550x-3.3YM5)
(description "300mA LDO fixed output voltage 3.3V ultra-low-noise")
(docs http://ww1.microchip.com/downloads/en/DeviceDoc/MIC550X.pdf)
(footprints
(fp SOT-23*))
(fields
(field (name Reference) U)
(field (name Value) MIC550x-3.3YM5)
(field (name Footprint) TO_SOT_Packages_SMD:SOT-23-5))
(pins
(pin (num 1) (name VIN) (type power_in))
(pin (num 2) (name GND) (type power_in))
(pin (num 3) (name EN) (type input))
(pin (num 4) (name NC) (type NotConnected))
(pin (num 5) (name VOUT) (type power_out))))
(libpart (lib device) (part R)
(description Resistor)
(footprints
(fp R_*)
(fp R_*))
(fields
(field (name Reference) R)
(field (name Value) R))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))))
(libpart (lib stm32) (part STM32L151C6TxA)
(aliases
(alias STM32L151C8TxA)
(alias STM32L151CBTxA))
(description "Core: ARM Cortex-M3 Package: LQFP48 Flash: 32KB Ram: 16KB Frequency: 32MHz Voltage: 1.65..3.6V IO-pins: 37")
(docs http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00277537.pdf)
(fields
(field (name Reference) U)
(field (name Value) STM32L151C6TxA)
(field (name Footprint) Housings_QFP:LQFP-48_7x7mm_Pitch0.5mm))
(pins
(pin (num 1) (name VLCD) (type power_in))
(pin (num 2) (name PC13/RTC_OUT_ALARM/RTC_OUT_CALIB/RTC_TAMP1/RTC_TS/SYS_WKUP2/TIMX_IC2) (type BiDi))
(pin (num 3) (name PC14/RCC_OSC32_IN/TIMX_IC3) (type BiDi))
(pin (num 4) (name PC15/ADC_EXTI15/RCC_OSC32_OUT/TIMX_IC4) (type BiDi))
(pin (num 5) (name PH0/RCC_OSC_IN) (type input))
(pin (num 6) (name PH1/RCC_OSC_OUT) (type input))
(pin (num 7) (name NRST) (type input))
(pin (num 8) (name VSSA) (type power_in))
(pin (num 9) (name VDDA) (type power_in))
(pin (num 10) (name ADC_IN0/COMP1_INP/RTC_TAMP2/SYS_WKUP1/TIM2_CH1/TIM2_ETR/TIMX_IC1/TS_G1_IO1/USART2_CTS/PA0) (type BiDi))
(pin (num 11) (name ADC_IN1/COMP1_INP/TIM2_CH2/TIMX_IC2/TS_G1_IO2/USART2_RTS/PA1) (type BiDi))
(pin (num 12) (name ADC_IN2/COMP1_INP/TIM2_CH3/TIM9_CH1/TIMX_IC3/TS_G1_IO3/USART2_TX/PA2) (type BiDi))
(pin (num 13) (name ADC_IN3/COMP1_INP/TIM2_CH4/TIM9_CH2/TIMX_IC4/TS_G1_IO4/USART2_RX/PA3) (type BiDi))
(pin (num 14) (name ADC_IN4/COMP1_INP/DAC_OUT1/SPI1_NSS/TIMX_IC1/USART2_CK/PA4) (type BiDi))
(pin (num 15) (name ADC_IN5/COMP1_INP/DAC_OUT2/SPI1_SCK/TIM2_CH1/TIM2_ETR/TIMX_IC2/PA5) (type BiDi))
(pin (num 16) (name ADC_IN6/COMP1_INP/SPI1_MISO/TIM10_CH1/TIM3_CH1/TIMX_IC3/TS_G2_IO1/PA6) (type BiDi))
(pin (num 17) (name ADC_IN7/COMP1_INP/SPI1_MOSI/TIM11_CH1/TIM3_CH2/TIMX_IC4/TS_G2_IO2/PA7) (type BiDi))
(pin (num 18) (name PB0/ADC_IN8/COMP1_INP/SYS_V_REF_OUT/TIM3_CH3/TS_G3_IO1) (type BiDi))
(pin (num 19) (name PB1/ADC_IN9/COMP1_INP/SYS_V_REF_OUT/TIM3_CH4/TS_G3_IO2) (type BiDi))
(pin (num 20) (name PB2/BOOT1/COMP1_INP/TS_G3_IO3) (type BiDi))
(pin (num 21) (name PB10/I2C2_SCL/TIM2_CH3/USART3_TX) (type BiDi))
(pin (num 22) (name PB11/ADC_EXTI11/I2C2_SDA/TIM2_CH4/USART3_RX) (type BiDi))
(pin (num 23) (name VSS) (type power_in))
(pin (num 24) (name VDD) (type power_in))
(pin (num 25) (name PB12/ADC_IN18/COMP1_INP/I2C2_SMBA/SPI2_NSS/TIM10_CH1/TS_G7_IO1/USART3_CK) (type BiDi))
(pin (num 26) (name PB13/ADC_IN19/COMP1_INP/SPI2_SCK/TIM9_CH1/TS_G7_IO2/USART3_CTS) (type BiDi))
(pin (num 27) (name PB14/ADC_IN20/COMP1_INP/SPI2_MISO/TIM9_CH2/TS_G7_IO3/USART3_RTS) (type BiDi))
(pin (num 28) (name PB15/ADC_EXTI15/ADC_IN21/COMP1_INP/RTC_REFIN/SPI2_MOSI/TIM11_CH1/TS_G7_IO4) (type BiDi))
(pin (num 29) (name RCC_MCO/TIMX_IC1/TS_G4_IO1/USART1_CK/PA8) (type BiDi))
(pin (num 30) (name DAC_EXTI9/TIMX_IC2/TS_G4_IO2/USART1_TX/PA9) (type BiDi))
(pin (num 31) (name TIMX_IC3/TS_G4_IO3/USART1_RX/PA10) (type BiDi))
(pin (num 32) (name ADC_EXTI11/SPI1_MISO/TIMX_IC4/USART1_CTS/USB_DM/PA11) (type BiDi))
(pin (num 33) (name SPI1_MOSI/TIMX_IC1/USART1_RTS/USB_DP/PA12) (type BiDi))
(pin (num 34) (name SYS_JTMS-SWDIO/TIMX_IC2/TS_G5_IO1/PA13) (type BiDi))
(pin (num 35) (name VSS) (type power_in))
(pin (num 36) (name VDD) (type power_in))
(pin (num 37) (name SYS_JTCK-SWCLK/TIMX_IC3/TS_G5_IO2/PA14) (type BiDi))
(pin (num 38) (name ADC_EXTI15/SPI1_NSS/SYS_JTDI/TIM2_CH1/TIM2_ETR/TIMX_IC4/TS_G5_IO3/PA15) (type BiDi))
(pin (num 39) (name PB3/COMP2_INM/SPI1_SCK/SYS_JTDO-TRACESWO/TIM2_CH2) (type BiDi))
(pin (num 40) (name PB4/COMP2_INP/SPI1_MISO/SYS_JTRST/TIM3_CH1/TS_G6_IO1) (type BiDi))
(pin (num 41) (name PB5/COMP2_INP/I2C1_SMBA/SPI1_MOSI/TIM3_CH2/TS_G6_IO2) (type BiDi))
(pin (num 42) (name PB6/I2C1_SCL/TIM4_CH1/TS_G6_IO3/USART1_TX) (type BiDi))
(pin (num 43) (name PB7/I2C1_SDA/SYS_PVD_IN/TIM4_CH2/TS_G6_IO4/USART1_RX) (type BiDi))
(pin (num 44) (name BOOT0) (type input))
(pin (num 45) (name PB8/I2C1_SCL/TIM10_CH1/TIM4_CH3) (type BiDi))
(pin (num 46) (name PB9/DAC_EXTI9/I2C1_SDA/TIM11_CH1/TIM4_CH4) (type BiDi))
(pin (num 47) (name VSS) (type power_in))
(pin (num 48) (name VDD) (type power_in))))
(libpart (lib conn) (part TEST_1P)
(description point)
(fields
(field (name Reference) J)
(field (name Value) TEST_1P))
(pins
(pin (num 1) (name 1) (type passive))))
(libpart (lib hw1-rescue) (part USB_OTG-RESCUE-hw1)
(footprints
(fp USB*))
(fields
(field (name Reference) P)
(field (name Value) USB_OTG-RESCUE-hw1))
(pins
(pin (num 1) (name VBUS) (type power_out))
(pin (num 2) (name D-) (type passive))
(pin (num 3) (name D+) (type passive))
(pin (num 4) (name ID) (type power_in))
(pin (num 5) (name GND) (type power_in))
(pin (num 6) (name shield) (type passive)))))
(libraries
(library (logical conn)
(uri /usr/share/kicad/library/conn.lib))
(library (logical hw1-rescue)
(uri /home/karlp/src/libopencm3-tests/hw1/hw1-rescue.lib))
(library (logical device)
(uri /usr/share/kicad/library/device.lib))
(library (logical stm32)
(uri /usr/share/kicad/library/stm32.lib))
(library (logical karlp-klibs)
(uri /home/karlp/src/libopencm3-tests/hw1/karlp-klibs.lib)))
(nets
(net (code 1) (name "Net-(U2-Pad4)")
(node (ref U2) (pin 4)))
(net (code 2) (name /ADC_IN2)
(node (ref U1) (pin 17)))
(net (code 3) (name /ADC_IN1)
(node (ref U1) (pin 16))
(node (ref P2) (pin 3)))
(net (code 4) (name /SPI_MOSI)
(node (ref P9) (pin 5))
(node (ref P3) (pin 7))
(node (ref U1) (pin 28)))
(net (code 5) (name /SPI_MISO)
(node (ref U1) (pin 27))
(node (ref P9) (pin 6))
(node (ref P3) (pin 6)))
(net (code 6) (name /SPI_SCK)
(node (ref P3) (pin 5))
(node (ref U1) (pin 26))
(node (ref P9) (pin 7)))
(net (code 7) (name /SPI_CS)
(node (ref P3) (pin 8))
(node (ref U1) (pin 25))
(node (ref P9) (pin 8)))
(net (code 8) (name /NRST)
(node (ref P11) (pin 5))
(node (ref U1) (pin 7))
(node (ref C1) (pin 2)))
(net (code 9) (name /SWO)
(node (ref P11) (pin 6))
(node (ref U1) (pin 39)))
(net (code 10) (name +5V)
(node (ref C7) (pin 1))
(node (ref U2) (pin 3))
(node (ref U2) (pin 1))
(node (ref P10) (pin 1)))
(net (code 11) (name "Net-(P10-Pad6)")
(node (ref P10) (pin 6)))
(net (code 12) (name "Net-(P10-Pad4)")
(node (ref P10) (pin 4)))
(net (code 13) (name "Net-(U1-Pad4)")
(node (ref U1) (pin 4)))
(net (code 14) (name "Net-(U1-Pad3)")
(node (ref U1) (pin 3)))
(net (code 15) (name /UART_RX_OUT)
(node (ref U1) (pin 13))
(node (ref P9) (pin 4))
(node (ref P4) (pin 7)))
(net (code 16) (name /UART_TX_OUT)
(node (ref P4) (pin 8))
(node (ref U1) (pin 12))
(node (ref P9) (pin 3)))
(net (code 17) (name "Net-(P9-Pad9)")
(node (ref P9) (pin 9)))
(net (code 18) (name /SWCLK)
(node (ref U1) (pin 37))
(node (ref P11) (pin 2)))
(net (code 19) (name /SWDIO)
(node (ref P11) (pin 4))
(node (ref U1) (pin 34)))
(net (code 20) (name "Net-(U1-Pad40)")
(node (ref U1) (pin 40)))
(net (code 21) (name "Net-(U1-Pad2)")
(node (ref U1) (pin 2)))
(net (code 22) (name "Net-(P1-Pad5)")
(node (ref P1) (pin 5)))
(net (code 23) (name "Net-(C9-Pad1)")
(node (ref C9) (pin 1))
(node (ref U1) (pin 5))
(node (ref Y1) (pin 1)))
(net (code 24) (name "Net-(JP3-Pad2)")
(node (ref P1) (pin 4))
(node (ref JP3) (pin 2)))
(net (code 25) (name "Net-(C10-Pad1)")
(node (ref Y1) (pin 3))
(node (ref U1) (pin 6))
(node (ref C10) (pin 1)))
(net (code 26) (name "Net-(PB11-Pad1)")
(node (ref U1) (pin 22))
(node (ref PB11) (pin 1)))
(net (code 27) (name "Net-(U1-Pad20)")
(node (ref U1) (pin 20)))
(net (code 28) (name /VLCD)
(node (ref C6) (pin 2))
(node (ref U1) (pin 1)))
(net (code 29) (name "Net-(PA1-Pad1)")
(node (ref PA1) (pin 1))
(node (ref U1) (pin 11)))
(net (code 30) (name "Net-(PA0-Pad1)")
(node (ref U1) (pin 10))
(node (ref PA0) (pin 1)))
(net (code 31) (name "Net-(PA10-Pad1)")
(node (ref PA10) (pin 1))
(node (ref U1) (pin 31)))
(net (code 32) (name "Net-(PA9-Pad1)")
(node (ref PA9) (pin 1))
(node (ref U1) (pin 30)))
(net (code 33) (name "Net-(PA8-Pad1)")
(node (ref PA8) (pin 1))
(node (ref U1) (pin 29)))
(net (code 34) (name "Net-(Y1-Pad4)")
(node (ref Y1) (pin 4)))
(net (code 35) (name "Net-(PB10-Pad1)")
(node (ref PB10) (pin 1))
(node (ref U1) (pin 21)))
(net (code 36) (name "Net-(PB1-Pad1)")
(node (ref U1) (pin 19))
(node (ref PB1) (pin 1)))
(net (code 37) (name "Net-(PB0-Pad1)")
(node (ref U1) (pin 18))
(node (ref PB0) (pin 1)))
(net (code 38) (name "Net-(P3-Pad2)")
(node (ref P3) (pin 2)))
(net (code 39) (name "Net-(P3-Pad1)")
(node (ref P3) (pin 1)))
(net (code 40) (name /I2C_SDA)
(node (ref P2) (pin 5))
(node (ref JP1) (pin 1))
(node (ref U1) (pin 46))
(node (ref P9) (pin 1)))
(net (code 41) (name /I2C_SCL)
(node (ref JP2) (pin 1))
(node (ref U1) (pin 45))
(node (ref P2) (pin 6))
(node (ref P9) (pin 2)))
(net (code 42) (name "Net-(JP2-Pad2)")
(node (ref JP2) (pin 2))
(node (ref R2) (pin 2)))
(net (code 43) (name "Net-(JP1-Pad2)")
(node (ref R1) (pin 2))
(node (ref JP1) (pin 2)))
(net (code 44) (name "Net-(U1-Pad41)")
(node (ref U1) (pin 41)))
(net (code 45) (name "Net-(U1-Pad42)")
(node (ref U1) (pin 42)))
(net (code 46) (name "Net-(U1-Pad43)")
(node (ref U1) (pin 43)))
(net (code 47) (name "Net-(U1-Pad38)")
(node (ref U1) (pin 38)))
(net (code 48) (name "Net-(Y1-Pad2)")
(node (ref Y1) (pin 2)))
(net (code 49) (name +3V3)
(node (ref C2) (pin 1))
(node (ref C3) (pin 1))
(node (ref R2) (pin 1))
(node (ref U1) (pin 24))
(node (ref P11) (pin 1))
(node (ref JP3) (pin 1))
(node (ref R1) (pin 1))
(node (ref U1) (pin 48))
(node (ref C5) (pin 1))
(node (ref U1) (pin 9))
(node (ref C8) (pin 1))
(node (ref C4) (pin 1))
(node (ref U2) (pin 5))
(node (ref U1) (pin 36)))
(net (code 50) (name GND)
(node (ref P1) (pin 7))
(node (ref P1) (pin 6))
(node (ref C3) (pin 2))
(node (ref P9) (pin 10))
(node (ref P10) (pin 5))
(node (ref U2) (pin 2))
(node (ref C4) (pin 2))
(node (ref P11) (pin 3))
(node (ref C5) (pin 2))
(node (ref C2) (pin 2))
(node (ref C10) (pin 2))
(node (ref C8) (pin 2))
(node (ref C7) (pin 2))
(node (ref U1) (pin 35))
(node (ref C1) (pin 1))
(node (ref U1) (pin 44))
(node (ref U1) (pin 47))
(node (ref C9) (pin 2))
(node (ref U1) (pin 23))
(node (ref U1) (pin 8))
(node (ref C6) (pin 1))
(node (ref P3) (pin 4)))
(net (code 51) (name /Vin)
(node (ref P1) (pin 8)))
(net (code 52) (name /AREF)
(node (ref P3) (pin 3)))
(net (code 53) (name /RESET_OUT)
(node (ref P1) (pin 3)))
(net (code 54) (name /IOREF)
(node (ref P1) (pin 2)))
(net (code 55) (name "Net-(P1-Pad1)")
(node (ref P1) (pin 1)))
(net (code 56) (name "/9(**)")
(node (ref P3) (pin 9)))
(net (code 57) (name /8)
(node (ref P3) (pin 10)))
(net (code 58) (name /DAC2_OUT)
(node (ref U1) (pin 15))
(node (ref P2) (pin 2)))
(net (code 59) (name /2)
(node (ref P4) (pin 6)))
(net (code 60) (name "/3(**)")
(node (ref P4) (pin 5)))
(net (code 61) (name /4)
(node (ref P4) (pin 4)))
(net (code 62) (name "/5(**)")
(node (ref P4) (pin 3)))
(net (code 63) (name "/6(**)")
(node (ref P4) (pin 2)))
(net (code 64) (name /7)
(node (ref P4) (pin 1)))
(net (code 65) (name /A3)
(node (ref P2) (pin 4)))
(net (code 66) (name /DAC1_OUT)
(node (ref P2) (pin 1))
(node (ref U1) (pin 14)))
(net (code 67) (name /USB_DP)
(node (ref P10) (pin 3))
(node (ref J1) (pin 1))
(node (ref U1) (pin 33)))
(net (code 68) (name /USB_DM)
(node (ref J1) (pin 2))
(node (ref U1) (pin 32))
(node (ref P10) (pin 2)))))

Binary file not shown.

30446
hw1/hw1.plt

File diff suppressed because it is too large Load diff

View file

@ -1,73 +0,0 @@
update=Mon 05 Feb 2018 08:48:40 PM GMT
version=1
last_client=kicad
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=0.600000000000
PadDrillOvalY=0.600000000000
PadSizeH=1.500000000000
PadSizeV=1.500000000000
PcbTextSizeV=1.500000000000
PcbTextSizeH=1.500000000000
PcbTextThickness=0.300000000000
ModuleTextSizeV=1.000000000000
ModuleTextSizeH=1.000000000000
ModuleTextSizeThickness=0.150000000000
SolderMaskClearance=0.000000000000
SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000
[cvpcb]
version=1
NetIExt=net
[general]
version=1
[eeschema]
version=1
LibDir=
[eeschema/libraries]
LibName1=hw1-rescue
LibName2=power
LibName3=device
LibName4=transistors
LibName5=conn
LibName6=linear
LibName7=regul
LibName8=74xx
LibName9=cmos4000
LibName10=adc-dac
LibName11=memory
LibName12=xilinx
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=stm32
LibName32=karlp-klibs
[schematic_editor]
version=1
PageLayoutDescrFile=
PlotDirectoryName=
SubpartIdSeparator=0
SubpartFirstId=65
NetFmtName=Pcbnew
SpiceForceRefPrefix=0
SpiceUseNetNumbers=0
LabSize=60

File diff suppressed because it is too large Load diff

View file

@ -1,854 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<export version="D">
<design>
<source>/home/karlp/src/libopencm3-tests/hw1/hw1.sch</source>
<date>Fri 02 Feb 2018 08:19:44 PM GMT</date>
<tool>Eeschema 4.0.6</tool>
<sheet number="1" name="/" tstamps="/">
<title_block>
<title>test host</title>
<company>libopencm3</company>
<rev/>
<date>Autumn 2017</date>
<source>hw1.sch</source>
<comment number="1" value=""/>
<comment number="2" value=""/>
<comment number="3" value=""/>
<comment number="4" value=""/>
</title_block>
</sheet>
</design>
<components>
<comp ref="P1">
<value>Power</value>
<footprint>Socket_Arduino_Uno:Socket_Strip_Arduino_1x08</footprint>
<libsource lib="conn" part="CONN_01X08"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>56D70129</tstamp>
</comp>
<comp ref="P2">
<value>Analog</value>
<footprint>Socket_Arduino_Uno:Socket_Strip_Arduino_1x06</footprint>
<libsource lib="conn" part="CONN_01X06"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>56D70DD8</tstamp>
</comp>
<comp ref="P4">
<value>Digital</value>
<footprint>Socket_Arduino_Uno:Socket_Strip_Arduino_1x08</footprint>
<libsource lib="conn" part="CONN_01X08"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>56D7164F</tstamp>
</comp>
<comp ref="P3">
<value>Digital</value>
<footprint>Socket_Arduino_Uno:Socket_Strip_Arduino_1x10</footprint>
<libsource lib="conn" part="CONN_01X10"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>56D721E0</tstamp>
</comp>
<comp ref="U1">
<value>STM32L151C6TxA</value>
<footprint>Housings_QFP:TQFP-48_7x7mm_Pitch0.5mm</footprint>
<libsource lib="stm32" part="STM32L151C6TxA"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>58CEFE92</tstamp>
</comp>
<comp ref="P9">
<value>FX2LA</value>
<footprint>Socket_Strips:Socket_Strip_Angled_2x05_Pitch2.54mm</footprint>
<libsource lib="conn" part="CONN_02X05"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>58CF048F</tstamp>
</comp>
<comp ref="P10">
<value>CONTROL</value>
<footprint>Connectors:USB_Micro-B_10103594-0001LF</footprint>
<libsource lib="hw1-rescue" part="USB_OTG-RESCUE-hw1"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>58CF10AD</tstamp>
</comp>
<comp ref="C2">
<value>100n</value>
<footprint>Capacitors_SMD:C_0603_HandSoldering</footprint>
<libsource lib="device" part="C"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>58CF43FF</tstamp>
</comp>
<comp ref="C1">
<value>100n</value>
<footprint>Capacitors_SMD:C_0603_HandSoldering</footprint>
<libsource lib="device" part="C"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>58CF4B65</tstamp>
</comp>
<comp ref="C3">
<value>100n</value>
<footprint>Capacitors_SMD:C_0603_HandSoldering</footprint>
<libsource lib="device" part="C"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>58CF69A9</tstamp>
</comp>
<comp ref="C4">
<value>100n</value>
<footprint>Capacitors_SMD:C_0603_HandSoldering</footprint>
<libsource lib="device" part="C"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>58CF69F1</tstamp>
</comp>
<comp ref="C5">
<value>100n</value>
<footprint>Capacitors_SMD:C_0603_HandSoldering</footprint>
<libsource lib="device" part="C"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>58CF6A3A</tstamp>
</comp>
<comp ref="U2">
<value>MIC550x-3.3YM5</value>
<footprint>TO_SOT_Packages_SMD:SOT-23-5_HandSoldering</footprint>
<libsource lib="karlp-klibs" part="MIC550x-3.3YM5"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>59F7B611</tstamp>
</comp>
<comp ref="P11">
<value>CONN_01X06</value>
<footprint>Socket_Strips:Socket_Strip_Straight_1x06_Pitch2.54mm</footprint>
<libsource lib="conn" part="CONN_01X06"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>59F7E088</tstamp>
</comp>
<comp ref="R1">
<value>4k7</value>
<footprint>Resistors_SMD:R_0603_HandSoldering</footprint>
<libsource lib="device" part="R"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A0F8D14</tstamp>
</comp>
<comp ref="R2">
<value>4k7</value>
<footprint>Resistors_SMD:R_0603_HandSoldering</footprint>
<libsource lib="device" part="R"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A0F8EF5</tstamp>
</comp>
<comp ref="JP1">
<value>Jumper_NC_Small</value>
<footprint>Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm</footprint>
<libsource lib="device" part="Jumper_NC_Small"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A0F91B9</tstamp>
</comp>
<comp ref="JP2">
<value>Jumper_NC_Small</value>
<footprint>Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm</footprint>
<libsource lib="device" part="Jumper_NC_Small"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A0F9269</tstamp>
</comp>
<comp ref="C6">
<value>100n</value>
<footprint>Capacitors_SMD:C_0603_HandSoldering</footprint>
<libsource lib="device" part="C"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A0FB867</tstamp>
</comp>
<comp ref="C8">
<value>1u</value>
<footprint>Capacitors_SMD:C_0603_HandSoldering</footprint>
<libsource lib="device" part="C"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A0FC660</tstamp>
</comp>
<comp ref="C7">
<value>1u</value>
<footprint>Capacitors_SMD:C_0603_HandSoldering</footprint>
<libsource lib="device" part="C"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A0FC76D</tstamp>
</comp>
<comp ref="Y1">
<value>Crystal_GND24_Small</value>
<footprint>Crystals:Crystal_SMD_SeikoEpson_FA238-4pin_3.2x2.5mm</footprint>
<libsource lib="device" part="Crystal_GND24_Small"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A137095</tstamp>
</comp>
<comp ref="C10">
<value>18pf</value>
<footprint>Capacitors_SMD:C_0603_HandSoldering</footprint>
<libsource lib="device" part="C"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A1373B8</tstamp>
</comp>
<comp ref="C9">
<value>18pf</value>
<footprint>Capacitors_SMD:C_0603_HandSoldering</footprint>
<libsource lib="device" part="C"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A137455</tstamp>
</comp>
<comp ref="JP3">
<value>Jumper_NC_Small</value>
<footprint>Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm</footprint>
<libsource lib="device" part="Jumper_NC_Small"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A36E60E</tstamp>
</comp>
<comp ref="J1">
<value>CONN_01X02</value>
<footprint>Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm</footprint>
<libsource lib="conn" part="CONN_01X02"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A36EBE0</tstamp>
</comp>
<comp ref="PB0">
<value>TEST_1P</value>
<footprint>Measurement_Points:Measurement_Point_Round-TH_Small</footprint>
<libsource lib="conn" part="TEST_1P"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A43D04F</tstamp>
</comp>
<comp ref="PB1">
<value>TEST_1P</value>
<footprint>Measurement_Points:Measurement_Point_Round-TH_Small</footprint>
<libsource lib="conn" part="TEST_1P"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A43D328</tstamp>
</comp>
<comp ref="PB10">
<value>TEST_1P</value>
<footprint>Measurement_Points:Measurement_Point_Round-TH_Small</footprint>
<libsource lib="conn" part="TEST_1P"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A43D40B</tstamp>
</comp>
<comp ref="PB11">
<value>TEST_1P</value>
<footprint>Measurement_Points:Measurement_Point_Round-TH_Small</footprint>
<libsource lib="conn" part="TEST_1P"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A43D49D</tstamp>
</comp>
<comp ref="PA8">
<value>TEST_1P</value>
<footprint>Measurement_Points:Measurement_Point_Round-TH_Small</footprint>
<libsource lib="conn" part="TEST_1P"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A43EE7B</tstamp>
</comp>
<comp ref="PA9">
<value>TEST_1P</value>
<footprint>Measurement_Points:Measurement_Point_Round-TH_Small</footprint>
<libsource lib="conn" part="TEST_1P"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A43F060</tstamp>
</comp>
<comp ref="PA10">
<value>TEST_1P</value>
<footprint>Measurement_Points:Measurement_Point_Round-TH_Small</footprint>
<libsource lib="conn" part="TEST_1P"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A43F0E2</tstamp>
</comp>
<comp ref="PA0">
<value>TEST_1P</value>
<footprint>Measurement_Points:Measurement_Point_Round-TH_Small</footprint>
<libsource lib="conn" part="TEST_1P"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A43FB1F</tstamp>
</comp>
<comp ref="PA1">
<value>TEST_1P</value>
<footprint>Measurement_Points:Measurement_Point_Round-TH_Small</footprint>
<libsource lib="conn" part="TEST_1P"/>
<sheetpath names="/" tstamps="/"/>
<tstamp>5A43FBC5</tstamp>
</comp>
</components>
<libparts>
<libpart lib="device" part="C">
<description>Unpolarized capacitor</description>
<footprints>
<fp>C_*</fp>
</footprints>
<fields>
<field name="Reference">C</field>
<field name="Value">C</field>
</fields>
<pins>
<pin num="1" name="~" type="passive"/>
<pin num="2" name="~" type="passive"/>
</pins>
</libpart>
<libpart lib="conn" part="CONN_01X02">
<description>Connector, single row, 01x02, pin header</description>
<footprints>
<fp>Pin_Header_Straight_1X*</fp>
<fp>Pin_Header_Angled_1X*</fp>
<fp>Socket_Strip_Straight_1X*</fp>
<fp>Socket_Strip_Angled_1X*</fp>
</footprints>
<fields>
<field name="Reference">J</field>
<field name="Value">CONN_01X02</field>
</fields>
<pins>
<pin num="1" name="P1" type="passive"/>
<pin num="2" name="P2" type="passive"/>
</pins>
</libpart>
<libpart lib="conn" part="CONN_01X06">
<description>Connector, single row, 01x06, pin header</description>
<footprints>
<fp>Pin_Header_Straight_1X*</fp>
<fp>Pin_Header_Angled_1X*</fp>
<fp>Socket_Strip_Straight_1X*</fp>
<fp>Socket_Strip_Angled_1X*</fp>
</footprints>
<fields>
<field name="Reference">J</field>
<field name="Value">CONN_01X06</field>
</fields>
<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"/>
</pins>
</libpart>
<libpart lib="conn" part="CONN_01X08">
<description>Connector, single row, 01x08, pin header</description>
<footprints>
<fp>Pin_Header_Straight_1X*</fp>
<fp>Pin_Header_Angled_1X*</fp>
<fp>Socket_Strip_Straight_1X*</fp>
<fp>Socket_Strip_Angled_1X*</fp>
</footprints>
<fields>
<field name="Reference">J</field>
<field name="Value">CONN_01X08</field>
</fields>
<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"/>
</pins>
</libpart>
<libpart lib="conn" part="CONN_01X10">
<description>Connector, single row, 01x10, pin header</description>
<footprints>
<fp>Pin_Header_Straight_1X*</fp>
<fp>Pin_Header_Angled_1X*</fp>
<fp>Socket_Strip_Straight_1X*</fp>
<fp>Socket_Strip_Angled_1X*</fp>
</footprints>
<fields>
<field name="Reference">J</field>
<field name="Value">CONN_01X10</field>
</fields>
<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"/>
</pins>
</libpart>
<libpart lib="conn" part="CONN_02X05">
<description>Connector, double row, 02x05, pin header</description>
<footprints>
<fp>Pin_Header_Straight_2X*</fp>
<fp>Pin_Header_Angled_2X*</fp>
<fp>Socket_Strip_Straight_2X*</fp>
<fp>Socket_Strip_Angled_2X*</fp>
<fp>IDC_Header_Straight_*</fp>
</footprints>
<fields>
<field name="Reference">J</field>
<field name="Value">CONN_02X05</field>
</fields>
<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"/>
</pins>
</libpart>
<libpart lib="device" part="Crystal_GND24_Small">
<description>Two pin crystal, two ground/package pins (pin2 and 4) small symbol</description>
<footprints>
<fp>Crystal*</fp>
</footprints>
<fields>
<field name="Reference">Y</field>
<field name="Value">Crystal_GND24_Small</field>
</fields>
<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"/>
</pins>
</libpart>
<libpart lib="device" part="Jumper_NC_Small">
<description>Jumper, normally closed</description>
<fields>
<field name="Reference">JP</field>
<field name="Value">Jumper_NC_Small</field>
</fields>
<pins>
<pin num="1" name="1" type="passive"/>
<pin num="2" name="2" type="passive"/>
</pins>
</libpart>
<libpart lib="karlp-klibs" part="MIC550x-3.3YM5">
<description>300mA LDO fixed output voltage 3.3V ultra-low-noise</description>
<docs>http://ww1.microchip.com/downloads/en/DeviceDoc/MIC550X.pdf</docs>
<footprints>
<fp>SOT-23*</fp>
</footprints>
<fields>
<field name="Reference">U</field>
<field name="Value">MIC550x-3.3YM5</field>
<field name="Footprint">TO_SOT_Packages_SMD:SOT-23-5</field>
</fields>
<pins>
<pin num="1" name="VIN" type="power_in"/>
<pin num="2" name="GND" type="power_in"/>
<pin num="3" name="EN" type="input"/>
<pin num="4" name="NC" type="NotConnected"/>
<pin num="5" name="VOUT" type="power_out"/>
</pins>
</libpart>
<libpart lib="device" part="R">
<description>Resistor</description>
<footprints>
<fp>R_*</fp>
<fp>R_*</fp>
</footprints>
<fields>
<field name="Reference">R</field>
<field name="Value">R</field>
</fields>
<pins>
<pin num="1" name="~" type="passive"/>
<pin num="2" name="~" type="passive"/>
</pins>
</libpart>
<libpart lib="stm32" part="STM32L151C6TxA">
<aliases>
<alias>STM32L151C8TxA</alias>
<alias>STM32L151CBTxA</alias>
</aliases>
<description>Core: ARM Cortex-M3 Package: LQFP48 Flash: 32KB Ram: 16KB Frequency: 32MHz Voltage: 1.65..3.6V IO-pins: 37</description>
<docs>http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00277537.pdf</docs>
<fields>
<field name="Reference">U</field>
<field name="Value">STM32L151C6TxA</field>
<field name="Footprint">Housings_QFP:LQFP-48_7x7mm_Pitch0.5mm</field>
</fields>
<pins>
<pin num="1" name="VLCD" type="power_in"/>
<pin num="2" name="PC13/RTC_OUT_ALARM/RTC_OUT_CALIB/RTC_TAMP1/RTC_TS/SYS_WKUP2/TIMX_IC2" type="BiDi"/>
<pin num="3" name="PC14/RCC_OSC32_IN/TIMX_IC3" type="BiDi"/>
<pin num="4" name="PC15/ADC_EXTI15/RCC_OSC32_OUT/TIMX_IC4" type="BiDi"/>
<pin num="5" name="PH0/RCC_OSC_IN" type="input"/>
<pin num="6" name="PH1/RCC_OSC_OUT" type="input"/>
<pin num="7" name="NRST" type="input"/>
<pin num="8" name="VSSA" type="power_in"/>
<pin num="9" name="VDDA" type="power_in"/>
<pin num="10" name="ADC_IN0/COMP1_INP/RTC_TAMP2/SYS_WKUP1/TIM2_CH1/TIM2_ETR/TIMX_IC1/TS_G1_IO1/USART2_CTS/PA0" type="BiDi"/>
<pin num="11" name="ADC_IN1/COMP1_INP/TIM2_CH2/TIMX_IC2/TS_G1_IO2/USART2_RTS/PA1" type="BiDi"/>
<pin num="12" name="ADC_IN2/COMP1_INP/TIM2_CH3/TIM9_CH1/TIMX_IC3/TS_G1_IO3/USART2_TX/PA2" type="BiDi"/>
<pin num="13" name="ADC_IN3/COMP1_INP/TIM2_CH4/TIM9_CH2/TIMX_IC4/TS_G1_IO4/USART2_RX/PA3" type="BiDi"/>
<pin num="14" name="ADC_IN4/COMP1_INP/DAC_OUT1/SPI1_NSS/TIMX_IC1/USART2_CK/PA4" type="BiDi"/>
<pin num="15" name="ADC_IN5/COMP1_INP/DAC_OUT2/SPI1_SCK/TIM2_CH1/TIM2_ETR/TIMX_IC2/PA5" type="BiDi"/>
<pin num="16" name="ADC_IN6/COMP1_INP/SPI1_MISO/TIM10_CH1/TIM3_CH1/TIMX_IC3/TS_G2_IO1/PA6" type="BiDi"/>
<pin num="17" name="ADC_IN7/COMP1_INP/SPI1_MOSI/TIM11_CH1/TIM3_CH2/TIMX_IC4/TS_G2_IO2/PA7" type="BiDi"/>
<pin num="18" name="PB0/ADC_IN8/COMP1_INP/SYS_V_REF_OUT/TIM3_CH3/TS_G3_IO1" type="BiDi"/>
<pin num="19" name="PB1/ADC_IN9/COMP1_INP/SYS_V_REF_OUT/TIM3_CH4/TS_G3_IO2" type="BiDi"/>
<pin num="20" name="PB2/BOOT1/COMP1_INP/TS_G3_IO3" type="BiDi"/>
<pin num="21" name="PB10/I2C2_SCL/TIM2_CH3/USART3_TX" type="BiDi"/>
<pin num="22" name="PB11/ADC_EXTI11/I2C2_SDA/TIM2_CH4/USART3_RX" type="BiDi"/>
<pin num="23" name="VSS" type="power_in"/>
<pin num="24" name="VDD" type="power_in"/>
<pin num="25" name="PB12/ADC_IN18/COMP1_INP/I2C2_SMBA/SPI2_NSS/TIM10_CH1/TS_G7_IO1/USART3_CK" type="BiDi"/>
<pin num="26" name="PB13/ADC_IN19/COMP1_INP/SPI2_SCK/TIM9_CH1/TS_G7_IO2/USART3_CTS" type="BiDi"/>
<pin num="27" name="PB14/ADC_IN20/COMP1_INP/SPI2_MISO/TIM9_CH2/TS_G7_IO3/USART3_RTS" type="BiDi"/>
<pin num="28" name="PB15/ADC_EXTI15/ADC_IN21/COMP1_INP/RTC_REFIN/SPI2_MOSI/TIM11_CH1/TS_G7_IO4" type="BiDi"/>
<pin num="29" name="RCC_MCO/TIMX_IC1/TS_G4_IO1/USART1_CK/PA8" type="BiDi"/>
<pin num="30" name="DAC_EXTI9/TIMX_IC2/TS_G4_IO2/USART1_TX/PA9" type="BiDi"/>
<pin num="31" name="TIMX_IC3/TS_G4_IO3/USART1_RX/PA10" type="BiDi"/>
<pin num="32" name="ADC_EXTI11/SPI1_MISO/TIMX_IC4/USART1_CTS/USB_DM/PA11" type="BiDi"/>
<pin num="33" name="SPI1_MOSI/TIMX_IC1/USART1_RTS/USB_DP/PA12" type="BiDi"/>
<pin num="34" name="SYS_JTMS-SWDIO/TIMX_IC2/TS_G5_IO1/PA13" type="BiDi"/>
<pin num="35" name="VSS" type="power_in"/>
<pin num="36" name="VDD" type="power_in"/>
<pin num="37" name="SYS_JTCK-SWCLK/TIMX_IC3/TS_G5_IO2/PA14" type="BiDi"/>
<pin num="38" name="ADC_EXTI15/SPI1_NSS/SYS_JTDI/TIM2_CH1/TIM2_ETR/TIMX_IC4/TS_G5_IO3/PA15" type="BiDi"/>
<pin num="39" name="PB3/COMP2_INM/SPI1_SCK/SYS_JTDO-TRACESWO/TIM2_CH2" type="BiDi"/>
<pin num="40" name="PB4/COMP2_INP/SPI1_MISO/SYS_JTRST/TIM3_CH1/TS_G6_IO1" type="BiDi"/>
<pin num="41" name="PB5/COMP2_INP/I2C1_SMBA/SPI1_MOSI/TIM3_CH2/TS_G6_IO2" type="BiDi"/>
<pin num="42" name="PB6/I2C1_SCL/TIM4_CH1/TS_G6_IO3/USART1_TX" type="BiDi"/>
<pin num="43" name="PB7/I2C1_SDA/SYS_PVD_IN/TIM4_CH2/TS_G6_IO4/USART1_RX" type="BiDi"/>
<pin num="44" name="BOOT0" type="input"/>
<pin num="45" name="PB8/I2C1_SCL/TIM10_CH1/TIM4_CH3" type="BiDi"/>
<pin num="46" name="PB9/DAC_EXTI9/I2C1_SDA/TIM11_CH1/TIM4_CH4" type="BiDi"/>
<pin num="47" name="VSS" type="power_in"/>
<pin num="48" name="VDD" type="power_in"/>
</pins>
</libpart>
<libpart lib="conn" part="TEST_1P">
<description>point</description>
<fields>
<field name="Reference">J</field>
<field name="Value">TEST_1P</field>
</fields>
<pins>
<pin num="1" name="1" type="passive"/>
</pins>
</libpart>
<libpart lib="hw1-rescue" part="USB_OTG-RESCUE-hw1">
<footprints>
<fp>USB*</fp>
</footprints>
<fields>
<field name="Reference">P</field>
<field name="Value">USB_OTG-RESCUE-hw1</field>
</fields>
<pins>
<pin num="1" name="VBUS" type="power_out"/>
<pin num="2" name="D-" type="passive"/>
<pin num="3" name="D+" type="passive"/>
<pin num="4" name="ID" type="power_in"/>
<pin num="5" name="GND" type="power_in"/>
<pin num="6" name="shield" type="passive"/>
</pins>
</libpart>
</libparts>
<libraries>
<library logical="hw1-rescue">
<uri>/home/karlp/src/libopencm3-tests/hw1/hw1-rescue.lib</uri>
</library>
<library logical="device">
<uri>/usr/share/kicad/library/device.lib</uri>
</library>
<library logical="conn">
<uri>/usr/share/kicad/library/conn.lib</uri>
</library>
<library logical="stm32">
<uri>/usr/share/kicad/library/stm32.lib</uri>
</library>
<library logical="karlp-klibs">
<uri>/home/karlp/src/libopencm3-tests/hw1/karlp-klibs.lib</uri>
</library>
</libraries>
<nets>
<net code="1" name="Net-(U2-Pad4)">
<node ref="U2" pin="4"/>
</net>
<net code="2" name="/ADC_IN2">
<node ref="U1" pin="17"/>
</net>
<net code="3" name="/ADC_IN1">
<node ref="U1" pin="16"/>
<node ref="P2" pin="3"/>
</net>
<net code="4" name="/SPI_MOSI">
<node ref="P9" pin="5"/>
<node ref="P3" pin="7"/>
<node ref="U1" pin="28"/>
</net>
<net code="5" name="/SPI_MISO">
<node ref="U1" pin="27"/>
<node ref="P9" pin="6"/>
<node ref="P3" pin="6"/>
</net>
<net code="6" name="/SPI_SCK">
<node ref="P3" pin="5"/>
<node ref="U1" pin="26"/>
<node ref="P9" pin="7"/>
</net>
<net code="7" name="/SPI_CS">
<node ref="P3" pin="8"/>
<node ref="U1" pin="25"/>
<node ref="P9" pin="8"/>
</net>
<net code="8" name="/NRST">
<node ref="P11" pin="5"/>
<node ref="U1" pin="7"/>
<node ref="C1" pin="2"/>
</net>
<net code="9" name="/SWO">
<node ref="P11" pin="6"/>
<node ref="U1" pin="39"/>
</net>
<net code="10" name="+5V">
<node ref="C7" pin="1"/>
<node ref="U2" pin="3"/>
<node ref="U2" pin="1"/>
<node ref="P10" pin="1"/>
</net>
<net code="11" name="Net-(P10-Pad6)">
<node ref="P10" pin="6"/>
</net>
<net code="12" name="Net-(P10-Pad4)">
<node ref="P10" pin="4"/>
</net>
<net code="13" name="Net-(U1-Pad4)">
<node ref="U1" pin="4"/>
</net>
<net code="14" name="Net-(U1-Pad3)">
<node ref="U1" pin="3"/>
</net>
<net code="15" name="/UART_RX_OUT">
<node ref="U1" pin="13"/>
<node ref="P9" pin="4"/>
<node ref="P4" pin="7"/>
</net>
<net code="16" name="/UART_TX_OUT">
<node ref="P4" pin="8"/>
<node ref="U1" pin="12"/>
<node ref="P9" pin="3"/>
</net>
<net code="17" name="Net-(P9-Pad9)">
<node ref="P9" pin="9"/>
</net>
<net code="18" name="/SWCLK">
<node ref="U1" pin="37"/>
<node ref="P11" pin="2"/>
</net>
<net code="19" name="/SWDIO">
<node ref="P11" pin="4"/>
<node ref="U1" pin="34"/>
</net>
<net code="20" name="Net-(U1-Pad40)">
<node ref="U1" pin="40"/>
</net>
<net code="21" name="Net-(U1-Pad2)">
<node ref="U1" pin="2"/>
</net>
<net code="22" name="Net-(P1-Pad5)">
<node ref="P1" pin="5"/>
</net>
<net code="23" name="Net-(C9-Pad1)">
<node ref="C9" pin="1"/>
<node ref="U1" pin="5"/>
<node ref="Y1" pin="1"/>
</net>
<net code="24" name="Net-(JP3-Pad2)">
<node ref="P1" pin="4"/>
<node ref="JP3" pin="2"/>
</net>
<net code="25" name="Net-(C10-Pad1)">
<node ref="Y1" pin="3"/>
<node ref="U1" pin="6"/>
<node ref="C10" pin="1"/>
</net>
<net code="26" name="Net-(PB11-Pad1)">
<node ref="U1" pin="22"/>
<node ref="PB11" pin="1"/>
</net>
<net code="27" name="Net-(U1-Pad20)">
<node ref="U1" pin="20"/>
</net>
<net code="28" name="/VLCD">
<node ref="C6" pin="2"/>
<node ref="U1" pin="1"/>
</net>
<net code="29" name="Net-(PA1-Pad1)">
<node ref="PA1" pin="1"/>
<node ref="U1" pin="11"/>
</net>
<net code="30" name="Net-(PA0-Pad1)">
<node ref="U1" pin="10"/>
<node ref="PA0" pin="1"/>
</net>
<net code="31" name="Net-(PA10-Pad1)">
<node ref="PA10" pin="1"/>
<node ref="U1" pin="31"/>
</net>
<net code="32" name="Net-(PA9-Pad1)">
<node ref="PA9" pin="1"/>
<node ref="U1" pin="30"/>
</net>
<net code="33" name="Net-(PA8-Pad1)">
<node ref="PA8" pin="1"/>
<node ref="U1" pin="29"/>
</net>
<net code="34" name="Net-(Y1-Pad4)">
<node ref="Y1" pin="4"/>
</net>
<net code="35" name="Net-(PB10-Pad1)">
<node ref="PB10" pin="1"/>
<node ref="U1" pin="21"/>
</net>
<net code="36" name="Net-(PB1-Pad1)">
<node ref="U1" pin="19"/>
<node ref="PB1" pin="1"/>
</net>
<net code="37" name="Net-(PB0-Pad1)">
<node ref="U1" pin="18"/>
<node ref="PB0" pin="1"/>
</net>
<net code="38" name="Net-(P3-Pad2)">
<node ref="P3" pin="2"/>
</net>
<net code="39" name="Net-(P3-Pad1)">
<node ref="P3" pin="1"/>
</net>
<net code="40" name="/I2C_SDA">
<node ref="P2" pin="5"/>
<node ref="JP1" pin="1"/>
<node ref="U1" pin="46"/>
<node ref="P9" pin="1"/>
</net>
<net code="41" name="/I2C_SCL">
<node ref="JP2" pin="1"/>
<node ref="U1" pin="45"/>
<node ref="P2" pin="6"/>
<node ref="P9" pin="2"/>
</net>
<net code="42" name="Net-(JP2-Pad2)">
<node ref="JP2" pin="2"/>
<node ref="R2" pin="2"/>
</net>
<net code="43" name="Net-(JP1-Pad2)">
<node ref="R1" pin="2"/>
<node ref="JP1" pin="2"/>
</net>
<net code="44" name="Net-(U1-Pad41)">
<node ref="U1" pin="41"/>
</net>
<net code="45" name="Net-(U1-Pad42)">
<node ref="U1" pin="42"/>
</net>
<net code="46" name="Net-(U1-Pad43)">
<node ref="U1" pin="43"/>
</net>
<net code="47" name="Net-(U1-Pad38)">
<node ref="U1" pin="38"/>
</net>
<net code="48" name="Net-(Y1-Pad2)">
<node ref="Y1" pin="2"/>
</net>
<net code="49" name="+3V3">
<node ref="C2" pin="1"/>
<node ref="C3" pin="1"/>
<node ref="R2" pin="1"/>
<node ref="U1" pin="24"/>
<node ref="P11" pin="1"/>
<node ref="JP3" pin="1"/>
<node ref="R1" pin="1"/>
<node ref="U1" pin="48"/>
<node ref="C5" pin="1"/>
<node ref="U1" pin="9"/>
<node ref="C8" pin="1"/>
<node ref="C4" pin="1"/>
<node ref="U2" pin="5"/>
<node ref="U1" pin="36"/>
</net>
<net code="50" name="GND">
<node ref="P1" pin="7"/>
<node ref="P1" pin="6"/>
<node ref="C3" pin="2"/>
<node ref="P9" pin="10"/>
<node ref="P10" pin="5"/>
<node ref="U2" pin="2"/>
<node ref="C4" pin="2"/>
<node ref="P11" pin="3"/>
<node ref="C5" pin="2"/>
<node ref="C2" pin="2"/>
<node ref="C10" pin="2"/>
<node ref="C8" pin="2"/>
<node ref="C7" pin="2"/>
<node ref="U1" pin="35"/>
<node ref="C1" pin="1"/>
<node ref="U1" pin="44"/>
<node ref="U1" pin="47"/>
<node ref="C9" pin="2"/>
<node ref="U1" pin="23"/>
<node ref="U1" pin="8"/>
<node ref="C6" pin="1"/>
<node ref="P3" pin="4"/>
</net>
<net code="51" name="/Vin">
<node ref="P1" pin="8"/>
</net>
<net code="52" name="/AREF">
<node ref="P3" pin="3"/>
</net>
<net code="53" name="/RESET_OUT">
<node ref="P1" pin="3"/>
</net>
<net code="54" name="/IOREF">
<node ref="P1" pin="2"/>
</net>
<net code="55" name="Net-(P1-Pad1)">
<node ref="P1" pin="1"/>
</net>
<net code="56" name="/9(**)">
<node ref="P3" pin="9"/>
</net>
<net code="57" name="/8">
<node ref="P3" pin="10"/>
</net>
<net code="58" name="/DAC2_OUT">
<node ref="U1" pin="15"/>
<node ref="P2" pin="2"/>
</net>
<net code="59" name="/2">
<node ref="P4" pin="6"/>
</net>
<net code="60" name="/3(**)">
<node ref="P4" pin="5"/>
</net>
<net code="61" name="/4">
<node ref="P4" pin="4"/>
</net>
<net code="62" name="/5(**)">
<node ref="P4" pin="3"/>
</net>
<net code="63" name="/6(**)">
<node ref="P4" pin="2"/>
</net>
<net code="64" name="/7">
<node ref="P4" pin="1"/>
</net>
<net code="65" name="/A3">
<node ref="P2" pin="4"/>
</net>
<net code="66" name="/DAC1_OUT">
<node ref="P2" pin="1"/>
<node ref="U1" pin="14"/>
</net>
<net code="67" name="/USB_DP">
<node ref="P10" pin="3"/>
<node ref="J1" pin="1"/>
<node ref="U1" pin="33"/>
</net>
<net code="68" name="/USB_DM">
<node ref="J1" pin="2"/>
<node ref="U1" pin="32"/>
<node ref="P10" pin="2"/>
</net>
</nets>
</export>

View file

@ -1,9 +0,0 @@
EESchema-DOCLIB Version 2.0
#
$CMP MIC550x-3.3YM5
D 300mA LDO fixed output voltage 3.3V ultra-low-noise
K linear low dropout Regulator fixed ultra-low-noise
F http://ww1.microchip.com/downloads/en/DeviceDoc/MIC550X.pdf
$ENDCMP
#
#End Doc Library

View file

@ -1,24 +0,0 @@
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# MIC550x-3.3YM5
#
DEF MIC550x-3.3YM5 U 0 40 Y Y 1 F N
F0 "U" -250 200 50 H V L CNN
F1 "MIC550x-3.3YM5" 600 200 50 H V R CNN
F2 "TO_SOT_Packages_SMD:SOT-23-5" 650 -250 50 H I C CIN
F3 "" 0 0 50 H V C CNN
$FPLIST
SOT-23*
$ENDFPLIST
DRAW
S -250 150 250 -200 0 1 10 f
X VIN 1 -400 100 150 R 50 50 1 1 W
X GND 2 0 -300 100 U 50 50 1 1 W
X EN 3 -400 -100 150 R 50 50 1 1 I
X NC 4 400 -100 150 L 50 50 1 1 N
X VOUT 5 400 100 150 L 50 50 1 1 w
ENDDRAW
ENDDEF
#
#End Library

View file

@ -1,41 +0,0 @@
22:59 < karlp> BrainDamage: yeah, proper questions from you of course. building
test harness host board to plug all the nucleo64 boards into
for locm3 testing. Adding a port for plugging a cheap fx2 logic
analyser on, so I can do auto testing with sigrok,
23:00 < karlp> I'm estimating like 20-30mm on the side tap to the logic
analyser port, plus 30-40mm or so between target/host.
23:00 < karlp> how fast can I go on the signals before I need to do anything I
guess?
23:00 < karlp> i2c/uart are probably fine, spi might have an upper limit?
23:06 < BrainDamage> the highest frequency for squarewaves is 2/trise for
signal integrity, assuming say, 30MHz spi that gives us
30ns period, trise would be say, 1/5th of a semiperiod so
30/2/5 ~3ns, so that gives us a frequency of approx
~700MHz for signal integrity, in turn that has a
wavelength of c/700MHz ~430mm, now a common ballpark is
that when your circuit size is comparable to 1/10th of the
wavelength, you start seeing
23:06 < BrainDamage> effects, since you said it's overall 60mm it's more than
40, so yes, it'll distort the signal a bit leaving it
dangling there
23:07 * karlp loves you
23:08 < karlp> so, is the solution "throw small series resistors right by the
stub off to the dangling trace, so that it dissipates any
reflections on that line?
23:08 < karlp> I guess this also then changes when the LA is plugged in/not in
too.
23:09 < BrainDamage> the LA tends to be a very high impedance, so it doesn't
change a lot when it's in compared to the open circuit case
23:09 < BrainDamage> series termination should work
23:09 < karlp> adds capacitance though, I've foudn that out the hardware with
insufficient i2c pullups, but that's already taken care of.
23:09 < karlp> and yeah, just like 22ohm right on the beginning of the stub, by
the T-junction?
23:12 < BrainDamage> i forgot the exact value for series termination, it was
either 2x or 1/2 of the nominal impedance, if 22 is what
you've seen before then i guess it was 1/2 and yes, that
should fix it
23:14 < BrainDamage> if you feel brave there's faster terminations using
clamping diodes and caps, buuut, i'd say to keep it simple
first

@ -1 +0,0 @@
Subproject commit 99cea7a79f53f1a563529748fac2cb1997052bf0

View file

@ -1,3 +0,0 @@
# Personal OpenOCD config files
config files that match all my connected boards.

View file

@ -1,10 +0,0 @@
# Shared openocd script helpers
# put things like "hla_serial 'asdfadfa'" in openocd.<board>.local.cfg to support
# multiple simultaneously connected boards.
proc optional_local { LOCAL_FILE } {
if { [ file exists $LOCAL_FILE ] } {
puts "Loading custom local settings from $LOCAL_FILE"
source [find $LOCAL_FILE]
}
}

View file

@ -1,14 +0,0 @@
source [find interface/stlink-v2.cfg]
set WORKAREASIZE 0x4000
source [find target/stm32f0x.cfg]
source [find openocd.common.cfg]
optional_local "openocd.stm32f072disco.local.cfg"
# no trace on cm0
#tpiu config internal swodump.stm32f4disco.log uart off 168000000
# Uncomment to reset on connect, for grabbing under WFI et al
reset_config srst_only srst_nogate
# reset_config srst_only srst_nogate connect_assert_srst

View file

@ -1,2 +0,0 @@
# serial of my f072 disco board.
hla_serial "Q?o\x06PgHW#$\x16?"

View file

@ -1,20 +0,0 @@
# Unfortunately, with no f103 disco, we're currently
# using a separate disco board
#source [find interface/stlink-v2.cfg]
source [find interface/stlink-v2-1.cfg]
set WORKAREASIZE 0x2000
source [find target/stm32f1x.cfg]
# Serial of my l1 disco used as stlink here.
#hla_serial "S?l\x06H?WQ%\x10\x18?"
# if f4 disco
#hla_serial "W?k\x06IgHV0H\x10?"
# if l0 disco (And fix the line above!)
hla_serial "0670FF484849785087085514"
tpiu config internal swodump.stm32f103-generic.log uart off 72000000
# Uncomment to reset on connect, for grabbing under WFI et al
reset_config srst_only srst_nogate
# reset_config srst_only srst_nogate connect_assert_srst

View file

@ -1,13 +0,0 @@
source [find interface/stlink-v2.cfg]
set WORKAREASIZE 0x4000
source [find target/stm32f3x.cfg]
# serial of my f3 disco board.
hla_serial "S?n\x06gePQ6G%g"
tpiu config internal swodump.stm32f3-disco.log uart off 72000000
# Uncomment to reset on connect, for grabbing under WFI et al
reset_config srst_only srst_nogate
# reset_config srst_only srst_nogate connect_assert_srst

View file

@ -1,13 +0,0 @@
source [find interface/stlink-v2.cfg]
set WORKAREASIZE 0x4000
source [find target/stm32f4x.cfg]
source [find openocd.common.cfg]
optional_local "openocd.stm32f4-disco.local.cfg"
tpiu config internal swodump.stm32f4disco.log uart off 168000000
# Uncomment to reset on connect, for grabbing under WFI et al
#reset_config srst_only srst_nogate
reset_config srst_only srst_nogate connect_assert_srst

View file

@ -1,2 +0,0 @@
# serial of my f4 disco board.
hla_serial "W?k\x06IgHV0H\x10?"

View file

@ -1,14 +0,0 @@
source [find interface/stlink-v2-1.cfg]
set WORKAREASIZE 0x1000
source [find target/stm32l0.cfg]
source [find openocd.common.cfg]
optional_local "openocd.stm32l053disco.local.cfg"
# no trace on cm0
#tpiu config internal swodump.stm32f4disco.log uart off 168000000
# Uncomment to reset on connect, for grabbing under WFI et al
reset_config srst_only srst_nogate
# reset_config srst_only srst_nogate connect_assert_srst

View file

@ -1,17 +0,0 @@
# l1 generic, using a l4 disco board
source [find interface/stlink-v2-1.cfg]
# l1 disco itself or similar
#source [find interface/stlink-v2.cfg]
set WORKAREASIZE 0x2000
source [find target/stm32l1.cfg]
#hla_serial "W?k\x06IgHV0H\x10?"; # My f4 disco
hla_serial "066DFF495351885087171826"; # My l4 disco
hla_serial "066CFF495150807567064226"; # My l053 nucleo
#hla_serial "S?l\x06H?WQ%\x10\x18?"; # My l1 disco
tpiu config internal swodump.stm32l1-generic.log uart off 32000000
# Uncomment to reset on connect, for grabbing under WFI et al
reset_config srst_only srst_nogate
#reset_config srst_only srst_nogate connect_assert_srst

View file

@ -1,13 +0,0 @@
source [find interface/stlink-v2-1.cfg]
source [find target/stm32l4x.cfg]
# serial of my f072 disco board.
hla_serial "066DFF495351885087171826"
tpiu config internal swodump.stm32l4-disco.log uart off 48000000
# Uncomment to reset on connect, for grabbing under WFI et al
#reset_config srst_only srst_nogate
#reset_config srst_only srst_nogate connect_assert_srst
reset_config none

172
rules.mk
View file

@ -1,172 +0,0 @@
##
## This file is part of the libopencm3 project.
##
## This library is free software: you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This library 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 Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
##
# This version of rules.mk expects the following to be defined before
# inclusion..
### REQUIRED ###
# DEVICE=xxxx - this tree uses the genlink-config.mk and genlink-rules.mk!
# OPENCM3_DIR - duh
# PROJECT - will be the basename of the output elf, eg usb-gadget0-stm32f4disco
# CFILES - basenames only, eg main.c blah.c
# The follow vars are assumed to have been created via genlink.mk
# xOPENCM3_LIB - the basename, eg: opencm3_stm32f4
# SOURCED VIA devices.data!
# xOPENCM3_DEFS - the target define eg: -DSTM32F4
# SOURCED VIA devices.data!
# xARCH_FLAGS - eg, -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
# (ie, the full set of cpu arch flags, _none_ are defined in this file)
# SOURCED VIA devices.data!
# xLDSCRIPT - full path, eg ../../examples/stm32/f4/stm32f4-discovery/stm32f4-discovery.ld
# SOURCED VIA devices.data!
#
### OPTIONAL ###
# INCLUDES - fully formed -I paths, if you want extra, eg -I../shared
# BUILD_DIR - defaults to bin, should set this if you are building multiarch
# OPT - full -O flag, defaults to -Os
# CSTD - defaults -std=c99
# CXXSTD - no default.
# OOCD_INTERFACE - eg stlink-v2
# OOCD_TARGET - eg stm32f4x
# both only used if you use the "make flash" target.
# OOCD_FILE - eg my.openocd.cfg
# This overrides interface/target above, and is used as just -f FILE
### TODO/FIXME/notes ###
# No support for stylecheck.
# No support for BMP/texane/random flash methods, no plans either
# No support for magically finding the library.
# C++ hasn't been actually tested with this..... sorry bout that. ;)
# Second expansion/secondary not set, add this if you need them.
BUILD_DIR ?= bin
OPT ?= -Os
CSTD ?= -std=c99
# Be silent per default, but 'make V=1' will show all compiler calls.
# If you're insane, V=99 will print out all sorts of things.
V?=0
ifeq ($(V),0)
Q := @
NULL := 2>/dev/null
endif
# Tool paths.
PREFIX ?= arm-none-eabi-
CC = $(PREFIX)gcc
LD = $(PREFIX)gcc
OBJCOPY = $(PREFIX)objcopy
OBJDUMP = $(PREFIX)objdump
OOCD ?= openocd
# Inclusion of library header files
include $(OPENCM3_DIR)/mk/genlink-config.mk
OBJS = $(CFILES:%.c=$(BUILD_DIR)/%.o)
TGT_CPPFLAGS += -MD
TGT_CPPFLAGS += -Wall -Wundef
TGT_CPPFLAGS += $(INCLUDES)
TGT_CFLAGS += $(OPT) $(CSTD) -ggdb3
TGT_CFLAGS += $(ARCH_FLAGS)
TGT_CFLAGS += -fno-common
TGT_CFLAGS += -ffunction-sections -fdata-sections
TGT_CFLAGS += -Wextra -Wshadow -Wno-unused-variable -Wimplicit-function-declaration
TGT_CFLAGS += -Wredundant-decls -Wstrict-prototypes -Wmissing-prototypes
TGT_CXXFLAGS += $(OPT) $(CXXSTD) -ggdb3
TGT_CXXFLAGS += $(ARCH_FLAGS)
TGT_CXXFLAGS += -fno-common
TGT_CXXFLAGS += -ffunction-sections -fdata-sections
TGT_CXXFLAGS += -Wextra -Wshadow -Wredundant-decls -Weffc++
TGT_LDFLAGS += -T$(LDSCRIPT) -L$(OPENCM3_DIR)/lib -nostartfiles
TGT_LDFLAGS += $(ARCH_FLAGS)
TGT_LDFLAGS += -specs=nano.specs
TGT_LDFLAGS += -u _printf_float
TGT_LDFLAGS += -Wl,--gc-sections
# OPTIONAL
#TGT_LDFLAGS += -Wl,-Map=$(PROJECT).map
ifeq ($(V),99)
TGT_LDFLAGS += -Wl,--print-gc-sections
endif
# nosys is only in newer gcc-arm-embedded...
LDLIBS += -specs=nosys.specs
#LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
# Burn in legacy hell fortran modula pascal yacc idontevenwat
.SUFFIXES:
.SUFFIXES: .c .h .o .cxx .elf .bin .list .lss
# Bad make, never *ever* try to get a file out of source control by yourself.
%: %,v
%: RCS/%,v
%: RCS/%
%: s.%
%: SCCS/s.%
all: $(PROJECT).elf #$(PROJECT).bin
flash: $(PROJECT).flash
# Need a special rule to have a bin dir
$(BUILD_DIR)/%.o: %.c
@printf " CC\t$<\n"
@mkdir -p $(dir $@)
$(Q)$(CC) $(TGT_CFLAGS) $(CFLAGS) $(TGT_CPPFLAGS) $(CPPFLAGS) -o $@ -c $<
$(BUILD_DIR)/%.o: %.cxx
@printf " CXX\t$<\n"
@mkdir -p $(dir $@)
$(Q)$(CC) $(TGT_CXXFLAGS) $(CXXFLAGS) $(TGT_CPPFLAGS) $(CPPFLAGS) -o $@ -c $<
$(PROJECT).elf: $(OBJS) $(LDSCRIPT)
@printf " LD\t$@\n"
$(Q)$(LD) $(TGT_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
%.bin: %.elf
@printf " OBJCOPY\t$@\n"
$(Q)$(OBJCOPY) -O binary $< $@
%.lss: %.elf
$(OBJDUMP) -h -S $< > $@
%.list: %.elf
$(OBJDUMP) -S $< > $@
%.flash: %.elf
@printf " FLASH\t$<\n"
ifeq (,$(OOCD_FILE))
$(Q)(echo "halt; program $(realpath $(*).elf) verify reset" | nc -4 localhost 4444 2>/dev/null) || \
$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
-f target/$(OOCD_TARGET).cfg \
-c "program $(*).elf verify reset exit" \
$(NULL)
else
$(Q)(echo "halt; program $(realpath $(*).elf) verify reset" | nc -4 localhost 4444 2>/dev/null) || \
$(OOCD) -s ../../openocd/ -f $(OOCD_FILE) \
-c "program $(*).elf verify reset exit" \
$(NULL)
endif
clean:
rm -rf $(BUILD_DIR) $(PROJECT).{elf,bin} $(PROJECT).{list,lss,map} $(LDSCRIPT)
include $(OPENCM3_DIR)/mk/genlink-rules.mk
.PHONY: all clean flash
-include $(OBJS:.o=.d)

View file

@ -1,2 +0,0 @@
This directory contains target independent code reused by 2 or more test
projects. _only_ target independent code

View file

@ -1,54 +0,0 @@
#include <stdint.h>
#include <libopencm3/cm3/common.h>
#include <libopencm3/cm3/memorymap.h>
#include <libopencm3/cm3/itm.h>
#include "trace.h"
void trace_send_blocking8(int stimulus_port, char c) {
if (!(ITM_TER[0] & (1<<stimulus_port))) {
return;
}
while (!(ITM_STIM8(stimulus_port) & ITM_STIM_FIFOREADY))
;
ITM_STIM8(stimulus_port) = c;
}
void trace_send8(int stimulus_port, char val) {
if (!(ITM_TER[0] & (1<<stimulus_port))) {
return;
}
ITM_STIM8(stimulus_port) = val;
}
void trace_send_blocking16(int stimulus_port, uint16_t val) {
if (!(ITM_TER[0] & (1<<stimulus_port))) {
return;
}
while (!(ITM_STIM16(stimulus_port) & ITM_STIM_FIFOREADY))
;
ITM_STIM16(stimulus_port) = val;
}
void trace_send16(int stimulus_port, uint16_t val) {
if (!(ITM_TER[0] & (1<<stimulus_port))) {
return;
}
ITM_STIM16(stimulus_port) = val;
}
void trace_send_blocking32(int stimulus_port, uint32_t val) {
if (!(ITM_TER[0] & (1<<stimulus_port))) {
return;
}
while (!(ITM_STIM32(stimulus_port) & ITM_STIM_FIFOREADY))
;
ITM_STIM32(stimulus_port) = val;
}
void trace_send32(int stimulus_port, uint32_t val) {
if (!(ITM_TER[0] & (1<<stimulus_port))) {
return;
}
ITM_STIM32(stimulus_port) = val;
}

View file

@ -1,30 +0,0 @@
/*
* trace support
* Karl Palsson <karlp@tweak.net.au>
*/
#ifndef TRACE_H
#define TRACE_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
void trace_send_blocking8(int stimulus_port, char c);
void trace_send8(int stimulus_port, char c);
void trace_send_blocking16(int stimulus_port, uint16_t val);
void trace_send16(int stimulus_port, uint16_t val);
void trace_send_blocking32(int stimulus_port, uint32_t val);
void trace_send32(int stimulus_port, uint32_t val);
#ifdef __cplusplus
}
#endif
#endif /* TRACE_H */

View file

@ -1,34 +0,0 @@
/*
* support for stdio output to a trace port
* Karl Palsson, 2014 <karlp@remake.is>
*/
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include "trace.h"
#ifndef STIMULUS_STDIO
#define STIMULUS_STDIO 0
#endif
int _write(int file, char *ptr, int len);
int _write(int file, char *ptr, int len)
{
int i;
if (file == STDOUT_FILENO || file == STDERR_FILENO) {
for (i = 0; i < len; i++) {
if (ptr[i] == '\n') {
trace_send_blocking8(STIMULUS_STDIO, '\r');
}
trace_send_blocking8(STIMULUS_STDIO, ptr[i]);
}
return i;
}
errno = EIO;
return -1;
}

View file

@ -1,34 +0,0 @@
/*
* support for stdio output to a usart
* Karl Palsson, 2015 <karlp@tweak.net.au>
*/
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <libopencm3/stm32/usart.h>
#ifndef STDIO_USART
#define STDIO_USART USART1
#endif
int _write(int file, char *ptr, int len);
int _write(int file, char *ptr, int len)
{
int i;
if (file == STDOUT_FILENO || file == STDERR_FILENO) {
for (i = 0; i < len; i++) {
if (ptr[i] == '\n') {
usart_send_blocking(STDIO_USART, '\r');
}
usart_send_blocking(STDIO_USART, ptr[i]);
}
return i;
}
errno = EIO;
return -1;
}

View file

@ -1,15 +0,0 @@
# This is just a stub makefile used for travis builds
# to keep things all compiling. Normally you'd use
# one of the makefiles directly.
# These hoops are to enable parallel make correctly.
GZ_ALL := $(wildcard Makefile.*)
all: $(GZ_ALL:=.all)
clean: $(GZ_ALL:=.clean)
%.all:
$(MAKE) -f $* all
%.clean:
$(MAKE) -f $* clean

View file

@ -1,23 +0,0 @@
BOARD = stm32f072-disco
PROJECT = adc-power-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += adc-power.c
# No trace on cm0!
#CFILES += trace.c trace_stdio.c
CFILES += usart_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3
DEVICE=stm32f072rb
#OOCD_INTERFACE = stlink-v2
#OOCD_TARGET = stm32f0x
OOCD_FILE = ../../openocd/openocd.stm32f072-disco.cfg
include ../../rules.mk

View file

@ -1,38 +0,0 @@
##
## This file is part of the libopencm3 project.
##
## This library is free software: you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This library 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 Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
##
BOARD = stm32f103-generic
PROJECT = adc-power-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += adc-power.c
CFILES += trace.c trace_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3
DEVICE=stm32f103x8
#OOCD_INTERFACE = jlink
#OOCD_TARGET = stm32f1x
OOCD_FILE = ../../openocd/openocd.stm32f103-generic.cfg
include ../../rules.mk

View file

@ -1,22 +0,0 @@
BOARD = stm32f3-disco
PROJECT = adc-power-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += adc-power.c
CFILES += trace.c trace_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3/
DEVICE=stm32f303vct6
#OOCD_INTERFACE = stlink-v2
#OOCD_TARGET = stm32f3x
OOCD_FILE = ../../openocd/openocd.stm32f3-disco.cfg
include ../../rules.mk

View file

@ -1,40 +0,0 @@
##
## This file is part of the libopencm3 project.
##
## This library is free software: you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This library 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 Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
##
BOARD = stm32f4-disco
PROJECT = adc-power-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += adc-power.c
CFILES += trace.c trace_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3/
### This section can go to an arch shared rules eventually...
DEVICE=stm32f405xg
#OOCD_INTERFACE = stlink-v2
#OOCD_TARGET = stm32f4x
OOCD_FILE = ../../openocd/openocd.stm32f4-disco.cfg
include ../../rules.mk

View file

@ -1,18 +0,0 @@
BOARD = stm32l1-generic
PROJECT = adc-power-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += adc-power.c
CFILES += trace.c trace_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3
DEVICE=stm32l151x8
OOCD_FILE = openocd.stm32l1-generic.cfg
include ../../rules.mk

View file

@ -1,23 +0,0 @@
BOARD = stm32l4-disco
PROJECT = adc-power-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += adc-power.c
CFILES += trace.c trace_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3/
### This section can go to an arch shared rules eventually...
DEVICE=stm32l476vgt6
#OOCD_INTERFACE = stlink-v2-1
#OOCD_TARGET = stm32l4x
OOCD_FILE = ../../openocd/openocd.stm32l4-disco.cfg
include ../../rules.mk

View file

@ -1,17 +0,0 @@
For most boards, adc channels 1 and 5 are PA1 and PA5.
Not the F3. oh no, that board is cray cray. PA0 and PF4
For boards with a Cortex-M3 or better, debug output is on ITM
channel 0 (Yay!)
For M0/M0+ boards, debug is via a tx only UART on PA9.
https://github.com/libopencm3/libopencm3/pull/471
https://github.com/libopencm3/libopencm3/pull/457
https://github.com/libopencm3/libopencm3/pull/534
https://github.com/libopencm3/libopencm3/issues/456
https://github.com/libopencm3/libopencm3/issues/455
https://github.com/libopencm3/libopencm3/issues/454

View file

@ -1,211 +0,0 @@
/**
* Testing ADC power up and power down, for timing and actual on/off
* Uses TIM6, because DWT_CYCCNT not available on cm0(+) :(
* (And with no DWT, no ITM timestamping either, get a real mcu!)
*/
#include <stdio.h>
#include <stdint.h>
#include <libopencm3/stm32/adc.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/timer.h>
#include "adc-power.h"
/* Everyone has tim6 right? */
#define TIMER TIM6
#define TIMER_RCC RCC_TIM6
// TODO - stick this in libopencm3?
#define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0]))
// Still have some bad shit to deal with...
#if defined(STM32F0)
#define SEPARATE_ADC_SAMPLING 0
#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_239DOT5 // 4usec or more for tempsensor
#define HAS_CALIBRATION 1
#elif defined(STM32F1)
#define SEPARATE_ADC_SAMPLING 0
#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_28DOT5CYC // 17usecs or more. >~15cycles at 9Mhz
#define SEPARATE_VREF 0
#define HAS_CALIBRATION 1
#define HAS_ROM_CALIBRATION 0
#elif defined(STM32F3)
#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_181DOT5CYC
#define SAMPLE_TIME_TEMP ADC_SMPR_SMP_601DOT5CYC // 2.2usecs or more
#define SAMPLE_TIME_VREF SAMPLE_TIME_TEMP
#define HAS_CALIBRATION 1
#elif defined(STM32F4)
#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_28CYC
#define SAMPLE_TIME_TEMP ADC_SMPR_SMP_144CYC // 10 usecs or more, in theory needs 840cycles!
#define SAMPLE_TIME_VREF SAMPLE_TIME_TEMP
#define ADC_CHANNEL_TEMP ADC_CHANNEL_TEMP_F40
#define SEPARATE_VREF 0
#elif defined(STM32L1)
#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_24CYC
#define SAMPLE_TIME_TEMP ADC_SMPR_SMP_192CYC
#define SAMPLE_TIME_VREF SAMPLE_TIME_TEMP
#define SEPARATE_VREF 0
#elif defined(STM32L4)
#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_247DOT5CYC
#define SAMPLE_TIME_TEMP ADC_SMPR_SMP_247DOT5CYC
#define SAMPLE_TIME_VREF SAMPLE_TIME_TEMP
#define HAS_CALIBRATION 1
#else
#error "no sample time for your target yet?!"
#endif
#ifndef SEPARATE_VREF
#define SEPARATE_VREF 1
#endif
#ifndef SEPARATE_ADC_SAMPLING
#define SEPARATE_ADC_SAMPLING 1
#endif
#ifndef HAS_CALIBRATION
#define HAS_CALIBRATION 0
#endif
#ifndef HAS_ROM_CALIBRATION
#define HAS_ROM_CALIBRATION 1
#endif
void adc_power_init(void)
{
/* Some basic ADC config, that we won't touch again */
#if defined(STM32F3)
/* silly f303 */
rcc_periph_clock_enable(RCC_ADC12);
rcc_adc_prescale(RCC_CFGR2_ADCxPRES_PLL_CLK_DIV_1, RCC_CFGR2_ADCxPRES_PLL_CLK_DIV_1);
adc_enable_regulator(ADC1);
#elif defined (STM32L4)
/* same same but different */
rcc_periph_clock_enable(RCC_ADC1);
ADC_CR(ADC1) &= ~ADC_CR_DEEPPWD;
RCC_CCIPR |= 3 << 28; // system clock as adc clock. (with CKMODE == 0)
adc_enable_regulator(ADC1);
ADC_CR(ADC1) &= ~ADC_CR_ADCALDIF;
ADC_CR(ADC1) |= ADC_CR_ADCAL;
while (ADC_CR(ADC1) & ADC_CR_ADCAL);
#else
rcc_periph_clock_enable(RCC_ADC1);
#if 0
// DANGER DANGER! doing this without DMA is dum.
// but... we're busy polling, we should be right... right?
// (dma across platforms is teh suck)
adc_enable_scan_mode(ADC1);
ADC_CR2 |= ADC_CR2_EOCS; // FIXME
#else
// FIXME - f0! adc_disable_scan_mode(ADC1);
#endif
#endif
#if (SEPARATE_ADC_SAMPLING == 1)
adc_set_sample_time_on_all_channels(ADC1, SAMPLE_TIME_BASIC);
adc_set_sample_time(ADC1, ADC_CHANNEL_TEMP, SAMPLE_TIME_TEMP);
adc_set_sample_time(ADC1, ADC_CHANNEL_TEMP, SAMPLE_TIME_VREF);
#else
adc_set_sample_time_on_all_channels(ADC1, SAMPLE_TIME_BASIC);
#endif
adc_enable_temperature_sensor();
#if (SEPARATE_VREF == 1)
adc_enable_vrefint();
#endif
/*
* We're going to setup a timer to run at top speed, so... "fast"
* but we don't actually care about the rate itself. We just
* want to collect how many ticks it takes to enable and disable
* the adc.
*/
rcc_periph_clock_enable(TIMER_RCC);
timer_reset(TIMER);
timer_set_prescaler(TIMER, 0);
timer_enable_counter(TIMER);
}
static uint16_t read_adc_naiive(uint8_t channel)
{
uint8_t channel_array[16];
channel_array[0] = channel;
adc_set_regular_sequence(ADC1, 1, channel_array);
// FIXME - use a trigger, see f1 notes!
#if defined (STM32F1)
adc_start_conversion_direct(ADC1);
#else
adc_start_conversion_regular(ADC1);
#endif
while (!adc_eoc(ADC1));
return adc_read_regular(ADC1);
}
static float adc_calc_tempf(unsigned int ts_v, unsigned int vref) {
#if (HAS_ROM_CALIBRATION == 1)
float adjusted_vtemp = ts_v * ST_VREFINT_CAL * 1.0f / vref * 1.0f;
float slope = (110-30) * 1.0f / (ST_TSENSE_CAL2_110C - ST_TSENSE_CAL1_30C) * 1.0f;
return slope * (adjusted_vtemp - ST_TSENSE_CAL1_30C) + 30;
#else
(void)vref;
return ts_v * 1.0;
#endif
}
static int adc_calc_tempi(unsigned int ts, unsigned int vref) {
#if (HAS_ROM_CALIBRATION == 1)
int adjusted_vtemp = ts * ST_VREFINT_CAL / vref;
int slope = (110-30) / (ST_TSENSE_CAL2_110C - ST_TSENSE_CAL1_30C);
return slope * (adjusted_vtemp - ST_TSENSE_CAL1_30C) + 30;
#else
(void)vref;
return ts * 1.00;
#endif
}
void adc_power_task_up(void) {
TIM_CNT(TIMER) = 0;
// Welcome to f1 world.
#if defined (STM32F1)
adc_power_on(ADC1);
for (int i = 0; i < 0x80000; i++) { /* Wait a bit. */
__asm__("NOP");
}
#endif
#if (HAS_CALIBRATION == 1)
adc_calibrate(ADC1);
#endif
adc_power_on(ADC1);
unsigned int td = TIM_CNT(TIMER);
/* just for kicks, let's time some sequences too....
* I mean, we're going to do some conversions right? */
adc_set_single_conversion_mode(ADC1);
TIM_CNT(TIMER) = 0;
unsigned int v1 = read_adc_naiive(1); // 8 for l4!
unsigned int v5 = read_adc_naiive(5);
unsigned int temp_adc = read_adc_naiive(ADC_CHANNEL_TEMP);
unsigned int vref_adc = read_adc_naiive(ADC_CHANNEL_VREF);
unsigned int tconv = TIM_CNT(TIMER);
TIM_CNT(TIMER) = 0;
float tempf = adc_calc_tempf(temp_adc, vref_adc);
int tconvf = TIM_CNT(TIMER);
TIM_CNT(TIMER) = 0;
int tempi = adc_calc_tempi(temp_adc, vref_adc);
int tconvi = TIM_CNT(TIMER);
printf("ton: %u, tconv: %u, ch1: %u, ch5: %u\n", td, tconv, v1, v5);
printf("\tTemperature: %f (tc %d) or %d (tc %d) (raw ts: %d, raw vref: %d)\n",
tempf, tconvf, tempi, tconvi, temp_adc, vref_adc);
//printf("\tT1-30 %d, t2-110 %d, vrefcal: %d\n", ST_TSENSE_CAL1_30C, ST_TSENSE_CAL2_110C, ST_VREFINT_CAL);
}
void adc_power_task_down()
{
TIM_CNT(TIMER) = 0;
adc_power_off(ADC1);
/* double power off should be safe */
adc_power_off(ADC1);
unsigned int td = TIM_CNT(TIMER);
printf("toff in: %u\n", td);
}

View file

@ -1,25 +0,0 @@
/*
* File: adc-power.h
* Author: karlp
*
* Created on October 17, 2015, 12:19 AM
*/
#ifndef ADC_POWER_H
#define ADC_POWER_H
#ifdef __cplusplus
extern "C" {
#endif
void adc_power_init(void);
void adc_power_task_up(void);
void adc_power_task_down(void);
#ifdef __cplusplus
}
#endif
#endif /* ADC_POWER_H */

View file

@ -1,67 +0,0 @@
/*
* Copyright (C) 2015 Karl Palsson <karlp@tweak.net.au>
*/
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/crs.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/usart.h>
#include <stdio.h>
#include "adc-power.h"
static
void setup_usart(void)
{
uint32_t dev = USART1;
rcc_periph_clock_enable(RCC_USART1);
rcc_periph_clock_enable(RCC_GPIOA);
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO9);
gpio_set_af(GPIOA, GPIO_AF1, GPIO9);
usart_set_baudrate(dev, 115200);
usart_set_databits(dev, 8);
usart_set_parity(dev, USART_PARITY_NONE);
usart_set_stopbits(dev, USART_CR2_STOPBITS_1);
usart_set_mode(dev, USART_MODE_TX);
usart_set_flow_control(dev, USART_FLOWCONTROL_NONE);
/* Finally enable the USART. */
usart_enable(dev);
}
int main(void)
{
int i;
rcc_clock_setup_in_hsi48_out_48mhz();
setup_usart();
/* LED on for boot progress */
rcc_periph_clock_enable(RCC_GPIOC);
gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO7);
gpio_set(GPIOC, GPIO7);
printf("hi guys!\n");
rcc_periph_clock_enable(RCC_GPIOA);
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO1);
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO5);
adc_power_init();
while (1) {
adc_power_task_up();
gpio_toggle(GPIOC, GPIO7);
for (i = 0; i < 0x100000; i++) { /* Wait a bit. */
__asm__("NOP");
}
printf("tick...\n");
adc_power_task_down();
gpio_toggle(GPIOC, GPIO7);
for (i = 0; i < 0x100000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
}

View file

@ -1,52 +0,0 @@
/*
* Oct 2015 Karl Palsson <karlp@tweak.net.au>
*/
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/adc.h>
#include <libopencm3/stm32/dac.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/usart.h>
#include "trace.h"
#include "adc-power.h"
#define LED_PORT GPIOC
#define LED_PIN GPIO13
int main(void)
{
int i;
int j = 0;
rcc_clock_setup_in_hse_8mhz_out_72mhz();
rcc_periph_clock_enable(RCC_GPIOC);
printf("hi guys!\n");
/* green led for ticking */
gpio_set_mode(LED_PORT, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, LED_PIN);
rcc_periph_clock_enable(RCC_GPIOA);
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_ANALOG, GPIO0);
gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_ANALOG, GPIO5);
adc_power_init();
while (1) {
adc_power_task_up();
gpio_toggle(LED_PORT, LED_PIN);
for (i = 0; i < 0x80000; i++) { /* Wait a bit. */
__asm__("NOP");
}
adc_power_task_down();
gpio_toggle(LED_PORT, LED_PIN);
for (i = 0; i < 0x80000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
return 0;
}

View file

@ -1,133 +0,0 @@
/*
* Oct 2015 Karl Palsson <karlp@tweak.net.au>
*/
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/adc.h>
#include <libopencm3/stm32/dac.h>
#include <libopencm3/stm32/flash.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/usart.h>
#include "trace.h"
#include "adc-power.h"
/* f3 pll setup, based on l1/f4*/
typedef struct {
uint8_t pll_mul;
uint8_t pll_div;
uint8_t pll_source;
uint32_t flash_config;
uint8_t hpre;
uint8_t ppre1;
uint8_t ppre2;
uint32_t apb1_frequency;
uint32_t apb2_frequency;
uint32_t ahb_frequency;
} rcc_clock_scale_t;
static void rcc_clock_setup_pll_f3_special(const rcc_clock_scale_t *clock)
{
/* Turn on the appropriate source for the PLL */
// TODO, some f3's have extra bits here
enum rcc_osc my_osc;
if (clock->pll_source == RCC_CFGR_PLLSRC_HSE_PREDIV) {
my_osc = RCC_HSE;
} else {
my_osc = RCC_HSI;
}
rcc_osc_on(my_osc);
while (!rcc_is_osc_ready(my_osc));
/* Configure flash settings. */
flash_set_ws(clock->flash_config);
/*
* Set prescalers for AHB, ADC, ABP1, ABP2.
* Do this before touching the PLL (TODO: why?).
*/
rcc_set_hpre(clock->hpre);
rcc_set_ppre1(clock->ppre1);
rcc_set_ppre2(clock->ppre2);
rcc_osc_off(RCC_PLL);
while (rcc_is_osc_ready(RCC_PLL));
rcc_set_pll_source(clock->pll_source);
rcc_set_pll_multiplier(clock->pll_mul);
// TODO - iff pll_div != 0, then maybe we're on a target that
// has the dividers?
/* Enable PLL oscillator and wait for it to stabilize. */
rcc_osc_on(RCC_PLL);
while (!rcc_is_osc_ready(RCC_PLL));
/* Select PLL as SYSCLK source. */
rcc_set_sysclk_source(RCC_CFGR_SW_PLL);
rcc_wait_for_sysclk_status(RCC_PLL);
/* Set the peripheral clock frequencies used. */
rcc_ahb_frequency = clock->ahb_frequency;
rcc_apb1_frequency = clock->apb1_frequency;
rcc_apb2_frequency = clock->apb2_frequency;
}
static void setup_clocks(void)
{
rcc_clock_scale_t clock_full_hse8mhz ={
.pll_mul = RCC_CFGR_PLLMUL_PLL_IN_CLK_X9,
.pll_source = RCC_CFGR_PLLSRC_HSE_PREDIV,
.hpre = RCC_CFGR_HPRE_DIV_NONE,
.ppre1 = RCC_CFGR_PPRE1_DIV_2,
.ppre2 = RCC_CFGR_PPRE2_DIV_NONE,
.flash_config = FLASH_ACR_PRFTBE | FLASH_ACR_LATENCY_2WS,
.apb1_frequency = 36000000,
.apb2_frequency = 72000000,
.ahb_frequency = 72000000,
};
rcc_clock_setup_pll_f3_special(&clock_full_hse8mhz);
}
int main(void)
{
int i;
int j = 0;
setup_clocks();
/* Board led */
rcc_periph_clock_enable(RCC_GPIOE);
gpio_mode_setup(GPIOE, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO8);
gpio_set(GPIOE, GPIO8);
printf("hi guys!\n");
// ADC seems to take these no matter what?
// rcc_periph_clock_enable(RCC_GPIOA);
// rcc_periph_clock_enable(RCC_GPIOF);
// gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO0);
// gpio_mode_setup(GPIOF, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO4);
adc_power_init();
for (i = 0; i < 0x1000; i++) { /* need as much as 10 usecs for vreg */
__asm__("NOP");
}
while (1) {
adc_power_task_up();
gpio_toggle(GPIOE, GPIO8);
for (i = 0; i < 0x100000; i++) { /* Wait a bit. */
__asm__("NOP");
}
printf("tick...\n");
adc_power_task_down();
gpio_toggle(GPIOE, GPIO8);
for (i = 0; i < 0x100000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
return 0;
}

View file

@ -1,52 +0,0 @@
/*
* Oct 2015 Karl Palsson <karlp@tweak.net.au>
*/
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/adc.h>
#include <libopencm3/stm32/dac.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/usart.h>
#include "trace.h"
#include "adc-power.h"
#define LED_DISCO_GREEN_PORT GPIOD
#define LED_DISCO_GREEN_PIN GPIO12
int main(void)
{
int i;
int j = 0;
rcc_clock_setup_hse_3v3(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_168MHZ]);
rcc_periph_clock_enable(RCC_GPIOD);
printf("hi guys!\n");
/* green led for ticking */
gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE,
LED_DISCO_GREEN_PIN);
rcc_periph_clock_enable(RCC_GPIOA);
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO0);
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO5);
adc_power_init();
while (1) {
adc_power_task_up();
gpio_toggle(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
for (i = 0; i < 0x800000; i++) { /* Wait a bit. */
__asm__("NOP");
}
adc_power_task_down();
gpio_toggle(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
for (i = 0; i < 0x800000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
return 0;
}

View file

@ -1,53 +0,0 @@
/*
* Oct 2015 Karl Palsson <karlp@tweak.net.au>
*/
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/adc.h>
#include <libopencm3/stm32/flash.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/usart.h>
#include "trace.h"
#include "adc-power.h"
#define LED_DISCO_GREEN_PORT GPIOB
#define LED_DISCO_GREEN_PIN GPIO9
int main(void)
{
int i;
int j = 0;
rcc_clock_setup_pll(&rcc_clock_config[RCC_CLOCK_VRANGE1_HSI_PLL_32MHZ]);
rcc_periph_clock_enable(RCC_GPIOB);
printf("hi guys!\n");
/* green led for ticking */
gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE,
LED_DISCO_GREEN_PIN);
rcc_periph_clock_enable(RCC_GPIOA);
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO1);
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO5);
adc_power_init();
while (1) {
adc_power_task_up();
gpio_toggle(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
for (i = 0; i < 0x100000; i++) { /* Wait a bit. */
__asm__("NOP");
}
adc_power_task_down();
gpio_toggle(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
for (i = 0; i < 0x100000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
return 0;
}

View file

@ -1,74 +0,0 @@
/*
* Nov 2015 Karl Palsson <karlp@tweak.net.au>
*/
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/flash.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/pwr.h>
#include <libopencm3/stm32/rcc.h>
#include "trace.h"
#include "adc-power.h"
#define LED_DISCO_RED_PORT GPIOB
#define LED_DISCO_RED_PIN GPIO2
#define LED_DISCO_GREEN_PORT GPIOE
#define LED_DISCO_GREEN_PIN GPIO8
static int hack(void) {
pwr_set_vos_scale(PWR_SCALE1);
flash_set_ws(FLASH_ACR_LATENCY_2WS);
rcc_set_msi_range(RCC_CR_MSIRANGE_48MHZ);
return 0;
}
int main(void)
{
int i;
int j = 0;
rcc_periph_clock_enable(RCC_GPIOB); // led
rcc_periph_clock_enable(RCC_GPIOE); // led
rcc_periph_clock_enable(RCC_GPIOA); // adcs
rcc_periph_clock_enable(RCC_GPIOC); // adcs
rcc_periph_clock_enable(RCC_PWR);
hack();
printf("hi guys!\n");
/* green led for ticking */
gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE,
LED_DISCO_GREEN_PIN);
gpio_mode_setup(LED_DISCO_RED_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE,
LED_DISCO_RED_PIN);
/* ADC 1 channels 1 and 5 */
// This is the reset state, so not really necessary.
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO0);
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO1);
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO2);
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO3);
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO5);
// This is NOT the reset state! very important!
GPIO_ASCR(GPIOA) |= GPIO0 | GPIO1 | GPIO2 | GPIO3 | GPIO5;
adc_power_init();
while (1) {
adc_power_task_up();
gpio_toggle(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
for (i = 0; i < 0x10000; i++) { /* Wait a bit. */
__asm__("NOP");
}
adc_power_task_down();
gpio_toggle(LED_DISCO_RED_PORT, LED_DISCO_RED_PIN);
for (i = 0; i < 0x10000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
return 0;
}

View file

@ -1,15 +0,0 @@
# l1 generic, using a l4 disco board
#source [find interface/stlink-v2-1.cfg]
# l1 disco itself or similar
source [find interface/stlink-v2.cfg]
set WORKAREASIZE 0x2000
source [find target/stm32l1.cfg]
#hla_serial "066DFF495351885087171826" # My l4 disco
hla_serial "S?l\x06H?WQ%\x10\x18?" # My l1 disco
tpiu config internal swodump.stm32l1-generic.log uart off 32000000
# Uncomment to reset on connect, for grabbing under WFI et al
reset_config srst_only srst_nogate
# reset_config srst_only srst_nogate connect_assert_srst

View file

@ -1,18 +0,0 @@
BOARD = stm32l1-generic
PROJECT = awd-timer-dma-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += awd-timer-dma.c
CFILES += trace.c trace_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3
DEVICE=stm32l151xb
OOCD_FILE = openocd.stm32l1-generic.cfg
include ../../rules.mk

View file

@ -1,2 +0,0 @@
Exploring analog watchdog and timer triggered adc via dma

View file

@ -1,219 +0,0 @@
/**
* Testing AWD interrupt, with timer triggered dma
*/
#include <stdio.h>
#include <stdint.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/adc.h>
#include <libopencm3/stm32/dma.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/timer.h>
#include "awd-timer-dma.h"
/* Everyone has tim6 right? */
#define TIMER TIM6
#define TIMER_RCC RCC_TIM6
/* what external channel should be included? (Connect a pot here) */
#define EXT_CHAN_RCC RCC_GPIOA
#define EXT_CHAN_PORT GPIOA
#define EXT_CHAN_PIN GPIO5
#define EXT_CHAN_CHAN 5
// TODO - stick this in libopencm3?
#define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0]))
// Still have some bad shit to deal with...
#if defined(STM32F0)
#define SEPARATE_ADC_SAMPLING 0
#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_239DOT5 // 4usec or more for tempsensor
#define HAS_CALIBRATION 1
#elif defined(STM32F1)
#define SEPARATE_ADC_SAMPLING 0
#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_28DOT5CYC // 17usecs or more. >~15cycles at 9Mhz
#define SEPARATE_VREF 0
#define HAS_CALIBRATION 1
#define HAS_ROM_CALIBRATION 0
#elif defined(STM32F3)
#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_181DOT5CYC
#define SAMPLE_TIME_TEMP ADC_SMPR_SMP_601DOT5CYC // 2.2usecs or more
#define SAMPLE_TIME_VREF SAMPLE_TIME_TEMP
#define HAS_CALIBRATION 1
#elif defined(STM32F4)
#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_28CYC
#define SAMPLE_TIME_TEMP ADC_SMPR_SMP_144CYC // 10 usecs or more, in theory needs 840cycles!
#define SAMPLE_TIME_VREF SAMPLE_TIME_TEMP
#define ADC_CHANNEL_TEMP ADC_CHANNEL_TEMP_F40
#define SEPARATE_VREF 0
#elif defined(STM32L1)
#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_48CYC
#define SAMPLE_TIME_TEMP ADC_SMPR_SMP_192CYC
#define SAMPLE_TIME_VREF SAMPLE_TIME_TEMP
#define SEPARATE_VREF 0
#elif defined(STM32L4)
#define SAMPLE_TIME_BASIC ADC_SMPR_SMP_247DOT5CYC
#define SAMPLE_TIME_TEMP ADC_SMPR_SMP_247DOT5CYC
#define SAMPLE_TIME_VREF SAMPLE_TIME_TEMP
#define HAS_CALIBRATION 1
#else
#error "no sample time for your target yet?!"
#endif
#ifndef SEPARATE_VREF
#define SEPARATE_VREF 1
#endif
#ifndef SEPARATE_ADC_SAMPLING
#define SEPARATE_ADC_SAMPLING 1
#endif
#ifndef HAS_CALIBRATION
#define HAS_CALIBRATION 0
#endif
#ifndef HAS_ROM_CALIBRATION
#define HAS_ROM_CALIBRATION 1
#endif
/* dma destination */
static uint16_t adc_buffer[3];
static int awd_hits;
/**
* set up a timer from a 100khz timer base.
* @param sample_rate minimum is ~2hz, max is just under 100khz
*/
static void timer_trigger_setup(int sample_rate)
{
uint32_t timer = TIMER;
timer_disable_counter(timer);
TIM_CNT(timer) = 0;
/* 100kHz base */
timer_set_prescaler(timer, (rcc_apb1_frequency / (100*1000)) -1);
timer_set_period(timer, ((100*1000)/sample_rate) - 1);
timer_set_master_mode(timer, TIM_CR2_MMS_UPDATE);
}
void adc1_isr(void) {
if (ADC_SR(ADC1) & ADC_SR_AWD) {
ADC_SR(ADC1) &= ~ADC_SR_AWD;
awd_hits++;
}
}
void task_init(void)
{
/* Some basic ADC config, that we won't touch again */
#if defined(STM32F3)
/* silly f303 */
rcc_periph_clock_enable(RCC_ADC12);
rcc_adc_prescale(RCC_CFGR2_ADCxPRES_PLL_CLK_DIV_1, RCC_CFGR2_ADCxPRES_PLL_CLK_DIV_1);
adc_enable_regulator(ADC1);
#elif defined (STM32L4)
/* same same but different */
rcc_periph_clock_enable(RCC_ADC1);
ADC_CR(ADC1) &= ~ADC_CR_DEEPPWD;
RCC_CCIPR |= 3 << 28; // system clock as adc clock. (with CKMODE == 0)
adc_enable_regulator(ADC1);
ADC_CR(ADC1) &= ~ADC_CR_ADCALDIF;
ADC_CR(ADC1) |= ADC_CR_ADCAL;
while (ADC_CR(ADC1) & ADC_CR_ADCAL);
#else
rcc_periph_clock_enable(RCC_ADC1);
rcc_periph_clock_enable(RCC_DMA1);
rcc_periph_clock_enable(RCC_TIM6);
rcc_periph_clock_enable(EXT_CHAN_RCC);
gpio_mode_setup(EXT_CHAN_PORT, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, EXT_CHAN_PIN);
adc_power_off(ADC1);
#endif
#if (SEPARATE_ADC_SAMPLING == 1)
adc_set_sample_time_on_all_channels(ADC1, SAMPLE_TIME_BASIC);
adc_set_sample_time(ADC1, ADC_CHANNEL_TEMP, SAMPLE_TIME_TEMP);
adc_set_sample_time(ADC1, ADC_CHANNEL_VREF, SAMPLE_TIME_VREF);
#else
adc_set_sample_time_on_all_channels(ADC1, SAMPLE_TIME_BASIC);
#endif
adc_enable_temperature_sensor();
#if (SEPARATE_VREF == 1)
adc_enable_vrefint();
#endif
adc_enable_scan_mode(ADC1);
uint8_t channel_array[] = {EXT_CHAN_CHAN, ADC_CHANNEL_TEMP, ADC_CHANNEL_VREF};
adc_set_regular_sequence(ADC1, ARRAY_SIZE(channel_array), channel_array);
adc_enable_external_trigger_regular(ADC1, ADC_CR2_EXTSEL_TIM6_TRGO, ADC_CR2_EXTEN_RISING_EDGE);
/* power down when not in use please. */
ADC_CR1(ADC1) |= ADC_CR1_PDD | ADC_CR1_PDI;
adc_power_on(ADC1);
#if 1
/* adc-v2 has this as "adc_is_power_on*/
while ((ADC_SR(ADC1) & ADC_SR_ADONS) == 0) {
;
}
#endif
/* hard code a threshold for now , around a third */
adc_set_watchdog_low_threshold(ADC1, 1400);
adc_enable_analog_watchdog_on_selected_channel(ADC1, EXT_CHAN_CHAN);
adc_enable_analog_watchdog_regular(ADC1);
adc_enable_awd_interrupt(ADC1);
nvic_enable_irq(NVIC_ADC1_IRQ);
dma_channel_reset(DMA1, DMA_CHANNEL1); // channel1 is adc
dma_set_memory_address(DMA1, DMA_CHANNEL1, (uint32_t)adc_buffer);
dma_set_memory_size(DMA1, DMA_CHANNEL1, DMA_CCR_MSIZE_16BIT);
dma_enable_memory_increment_mode(DMA1, DMA_CHANNEL1);
dma_set_peripheral_address(DMA1, DMA_CHANNEL1, (uint32_t) & ADC_DR(ADC1));
dma_set_peripheral_size(DMA1, DMA_CHANNEL1, DMA_CCR_PSIZE_16BIT);
dma_set_number_of_data(DMA1, DMA_CHANNEL1, ARRAY_SIZE(adc_buffer));
// dma_enable_transfer_complete_interrupt(DMA1, DMA_CHANNEL1);
dma_enable_transfer_error_interrupt(DMA1, DMA_CHANNEL1);
dma_set_read_from_peripheral(DMA1, DMA_CHANNEL1);
// This is essential to stop overflows.
dma_enable_circular_mode(DMA1, DMA_CHANNEL1);
dma_enable_channel(DMA1, DMA_CHANNEL1);
nvic_enable_irq(NVIC_DMA1_CHANNEL1_IRQ);
//Keep on requesting DMA, as long as ADC is running
ADC_CR2(ADC1) |= ADC_CR2_DDS;
adc_enable_dma(ADC1);
timer_trigger_setup(100); // slowly for now...
/* Reset timer count and start */
TIM_CNT(TIM6) = 0;
timer_enable_counter(TIM6);
}
static float adc_calc_tempf(unsigned int adc_raw_temp) {
#if (HAS_ROM_CALIBRATION == 1)
float slope = ((110-30) * 1.0f)/((ST_TSENSE_CAL2_110C - ST_TSENSE_CAL1_30C) * 1.0f);
return slope * (adc_raw_temp - ST_TSENSE_CAL1_30C) + 30;
#else
return ts_v * 1.0;
#endif
}
void task_run(void)
{
static int last_awd_hits;
float temperature = adc_calc_tempf(adc_buffer[1]);
printf("Last adc reading: %d, last temp: %f (raw=%d), last cal: %d\n",
adc_buffer[0], temperature, adc_buffer[1], adc_buffer[2]);
if (awd_hits > last_awd_hits) {
printf("Got %d AWD hits since last run\n", awd_hits);
last_awd_hits = awd_hits;
}
}

View file

@ -1,12 +0,0 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void task_init(void);
void task_run(void);
#ifdef __cplusplus
}
#endif

View file

@ -1,42 +0,0 @@
/*
* Oct 2015 Karl Palsson <karlp@tweak.net.au>
*/
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/adc.h>
#include <libopencm3/stm32/flash.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/usart.h>
#include "trace.h"
#include "awd-timer-dma.h"
#define LED_DISCO_GREEN_PORT GPIOB
#define LED_DISCO_GREEN_PIN GPIO7
int main(void)
{
int i;
int j = 0;
rcc_clock_setup_pll(&rcc_clock_config[RCC_CLOCK_VRANGE1_HSI_PLL_32MHZ]);
rcc_periph_clock_enable(RCC_GPIOB);
printf("hi guys!\n");
/* green led for ticking */
gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE,
LED_DISCO_GREEN_PIN);
task_init();
while (1) {
task_run();
for (i = 0; i < 0x100000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
return 0;
}

View file

@ -1,15 +0,0 @@
# This is just a stub makefile used for travis builds
# to keep things all compiling. Normally you'd use
# one of the makefiles directly.
# These hoops are to enable parallel make correctly.
GZ_ALL := $(wildcard Makefile.*)
all: $(GZ_ALL:=.all)
clean: $(GZ_ALL:=.clean)
%.all:
make -f $* all
%.clean:
make -f $* clean

View file

@ -1,23 +0,0 @@
BOARD = stm32f072-disco
PROJECT = i2c-master-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += i2c-master.c
# No trace on cm0!
#CFILES += trace.c trace_stdio.c
CFILES += usart_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3
DEVICE=stm32f072rb
#OOCD_INTERFACE = stlink-v2
#OOCD_TARGET = stm32f0x
OOCD_FILE = ../../openocd/openocd.stm32f072-disco.cfg
include ../../rules.mk

View file

@ -1,40 +0,0 @@
##
## This file is part of the libopencm3 project.
##
## This library is free software: you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This library 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 Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
##
BOARD = stm32f4-disco
PROJECT = i2c-master-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += i2c-master.c
CFILES += trace.c trace_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3/
### This section can go to an arch shared rules eventually...
DEVICE=stm32f405xg
#OOCD_INTERFACE = stlink-v2
#OOCD_TARGET = stm32f4x
OOCD_FILE = ../../openocd/openocd.stm32f4-disco.cfg
include ../../rules.mk

View file

@ -1,18 +0,0 @@
BOARD = stm32l1-generic
PROJECT = i2c-master-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += i2c-master.c
CFILES += trace.c trace_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3
DEVICE=stm32l151xb
OOCD_FILE = openocd.stm32l1-generic.cfg
include ../../rules.mk

View file

@ -1,31 +0,0 @@
i2c master mode tests.
While many of the disco boards have some form of i2c device onboard,
which would, on the face of it, make testing easy, it's a different
device on each board, and there are boards without it.
Instead, use a known I2C peripheral on all boards, and require/expect
a known fixed i2c slave device. (Eventually, this will be a soft
controllable i2c slave in the auto test setup ;)
the "trigger" pin is bounced when each iteration of the test code starts,
allowing synchronization with a sigrok script that helps assure that
results are as expected.
Debug is via SWO wherever possible, uart (tx only) on less capable cores
Pinouts: (External PullUps REQUIRED!)
board SCLK SDA i2cperiph trigger uart
f4-disco PB8 PB9 i2c1 PB13
l1-disco PB8 PB9 i2c1 PB13
f072-disco PB8 PB9 i2c1 PB12 PA9!
Notes for monitoring with sigrok:
$ sigrok-cli -d fx2lafw -C D0=SDA,D1=SCL,D2=Trig -c samplerate=4Mhz:captureratio=4 --time=150ms -t Trig=r -o cap2.cli.sr
# Then open the .sr file in pulseview. something's wrong with decoding
# directly from the cli!
# or....
$ sigrok-cli -d fx2lafw -C D0=SDA,D1=SCL,D2=Trig -c samplerate=4Mhz:captureratio=4 --time=150ms -t Trig=r -P i2c:scl=SCL:sda=SDA

View file

@ -1,42 +0,0 @@
/*
* Feb 2017 Karl Palsson <karlp@tweak.net.au>
*/
#include <stdbool.h>
#include <stdint.h>
#pragma once
struct hw_detail
{
uint32_t periph; /* eg: I2C1 */
uint32_t periph_rcc; /* eg: RCC_I2C1 */
uint32_t periph_rst; /* eg: RST_I2C1 */
uint32_t pins; /* eg: GPIO8 | GPIO9 */ /* ASSUMES SAME PORT*/
uint32_t port; /* eg GPIOB */
uint32_t port_rcc; /* eg RCC_GPIOB */
uint32_t trigger_rcc;
uint32_t trigger_port;
uint32_t trigger_pin;
int i2c_clock_megahz; /* eg 42 for APB1 on an F4@168Mhz */
};
extern struct hw_detail hw_details;
#ifdef __cplusplus
extern "C" {
#endif
/**
* Expected to setup clocks, turn on all peripherals, and configure
* any gpios necessary.
* @param hw pointer to hw details necessary
*/
void hw_setup(struct hw_detail* hw);
/* let devices have a status led */
void hw_set_led(bool val);
#ifdef __cplusplus
}
#endif

View file

@ -1,121 +0,0 @@
/*
* Feb 2017, Karl Palsson <karlp@tweak.net.au>
*/
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <libopencm3/stm32/i2c.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include "trace.h"
#include "hw.h"
#include "i2c-master.h"
#define SENSOR_ADDRESS (0x40)
enum sht21_cmd_e {
SHT21_CMD_TEMP_HOLD = 0xe3,
SHT21_CMD_HUMIDITY_HOLD = 0xe5,
SHT21_CMD_TEMP_NOHOLD = 0xf3,
SHT21_CMD_HUMIDITY_NOHOLD = 0xf5,
SHT21_CMD_WRITE_REG = 0xe6,
SHT21_CMD_READ_REG = 0xe7,
SHT21_CMD_RESET = 0xfe,
/* 0xfa, 0x0f to read serial */
};
void i2cm_init(void)
{
rcc_periph_clock_enable(hw_details.periph_rcc);
rcc_periph_reset_pulse(hw_details.periph_rst);
i2c_set_speed(hw_details.periph, i2c_speed_sm_100k, hw_details.i2c_clock_megahz);
//i2c_set_speed(hw_details.periph, i2c_speed_fm_400k, hw_details.i2c_clock_megahz);
i2c_peripheral_enable(hw_details.periph);
}
static float sht21_convert_temp(uint16_t raw)
{
//assert((raw & 0x2) == 0x2);
raw &= ~0x3; /* Clear lower status bits */
float tf = -46.85 + 175.72 * ((float) raw / 65536.0);
return tf;
}
static float sht21_convert_humi(uint16_t raw)
{
//assert((raw & 0x2) == 0);
raw &= ~0x3; /* Clear lower status bits */
float tf = -6 + 125 * ((float) raw / 65536.0);
return tf;
}
static float sht21_read_temp_hold(uint32_t i2c)
{
uint8_t data[3];
uint8_t cmd = SHT21_CMD_TEMP_HOLD;
i2c_transfer7(i2c, SENSOR_ADDRESS, &cmd, 1, data, sizeof(data));
uint8_t crc = data[2];
uint16_t temp = data[0] << 8 | data[1];
// TODO - calcualte CRC and check!
printf("CRC=%#x, data0=%#x, data1=%#x\n", crc, data[0], data[1]);
return sht21_convert_temp(temp);
}
static float sht21_read_humi_hold(uint32_t i2c)
{
uint8_t data[3];
uint8_t cmd = SHT21_CMD_HUMIDITY_HOLD;
i2c_transfer7(i2c, SENSOR_ADDRESS, &cmd, 1, data, sizeof(data));
uint8_t crc = data[2];
uint16_t left = data[0] << 8 | data[1];
// TODO - calcualte CRC and check!
printf("CRC=%#x, data0=%#x, data1=%#x\n", crc, data[0], data[1]);
return sht21_convert_humi(left);
}
static void sht21_readid(void)
{
uint8_t raw = 0;
uint8_t cmd = SHT21_CMD_READ_REG;
printf("RP...");
i2c_transfer7(hw_details.periph, SENSOR_ADDRESS, &cmd, 1, &raw, 1);
printf("..S/S\n");
// or, with stop/start
i2c_transfer7(hw_details.periph, SENSOR_ADDRESS, &cmd, 1, 0, 0);
i2c_transfer7(hw_details.periph, SENSOR_ADDRESS, 0, 0, &raw, 1);
printf("raw user reg = %#x\n", raw);
int resolution = ((raw & 0x80) >> 6) | (raw & 1);
printf("temp resolution is in %d bits\n", 14 - resolution);
printf("battery status: %s\n", (raw & (1 << 6) ? "failing" : "good"));
printf("On chip heater: %s\n", (raw & 0x2) ? "on" : "off");
uint8_t req1[] = {0xfa, 0x0f};
uint8_t res[8];
i2c_transfer7(hw_details.periph, SENSOR_ADDRESS, req1, sizeof(req1), res, 8);
uint8_t req2[] = {0xfc, 0xc9};
uint8_t res2[8];
i2c_transfer7(hw_details.periph, SENSOR_ADDRESS, req1, sizeof(req1), res2, 8);
printf("Serial = %02x%02x %02x%02x %02x%02x %02x%02x\n",
res2[3], res2[4], res[0], res[2], res[4], res[6], res2[0], res2[1]);
}
void i2cm_task(void)
{
static int i = 1;
printf(">>>>Starting iteration %d\n", i++);
gpio_set(hw_details.trigger_port, hw_details.trigger_pin);
sht21_readid();
float temp = sht21_read_temp_hold(hw_details.periph);
float humi = sht21_read_humi_hold(hw_details.periph);
gpio_clear(hw_details.trigger_port, hw_details.trigger_pin);
printf("Temp: %f C, RH: %f\n", temp, humi);
}

View file

@ -1,19 +0,0 @@
/*
* common i2c master code headers.
* Karl Palsson <karlp@tweak.net.au>
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void i2cm_init(void);
void i2cm_task(void);
#ifdef __cplusplus
}
#endif

View file

@ -1,104 +0,0 @@
/*
* Copyright (C) 2017 Karl Palsson <karlp@tweak.net.au>
*/
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/crs.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/i2c.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/usart.h>
#include <stdio.h>
#include "hw.h"
#include "i2c-master.h"
#define LED_DISCO_GREEN_PORT GPIOC
#define LED_DISCO_GREEN_PIN GPIO9
struct hw_detail hw_details = {
.periph = I2C1,
.periph_rcc = RCC_I2C1,
.periph_rst = RST_I2C1,
.pins = GPIO8 | GPIO9, /* our external i2c device on I2c1 */
.port = GPIOB,
.port_rcc = RCC_GPIOB,
.trigger_rcc = RCC_GPIOB,
.trigger_port = GPIOB,
.trigger_pin = GPIO12,
.i2c_clock_megahz = 48,
};
static
void setup_usart(void)
{
uint32_t dev = USART1;
rcc_periph_clock_enable(RCC_USART1);
rcc_periph_clock_enable(RCC_GPIOA);
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO9);
gpio_set_af(GPIOA, GPIO_AF1, GPIO9);
usart_set_baudrate(dev, 115200);
usart_set_databits(dev, 8);
usart_set_parity(dev, USART_PARITY_NONE);
usart_set_stopbits(dev, USART_CR2_STOPBITS_1);
usart_set_mode(dev, USART_MODE_TX);
usart_set_flow_control(dev, USART_FLOWCONTROL_NONE);
/* Finally enable the USART. */
usart_enable(dev);
}
/**
* Setup any gpios or anything hardware specific.
* Should _only_ be things that can't be done in shared i2cm_init!
*/
static void i2cm_hw_init(void)
{
/* trigger pin gpio */
rcc_periph_clock_enable(hw_details.trigger_rcc);
gpio_mode_setup(hw_details.trigger_port, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, hw_details.trigger_pin);
/* i2c control lines */
rcc_periph_clock_enable(hw_details.port_rcc);
gpio_mode_setup(hw_details.port, GPIO_MODE_AF, GPIO_PUPD_NONE, hw_details.pins);
gpio_set_output_options(hw_details.port, GPIO_OTYPE_OD, GPIO_OSPEED_HIGH, hw_details.pins);
gpio_set_af(hw_details.port, GPIO_AF1, hw_details.pins);
/* select sysclk as i2c clock! */
RCC_CFGR3 |= RCC_CFGR3_I2C1SW;
}
static void setup(void)
{
setup_usart();
printf("hi guys!\n");
i2cm_hw_init();
i2cm_init();
}
int main(void)
{
int i;
rcc_clock_setup_in_hsi48_out_48mhz();
/* green led for ticking */
rcc_periph_clock_enable(RCC_GPIOC);
gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LED_DISCO_GREEN_PIN);
gpio_set(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
setup();
while (1) {
i2cm_task();
gpio_toggle(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
for (i = 0; i < 0x800000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
}

View file

@ -1,79 +0,0 @@
/*
* Feb 2017 Karl Palsson <karlp@tweak.net.au>
*/
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/i2c.h>
#include <libopencm3/stm32/rcc.h>
#include "trace.h"
#include "hw.h"
#include "i2c-master.h"
#define LED_DISCO_GREEN_PORT GPIOD
#define LED_DISCO_GREEN_PIN GPIO12
struct hw_detail hw_details = {
.periph = I2C1,
.periph_rcc = RCC_I2C1,
.periph_rst = RST_I2C1,
.pins = GPIO8 | GPIO9, /* our external i2c device on I2c1 */
.port = GPIOB,
.port_rcc = RCC_GPIOB,
.trigger_rcc = RCC_GPIOB,
.trigger_port = GPIOB,
.trigger_pin = GPIO13,
};
/* provided in board files please*/
/**
* Setup any gpios or anything hardware specific.
* Should _only_ be things that can't be done in shared i2cm_init!
*/
static void i2cm_hw_init(void)
{
/* trigger pin gpio */
rcc_periph_clock_enable(hw_details.trigger_rcc);
gpio_mode_setup(hw_details.trigger_port, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, hw_details.trigger_pin);
/* i2c control lines */
rcc_periph_clock_enable(hw_details.port_rcc);
gpio_mode_setup(hw_details.port, GPIO_MODE_AF, GPIO_PUPD_NONE, hw_details.pins);
gpio_set_output_options(hw_details.port, GPIO_OTYPE_OD, GPIO_OSPEED_50MHZ, hw_details.pins);
gpio_set_af(hw_details.port, GPIO_AF4, hw_details.pins);
}
static void setup(void)
{
printf("hi guys!\n");
i2cm_hw_init();
i2cm_init();
}
int main(void)
{
int i, j;
rcc_clock_setup_hse_3v3(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_168MHZ]);
/* green led for ticking */
rcc_periph_clock_enable(RCC_GPIOD);
gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE,
LED_DISCO_GREEN_PIN);
setup();
while (1) {
i2cm_task();
gpio_toggle(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
for (i = 0; i < 0x800000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
return 0;
}

View file

@ -1,80 +0,0 @@
/*
* Feb 2017 Karl Palsson <karlp@tweak.net.au>
*/
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/i2c.h>
#include <libopencm3/stm32/rcc.h>
#include "trace.h"
#include "hw.h"
#include "i2c-master.h"
#define LED_DISCO_GREEN_PORT GPIOB
#define LED_DISCO_GREEN_PIN GPIO7
struct hw_detail hw_details = {
.periph = I2C1,
.periph_rcc = RCC_I2C1,
.periph_rst = RST_I2C1,
.pins = GPIO8 | GPIO9, /* our external i2c device on I2c1 */
.port = GPIOB,
.port_rcc = RCC_GPIOB,
.trigger_rcc = RCC_GPIOB,
.trigger_port = GPIOB,
.trigger_pin = GPIO13,
.i2c_clock_megahz = 32,
};
/* provided in board files please*/
/**
* Setup any gpios or anything hardware specific.
* Should _only_ be things that can't be done in shared i2cm_init!
*/
static void i2cm_hw_init(void)
{
/* trigger pin gpio */
rcc_periph_clock_enable(hw_details.trigger_rcc);
gpio_mode_setup(hw_details.trigger_port, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, hw_details.trigger_pin);
/* i2c control lines */
rcc_periph_clock_enable(hw_details.port_rcc);
gpio_mode_setup(hw_details.port, GPIO_MODE_AF, GPIO_PUPD_NONE, hw_details.pins);
gpio_set_output_options(hw_details.port, GPIO_OTYPE_OD, GPIO_OSPEED_10MHZ, hw_details.pins);
gpio_set_af(hw_details.port, GPIO_AF4, hw_details.pins);
}
static void setup(void)
{
printf("hi guys!\n");
i2cm_hw_init();
i2cm_init();
}
int main(void)
{
int i, j;
rcc_clock_setup_pll(&rcc_clock_config[RCC_CLOCK_VRANGE1_HSI_PLL_32MHZ]);
/* green led for ticking */
rcc_periph_clock_enable(RCC_GPIOB);
gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE,
LED_DISCO_GREEN_PIN);
setup();
while (1) {
i2cm_task();
gpio_toggle(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
for (i = 0; i < 0x800000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
return 0;
}

View file

@ -1,40 +0,0 @@
##
## This file is part of the libopencm3 project.
##
## This library is free software: you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This library 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 Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
##
BOARD = lm3s
PROJECT = qemu-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../shared
CFILES = main.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3
DEVICE=lm3s6965
include ../../rules.mk
qemu: $(PROJECT).elf
qemu-system-arm -semihosting -M lm3s6965evb --kernel $^ -serial stdio
qemu-dbg: $(PROJECT).elf
qemu-system-arm -semihosting -M lm3s6965evb --kernel $^ -serial stdio -S -gdb tcp::3333

View file

@ -1,20 +0,0 @@
This project is used as a demonstrator on how to run a small baremetal application
on a LM3S6965 board, which can be emulated on qemu as well (using qemu-system-arm
with -M lm3s6965evb).
For this reason, this application is not portable to other platforms at the moment.
To execute in qemu run:
`make qemu`
To debug using gcc run:
`make qemu-dbg`
and then attach a gdb to localhost tcp port 3333.
Requirements:
qemu-system-arm
openocd

View file

@ -1,58 +0,0 @@
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/cm3/systick.h>
/* LM3S Specifics, usart and RCC */
#include <libopencm3/lm3s/rcc.h>
#include <libopencm3/lm3s/usart.h>
static volatile uint32_t jiffies = 0u;
static void printbanner(void)
{
char msg[] = "One second elapsed!\r\n";
char *c = msg;
while (*c != 0) {
usart_send(USART0_BASE, (uint16_t )*c);
c++;
}
}
void sys_tick_handler(void)
{
jiffies++;
}
static inline uint32_t systick_app_config(uint32_t n_ticks)
{
/* constant from systick_set_reload -- as this returns something that's
* * not void, this is the only possible error condition */
if (n_ticks & ~0x00FFFFFF) {
return 1;
}
systick_set_reload(n_ticks);
systick_set_clocksource(1);
systick_interrupt_enable();
systick_counter_enable();
return 0;
}
#define HZ 1000
int main(void)
{
uint32_t last_time = 0;
rcc_clock_setup_in_xtal_8mhz_out_50mhz();
systick_app_config(HZ);
nvic_set_priority(NVIC_SYSTICK_IRQ, 0);
jiffies = 0;
while(1) {
if (jiffies > HZ) {
printbanner();
jiffies = 0;
}
}
}

View file

@ -1,28 +0,0 @@
BOARD = stm32l1-generic
PROJECT = rcc-legal-ranges-$(BOARD)
BUILD_DIR = bin-$(BOARD)
OPT=-O0
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
#CFILES += trace.c trace_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3/
### This section can go to an arch shared rules eventually...
LDSCRIPT = $(OPENCM3_DIR)/lib/stm32/l1/stm32l15xx6.ld # pessimistic ;)
OPENCM3_LIB = opencm3_stm32l1
OPENCM3_DEFS = -DSTM32L1
FP_FLAGS ?=
ARCH_FLAGS = -mthumb -mcpu=cortex-m3 $(FP_FLAGS)
# Use the base targets, as we're playing with clocking too much for swo
OOCD_INTERFACE = stlink-v2
OOCD_TARGET = stm32l1
include ../../rules.mk

View file

@ -1,14 +0,0 @@
Tests whether legal clock config structures can actually be used.
This primarily is testing whether the order of steps taken for
turning on and selecting different clocks, power ranges and flash
wait state configuration are robust enough.
## PASSING
On boot you should get two slow blinks.
After boot, you should get continuous 5/2 fast/slow blinks as it
continuously shuffles and resets clock configurations.
## FAILING
The board stops blinking at any point in the sequence

View file

@ -1,154 +0,0 @@
/*
* Aug 2016 Karl Palsson <karlp@tweak.net.au>
*/
#include <stdlib.h>
#include <libopencm3/stm32/flash.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/pwr.h>
#include <libopencm3/stm32/rcc.h>
/* Disco board is b6 */
#define LEDPORT GPIOB
#define LEDPIN GPIO6
#ifndef ARRAY_LENGTH
#define ARRAY_LENGTH(array) (sizeof((array))/sizeof((array)[0]))
#endif
/*
* A set of valid clock configurations with HSI as the source.
* thankfully, L1 allows apb1/apb2 to reach full ahb speed in all cases.
*/
struct rcc_clock_scale valid_hsi_clocks[] = {
{
/* 8Mhz, hsi/div2, max perf for range 2 with 0 ws */
.hpre = RCC_CFGR_HPRE_SYSCLK_DIV2,
.ppre1 = RCC_CFGR_PPRE1_HCLK_NODIV,
.ppre2 = RCC_CFGR_PPRE2_HCLK_NODIV,
.voltage_scale = PWR_SCALE2,
.flash_config = FLASH_ACR_LATENCY_0WS,
.ahb_frequency = 8e6,
.apb1_frequency = 8e6,
.apb2_frequency = 8e6,
},
{
/* Slowest hsi possible */
.hpre = RCC_CFGR_HPRE_SYSCLK_DIV512,
.ppre1 = RCC_CFGR_PPRE1_HCLK_NODIV,
.ppre2 = RCC_CFGR_PPRE1_HCLK_NODIV,
.voltage_scale = PWR_SCALE3,
.flash_config = FLASH_ACR_LATENCY_0WS,
.ahb_frequency = 31250,
.apb1_frequency = 31250,
.apb2_frequency = 31250,
},
{
/* Fastest HSI possible, range 1, 0ws */
.hpre = RCC_CFGR_HPRE_SYSCLK_NODIV,
.ppre1 = RCC_CFGR_PPRE1_HCLK_NODIV,
.ppre2 = RCC_CFGR_PPRE1_HCLK_NODIV,
.voltage_scale = PWR_SCALE1,
.flash_config = FLASH_ACR_LATENCY_0WS,
.ahb_frequency = 16e6,
.apb1_frequency = 16e6,
.apb2_frequency = 16e6,
},
{
/* highest perf for range 3 with 0 wait states */
.hpre = RCC_CFGR_HPRE_SYSCLK_DIV8,
.ppre1 = RCC_CFGR_PPRE1_HCLK_NODIV,
.ppre2 = RCC_CFGR_PPRE1_HCLK_NODIV,
.voltage_scale = PWR_SCALE3,
.flash_config = FLASH_ACR_LATENCY_0WS,
.ahb_frequency = 2e6,
.apb1_frequency = 2e6,
.apb2_frequency = 2e6,
},
{
/* Fastest HSI for range 2, 0ws */
.hpre = RCC_CFGR_HPRE_SYSCLK_NODIV,
.ppre1 = RCC_CFGR_PPRE1_HCLK_NODIV,
.ppre2 = RCC_CFGR_PPRE1_HCLK_NODIV,
.voltage_scale = PWR_SCALE1,
.flash_config = FLASH_ACR_LATENCY_0WS,
.ahb_frequency = 16e6,
.apb1_frequency = 16e6,
.apb2_frequency = 16e6,
},
{
/* highest perf for range 3 */
.hpre = RCC_CFGR_HPRE_SYSCLK_DIV4,
.ppre1 = RCC_CFGR_PPRE1_HCLK_NODIV,
.ppre2 = RCC_CFGR_PPRE1_HCLK_NODIV,
.voltage_scale = PWR_SCALE3,
.flash_config = FLASH_ACR_LATENCY_1WS,
.ahb_frequency = 4e6,
.apb1_frequency = 4e6,
.apb2_frequency = 4e6,
},
};
int shuffled[ARRAY_LENGTH(valid_hsi_clocks)];
/**
* blink led count times, with vile hack * 1000 asm nops
*/
static void hack_blink(int count, int hack)
{
for (int i = 0; i < count; i++) {
gpio_toggle(LEDPORT, LEDPIN);
for (int k = 0; k < hack * 1000; k++) {
__asm__("nop");
}
}
}
/* Stack overflow, wiki, whathaveyou */
/* FIXME oh yeah, did I mention that rand() is always zero? */
static void shuffle_fisher_yates(int *array, size_t n)
{
if (n > 1) {
size_t i;
for (i = 0; i < n - 1; i++) {
size_t j = i + rand() / (RAND_MAX / (n - i) + 1);
int t = array[j];
array[j] = array[i];
array[i] = t;
}
}
}
static void run_clock_set(void)
{
shuffle_fisher_yates(shuffled, ARRAY_LENGTH(shuffled));
struct rcc_clock_scale *clock;
for (size_t i = 0; i < ARRAY_LENGTH(shuffled); i++) {
clock = &valid_hsi_clocks[i];
rcc_clock_setup_hsi(clock);
/** blink quickly/slowly as we run through these */
hack_blink(10, clock->ahb_frequency / (500 * 1000));
hack_blink(4, clock->ahb_frequency / (200 * 1000));
}
}
int main(void)
{
/* Allow leds on any port */
RCC_AHBENR |= 0xff;
gpio_mode_setup(LEDPORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LEDPIN);
/* blink twice with slow msi reset clock */
hack_blink(4, 60);
/* ok, now, "randomly" sort the list of clocks to try them out */
for (size_t i = 0; i < ARRAY_LENGTH(shuffled); i++) {
shuffled[i] = i;
}
while (1) {
run_clock_set();
}
return 0;
}

View file

@ -1,15 +0,0 @@
# This is just a stub makefile used for travis builds
# to keep things all compiling. Normally you'd use
# one of the makefiles directly.
# These hoops are to enable parallel make correctly.
GZ_ALL := $(wildcard Makefile.*)
all: $(GZ_ALL:=.all)
clean: $(GZ_ALL:=.clean)
%.all:
make -f $* all
%.clean:
make -f $* clean

View file

@ -1,21 +0,0 @@
BOARD = dut-stm32l073rz
PROJECT = spi-master-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFLAGS = -DSTDIO_USART=USART2
CFILES = main-$(BOARD).c
#CFILES += spi-master.c
# No trace on cm0!
#CFILES += trace.c trace_stdio.c
CFILES += usart_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3
DEVICE=stm32l073rz
OOCD_FILE = openocd.dut-stm32l073rz.cfg
include ../../rules.mk

View file

@ -1,18 +0,0 @@
BOARD = host-stm32l1-generic
PROJECT = spi-slave-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
#CFILES += spi-master.c
CFILES += trace.c trace_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3
DEVICE=stm32l151xb
OOCD_FILE = openocd.stm32l1-generic.cfg
include ../../rules.mk

View file

@ -1,25 +0,0 @@
SPI master mode tests
While some of the disco boards have some form of spi device onboard,
which would, on the face of it, make testing easy, it's a different
device on each board, and there are boards without it.
Instead, use a known SPI peripheral on all boards, and require/expect
a known fixed SPI slave device. Use a soft controller SPI slave device
for the far side, for double the test coverage!
the "trigger" pin is bounced when each iteration of the test code starts,
allowing synchronization with a sigrok script that helps assure that
results are as expected.
Debug is via SWO wherever possible, PA2 (tx only) on less capable cores
Pinouts:
(red) (orange) (yellow)(brown) (black)
board CLK MISO MOSI CS periph trigger
f4-disco PB13 PB14 PB15 PB12 spi2 PB11
l1-disco PB13 PB14 PB15 PB12 spi2 PB11
Notes for monitoring with sigrok:
$ sigrok-cli -d fx2lafw -C D0=TRIG,D1=CS,D2=CLK,D3=MISO,D4=MOSI -c samplerate=12Mhz:captureratio=4 --time=150ms -t TRIG=r -P spi:clk=CLK:miso=MISO:mosi=MOSI -A spi=mosi-data

View file

@ -1,41 +0,0 @@
/*
* March 2017 Karl Palsson <karlp@tweak.net.au>
*/
#include <stdbool.h>
#include <stdint.h>
#pragma once
struct hw_detail
{
uint32_t periph; /* eg: SPI2 */
uint32_t periph_rcc; /* eg: RCC_SPI2 */
uint32_t periph_rst; /* eg: RST_SPI2 */
uint32_t pins; /* to set to the AF for the periph */
uint32_t port; /* eg GPIOB */
uint32_t port_rcc; /* for the gpio pins */
uint32_t trigger_rcc;
uint32_t trigger_port;
uint32_t trigger_pin;
};
extern struct hw_detail hw_details;
#ifdef __cplusplus
extern "C" {
#endif
/**
* Expected to setup clocks, turn on all peripherals, and configure
* any gpios necessary.
* @param hw pointer to hw details necessary
*/
void hw_setup(struct hw_detail* hw);
/* let devices have a status led */
void hw_set_led(bool val);
#ifdef __cplusplus
}
#endif

View file

@ -1,140 +0,0 @@
/*
* March 2017 Karl Palsson <karlp@tweak.net.au>
*/
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/spi.h>
#include <libopencm3/stm32/usart.h>
#include "hw.h"
#define LED_DISCO_GREEN_PORT GPIOB // actually cs
#define LED_DISCO_GREEN_PIN GPIO6
struct hw_detail hw_details = {
.periph = SPI1,
.periph_rcc = RCC_SPI1,
.periph_rst = RST_SPI1,
.pins = GPIO5| GPIO6 | GPIO7, /* SPI pins for setting AF with */
.port = GPIOA,
.port_rcc = RCC_GPIOA,
.trigger_rcc = RCC_GPIOB,
.trigger_port = GPIOB,
.trigger_pin = GPIO8, // pb6 is d7 on the LA
};
/* provided in board files please*/
/**
* Setup any gpios or anything hardware specific.
* Should _only_ be things that can't be done in shared init()
*/
static void hw_init(void)
{
/* trigger pin gpio */
rcc_periph_clock_enable(hw_details.trigger_rcc);
gpio_mode_setup(hw_details.trigger_port, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, hw_details.trigger_pin);
/* spi control lines */
rcc_periph_clock_enable(hw_details.port_rcc);
gpio_mode_setup(hw_details.port, GPIO_MODE_AF, GPIO_PUPD_NONE, hw_details.pins);
gpio_set_output_options(hw_details.port, GPIO_OTYPE_PP, GPIO_OSPEED_MED, hw_details.pins);
gpio_set_af(hw_details.port, GPIO_AF0, hw_details.pins);
}
static void test_init(void)
{
/* Setup SPI parameters. */
rcc_periph_clock_enable(hw_details.periph_rcc);
spi_init_master(hw_details.periph, SPI_CR1_BAUDRATE_FPCLK_DIV_32, SPI_CR1_CPOL_CLK_TO_0_WHEN_IDLE,
SPI_CR1_CPHA_CLK_TRANSITION_1, SPI_CR1_DFF_8BIT, SPI_CR1_MSBFIRST);
/* Ignore the stupid NSS pin. */
spi_enable_software_slave_management(hw_details.periph);
spi_set_nss_high(hw_details.periph);
/* Finally enable the SPI. */
spi_enable(hw_details.periph);
}
static void test_task(void) {
static int i = 0;
printf("DUT iter %d\n", i++);
gpio_set(hw_details.trigger_port, hw_details.trigger_pin);
gpio_clear(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
spi_xfer(hw_details.periph, 0xaa);
spi_xfer(hw_details.periph, 0x42);
spi_xfer(hw_details.periph, 0x69);
gpio_set(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
gpio_clear(hw_details.trigger_port, hw_details.trigger_pin);
}
static
void setup_usart(void)
{
uint32_t dev = USART2;
rcc_periph_clock_enable(RCC_USART2);
rcc_periph_clock_enable(RCC_GPIOA);
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO2|GPIO3);
gpio_set_af(GPIOA, GPIO_AF4, GPIO2|GPIO3);
usart_set_baudrate(dev, 115200);
usart_set_databits(dev, 8);
usart_set_parity(dev, USART_PARITY_NONE);
usart_set_stopbits(dev, USART_STOPBITS_1);
usart_set_mode(dev, USART_MODE_TX_RX);
usart_set_flow_control(dev, USART_FLOWCONTROL_NONE);
/* Finally enable the USART. */
usart_enable(dev);
}
static void setup(void)
{
setup_usart();
printf("hi guys!\n");
hw_init();
test_init();
}
int main(void)
{
const struct rcc_clock_scale myclock = {
.pll_source = RCC_CFGR_PLLSRC_HSI16_CLK,
.pll_mul = RCC_CFGR_PLLMUL_MUL4,
.pll_div = RCC_CFGR_PLLDIV_DIV2,
.hpre = RCC_CFGR_HPRE_NODIV,
.ppre1 = RCC_CFGR_PPRE1_NODIV,
.ppre2 = RCC_CFGR_PPRE2_NODIV,
.voltage_scale = PWR_SCALE1,
.flash_waitstates = 1,
.ahb_frequency = 32e6,
.apb1_frequency = 32e6,
.apb2_frequency = 32e6,
};
int i, j;
rcc_clock_setup_pll(&myclock);
rcc_periph_clock_enable(RCC_SYSCFG);
/* green led for ticking */
rcc_periph_clock_enable(RCC_GPIOB);
gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LED_DISCO_GREEN_PIN);
gpio_set(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
setup();
while (1) {
test_task();
//gpio_toggle(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
for (i = 0; i < 0x80000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
return 0;
}

View file

@ -1,114 +0,0 @@
/*
* March 2017 Karl Palsson <karlp@tweak.net.au>
*/
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/spi.h>
#include <libopencm3/stm32/rcc.h>
#include "trace.h"
#include "hw.h"
struct hw_detail hw_details = {
.periph = SPI2,
.periph_rcc = RCC_SPI2,
.periph_rst = RST_SPI2,
.pins = GPIO13| GPIO14 | GPIO15, /* SPI pins for setting AF with */
.port = GPIOB,
.port_rcc = RCC_GPIOB,
.trigger_rcc = RCC_GPIOB,
.trigger_port = GPIOB,
.trigger_pin = GPIO9,
};
/* provided in board files please*/
/**
* Setup any gpios or anything hardware specific.
* Should _only_ be things that can't be done in shared init()
*/
static void hw_init(void)
{
/* trigger pin gpio */
rcc_periph_clock_enable(hw_details.trigger_rcc);
gpio_mode_setup(hw_details.trigger_port, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, hw_details.trigger_pin);
/* spi control lines */
rcc_periph_clock_enable(hw_details.port_rcc);
gpio_mode_setup(hw_details.port, GPIO_MODE_AF, GPIO_PUPD_NONE, hw_details.pins);
gpio_set_output_options(hw_details.port, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, hw_details.pins);
gpio_set_af(hw_details.port, GPIO_AF5, hw_details.pins);
}
static void test_init(void)
{
/* Setup SPI parameters. */
rcc_periph_clock_enable(hw_details.periph_rcc);
/* mostly, this is just "write 0 to cr1" */
spi_set_slave_mode(hw_details.periph);
spi_send_msb_first(hw_details.periph);
spi_set_dff_8bit(hw_details.periph);
spi_set_clock_phase_0(hw_details.periph);
spi_set_clock_polarity_0(hw_details.periph);
spi_set_frf_motorola(hw_details.periph);
/* we're a spi slave, use a CS pin */
spi_disable_software_slave_management(hw_details.periph);
SPI_CR2(hw_details.periph) &= ~SPI_CR2_SSOE;
/* Finally enable the SPI. */
spi_enable(hw_details.periph);
}
static void test_task(void) {
static int i = 0;
uint32_t spi = hw_details.periph;
if (SPI_SR(spi) & SPI_SR_TXE) {
/* ready to load next data in */
SPI_DR(spi) = i++;
}
if (SPI_SR(spi) & SPI_SR_RXNE) {
uint8_t data = SPI_DR(spi);
trace_send8(2, data);
}
}
static void setup(void)
{
printf("hi guys!\n");
hw_init();
test_init();
}
int main(void)
{
const struct rcc_clock_scale myclock = {
.pll_source = RCC_CFGR_PLLSRC_HSE_CLK,
.pll_mul = RCC_CFGR_PLLMUL_MUL4,
.pll_div = RCC_CFGR_PLLDIV_DIV2,
.hpre = RCC_CFGR_HPRE_SYSCLK_NODIV,
.ppre1 = RCC_CFGR_PPRE1_HCLK_NODIV,
.ppre2 = RCC_CFGR_PPRE2_HCLK_NODIV,
.voltage_scale = PWR_SCALE1,
.flash_waitstates = 1,
.ahb_frequency = 32e6,
.apb1_frequency = 32e6,
.apb2_frequency = 32e6,
};
int i, j;
rcc_clock_setup_pll(&myclock);
setup();
while (1) {
test_task();
}
return 0;
}

View file

@ -1,26 +0,0 @@
# This is just a makefile.
# Consider it released into the public domain, or, where not available,
# available under your choice of BSD2clause, MIT, X11, ISC or Apache2 licenses
# Karl Palsson <karlp@tweak.net.au>
BOARD = dut-stm32l073rz
PROJECT = uart-basic-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += uart-basic.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3/
### This section can go to an arch shared rules eventually...
DEVICE=stm32l073rz
#OOCD_INTERFACE = stlink-v2
#OOCD_TARGET = stm32l0x
OOCD_FILE = ../../openocd/openocd.$(BOARD).cfg
include ../../rules.mk

View file

@ -1,26 +0,0 @@
# This is just a makefile.
# Consider it released into the public domain, or, where not available,
# available under your choice of BSD2clause, MIT, X11, ISC or Apache2 licenses
# Karl Palsson <karlp@tweak.net.au>
BOARD = stm32f072disco
PROJECT = uart-basic-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += uart-basic.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3/
### This section can go to an arch shared rules eventually...
DEVICE=stm32f072rb
#OOCD_INTERFACE = stlink-v2
#OOCD_TARGET = stm32f0x
OOCD_FILE = ../../openocd/openocd.$(BOARD).cfg
include ../../rules.mk

View file

@ -1,29 +0,0 @@
# This is just a makefile.
# Consider it released into the public domain, or, where not available,
# available under your choice of BSD2clause, MIT, X11, ISC or Apache2 licenses
# Karl Palsson <karlp@tweak.net.au>
BOARD = stm32f3-disco
PROJECT = uart-basic-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += uart-basic.c
# No trace, we're using the uart explicitly here, deliberately.
# Perhaps later we'll use trace differently, or with different files
#CFILES += trace.c trace_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3/
### This section can go to an arch shared rules eventually...
DEVICE=stm32f303vct6
#OOCD_INTERFACE = stlink-v2
#OOCD_TARGET = stm32f3x
OOCD_FILE = ../../openocd/openocd.stm32f3-disco.cfg
include ../../rules.mk

View file

@ -1,29 +0,0 @@
# This is just a makefile.
# Consider it released into the public domain, or, where not available,
# available under your choice of BSD2clause, MIT, X11, ISC or Apache2 licenses
# Karl Palsson <karlp@tweak.net.au>
BOARD = stm32f4-disco
PROJECT = uart-basic-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += uart-basic.c
# No trace, we're using the uart explicitly here, deliberately.
# Perhaps later we'll use trace differently, or with different files
#CFILES += trace.c trace_stdio.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3/
### This section can go to an arch shared rules eventually...
DEVICE=stm32f405xg
#OOCD_INTERFACE = stlink-v2
#OOCD_TARGET = stm32f4x
OOCD_FILE = ../../openocd/openocd.stm32f4-disco.cfg
include ../../rules.mk

View file

@ -1,26 +0,0 @@
# This is just a makefile.
# Consider it released into the public domain, or, where not available,
# available under your choice of BSD2clause, MIT, X11, ISC or Apache2 licenses
# Karl Palsson <karlp@tweak.net.au>
BOARD = stm32l053disco
PROJECT = uart-basic-$(BOARD)
BUILD_DIR = bin-$(BOARD)
SHARED_DIR = ../../shared
CFILES = main-$(BOARD).c
CFILES += uart-basic.c
VPATH += $(SHARED_DIR)
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
OPENCM3_DIR=../../libopencm3/
### This section can go to an arch shared rules eventually...
DEVICE=stm32l053c8
#OOCD_INTERFACE = stlink-v2
#OOCD_TARGET = stm32l0x
OOCD_FILE = ../../openocd/openocd.$(BOARD).cfg
include ../../rules.mk

Some files were not shown because too many files have changed in this diff Show more