Skip to content

Updates and fixes for stm32g4xx: FDCAN, FLASH, TIM #668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions devices/common_patches/fdcan/fdcan_g4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ _include:
- ./fdcan_common.yaml

"FDCAN,FDCAN?":
_modify:
CREL:
resetValue: 0x32141218
PSR:
access: read-only
RXF0S:
access: read-only

RXGFC:
_add:
LSE:
Expand All @@ -22,6 +30,32 @@ _include:
description: FIFO 1 operation mode
bitOffset: 8
bitWidth: 1
_modify:
ANFS:
description: Accept Non-matching frames standard
ANFE:
description: Accept Non-matching frames extended
RRFS:
description: Reject remote frames standard
RRFE:
description: Reject remote frames extended

ANFS:
accept_rx_fifo0: [0b00, "Accept non-matching standard frames in Rx FIFO 0"]
accept_rx_fifo1: [0b01, "Accept non-matching standard frames in Rx FIFO 1"]
reject: [0b10, "Reject non-matching standard frames"]
reject_: [0b11, "Reject non-matching standard frames"]
ANFE:
accept_rx_fifo0: [0b00, "Accept non-matching extended frames in Rx FIFO 0"]
accept_rx_fifo1: [0b01, "Accept non-matching extended frames in Rx FIFO 1"]
reject: [0b10, "Reject non-matching extended frames"]
reject_: [0b11, "Reject non-matching extended frames"]
RRFS:
filter: [0b0, "Filter remote frames with 11-bit standard IDs"]
reject: [0b1, "Reject all remote frames with 11-bit standard IDs"]
RRFE:
filter: [0b0, "Filter remote frames with 29-bit standard IDs"]
reject: [0b1, "Reject remote frames with 29-bit standard IDs"]
Comment on lines +43 to +58
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of those blocks that belongs in peripherals/ because it adds enumerated values (or permitted write ranges) to a field


# Interrupt registers are a disaster, start over
IR:
Expand Down Expand Up @@ -260,8 +294,10 @@ _include:
TXFQS:
_modify:
TFQPI:
bitOffset: 16
bitWidth: 2
TFGI:
bitOffset: 8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like these two new bitOffset values don't change anything since these fields were already at this offset already. Don't think it's a problem, just harder to review

bitWidth: 2
TFFL:
bitWidth: 3
Expand Down Expand Up @@ -301,3 +337,76 @@ _include:
_modify:
CFIE:
bitWidth: 3

ECR:
_modify:
TREC:
name: REC

HPMS:
_modify:
FIDX:
bitOffset: 8
bitWidth: 5
MSI:
bitOffset: 6
bitWidth: 2
BIDX:
bitOffset: 0
bitWidth: 3

RXF0S:
_modify:
F0PI:
bitOffset: 16
bitWidth: 2
F0GI:
bitOffset: 8
bitWidth: 2
F0FL:
bitOffset: 0
bitWidth: 4

RXF0A:
_modify:
F0AI:
bitOffset: 0
bitWidth: 3

RXF1S:
_delete:
DMS:
_modify:
F1PI:
bitOffset: 16
bitWidth: 2
F1GI:
bitOffset: 8
bitWidth: 2
F1FL:
bitOffset: 0
bitWidth: 4

RXF1A:
_modify:
F1AI:
bitOffset: 0
bitWidth: 4

TXBC:
_delete:
TFQS:
NDTB:
TBSA:
_modify:
TFQM:
bitOffset: 24
bitWidth: 1
TFQM:
fifo: [0b0, "Tx FIFO operation"]
queue: [0b1, "Tx queue operation"]
Comment on lines +405 to +407
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little block that belongs in peripherals/ because it adds enumerated values (or permitted write ranges) to a field


TXEFA:
_modify:
EFAI:
bitWidth: 2
85 changes: 83 additions & 2 deletions devices/common_patches/tim/v2/g4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,76 @@ _derive:
OC6M_bit3:
name: OC6M_3

CR1:
CKD:
Div1: [0, "t_DTS = t_CK_INT"]
Div2: [1, "t_DTS = 2 × t_CK_INT"]
Div4: [2, "t_DTS = 4 × t_CK_INT"]
CMS:
EdgeAligned: [0, "The counter counts up or down depending on the direction bit"]
CenterAligned1: [1, "The counter counts up and down alternatively. Output compare interrupt flags are set only when the counter is counting down."]
CenterAligned2: [2, "The counter counts up and down alternatively. Output compare interrupt flags are set only when the counter is counting up."]
CenterAligned3: [3, "The counter counts up and down alternatively. Output compare interrupt flags are set both when the counter is counting up or down."]
DIR:
Up: [0, "Counter used as upcounter"]
Down: [1, "Counter used as downcounter"]
CEN:
Disabled: [0, "Counter disabled"]
Enabled: [1, "Counter enabled"]

