Skip to content

Commit 1923975

Browse files
bors[bot]oldsheep68adamgreig
authored
Merge #682
682: shorter registernames for stm32l4 devices of the COMP registers + add… r=adamgreig a=oldsheep68 …ing the register descriptions Changes in: crates stm32l4x1, crates stm32l4x2, crates stm32l4x3, crates stm32l4x5, crates stm32l4x6 registers of the comparator have been renamed, example: from comp1_en -> en this makes a more generic use in programming possible Furthermore, the description has been added for all comp During this work, I found the following topics, where I do not know, how to address: 1) Reference Manual RM0394: is valid for: STM32L443 and STM32L433; but I had to add the register description in the device descriptors stm32l4x3 of RM0351 2) The device STM32L471 is part of stm32l4x1, but is in RM0351 whereas all other devices are part of RM0394 Co-authored-by: oldsheep68 <oldsheep68@hotmail.com> Co-authored-by: Adam Greig <adam@adamgreig.com>
2 parents bc50d9e + 53bba2f commit 1923975

File tree

11 files changed

+317
-0
lines changed

11 files changed

+317
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
COMP:
2+
COMP1_CSR:
3+
_strip:
4+
- "COMP1_"
5+
COMP2_CSR:
6+
_strip:
7+
- "COMP2_"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
_modify:
2+
# Fix DAC peripherals to match other devices
3+
DAC1:
4+
name: DAC

devices/stm32l4x1.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,8 @@ _include:
138138
- ./common_patches/l4_gpio_brr.yaml
139139
- ./common_patches/l4_tim15_ch2.yaml
140140
- ../peripherals/spi/spi_l4.yaml
141+
- ./common_patches/comp/l4xx_comp_reg_rename.yaml
142+
- ../peripherals/comp/comp_l4x1.yaml
143+
- ./common_patches/dac/dac_rename_stm32l4xx.yaml
144+
- ../peripherals/dac/dac_l4xx.yaml
145+
- ../peripherals/opamp/opamp_l4.yaml

devices/stm32l4x2.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ _svd: ../svd/stm32l4x2.svd
33
MPU:
44
_strip:
55
- "MPU_"
6+
67

78
# Most of the patches and includes for this device are shared with the L412,
89
# so update the common patch file below instead.
@@ -13,3 +14,8 @@ _include:
1314
- ../peripherals/fw/fw_l0_l4.yaml
1415
- ../peripherals/rcc/rcc_l4_usart2_3.yaml
1516
- ../peripherals/rcc/rcc_l4_uart4.yaml
17+
- ./common_patches/comp/l4xx_comp_reg_rename.yaml
18+
- ../peripherals/comp/comp_l4x1.yaml
19+
- ./common_patches/dac/dac_rename_stm32l4xx.yaml
20+
- ../peripherals/dac/dac_l4xx.yaml
21+
- ../peripherals/opamp/opamp_l4.yaml

devices/stm32l4x3.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,8 @@ _include:
168168
- ./common_patches/l4_gpio_brr.yaml
169169
- ../peripherals/spi/spi_l4.yaml
170170
- ./common_patches/l4_lcd_segment.yaml
171+
- ./common_patches/comp/l4xx_comp_reg_rename.yaml
172+
- ../peripherals/comp/comp_l4x6.yaml
173+
- ./common_patches/dac/dac_rename_stm32l4xx.yaml
174+
- ../peripherals/dac/dac_l4xx.yaml
175+
- ../peripherals/opamp/opamp_l4.yaml

devices/stm32l4x5.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,8 @@ _include:
200200
- ../peripherals/spi/spi_l4.yaml
201201
- ./common_patches/l4_tim15_ch2.yaml
202202
- common_patches/adc_common_group_name.yaml
203+
- ./common_patches/comp/l4xx_comp_reg_rename.yaml
204+
- ../peripherals/comp/comp_l4x6.yaml
205+
- ./common_patches/dac/dac_rename_stm32l4xx.yaml
206+
- ../peripherals/dac/dac_l4xx.yaml
207+
- ../peripherals/opamp/opamp_l4.yaml

