Skip to content

Commit d26d42f

Browse files
committed
Updates and fixes for stm32g4xx: FDCAN, FLASH, TIM
1) Add missing fields and enumerations to FDCAN via fdcan_g4.yaml 2) Add registers for FLASH handling. Note that there are some commented out since different devices have different support for secure flash based on their device ID and flash capacity. 3) Fixes for some timer values. In particular, lower non-32-bit timers back down to 16 bit, since 20 bit is only enabled via dithering.
1 parent 1460378 commit d26d42f

File tree

11 files changed

+439
-17
lines changed

11 files changed

+439
-17
lines changed

devices/common_patches/fdcan/fdcan_g4.yaml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ _include:
44
- ./fdcan_common.yaml
55

66
"FDCAN,FDCAN?":
7+
_modify:
8+
CREL:
9+
resetValue: 0x32141218
10+
PSR:
11+
access: read-only
12+
RXF0S:
13+
access: read-only
14+
715
RXGFC:
816
_add:
917
LSE:
@@ -22,6 +30,32 @@ _include:
2230
description: FIFO 1 operation mode
2331
bitOffset: 8
2432
bitWidth: 1
33+
_modify:
34+
ANFS:
35+
description: Accept Non-matching frames standard
36+
ANFE:
37+
description: Accept Non-matching frames extended
38+
RRFS:
39+
description: Reject remote frames standard
40+
RRFE:
41+
description: Reject remote frames extended
42+
43+
ANFS:
44+
accept_rx_fifo0: [0b00, "Accept non-matching standard frames in Rx FIFO 0"]
45+
accept_rx_fifo1: [0b01, "Accept non-matching standard frames in Rx FIFO 1"]
46+
reject: [0b10, "Reject non-matching standard frames"]
47+
reject_: [0b11, "Reject non-matching standard frames"]
48+
ANFE:
49+
accept_rx_fifo0: [0b00, "Accept non-matching extended frames in Rx FIFO 0"]
50+
accept_rx_fifo1: [0b01, "Accept non-matching extended frames in Rx FIFO 1"]
51+
reject: [0b10, "Reject non-matching extended frames"]
52+
reject_: [0b11, "Reject non-matching extended frames"]
53+
RRFS:
54+
filter: [0b0, "Filter remote frames with 11-bit standard IDs"]
55+
reject: [0b1, "Reject all remote frames with 11-bit standard IDs"]
56+
RRFE:
57+
filter: [0b0, "Filter remote frames with 29-bit standard IDs"]
58+
reject: [0b1, "Reject remote frames with 29-bit standard IDs"]
2559

2660
# Interrupt registers are a disaster, start over
2761
IR:
@@ -260,8 +294,10 @@ _include:
260294
TXFQS:
261295
_modify:
262296
TFQPI:
297+
bitOffset: 16
263298
bitWidth: 2
264299
TFGI:
300+
bitOffset: 8
265301
bitWidth: 2
266302
TFFL:
267303
bitWidth: 3
@@ -301,3 +337,76 @@ _include:
301337
_modify:
302338
CFIE:
303339
bitWidth: 3
340+
341+
ECR:
342+
_modify:
343+
TREC:
344+
name: REC
345+
346+
HPMS:
347+
_modify:
348+
FIDX:
349+
bitOffset: 8
350+
bitWidth: 5
351+
MSI:
352+
bitOffset: 6
353+
bitWidth: 2
354+
BIDX:
355+
bitOffset: 0
356+
bitWidth: 3
357+
358+
RXF0S:
359+
_modify:
360+
F0PI:
361+
bitOffset: 16
362+
bitWidth: 2
363+
F0GI:
364+
bitOffset: 8
365+
bitWidth: 2
366+
F0FL:
367+
bitOffset: 0
368+
bitWidth: 4
369+
370+
RXF0A:
371+
_modify:
372+
F0AI:
373+
bitOffset: 0
374+
bitWidth: 3
375+
376+
RXF1S:
377+
_delete:
378+
DMS:
379+
_modify:
380+
F1PI:
381+
bitOffset: 16
382+
bitWidth: 2
383+
F1GI:
384+
bitOffset: 8
385+
bitWidth: 2
386+
F1FL:
387+
bitOffset: 0
388+
bitWidth: 4
389+
390+
RXF1A:
391+
_modify:
392+
F1AI:
393+
bitOffset: 0
394+
bitWidth: 4
395+
396+
TXBC:
397+
_delete:
398+
TFQS:
399+
NDTB:
400+
TBSA:
401+
_modify:
402+
TFQM:
403+
bitOffset: 24
404+
bitWidth: 1
405+
TFQM:
406+
fifo: [0b0, "Tx FIFO operation"]
407+
queue: [0b1, "Tx queue operation"]
408+
409+
TXEFA:
410+
_modify:
411+
EFAI:
412+
bitWidth: 2