CCMR1_Output:
OC2PE:
Disabled: [0, "Preload register on CCR2 disabled. New values written to CCR2 are taken into account immediately"]
Enabled: [1, "Preload register on CCR2 enabled. Preload value is loaded into active register on each update event"]
CC2S:
Output: [0, "CC2 channel is configured as output"]
OC1PE:
Disabled: [0, "Preload register on CCR1 disabled. New values written to CCR1 are taken into account immediately"]
Enabled: [1, "Preload register on CCR1 enabled. Preload value is loaded into active register on each update event"]
CC1S:
Output: [0, "CC1 channel is configured as output"]

CCMR2_Output:
OC4PE:
Disabled: [0, "Preload register on CCR4 disabled. New values written to CCR4 are taken into account immediately"]
Enabled: [1, "Preload register on CCR4 enabled. Preload value is loaded into active register on each update event"]
CC4S:
Output: [0, "CC4 channel is configured as output"]
OC3PE:
Disabled: [0, "Preload register on CCR3 disabled. New values written to CCR3 are taken into account immediately"]
Enabled: [1, "Preload register on CCR3 enabled. Preload value is loaded into active register on each update event"]
CC3S:
Output: [0, "CC3 channel is configured as output"]

DIER:
TDE:
Disabled: [0, "Trigger DMA request disabled"]
Enabled: [1, "Trigger DMA request enabled"]
"CC?DE":
Disabled: [0, "CCx DMA request disabled"]
Enabled: [1, "CCx DMA request enabled"]
UDE:
Disabled: [0, "Update DMA request disabled"]
Enabled: [1, "Update DMA request enabled"]
TIE:
Disabled: [0, "Trigger interrupt disabled"]
Enabled: [1, "Trigger interrupt enabled"]
"CC?IE":
Disabled: [0, "CCx interrupt disabled"]
Enabled: [1, "CCx interrupt enabled"]
UIE:
Disabled: [0, "Update interrupt disabled"]
Enabled: [1, "Update interrupt enabled"]
Comment on lines +17 to +76
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of those blocks that belongs in peripherals/ because it adds enumerated values (or permitted write ranges) to a field


PSC:
_modify:
PSC:
bitOffset: 0
bitWidth: 16
_write_constraint: [0, 65535]



TIM2:
CNT:
_modify:
Expand All @@ -33,15 +103,26 @@ TIM2:
CNT:
_modify:
CNT:
bitOffset: 0
bitWidth: 16
_write_constraint: [0, 65535]
ARR:
_modify:
ARR:
bitWidth: 20
bitOffset: 0
bitWidth: 16
_write_constraint: [0, 65535]
CCR?:
_modify:
CCR?:
bitWidth: 20
bitOffset: 0
bitWidth: 16
_write_constraint: [0, 65535]
CCR:
bitOffset: 0
bitWidth: 16
_write_constraint: [0, 65535]