devices/stm32l4x6.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,8 @@ _include:
9494
- ./common_patches/l4_dbg_apb_fzr_rename.yaml
9595
- ./common_patches/l4_lcd_segment.yaml
9696
- common_patches/adc_common_group_name.yaml
97+
- ./common_patches/comp/l4xx_comp_reg_rename.yaml
98+
- ../peripherals/comp/comp_l4x6.yaml
99+
- ../peripherals/dac/dac_l4xx.yaml
100+
- ../peripherals/opamp/opamp_l4.yaml
101+

peripherals/comp/comp_l4x1.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
COMP:
2+
COMP?_CSR:
3+
# LOCK:
4+
# Unlocked: [0, "Comparator CSR bits are read-write"]
5+
# Locked: [1, "Comparator CSR bits are read-only"]
6+
#COMP?_VALUE:
7+
VALUE:
8+
Low: [0, "Comparator output is low"]
9+
High: [1, "Comparator output is high"]
10+
SCALEN:
11+
Disabled: [0, "Voltage scaler disabled"]
12+
Enabled: [1, "Voltage scaler enabled"]
13+
BRGEN:
14+
Disabled: [0, "Scaler resistor bridge disabled"]
15+
Enabled: [1, "Scaler resistor bridge enabled"]
16+
BLANKING:
17+
NoBlanking: [0, "No blanking"]
18+
TIM1OC5: [4, "TIM15 OC1 selected as blanking source"]
19+
HYST:
20+
NoHysteresis: [0, "No hysteresis"]
21+
LowHysteresis: [1, "Low hysteresis"]
22+
MediumHysteresis: [2, "Medium hysteresis"]
23+
HighHysteresis: [3, "High hysteresis"]
24+
POLARITY:
25+
NotInverted: [0, "Output is not inverted"]
26+
Inverted: [1, "Output is inverted"]
27+
PWRMODE:
28+
HighSpeed: [0, "High speed / full power"]
29+
MediumSpeed: [1, "Medium speed / medium power"]
30+
LowSpeed: [3, "Low speed / ultra-low power"]
31+
EN:
32+
Disabled: [0, "Comparator 1 disabled"]
33+
Enabled: [1, "Comparator 1 enabled"]
34+
35+
COMP1_CSR:
36+
INPSEL:
37+
PC5: [0, "PC5 connected to input plus"]
38+
PB2: [1, "PB2 connected to input plus"]
39+
PA3: [2, "PA3 connected to input plus"]
40+
INMSEL:
41+
OneQuarterVRef: [0, "1/4 of VRefint"]
42+
OneHalfVRef: [1, "1/2 of VRefint"]
43+
ThreeQuarterVRef: [2, "3/4 of VRefint"]
44+
VRef: [3, "VRefint"]
45+
DAC_CH1: [4, "DAC Channel 1"]
46+
DAC_CH2: [5, "DAC Channel 2"]
47+
GPIOx: [6, "GPIO selected with INMESEL"]
48+
INMESEL:
49+
PC4: [0, "PC4"]
50+
PA0: [1, "PA0"]
51+
PA4: [2, "PA4"]
52+
PA5: [3, "PA5"]
53+
54+
COMP2_CSR:
55+
WINMODE:
56+
Disabled: [0, "COMP2 input plus is not connected to COMP1"]
57+
Enabled: [1, "COMP2 input plus is connected to COMP1 plus"]
58+
INPSEL:
59+
PB4: [0, "PB4 connected to input plus"]
60+
PB6: [1, "PB6 connected to input plus"]
61+
PA3: [2, "PA3 connected to input plus"]
62+
INMSEL:
63+
OneQuarterVRef: [0, "1/4 of VRefint"]
64+
OneHalfVRef: [1, "1/2 of VRefint"]
65+
ThreeQuarterVRef: [2, "3/4 of VRefint"]
66+
VRef: [3, "VRefint"]
67+
DAC_CH1: [4, "DAC Channel 1"]
68+
DAC_CH2: [5, "DAC Channel 2"]
69+
PB3: [6, "PB3"]
70+
GPIOx: [7, "GPIO selected by INMESEL"]
71+
INMESEL:
72+
PB7: [0, "PB7"]
73+
PA2: [1, "PA2"]
74+
PA4: [2, "PA4"]
75+
PA5: [3, "PA5"]