devices/common_patches/tim/v2/g4.yaml

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,74 @@ _derive:
1414
OC6M_bit3:
1515
name: OC6M_3
1616

17+
CR1:
18+
CKD:
19+
Div1: [0, "t_DTS = t_CK_INT"]
20+
Div2: [1, "t_DTS = 2 × t_CK_INT"]
21+
Div4: [2, "t_DTS = 4 × t_CK_INT"]
22+
CMS:
23+
EdgeAligned: [0, "The counter counts up or down depending on the direction bit"]
24+
CenterAligned1: [1, "The counter counts up and down alternatively. Output compare interrupt flags are set only when the counter is counting down."]
25+
CenterAligned2: [2, "The counter counts up and down alternatively. Output compare interrupt flags are set only when the counter is counting up."]
26+
CenterAligned3: [3, "The counter counts up and down alternatively. Output compare interrupt flags are set both when the counter is counting up or down."]
27+
DIR:
28+
Up: [0, "Counter used as upcounter"]
29+
Down: [1, "Counter used as downcounter"]
30+
CEN:
31+
Disabled: [0, "Counter disabled"]
32+
Enabled: [1, "Counter enabled"]
33+
34+
CCMR1_Output:
35+
OC2PE:
36+
Disabled: [0, "Preload register on CCR2 disabled. New values written to CCR2 are taken into account immediately"]
37+
Enabled: [1, "Preload register on CCR2 enabled. Preload value is loaded into active register on each update event"]
38+
CC2S:
39+
Output: [0, "CC2 channel is configured as output"]
40+
OC1PE:
41+
Disabled: [0, "Preload register on CCR1 disabled. New values written to CCR1 are taken into account immediately"]
42+
Enabled: [1, "Preload register on CCR1 enabled. Preload value is loaded into active register on each update event"]
43+
CC1S:
44+
Output: [0, "CC1 channel is configured as output"]
45+
46+
CCMR2_Output:
47+
OC4PE:
48+
Disabled: [0, "Preload register on CCR4 disabled. New values written to CCR4 are taken into account immediately"]
49+
Enabled: [1, "Preload register on CCR4 enabled. Preload value is loaded into active register on each update event"]
50+
CC4S:
51+
Output: [0, "CC4 channel is configured as output"]
52+
OC3PE:
53+
Disabled: [0, "Preload register on CCR3 disabled. New values written to CCR3 are taken into account immediately"]
54+
Enabled: [1, "Preload register on CCR3 enabled. Preload value is loaded into active register on each update event"]
55+
CC3S:
56+
Output: [0, "CC3 channel is configured as output"]
57+
58+
DIER:
59+
TDE:
60+
Disabled: [0, "Trigger DMA request disabled"]
61+
Enabled: [1, "Trigger DMA request enabled"]
62+
"CC?DE":
63+
Disabled: [0, "CCx DMA request disabled"]
64+
Enabled: [1, "CCx DMA request enabled"]
65+
UDE:
66+
Disabled: [0, "Update DMA request disabled"]
67+
Enabled: [1, "Update DMA request enabled"]
68+
TIE:
69+
Disabled: [0, "Trigger interrupt disabled"]
70+
Enabled: [1, "Trigger interrupt enabled"]
71+
"CC?IE":
72+
Disabled: [0, "CCx interrupt disabled"]
73+
Enabled: [1, "CCx interrupt enabled"]
74+
UIE:
75+
Disabled: [0, "Update interrupt disabled"]
76+
Enabled: [1, "Update interrupt enabled"]
77+
78+
PSC:
79+
_modify:
80+
PSC:
81+
_write_constraint: [0, 65535]
82+
83+
84+
1785
TIM2:
1886
CNT:
1987
_modify:
@@ -33,15 +101,18 @@ TIM2:
33101
CNT:
34102
_modify:
35103
CNT:
36-
bitWidth: 16
104+
_write_constraint: [0, 65535]
37105
ARR:
38106
_modify:
39107
ARR:
40-
bitWidth: 20
108+
_write_constraint: [0, 65535]
41109
CCR?:
42110
_modify:
43111
CCR?:
44-
bitWidth: 20
112+
_write_constraint: [0, 65535]
113+
CCR:
114+
_write_constraint: [0, 65535]
115+
45116

