tcl/target/stm32l4, tcl/target/stm32w*: Fix clock configuration
For stm32l4, stm32wbx, stm32wlx the target tcl scripts try to change the MSI oscillator's speed to 24 MHz before boosting the interface frequency, but don't clear the RCC_CR_MSIRANGE field correctly before. This causes the register write access to fail and leaves the clock frequency unchanged. For the stm32wlx, the script also neglects to set the MSIRGSEL bit, such that the frequency setting is not actually applied. The issue appears to not cause a problem when using an ST-Link adapter. When using an FT4232HP, communication to the target fails after the reset-init event, possibly because this adapter actually supports the higher interface frequency. This commit fixes the register accesses to make sure the RCC_CR_MSIRANGE is cleared to zero before OR-ing the new value. For the stm32wlx, also set the MSIRGSEL bit. Just to be safe, also fix the write access to the FLASH_ACR_LATENCY field to clear it before OR-ing, even though it should be zero at reset anyways. Change-Id: Ie8320fa6ee2086981c0b1f3c18f51e171709078d Signed-off-by: Niklas Gürtler <profclonk@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/9282 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
This commit is contained in:
committed by
Tomas Vanek
parent
8115c28663
commit
5479c58d23
@@ -143,8 +143,8 @@ $_TARGETNAME configure -event reset-init {
|
||||
# CPU comes out of reset with MSI_ON | MSI_RDY | MSI Range 6 (4 MHz).
|
||||
# Use MSI 24 MHz clock, compliant even with VOS == 2.
|
||||
# 3 WS compliant with VOS == 2 and 24 MHz.
|
||||
mww 0x40022000 0x00000103 ;# FLASH_ACR = PRFTBE | 3(Latency)
|
||||
mww 0x40021000 0x00000099 ;# RCC_CR = MSI_ON | MSIRGSEL | MSI Range 9
|
||||
mmw 0x40022000 0x00000103 0x00000007 ;# FLASH_ACR = PRFTBE | 3(Latency)
|
||||
mmw 0x40021000 0x00000099 0x000000F0 ;# RCC_CR = MSI_ON | MSIRGSEL | MSI Range 9
|
||||
|
||||
# Boost JTAG frequency
|
||||
adapter speed 4000
|
||||
|
||||
@@ -76,8 +76,8 @@ $_TARGETNAME configure -event reset-init {
|
||||
# CPU comes out of reset with MSI_ON | MSI_RDY | MSI Range 4 MHz.
|
||||
# Configure system to use MSI 24 MHz clock, compliant with VOS default Range1.
|
||||
# 2 WS compliant with VOS=Range1 and 24 MHz.
|
||||
mmw 0x58004000 0x00000102 0 ;# FLASH_ACR |= PRFTBE | 2(Latency)
|
||||
mmw 0x58000000 0x00000091 0 ;# RCC_CR = MSI_ON | MSI Range 24 MHz
|
||||
mmw 0x58004000 0x00000102 0x00000007 ;# FLASH_ACR |= PRFTBE | 2(Latency)
|
||||
mmw 0x58000000 0x00000091 0x000000F0 ;# RCC_CR = MSI_ON | MSI Range 24 MHz
|
||||
# Boost JTAG frequency
|
||||
adapter speed 4000
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ $_CHIPNAME.cpu0 configure -event reset-init {
|
||||
# CPU comes out of reset with MSI_ON | MSI_RDY | MSI Range 4 MHz.
|
||||
# Configure system to use MSI 24 MHz clock, compliant with VOS default Range1.
|
||||
# 2 WS compliant with VOS=Range1 and 24 MHz.
|
||||
mmw 0x58004000 0x00000102 0 ;# FLASH_ACR |= PRFTEN | 2(Latency)
|
||||
mmw 0x58000000 0x00000091 0 ;# RCC_CR = MSI_ON | MSI Range 24 MHz
|
||||
mmw 0x58004000 0x00000102 0x00000007 ;# FLASH_ACR |= PRFTEN | 2(Latency)
|
||||
mmw 0x58000000 0x00000099 0x000000F0 ;# RCC_CR = MSI_ON | MSI Range 24 MHz | MSIRGSEL
|
||||
# Boost JTAG frequency
|
||||
adapter speed 4000
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user