peripherals/comp/comp_l4x6.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
COMP:
2+
COMP?_CSR:
3+
# LOCK:
4+
# Unlocked: [0, "Comparator CSR bits are read-write"]
5+
# Locked: [1, "Comparator CSR bits are read-only"]
6+
#COMP?_VALUE:
7+
VALUE:
8+
Low: [0, "Comparator output is low"]
9+
High: [1, "Comparator output is high"]
10+
SCALEN:
11+
Disabled: [0, "Voltage scaler disabled"]
12+
Enabled: [1, "Voltage scaler enabled"]
13+
BRGEN:
14+
Disabled: [0, "Scaler resistor bridge disabled"]
15+
Enabled: [1, "Scaler resistor bridge enabled"]
16+
BLANKING:
17+
NoBlanking: [0, "No blanking"]
18+
TIM1OC5: [4, "TIM15 OC1 selected as blanking source"]
19+
HYST:
20+
NoHysteresis: [0, "No hysteresis"]
21+
LowHysteresis: [1, "Low hysteresis"]
22+
MediumHysteresis: [2, "Medium hysteresis"]
23+
HighHysteresis: [3, "High hysteresis"]
24+
POLARITY:
25+
NotInverted: [0, "Output is not inverted"]
26+
Inverted: [1, "Output is inverted"]
27+
PWRMODE:
28+
HighSpeed: [0, "High speed / full power"]
29+
MediumSpeed: [1, "Medium speed / medium power"]
30+
LowSpeed: [3, "Low speed / ultra-low power"]
31+
EN:
32+
Disabled: [0, "Comparator 1 disabled"]
33+
Enabled: [1, "Comparator 1 enabled"]
34+
35+
COMP1_CSR:
36+
INPSEL:
37+
PC5: [0, "PC5 connected to input plus"]
38+
PB2: [1, "PB2 connected to input plus"]
39+
INMSEL:
40+
OneQuarterVRef: [0, "1/4 of VRefint"]
41+
OneHalfVRef: [1, "1/2 of VRefint"]
42+
ThreeQuarterVRef: [2, "3/4 of VRefint"]
43+
VRef: [3, "VRefint"]
44+
DAC_CH1: [4, "DAC Channel 1"]
45+
DAC_CH2: [5, "DAC Channel 2"]
46+
PC4: [6, "PC4"]
47+
48+
COMP2_CSR:
49+
WINMODE:
50+
Disabled: [0, "COMP2 input plus is not connected to COMP1"]
51+
Enabled: [1, "COMP2 input plus is connected to COMP1 plus"]
52+
INPSEL:
53+
PB4: [0, "PB4 connected to input plus"]
54+
PB6: [1, "PB6 connected to input plus"]
55+
INMSEL:
56+
OneQuarterVRef: [0, "1/4 of VRefint"]
57+
OneHalfVRef: [1, "1/2 of VRefint"]
58+
ThreeQuarterVRef: [2, "3/4 of VRefint"]
59+
VRef: [3, "VRefint"]
60+
DAC_CH1: [4, "DAC Channel 1"]
61+
DAC_CH2: [5, "DAC Channel 2"]
62+
PB3: [6, "PB3"]
63+
PB7: [7, "PB7"]