46117
_include:
47118
- ../tim_ccr.yaml

devices/stm32g431.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ _include:
3131
- ../peripherals/rcc/rcc_g4.yaml
3232
- common_patches/tim/v2/g4.yaml
3333
- ../peripherals/tim/v2/ccm.yaml
34+
- ../peripherals/can/fdcan.yaml
35+
- ./common_patches/fdcan/fdcan_g4.yaml

devices/stm32g441.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ _include:
2323
- ../peripherals/cordic/cordic_g4.yaml
2424
- ./common_patches/sai/sai_v1.yaml
2525
- ./common_patches/rtc/rtc_cr.yaml
26-
- ../peripherals/opamp/opamp_g4_common.yaml
26+
- ../peripherals/opamp/opamp_g4_common.yaml
2727
- ../peripherals/i2c/i2c_v2.yaml
2828
- ../peripherals/gpio/gpio_v2.yaml
2929
- ./common_patches/rename_USB_FS_peripheral_to_USB.yaml
3030
- ./common_patches/g4_usb.yaml
3131
- ../peripherals/rcc/rcc_g4.yaml
3232
- common_patches/tim/v2/g4.yaml
3333
- ../peripherals/tim/v2/ccm.yaml
34+
- ../peripherals/can/fdcan.yaml
35+
- ./common_patches/fdcan/fdcan_g4.yaml

devices/stm32g471.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ _include:
2323
- ../peripherals/cordic/cordic_g4.yaml
2424
- ./common_patches/sai/sai_v1.yaml
2525
- ./common_patches/rtc/rtc_cr.yaml
26-
- ../peripherals/opamp/opamp_g4_common.yaml
26+
- ../peripherals/opamp/opamp_g4_common.yaml
2727
- ../peripherals/i2c/i2c_v2.yaml
2828
- ../peripherals/gpio/gpio_v2.yaml
2929
- ./common_patches/rename_USB_FS_peripheral_to_USB.yaml
3030
- ./common_patches/g4_usb.yaml
3131
- ../peripherals/rcc/rcc_g4.yaml
3232
- common_patches/tim/v2/g4.yaml
3333
- ../peripherals/tim/v2/ccm.yaml
34+
- ../peripherals/can/fdcan.yaml
35+
- ./common_patches/fdcan/fdcan_g4.yaml

devices/stm32g473.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@ _include:
2020
- ../peripherals/iwdg/iwdg_with_WINR.yaml
2121
- ../peripherals/wwdg/wwdg_v2.yaml
2222
- ./common_patches/g4_cordic.yaml
23-
- ../peripherals/cordic/cordic_g4.yaml
23+
- ../peripherals/cordic/cordic_g4.yaml
2424
- ./common_patches/sai/sai_v1.yaml
2525
- ./common_patches/rtc/rtc_cr.yaml
26-
- ../peripherals/opamp/opamp_g4_common.yaml
27-
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
28-
- ../peripherals/opamp/opamp_g4_opamp6.yaml
26+
- ../peripherals/opamp/opamp_g4_common.yaml
27+
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
28+
- ../peripherals/opamp/opamp_g4_opamp6.yaml
2929
- ../peripherals/i2c/i2c_v2.yaml
3030
- ../peripherals/gpio/gpio_v2.yaml
3131
- ./common_patches/rename_USB_FS_peripheral_to_USB.yaml
3232
- ./common_patches/g4_usb.yaml
3333
- ../peripherals/rcc/rcc_g4.yaml
3434
- common_patches/tim/v2/g4.yaml
3535
- ../peripherals/tim/v2/ccm.yaml
36+
- ../peripherals/can/fdcan.yaml
37+
- ./common_patches/fdcan/fdcan_g4.yaml