_include:
- ../tim_ccr.yaml
2 changes: 2 additions & 0 deletions devices/stm32g431.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ _include:
- ../peripherals/rcc/rcc_g4.yaml
- common_patches/tim/v2/g4.yaml
- ../peripherals/tim/v2/ccm.yaml
- ../peripherals/can/fdcan.yaml
- ./common_patches/fdcan/fdcan_g4.yaml
4 changes: 3 additions & 1 deletion devices/stm32g441.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ _include:
- ../peripherals/cordic/cordic_g4.yaml
- ./common_patches/sai/sai_v1.yaml
- ./common_patches/rtc/rtc_cr.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/i2c/i2c_v2.yaml
- ../peripherals/gpio/gpio_v2.yaml
- ./common_patches/rename_USB_FS_peripheral_to_USB.yaml
- ./common_patches/g4_usb.yaml
- ../peripherals/rcc/rcc_g4.yaml
- common_patches/tim/v2/g4.yaml
- ../peripherals/tim/v2/ccm.yaml
- ../peripherals/can/fdcan.yaml
- ./common_patches/fdcan/fdcan_g4.yaml
4 changes: 3 additions & 1 deletion devices/stm32g471.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ _include:
- ../peripherals/cordic/cordic_g4.yaml
- ./common_patches/sai/sai_v1.yaml
- ./common_patches/rtc/rtc_cr.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/i2c/i2c_v2.yaml
- ../peripherals/gpio/gpio_v2.yaml
- ./common_patches/rename_USB_FS_peripheral_to_USB.yaml
- ./common_patches/g4_usb.yaml
- ../peripherals/rcc/rcc_g4.yaml
- common_patches/tim/v2/g4.yaml
- ../peripherals/tim/v2/ccm.yaml
- ../peripherals/can/fdcan.yaml
- ./common_patches/fdcan/fdcan_g4.yaml
10 changes: 6 additions & 4 deletions devices/stm32g473.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ _include:
- ../peripherals/iwdg/iwdg_with_WINR.yaml
- ../peripherals/wwdg/wwdg_v2.yaml
- ./common_patches/g4_cordic.yaml
- ../peripherals/cordic/cordic_g4.yaml
- ../peripherals/cordic/cordic_g4.yaml
- ./common_patches/sai/sai_v1.yaml
- ./common_patches/rtc/rtc_cr.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
- ../peripherals/opamp/opamp_g4_opamp6.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
- ../peripherals/opamp/opamp_g4_opamp6.yaml
- ../peripherals/i2c/i2c_v2.yaml
- ../peripherals/gpio/gpio_v2.yaml
- ./common_patches/rename_USB_FS_peripheral_to_USB.yaml
- ./common_patches/g4_usb.yaml
- ../peripherals/rcc/rcc_g4.yaml
- common_patches/tim/v2/g4.yaml
- ../peripherals/tim/v2/ccm.yaml
- ../peripherals/can/fdcan.yaml
- ./common_patches/fdcan/fdcan_g4.yaml
12 changes: 8 additions & 4 deletions devices/stm32g474.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ VREFBUF:
_include:
- ./common_patches/g4_rcc.yaml
- ./common_patches/g4_exti.yaml
- ./common_patches/fdcan/fdcan_g4.yaml
- ../peripherals/exti/exti.yaml
- ../peripherals/adc/adc_v3_g4.yaml
- ../peripherals/adc/adc_v3_common_g4.yaml
Expand All @@ -23,13 +22,18 @@ _include:
- ../peripherals/cordic/cordic_g4.yaml
- ./common_patches/sai/sai_v1.yaml
- ./common_patches/rtc/rtc_cr.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
- ../peripherals/opamp/opamp_g4_opamp6.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
- ../peripherals/opamp/opamp_g4_opamp6.yaml
- ../peripherals/i2c/i2c_v2.yaml
- ../peripherals/gpio/gpio_v2.yaml
- ./common_patches/rename_USB_FS_peripheral_to_USB.yaml
- ./common_patches/g4_usb.yaml
- ../peripherals/rcc/rcc_g4.yaml
- common_patches/tim/v2/g4.yaml
- ../peripherals/tim/v2/ccm.yaml
- ../peripherals/flash/flash_g4.yaml
- ./common_patches/rename_f0_SPI_registers.yaml
- ../peripherals/spi/spi_v2_without_UDR_CHSIDE.yaml
- ../peripherals/can/fdcan.yaml
- ./common_patches/fdcan/fdcan_g4.yaml
10 changes: 6 additions & 4 deletions devices/stm32g483.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ _include:
- ../peripherals/cordic/cordic_g4.yaml
- ./common_patches/sai/sai_v1.yaml
- ./common_patches/rtc/rtc_cr.yaml
- ../peripherals/cordic/cordic_g4.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
- ../peripherals/opamp/opamp_g4_opamp6.yaml
- ../peripherals/cordic/cordic_g4.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
- ../peripherals/opamp/opamp_g4_opamp6.yaml
- ../peripherals/i2c/i2c_v2.yaml
- ../peripherals/gpio/gpio_v2.yaml
- ./common_patches/rename_USB_FS_peripheral_to_USB.yaml
- ./common_patches/g4_usb.yaml
- ../peripherals/rcc/rcc_g4.yaml
- common_patches/tim/v2/g4.yaml
- ../peripherals/tim/v2/ccm.yaml
- ../peripherals/can/fdcan.yaml
- ./common_patches/fdcan/fdcan_g4.yaml
6 changes: 4 additions & 2 deletions devices/stm32g484.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ _include:
- ../peripherals/cordic/cordic_g4.yaml
- ./common_patches/sai/sai_v1.yaml
- ./common_patches/rtc/rtc_cr.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/opamp/opamp_g4_opamp4_5.yaml
- ../peripherals/opamp/opamp_g4_opamp6.yaml
- ../peripherals/i2c/i2c_v2.yaml
- ../peripherals/gpio/gpio_v2.yaml
Expand All @@ -33,3 +33,5 @@ _include:
- ../peripherals/rcc/rcc_g4.yaml
- common_patches/tim/v2/g4.yaml
- ../peripherals/tim/v2/ccm.yaml
- ../peripherals/can/fdcan.yaml
- ./common_patches/fdcan/fdcan_g4.yaml
6 changes: 4 additions & 2 deletions devices/stm32g491.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ _include:
- ./common_patches/g4_cordic.yaml
- ../peripherals/cordic/cordic_g4.yaml
- ./common_patches/rtc/rtc_cr.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/opamp/opamp_g4_opamp6.yaml
- ../peripherals/opamp/opamp_g4_common.yaml
- ../peripherals/opamp/opamp_g4_opamp6.yaml
- ../peripherals/i2c/i2c_v2.yaml
- ../peripherals/gpio/gpio_v2.yaml
- ./common_patches/rename_USB_FS_peripheral_to_USB.yaml
- ./common_patches/g4_usb.yaml
- ../peripherals/rcc/rcc_g4.yaml
- common_patches/tim/v2/g4.yaml
- ../peripherals/tim/v2/ccm.yaml
- ../peripherals/can/fdcan.yaml
- ./common_patches/fdcan/fdcan_g4.yaml
Loading