peripherals/dac/dac_l4xx.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
DAC,DAC?:
2+
"CR,CR?":
3+
"CEN?":
4+
Normal: [0, 'DAC Channel X Normal operating mode']
5+
Calibration: [1, 'DAC Channel X calibration mode']
6+
"DMAUDRIE?":
7+
Disabled: [0, "DAC Channel X DMA Underrun Interrupt disabled"]
8+
Enabled: [1, "DAC Channel X DMA Underrun Interrupt enabled"]
9+
"DMAEN?":
10+
Disabled: [0, "DAC Channel X DMA mode disabled"]
11+
Enabled: [1, "DAC Channel X DMA mode enabled"]
12+
"MAMP?":
13+
Amp1: [0b0000, 'Unmask bit0 of LFSR/ triangle amplitude equal to 1']
14+
Amp3: [0b0001, 'Unmask bits[1:0] of LFSR/ triangle amplitude equal to 3']
15+
Amp7: [0b0010, 'Unmask bits[2:0] of LFSR/ triangle amplitude equal to 7']
16+
Amp15: [0b0011, 'Unmask bits[3:0] of LFSR/ triangle amplitude equal to 15']
17+
Amp31: [0b0100, 'Unmask bits[4:0] of LFSR/ triangle amplitude equal to 31']
18+
Amp63: [0b0101, 'Unmask bits[5:0] of LFSR/ triangle amplitude equal 63']
19+
Amp127: [0b0110, 'Unmask bits[6:0] of LFSR/ triangle amplitude equal to 127']
20+
Amp255: [0b0111, 'Unmask bits[7:0] of LFSR/ triangle amplitude equal to 255']
21+
Amp511: [0b1000, 'Unmask bits[8:0] of LFSR/ triangle amplitude equal to 511']
22+
Amp1023: [0b1001, 'Unmask bits[9:0] of LFSR/ triangle amplitude equal to 1023']
23+
Amp2047: [0b1010, 'Unmask bits[10:0] of LFSR/ triangle amplitude equal to 2047']
24+
Amp4095: [0b1011, 'Unmask bits[11:0] of LFSR/ triangle amplitude equal to 4095']
25+
"WAVE?":
26+
Disabled: [0, 'Wave generation disabled']
27+
Noise: [1, 'Noise wave generation enabled']
28+
Triangle: [2, 'Triangle wave generation enabled']
29+
"TSEL?":
30+
TIM6_TRGO: [0, 'TIM6_TRGO event trigger for DAC conversion, if TEN is enabled']
31+
TIM8_TRGO: [1, 'TIM8_TRGO']
32+
TIM7_TRGO: [2, 'TIM7_TRGO (Note: Reserved on STM32L45xxx and STM32L46xxx devices)']
33+
TIM5_TRGO: [3, 'TIM5_TRGO']
34+
TIM2_TRGO: [4, 'TIM2_TRGO']
35+
TIM4_TRGO: [5, 'TIM4_TRGO']
36+
EXTI9: [6, 'External pin']
37+
SWTRIG: [7, 'Software triger']
38+
"TEN?":
39+
Disabled: [0, "DAC Channel X trigger disabled"]
40+
Enabled: [1, "DAC Channel X trigger enabled"]
41+
"EN?":
42+
Disabled: [0, "DAC Channel X disabled"]
43+
Enabled: [1, "DAC Channel X enabled"]
44+
45+
SWTRIGR:
46+
"SWTRIG?":
47+
NoTrigger: [0, 'No trigger']
48+
Trigger: [1, 'Trigger']
49+
50+
"DOR?":
51+
"DACC?DOR": [0, 4095]
52+
53+
SR:
54+
"BWST?":
55+
Idle: [0, 'There is no write operation of DAC_SHSR1 ongoing: DAC_SHSR1 can be written']
56+
Busy: [1, 'There is a write operation of DAC_SHSR1 ongoing: DAC_SHSR1 cannot be written']
57+
"CAL_FLAG?":
58+
Lower: [0, 'Calibration trimming value is lower than the offset correction value']
59+
Equal_Higher: [1, 'Calibration trimming value is equal or greater than the offset correction value']
60+
"DMAUDR?":
61+
NoError: [0, 'No DMA underrun error condition occurred for DAC channel x']
62+
Error: [1, 'DMA underrun error condition occurred for DAC channel x (the currently selected trigger is driving DAC channel1 conversion at a frequency higher than the DMA service capability rate)']
63+
64+
CCR:
65+
"OTRIM?": [0, 31]
66+
67+
MCR:
68+
"MODE?":
69+
NormalPinBuffer: [0b000, 'Normal mode - DAC channelx is connected to external pin with Buffer enabled']
70+
NormalPinChipBuffer: [0b001, 'Normal mode - DAC channelx is connected to external pin and to on chip peripherals with Buffer enabled']
71+
NormalPinNoBuffer: [0b010, 'Normal mode - DAC channelx is connected to external pin with Buffer disabled']
72+
NormalChipNoBuffer: [0b011, 'Normal mode - DAC channelx is connected to on chip peripherals with Buffer disabled']
73+
SHPinBuffer: [0b100, 'S&H mode - DAC channelx is connected to external pin with Buffer enabled']
74+
SHPinChipBuffer: [0b101, 'S&H mode - DAC channelx is connected to external pin and to on chip peripherals with Buffer enabled']
75+
SHPinNoBuffer: [0b110, 'S&H mode - DAC channelx is connected to external pin and to on chip peripherals with Buffer disabled']
76+
SHChipNoBuffer: [0b111, 'S&H mode - DAC channelx is connected to on chip peripherals with Buffer disabled']
77+
78+
"SHSR?":
79+
"TSAMPLE?": [0, 1023]
80+
81+
SHHR:
82+
"THOLD?": [0, 1023]
83+
84+
SHRR:
85+
"TREFRESH?": [0, 255]
86+
87+
"DHR12R?":
88+
"DACC?DHR": [0, 4095]
89+
90+
"DHR12L?":
91+
"DACC?DHR": [0, 4095]
92+
93+
"DHR8R?":
94+
"DACC?DHR": [0, 255]
95+

peripherals/opamp/opamp_l4.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
OPAMP:
3+
OPAMP?_CSR:
4+
CALOUT: [0, 1]
5+
PGA_GAIN:
6+
Gain2: [0, "Gain 2"]
7+
Gain4: [1, "Gain 4"]
8+
Gain8: [2, "Gain 8"]
9+
Gain16: [3, "Gain 16"]
10+
CALSEL:
11+
NMOS: [0, "0.2V applied to OPAMP inputs during calibration"]
12+
PMOS: [1, VDDA-0.2V applied to OPAMP inputs during calibration"]
13+
CALON:
14+
Disabled: [0, "Normal mode"]
15+
Enabled: [1, "Calibration mode"]
16+
VP_SEL:
17+
GPIO: [0, "GPIO connectet to VINP"]
18+
DAC: [1, "DAC connected to VPINP"]
19+
VM_SEL:
20+
GPIO: [0, "GPIO connectet to VINM"]
21+
LOW_LEAKAGE: [1, "Low leakage inputs connecte (only available in certen BGA cases"]
22+
PGA_MODE: [2, "OPAMP in PGA mode"]
23+
USERTRIM:
24+
Factory: [0, "Factory trim used"]
25+
User: [1, "User trim used"]
26+
OPAMODE:
27+
PGA_DISABLED: [0, "internal PGA diabled"]
28+
PGA_ENABLED: [2, "internal PGA enabled, gain programmed in PGA_GAIN"]
29+
FOLLOWER: [3, "internal follower"]
30+
OPALPM:
31+
NORMAL: [0, OpAmp in normal mode]
32+
LOW: [1, OpAmp in low power mode]
33+
OPAEN:
34+
Disabled: [0, "OpAmp disabled"]
35+
Enabled: [1, "OpAmp enabled"]
36+
OPAMP?_OTR:
37+
TRIMOFFSETN: [0, 31]
38+
TRIMOFFSETP: [0, 31]
39+
OPAMP?_LPOTR:
40+
TRIMLPOFFSETN: [0, 31]
41+
TRIMLPOFFSETP: [0, 31]
42+
43+
OPAMP1_CSR:
44+
OPA_RANGE:
45+
LOW: [0, "low range (VDDA < 2.4V"]
46+
HIGH: [1, "low range (VDDA >2.4V"]
47+

0 commit comments

Comments
 (0)