devices/stm32g474.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ VREFBUF:
1111
_include:
1212
- ./common_patches/g4_rcc.yaml
1313
- ./common_patches/g4_exti.yaml
14-
- ./common_patches/fdcan/fdcan_g4.yaml
1514
- ../peripherals/exti/exti.yaml
1615
- ../peripherals/adc/adc_v3_g4.yaml
1716
- ../peripherals/adc/adc_v3_common_g4.yaml
@@ -23,13 +22,18 @@ _include:
2322
- ../peripherals/cordic/cordic_g4.yaml
2423
- ./common_patches/sai/sai_v1.yaml
2524
- ./common_patches/rtc/rtc_cr.yaml
26-
- ../peripherals/opamp/opamp_g4_common.yaml
27-
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
28-
- ../peripherals/opamp/opamp_g4_opamp6.yaml
25+
- ../peripherals/opamp/opamp_g4_common.yaml
26+
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
27+
- ../peripherals/opamp/opamp_g4_opamp6.yaml
2928
- ../peripherals/i2c/i2c_v2.yaml
3029
- ../peripherals/gpio/gpio_v2.yaml
3130
- ./common_patches/rename_USB_FS_peripheral_to_USB.yaml
3231
- ./common_patches/g4_usb.yaml
3332
- ../peripherals/rcc/rcc_g4.yaml
3433
- common_patches/tim/v2/g4.yaml
3534
- ../peripherals/tim/v2/ccm.yaml
35+
- ../peripherals/flash/flash_g4.yaml
36+
- ./common_patches/rename_f0_SPI_registers.yaml
37+
- ../peripherals/spi/spi_v2_without_UDR_CHSIDE.yaml
38+
- ../peripherals/can/fdcan.yaml
39+
- ./common_patches/fdcan/fdcan_g4.yaml

devices/stm32g484.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ _include:
2323
- ../peripherals/cordic/cordic_g4.yaml
2424
- ./common_patches/sai/sai_v1.yaml
2525
- ./common_patches/rtc/rtc_cr.yaml
26-
- ../peripherals/opamp/opamp_g4_common.yaml
27-
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
26+
- ../peripherals/opamp/opamp_g4_common.yaml
27+
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
2828
- ../peripherals/opamp/opamp_g4_opamp6.yaml
2929
- ../peripherals/i2c/i2c_v2.yaml
3030
- ../peripherals/gpio/gpio_v2.yaml
@@ -33,3 +33,5 @@ _include:
3333
- ../peripherals/rcc/rcc_g4.yaml
3434
- common_patches/tim/v2/g4.yaml
3535
- ../peripherals/tim/v2/ccm.yaml
36+
- ../peripherals/can/fdcan.yaml
37+
- ./common_patches/fdcan/fdcan_g4.yaml

devices/stm32g491.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ _include:
3333
- ./common_patches/g4_cordic.yaml
3434
- ../peripherals/cordic/cordic_g4.yaml
3535
- ./common_patches/rtc/rtc_cr.yaml
36-
- ../peripherals/opamp/opamp_g4_common.yaml
37-
- ../peripherals/opamp/opamp_g4_opamp6.yaml
36+
- ../peripherals/opamp/opamp_g4_common.yaml
37+
- ../peripherals/opamp/opamp_g4_opamp6.yaml
3838
- ../peripherals/i2c/i2c_v2.yaml
3939
- ../peripherals/gpio/gpio_v2.yaml
4040
- ./common_patches/rename_USB_FS_peripheral_to_USB.yaml
4141
- ./common_patches/g4_usb.yaml
4242
- ../peripherals/rcc/rcc_g4.yaml
4343
- common_patches/tim/v2/g4.yaml
4444
- ../peripherals/tim/v2/ccm.yaml
45+
- ../peripherals/can/fdcan.yaml
46+
- ./common_patches/fdcan/fdcan_g4.yaml

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy