Electoday 2025

ไมโครคอนโทรลเลอร์ => ARM Processors => Topic started by: tha on November 07, 2020, 08:35:59 AM

Title: STM32F1 RCC
Post by: tha on November 07, 2020, 08:35:59 AM
7 Low-, medium-, high- and XL-density reset and clock control (RCC)
Low-density devices are STM32F101xx, STM32F102xx and STM32F103xx
microcontrollers where the Flash memory density ranges between 16 and 32 Kbytes.
Medium-density devices are STM32F101xx, STM32F102xx and STM32F103xx
microcontrollers where the Flash memory density ranges between 64 and 128 Kbytes.
High-density devices are STM32F101xx and STM32F103xx microcontrollers where the
Flash memory density ranges between 256 and 512 Kbytes.
XL-density devices are STM32F101xx and STM32F103xx microcontrollers where the
Flash memory density ranges between 768 Kbytes and 1 Mbyte.
Connectivity line devices are STM32F105xx and STM32F107xx microcontrollers.

Section นี้ใช้กับ low-, medium-, high- and XL-density STM32F10xxx devices.
Connectivity line devicesจะกล่าวถึงในส่วนที่แยกต่างหาก (อ้างอิงถึง Connectivity line
devices: reset and clock control (RCC)).

7.1 Reset
มี 3 ชนิดของ reset, นิยามเป็น system reset, power reset และ backup domain reset.

7.1.1 System reset
A system reset เซ็ต registers ทั้งหมดไปเป็น reset values ของมันยกเว้น the reset flags ใน the clock controller CSR register และ the registers ใน the Backup domain (ดู Figure 4).
A system reset ถูกสร้างขึ้นเมื่อหนึ่งของ the following events เกิดขึ้น :
1. A low level บน the NRST pin (external reset)
2. Window watchdog การสิ้นสุดของเงื่อนใขการนับ (WWDG reset)
3. Independent watchdog การสิ้นสุดของเงื่อนใขการนับ (IWDG reset)
4. A software reset (SW reset) (ดู Software reset)
5. Low-power management reset (ดู Low-power management reset)
The reset source สามารถถูกระบุโดยการเช็ค the reset flags ใน the Control/Status register, RCC_CSR (ดู Section 7.3.10: Control/status register (RCC_CSR)).
Title: Re: STM32F1 RCC
Post by: tha on November 07, 2020, 10:03:23 AM
Software reset
The SYSRESETREQ bit ใน Cortex®-M3 Application Interrupt and Reset Control Register ต้องถูกเซ็ตเพื่อบังคับ(force) a software reset บน the device. อ้างอิงถึง the STM32F10xxx Cortex®-M3 programming manual (ดูเอกสารที่เกี่ยวข้อง) สำหรับรายละเอียดที่มากขึ้น.

Low-power management reset
มี 2 ทางที่จะสร้าง a low-power management reset:
1.    Reset สร้างขึ้นเมื่อเข้าสู่ Standby mode:
       reset ชนิดนี้ถูกเปิดการใช้งานโดยการรีเซ็ต nRST_STDBY bit ใน User Option Bytes. ในกรณีนี้, เมื่อไรก็ตาม a Standby
       mode entry sequence ถูกปฏิบัติสำเร็จลง, the device ถูก reset แทนการเข้าสู่ Standby mode.
2.    Reset เมื่อเข้าสู่ Stop mode:
       reset ชนิดนี้ถูกเปิดการใช้งานโดยการรีเซ็ต nRST_STOP bit ใน User Option Bytes. ในกรณีนี้, เมื่อไรก็ตาม a Stop mode
       entry sequence ถูกปฏิบัติสำเร็จลง, the device ถูก reset แทนการเข้าสู่ Stop mode.

สำหรับข้อมูลเพิ่มเติมเกี่ยวกับ the User Option Bytes, อ้างอิงถึง the STM32F10xxx Flash programming manual.
Title: Re: STM32F1 RCC
Post by: tha on November 07, 2020, 10:53:51 AM
7.1.2 Power reset
A power reset ถูกสร้างขึ้นเมื่อหนึ่งของ the following events เกิดขึ้น :
1. Power-on/power-down reset (POR/PDR reset)
2. เมื่อออกจาก Standby mode
A power reset เซ็ต registers ทั้งหมดไปเป็น reset values ของมันยกเว้น the Backup domain (ดู Figure 4)

sources เหล่านี้ทำงานบน the NRST pin และมันจะอยู่ในระดับต่ำเสมอในระหว่าง the delay phase. The RESET service routine vector ถูกคงที่ที่ address 0x0000_0004 ใน the memory map.

The system reset signal ที่ให้กับ the device จะ output ที่ the NRST pin. The pulse generator รับประกัน a minimum reset pulse ช่วงเวลาของ 20 μs สำหรับแต่ละ reset source (external หรือ internal reset). ในกรณีของ an external reset, the reset pulse ถูกสร้างขึ้นในขณะที่ the NRST pin ยืนยัน low.

(https://i.imgur.com/etIjQVJ.png)
Title: Re: STM32F1 RCC
Post by: tha on November 07, 2020, 04:11:00 PM
7.1.3 Backup domain reset
The backup domain มี 2 specific resets ที่เป็นผลกับเพียง the backup domain (ดู Figure 4).

A backup domain reset ถูกสร้างเมื่อหนึ่งของ the following events เกิดขึ้น :
1. Software reset, ทริกโดยการเซ็ต the BDRST bit ใน the Backup domain control register (RCC_BDCR).
2. VDD หรือ VBAT power on, ถ้าทั้งสอง supplies ถูก powered off มาก่อนหน้านี้.
Title: Re: STM32F1 RCC
Post by: tha on November 09, 2020, 08:50:28 AM
7.2 Clocks
Three different clock sources สามารถถูกใช้เพื่อขับ the system clock (SYSCLK):
•    HSI oscillator clock
•    HSE oscillator clock
•    PLL clock

The devices มี the following two secondary clock sources:
•    40 kHz low speed internal RC (LSI RC), ซึ่งขับ the independent watchdog และเป็นทางเลือกให้ the RTC ใช้สำหรับ
      Auto- wakeup จาก Stop/Standby mode.
•    32.768 kHz low speed external crystal (LSE crystal), ซึ่งเป็นทางเลือกใช้ขับ the real-time clock (RTCCLK)
      แต่ละ clock source สามารถถูก switched on หรือ off อย่างอิสระเมื่อมันไม่ได้ถูกใช้, เพื่อเพิ่มประสิทธิภาพ power consumption.

(https://i.imgur.com/r5aTPvu.png)

1. เมื่อ the HSI ถูกใช้เป็น a PLL clock input, the maximum system clock frequency ที่สามารถถูกทำให้สำเร็จได้คือ 64 MHz.

2. สำหรับรายละเอียดเติมเกี่ยวกับ the internal and external clock source characteristics อ้างอิงถึง the "Electrical
    characteristics" section ใน your device datasheet.

prescalers หลายตัวยอมให้กำหนดค่าของ the AHB frequency, the high speed APB(APB2) และ the low speed APB (APB1) domains. The maximum frequency ของ the AHB และ the APB2 domains คือ 72 MHz. The maximum allowed frequency ของ the APB1 domain คือ 36 MHz. The SDIO AHB interface ถูก clocked ด้วย a fixed frequency เท่ากับ HCLK/2

The RCC ให้(feeds) the Cortex® System Timer (SysTick) external clock ด้วย the AHB clock (HCLK) หารด้วย 8. The SysTick สามารถทำงานด้วย clock นี้หรือด้วย the Cortex® clock (HCLK) อย่างใดอย่างหนึ่ง, กำหนดค่าได้ใน the SysTick Control และ Status Register. The ADCs ถูก clocked โดย the clock ของ the High Speed domain (APB2) หารด้วย 2, 4, 6 หรือ 8.

The Flash memory programming interface clock (FLITFCLK) คือ the HSI clock เสมอ.

The timer clock frequencies ถูกคงที่โดยอัตโนมัติโดย. มันมีสองกรณี :
1. ถ้า the APB prescaler คือ 1, the timer clock frequencies ถูกเซ็ตเป็นความถี่เดียวกับของ the APB domain ซึ่ง the timers
    ถูกเชื่อมต่อ.
2. มิฉะนั้น, จะถูกตั้งค่าเป็นสองเท่า (× 2) ของความถี่ของ the APB domain ซึ่ง the timers ถูกเชื่อมต่อ.

FCLK ทำงานเป็น Cortex®-M3's free-running clock. สำหรับรายละเอียดที่มากขึ้นอ้างอิงถึง Arm® Cortex-M3 r1p1 Technical Reference Manual (TRM).
Title: Re: STM32F1 RCC
Post by: tha on November 10, 2020, 08:23:39 AM
7.2.1 HSE clock
The high speed external clock signal (HSE) สามารถถูกสร้างจาก two possible clock sources:

•    HSE external crystal/ceramic resonator
•    HSE user external clock

The resonator และ the load capacitors ต้องถูกใส่ให้ใกล้ที่สุดเท่าที่จะทำได้เข้ากับ the oscillator pins เพื่อที่จะลด output distortion และ startup stabilization time. The loading capacitance values ต้องถูกปรับให้สอดคล้องกับ the selected oscillator.

(https://i.imgur.com/njeCxrP.png)

External source (HSE bypass)
ในโหมดนี้, an external clock source ต้องถูกจัดให้มี. มันสามารถมีความถี่ขึ้นไปถึง 25 MHz. คุณเลือกโหมดนี้โดยการเซ็ต the HSEBYP และ HSEON bits ใน the Clock control register (RCC_CR). The external clock signal (square, sinus หรือ triangle) ด้วย ~50% duty cycle ต้องขับ the OSC_IN pin ในขณะที่ the OSC_OUT pin ควรถูกปล่อยให้เป็นอิมพิแด๊นท์สูง (hi-Z). ดู Figure 9.

External crystal/ceramic resonator (HSE crystal)
The 4 ถึง 16 MHz external oscillator มีข้อได้เปรียบในการสร้าง a very accurate rate บน the main clock

The associated hardware configuration ถูกแสดงใน Figure 9. อ้างอิงถึง the electrical characteristics section ของ the datasheet สำหรับรายละเอียดที่มากขึ้น

The HSERDY flag ใน the Clock control register (RCC_CR) แสดงถ้า the high-speed external oscillator มีความเสถียรหรือไม่. ที่ startup, the clock จะไม่ถูกปล่อยออกมาจนกว่าบิตนี้ถูกเซ็ตโดย hardware. An interrupt สามารถถูกสร้างขึ่นถ้าเปิดการใช้งานใน the Clock interrupt register (RCC_CIR).

The HSE Crystal สามารถถูก switched on และ off โดยใช้ the HSEON bit ใน the Clock control register (RCC_CR).
Title: Re: STM32F1 RCC
Post by: tha on November 10, 2020, 08:47:59 AM
7.2.2 HSI clock
The HSI clock signal ถูกสร้างจาก an internal 8 MHz RC Oscillator และสามารถถูกใช้โดยตรงเป็น a system clock หรือหารด้วย 2 เพื่อถูกใช้เป็น PLL input.

The HSI RC oscillator มีข้อได้เปรียบของการจัดให้มี a clock source ที่ราคาต่ำ (ไม่มีส่วนประกอบภายนอก). มันยังมี startup time ที่เร็วกว่า the HSE crystal oscillator อย่างไรก็ตาม, แม้
ด้วยการสอบเทียบ the frequency ก็ยังมีความแม่นยำที่น้อยกว่า an external crystal oscillator หรือ ceramic resonator.

Calibration
RC oscillator frequencies สามารถแตกต่างกันไปจากชิปไปยังชิปอื่นเนื่องจาก manufacturing process variations, นี่คือสาเหตุที่อุปกรณ์แต่ละ device ถูกปรับเทียบจากโรงงานโดย ST เพื่อความแม่นยำ 1% ที่ TA = 25 ° C.

หลังจาก reset, the factory calibration value ถูกโหลดลงใน the HSICAL[7:0] bits ใน the Clock control register (RCC_CR).

หาก the application อยู่ภายใต้ voltage หรือ temperature variations นี้อาจมีผลกระทบต่อ the RC oscillator speed. คุณสามารถตัดแต่ง the HSI frequency ใน the application โดยใช้ the HSITRIM[4:0]bits ใน the Clock control register (RCC_CR).

The HSIRDY flag ใน the Clock control register (RCC_CR) แสดงถ้า the HSI RC มีความเสถียรหรือไม่. ที่ startup, the HSI RC output clock จะไม่ถูกปล่อยออกมาจนกว่าบิตนี้ถูกเซ็ตโดย hardware.

The HSI RC สามารถถูก switched on และ off โดยใช้ the HSION bit ใน the Clock control register (RCC_CR).
Title: Re: STM32F1 RCC
Post by: tha on November 10, 2020, 09:40:26 AM
7.2.3 PLL
The internal PLL สามารถถูกใช้เพื่อคูณ the HSI RC output หรือ HSE crystal output clock frequency. อ้างอิงถึง Figure 8 และ Clock control register (RCC_CR). The PLL configuration (การเลือกของ HSI oscillator หารด้วย 2 หรือ HSE oscillator สำหรับ PLL input clock, และ multiplication factor) ต้องถูกทำก่อนการเปิดใช้งาน the PLL. เมื่อ the PLL เปิดการใช้งาน, parameters เหล่านี้ไม่สามารถถูกเปลี่ยน.

An interrupt สามารถถูกสร้างขึ้นเมื่อ the PLL พร้อมแล้ว ถ้าเปิดการใช้งานใน the Clock interrupt register (RCC_CIR).

ถ้า the USB interface ถูกใช้ใน the application, the PLL ต้องถูกโปรแกรมเป็น output 48 หรือ 72 MHz. นี้ถูกต้องการจัดให้มี a 48 MHz USBCLK.
Title: Re: STM32F1 RCC
Post by: tha on November 11, 2020, 08:20:34 AM
7.2.4 LSE clock
The LSE crystal คือ a 32.768 kHz Low Speed External crystal หรือ ceramic resonator.มันมีข้อได้เปรียบการจัดให้มี a low-power แต่ highly accurate clock source ไปยัง the real-time clock peripheral (RTC) สำหรับ clock/calendar หรือ timing functions อื่นๆ.

The LSE crystal ถูก switched on และ off โดยใช้ the LSEON bit ใน Backup domain control register (RCC_BDCR).

The LSERDY flag ใน the Backup domain control register (RCC_BDCR) แสดงถ้า the LSE crystal มีความเสถียรหรือไม่. ที่ startup, the LSE crystal output clock signal จะไม่ถูกปล่อยออกมาจนกว่าบิตนี้ถูกเซ็ตโดย hardware. An interrupt สามารถถูกสร้างขึ่นถ้าเปิดการใช้งานใน the Clock interrupt register (RCC_CIR).

External source (LSE bypass)
ในโหมดนี้, an external clock source ต้องถูกจัดให้มี. มันสามารถมีความถี่ขึ้นไปถึง 1 MHz. คุณเลือกโหมดนี้โดยการเซ็ต the LSEBYP และ LSEON bits ใน the Backup domain control register (RCC_BDCR). The external clock signal (square, sinus หรือ triangle) ด้วยประมาณ ~50% duty cycle ต้องขับ  the OSC32_IN pin ในขณะที่ the OSC32_OUT pin ควรถูกปล่อยให้เป็นอิมพิแด๊นท์สูง (hi-Z). ดู Figure 9.
Title: Re: STM32F1 RCC
Post by: tha on November 11, 2020, 08:43:38 AM
7.2.5 LSI clock
The LSI RC ทำหน้าที่เป็น an low-power clock source ที่สามารถทำงานต่อไปใน Stop และ Standby mode สำหรับ the independent watchdog (IWDG) และ Auto-wakeup unit (AWU). The clock frequency อยู่ที่ประมาณ 40 kHz (ระหว่าง 30 kHz และ 60 kHz). สำหรับรายละเอียดที่มากขึ้น, อ้างอิงถึง the electrical characteristics section ของ the datasheets.

The LSI RC สามารถถูก switched on และ off โดยใช้ the LSION bit ใน the Control/status register (RCC_CSR).

The LSIRDY flag ใน the Control/status register (RCC_CSR) แสดงถ้า the low-speed internal oscillator มีความเสถียรหรือไม่. ที่ startup, the clock จะไม่ถูกปล่อยออกมาจนกว่าบิตนี้ถูกเซ็ตโดย hardware. An interrupt สามารถถูกสร้างขึ่นถ้าเปิดการใช้งานใน the Clock interrupt register (RCC_CIR).

Note: LSI calibration มีให้ใช้เพียงบน high-density, XL-density และ connectivity line devices เท่านั้น.

LSI calibration
The frequency dispersion ของ the Low Speed Internal RC (LSI) oscillator สามารถถูก calibrated ให้มี accurate RTC time base และ/หรือ IWDG timeout (เมื่อ LSI ถูกใช้เป็น clock source สำหรับ peripherals เหล่านี้)  ด้วยความแม่นยำที่ยอมรับได้

calibration นี้ถูกดำเนินการโดยการวัด the LSI clock frequency ตาม TIM5 input clock (TIM5CLK). สอดคล้องกับการวัดนี้ทำที่ความแม่นยำของ the HSE oscillator, the software สามารถปรับ the programmable 20-bit prescaler ของ the RTC เพื่อให้ได้ an accurate time base หรือสามารถคำนวณ accurate IWDG timeout

ใช้ขั้นตอนต่อไปนี้เพื่อปรับเทียบ LSI :
1. เปิดการใช้งาน TIM5 timer และกำหนด channel4 ใน input capture mode
2. เซ็ต the TIM5CH4_IREMAP bit ใน the AFIO_MAPR register เพื่อต่อ the LSI clock ภายในไปยัง TIM5 channel4 input
    capture สำหรับ calibration purpose.
3. วัดความถี่ของ LSI clock โดยใช้ the TIM5 Capture/compare 4 event หรือ interrupt.
4. ใช้ the measured LSI frequency เพื่ออัปเดต the 20-bit prescaler ของ the RTC ขึ้นอยู่กับ the desired time base และ/
    หรือเพื่อคำนวณ the IWDG timeout
Title: Re: STM32F1 RCC
Post by: tha on November 11, 2020, 09:11:16 AM
7.2.6 System clock (SYSCLK) selection
หลังจาก a system reset, the HSI oscillator ถูกเลือกเป็น system clock. เมื่อ a clock source ถูกใช้โดยตรงหรือผ่านทาง the PLL เป็น system clock, เป็นไปไม่ได้ที่จะหยุดมัน.

การสวิทช์จาก clock source หนึ่งไปยังจะเกิดขึ้นเพียงถ้า the target clock source พร้อมแล้วเท่านั้น (clock มีเสถียรหลังจาก startup delay หรือ PLL locked). หาก a clock source ซึ่งยังไม่พร้อมถูกเลือก, การสวิทช์จะเกิดขึ้นเมื่อ the clock source จะพร้อม. Status bits ใน the Clock control register (RCC_CR) แสดงว่า clock(s) พร้อมแล้วและว่า clock ถูกใช้ในขณะนี้เป็น system clock
Title: Re: STM32F1 RCC
Post by: tha on November 11, 2020, 09:22:43 AM
7.2.7 Clock security system (CSS)
Clock Security System สามารถถูกทำให้ทำงานโดย. ในกรณีนี้, the clock detector ถูกเปิดการใช้งานหลังจาก the HSE oscillator startup delay, และปิดการใช้งานเมื่อ oscillator นี้ถูกหยุด.

ถ้าความล้มเหลวถูกตรวจจับได้บน the HSE clock, the HSE oscillator ถูกปิดการใช้งานโดยอัตโนมัติ, a clock failure event ถูกส่งไปยัง the break input ของ the advanced-control timers (TIM1 and TIM8) และ an interrupt ถูกสร้างขึ้นเพื่อแจ้ง the software เกี่ยวกับความล้มเหลวนี้ (Clock Security System Interrupt CSSI), ยอมให้ the MCU ดำเนินการ rescue operations. The CSSI ถูกเชื่อมต่อถึง the Cortex®-M3 NMI (Non-Maskable Interrupt) exception vector.

Note: เมื่อ the CSS ถูกเปิดการใช้งานและถ้า the HSE clock ล้มเหลว, the CSS interrupt เกิดขึ้นและ an NMI ถูกสร้างขึ้นโดยอัตโนมัติ. The NMI จะถูกดำเนินการต่อไปอย่างไม่มีกำหนดเว้นแต่ the CSS interrupt pending bit ถูก cleared. เป็นผลให้, ใน the NMI ISR ผู้ใช้ต้องเคลียร์ the CSS interrupt โดยการเซ็ต the CSSC bit ใน the Clock interrupt register (RCC_CIR).

ถ้า the HSE oscillator ถูกใช้โดยตรงหรือโดยอ้อมเป็น the system clock (โดยอ้อมหมายถึง : มันถูกใช้เป็น PLL input clock, และ the PLL clock ถูกใช้เป็น system clock), a detected failure เป็นเหตุให้เกิดการสวิทช์ของ the system clock ไปยัง the HSI oscillator และปิดการใช้งานของ the HSE oscillator. ถ้า the HSE clock (หารหรือไม่หาร) เป็น the clock entry ของ the PLL ที่ใช้เป็น system clock เมื่อ the failure เกิดขึ้น, the PLL ก็ถูกปิดการใช้งานด้วย.
Title: Re: STM32F1 RCC
Post by: tha on November 11, 2020, 10:08:38 AM
7.2.8 RTC clock
The RTCCLK clock source สามารถเป็น the HSE/128, LSE หรือ LSI clocks อย่างใดอย่างหนึ่ง. นี้ถูกเลือกโดยการโปรแกรม the RTCSEL[1:0] bits ใน the Backup domain control register (RCC_BDCR). การเลือกนี้ไม่สามารถถูกเปลี่ยนแปลงได้โดยปราศจากการรีเซ็ต the Backup domain.

The LSE clock อยู่ใน the Backup domain, ในขณะที่ the HSE และ LSI clocks ไม่ได้อยู่. ด้วยเหตุนี้ :
•    ถ้า LSE ถูกเลือกเป็น RTC clock:
      – The RTC ยังคงทำงานต่อไปแม้ว่า the VDD supply ถูก switched off, การจัดให้มี the VBAT supply ถูกค้ำจุนไว้.
•    ถ้า LSI ถูกเลือกเป็น Auto-Wakeup unit (AWU) clock:
      – The AWU state ไม่ถูกรับประกันถ้า the VDD supply ถูก powered off. อ้างอิงถึง Section 7.2.5: LSI clock สำหรับราย
      ละเอียดที่มากขึ้นบน LSI calibration
•    ถ้า the HSE clock หารด้วย 128 ถูกใช้เป็น the RTC clock:
      – The RTC state ไม่ถูกรับประกันถ้า the VDD supply ถูก powered off หรือถ้า the internal voltage regulator ถูก
      powered off (การถอดไฟออกจาก the 1.8 V domain).
      – The DPB bit (disable backup domain write protection) ใน the Power controller register ต้องถูกเซ็ตเป็น 1 (อ้างอิง
      ถึง Section 5.4.1: Power control register (PWR_CR)).
Title: Re: STM32F1 RCC
Post by: tha on November 11, 2020, 10:42:24 AM
7.2.9 Watchdog clock
ถ้า the Independent watchdog (IWDG) ถูก started โดยอย่างใดอย่างหนึ่ง hardware option หรือ software access , the LSI oscillator ถูกบังคับให้ ON และไม่สามารถถูกปิดการใช้งาน. หลังจาก the LSI oscillator temporization, the clock ถูกจัดให้กับ the IWDG.
Title: Re: STM32F1 RCC
Post by: tha on November 11, 2020, 10:48:51 AM
7.2.10 Clock-out capability
The microcontroller clock output (MCO) capability ยอมให้ the clock ถูก output ไปบน the external MCO pin. The configuration registers ของ the corresponding GPIO port ต้องถูกโปรแกรมใน alternate function mode. หนึ่งของ 4 clock signals สามารถถูกเลือกเป็น the MCO clock.
• SYSCLK
• HSI
• HSE
• PLL clock หารด้วย 2
การเลือกนี้ถูกควบคุมโดย the MCO[2:0] bits ของ the Clock configuration register (RCC_CFGR).
Title: Re: STM32F1 RCC
Post by: tha on November 12, 2020, 08:27:15 AM
7.3 RCC registers
อ้างอิงถึง Section 2.2 on page 45 สำหรับรายการตัวย่อที่ใช้ใน register descriptions

(https://i.imgur.com/EcSc99P.png)

Bits 31:26 Reserved, must be kept at reset value.

Bit 25 PLLRDY: PLL clock ready flag
เซ็ตโดย hardware เพื่อแสดงว่า the PLL ถูก locked.
     0: PLL unlocked
     1: PLL locked

Bit 24 PLLON: PLL enable
เซ็ตและเคลียร์โดย software เพื่อเปิดการใช้งาน PLL.
เคลียร์โดย hardware เมื่อเข้าสู่ Stop หรือ Standby mode. บิตนี้ไม่สมารถถูก reset ถ้า the PLL clock ถูกใช้เป็น system clock หรือถูกเลือกให้เป็น the system clock.
     0: PLL OFF
     1: PLL ON

Bits 23:20 Reserved, must be kept at reset value.

Bit 19 CSSON: Clock security system enable
เซ็ตและเคลียร์โดย software เพื่อเปิดการใช้งาน the clock security system. เมื่อ CSSON ถูก set, the clock detector ถูก enabled โดย hardware เมื่อ the HSE oscillator พร้อมแล้ว, และ disabled โดย hardware ถ้า a HSE clock failure ถูกตรวจจับได้.
     0: Clock detector OFF
     1: Clock detector ON (Clock detector ON ถ้า the HSE oscillator พร้อมแล้ว , OFF ถ้าไม่พร้อม).

Bit 18 HSEBYP: External high-speed clock bypass
เซ็ตและเคลียร์โดย software เพื่อข้ามผ่าน the oscillator ด้วย an external clock. The external clock ต้องถูก enabled ด้วย the HSEON bit เซ็ต, เพื่อถูกใช้โดย the device. The HSEBYP bit สามารถถูกเขียนได้เพียงถ้า the HSE oscillator ถูก disabled เท่านั้น.
     0: external 4-16 MHz oscillator not bypassed
     1: external 4-16 MHz oscillator bypassed with external clock

Bit 17 HSERDY: External high-speed clock ready flag
เซ็ตโดย hardware เพื่อแสดงว่า the HSE oscillator มีความเสถียร. บิตนี้ต้องการ 6 cycles ของ the HSE oscillator clock เพื่อตกลงหลังจาก HSEON reset.
     0: HSE oscillator not ready
     1: HSE oscillator ready

Bit 16 HSEON: HSE clock enable
เซ็ตและเคลียร์โดย software.
เคลียร์โดย hardware เพื่อหยุด the HSE oscillator เมื่อเข้าสู่ Stop หรือ Standby mode. บิตนี้ไม่สามารถถูกรีเซ็ตถ้า the HSE oscillator ถูกใช้โดยตรงหรือโดยอ้อมเป็น the system clock.
     0: HSE oscillator OFF
     1: HSE oscillator ON

Bits 15:8 HSICAL[7:0]: Internal high-speed clock calibration
บิตเหล่านี้ถูกเริ่มต้นโดยอัตโนมัติที่ startup.

Bits 7:3 HSITRIM[4:0]: Internal high-speed clock trimming
บิตเหล่านี้จัดให้มี an additional user-programmable trimming value ที่ถูกเพิ่มไปยัง the HSICAL[7:0] bits. มันสามารถถูกโปรแกรมเพื่อปรับการเปลี่ยนแปลงใน voltage และ temperature ที่มีผลต่อ the frequency ของ the internal HSI RC.
ค่าเริ่มต้นคือ 16 ซึ่งเมื่อเพิ่มเข้าไปใน the HSICAL value, ควรตัดแต่ง the HSI เป็น 8 MHz ? 1%. The trimming step (Fhsitrim) อยู่ที่ประมาณ 40 kHz ระหว่าง 2 HSICALsteps ซึ่งต่อเนื่องกันมา.

Bit 2 Reserved, must be kept at reset value.

Bit 1 HSIRDY: Internal high-speed clock ready flag
เซ็ตโดย hardware เพื่อแสดงว่า internal 8 MHz RC oscillator มีความเสถียร. หลังจาก the HSION bit ถูก cleared, HSIRDY ลงไป low หลังจาก 6 internal 8 MHz RC oscillator clock cycles.
     0: internal 8 MHz RC oscillator not ready
     1: internal 8 MHz RC oscillator ready

Bit 0 HSION: Internal high-speed clock enable
เซ็ตและเคลียร์โดย software.
เซ็ตโดย hardware เพื่อบังคับ the internal 8 MHz RC oscillator ON เมื่อออกจาก Stop หรือ Standby mode หรือในกรณีของความล้มเหลวของ the external 4-16 MHz oscillator ใช้โดยตรงหรือโดยอ้อมเป็น system clock. บิตนี้ไม่สามารถถูก reset ถ้า the internal 8 MHz RC ถูกใช้โดยตรงหรือโดยอ้อมเป็น system clock หรือถูกเลือกให้เป็น the system clock.
     0: internal 8 MHz RC oscillator OFF
     1: internal 8 MHz RC oscillator ON
Title: Re: STM32F1 RCC
Post by: tha on November 12, 2020, 10:05:28 AM
(https://i.imgur.com/yCFjBi3.png)

         1 or 2 wait states inserted only if the access occurs during clock source switch.
       (1 or 2 wait states ถูกแทรกเพียงถ้าการเข้าถึงเกิดขึ้นในระหว่าง clock source switch เท่านั้น.)

Bits 31:27 Reserved, must be kept at reset value.

Bits 26:24 MCO: Microcontroller clock output
เซ็ตและเคลียร์โดย software.
     0xx: No clock
     100: System clock (SYSCLK) ถูกเลือก
     101: HSI clock selected
     110: HSE clock selected
     111: PLL clock divided by 2 selected
Note: clock output นี้อาจมีบาง truncated cycles ที่ startup หรือในระหว่าง MCO clock source switching.
เมื่อ the System Clock ถูกเลือกเป็น output ไปยัง the MCO pin, ต้องทำให้แน่ใจว่า clock นี้ไม่เกิน 50 MHz (the maximum IO speed).

Bit 22 USBPRE: USB prescaler
เซ็ตและเคลียร์โดย software เพื่อสร้าง 48 MHz USB clock. บิตนี้ต้องเป็นผลก่อนการเปิดการใช้งาน the USB clock ใน the RCC_APB1ENR register. บิตนี้ไม่สามารถถูก reset ถ้า the USB clock ถูก enabled.
     0: PLL clock ถูกหารด้วย 1.5
     1: PLL clock ไม่ถูกหาร

Bits 21:18 PLLMUL: PLL multiplication factor
บิตเหล่านี้ถูกเขียนโดย soltware เพื่อกำหนด the PLL multiplication factor. บิตเหล่านี้สามารถถูกเขียนได้เพียงเมื่อ PLL ถูก disabled เท่านั้น.
ข้อควรระวัง: The PLL output frequency ต้องไม่เกิน 72 MHz.
     0000: PLL input clock x 2
     0001: PLL input clock x 3
     0010: PLL input clock x 4
     0011: PLL input clock x 5
     0100: PLL input clock x 6
     0101: PLL input clock x 7
     0110: PLL input clock x 8
     0111: PLL input clock x 9
     1000: PLL input clock x 10
     1001: PLL input clock x 11
     1010: PLL input clock x 12
     1011: PLL input clock x 13
     1100: PLL input clock x 14
     1101: PLL input clock x 15
     1110: PLL input clock x 16
     1111: PLL input clock x 16

Bit 17 PLLXTPRE: HSE divider for PLL entry
เซ็ตและเคลียร์โดย software เพื่อหาร HSE ก่อนการเข้าสู่ PLL . บิตนี้สามารถถูกเขียนได้เพียงเมื่อ PLL ถูก disabled เท่านั้น.
     0: HSE clock ไม่ถูกหาร
     1: HSE clock ถูกหารด้วย 2

Bit 16 PLLSRC: PLL entry clock source
เซ็ตและเคลียร์โดย software เพื่อเลือก PLL clock source . บิตนี้สามารถถูกเขียนได้เพียงเมื่อ PLL ถูก disabled เท่านั้น.
     0: HSI oscillator clock / 2 ถูกเลือกเป็น PLL input clock
     1: HSE oscillator clock ถูกเลือกเป็น PLL input clock

Bits 15:14 ADCPRE: ADC prescaler
เซ็ตและเคลียร์โดย software เพื่อเลือก the frequency ของ the clock ไปยัง the ADCs.
     00: PCLK2 ถูกหารด้วย 2
     01: PCLK2 divided by 4
     10: PCLK2 divided by 6
     11: PCLK2 divided by 8

Bits 13:11 PPRE2: APB high-speed prescaler (APB2)
เซ็ตและเคลียร์โดย software เพื่อควบคุม the division factor ของ the APB high-speed clock (PCLK2).
     0xx: HCLK ไม่ถูกหาร
     100: HCLK ถูกหารด้วย 2
     101: HCLK divided by 4
     110: HCLK divided by 8
     111: HCLK divided by 16

Bits 10:8 PPRE1: APB low-speed prescaler (APB1)
เซ็ตและเคลียร์โดย software เพื่อควบคุม the division factor ของ the APB low-speed clock (PCLK1).
คำเตือน: the software ต้องเซ็ตบิตเหล่านี้อย่างถูกต้องไม่ให้เกิน 36 MHz บน domain นี้.
     0xx: HCLK ไม่ถูกหาร
     100: HCLK ถูกหารด้วย 2
     101: HCLK divided by 4
     110: HCLK divided by 8
     111: HCLK divided by 16

Bits 7:4 HPRE: AHB prescaler
เซ็ตและเคลียร์โดย software เพื่อควบคุม the division factor ของ the AHB clock.
     0xxx: SYSCLK ไม่ถูกหาร
     1000: SYSCLK ถูกหารด้วย 2
     1001: SYSCLK divided by 4
     1010: SYSCLK divided by 8
     1011: SYSCLK divided by 16
     1100: SYSCLK divided by 64
     1101: SYSCLK divided by 128
     1110: SYSCLK divided by 256
     1111: SYSCLK divided by 512
Note: The prefetch buffer ต้องถูกเก็บไว้เมื่อใช้ a prescaler แตกต่างไปจาก 1 บน the AHB clock. อ้างอิงถึง Reading the Flash memory section สำหรับรายละเอียดที่มากขึ้น.

Bits 3:2 SWS: System clock switch status
เซ็ตและเคลียร์โดย hardware เพื่อแสดง clock source ที่ถูกใช้เป็น system clock.
     00: HSI oscillator ถูกใช้เป็น system clock
     01: HSE oscillator used as system clock
     10: PLL used as system clock
     11: ไม่สามารถใช้ได้

Bits 1:0 SW: System clock switch
เซ็ตและเคลียร์โดย software เพื่อเลือก SYSCLK source.
เซ็ตโดย hardware เพื่อบังคับให้เลือก HSI เมื่อออกจาก Stop หรือ Standby mode หรือในกรณีของความล้มเหลวของ the HSE oscillator ใช้โดยตรงหรือโดยอ้อมเป็น system clock. (ถ้า the Clock Security System ถูก enabled).
     00: HSI ถูกเลือกเป็น system clock
     01: HSE selected as system clock
     10: PLL selected as system clock
     11: ไม่ถูกอนุญาติ
Title: Re: STM32F1 RCC
Post by: tha on November 13, 2020, 08:20:45 AM
(https://i.imgur.com/ksUWFNE.png)

Bits 31:24 Reserved, must be kept at reset value.

Bit 23 CSSC: Clock security system interrupt clear
บิตนี้ถูกเซ็ตโดย software เพื่อเคลียร์ the CSSF flag.
     0: ไม่มีผลอะไร
     1: เคลียร์ CSSF flag

Bits 22:21 Reserved, must be kept at reset value.

Bit 20 PLLRDYC: PLL ready interrupt clear
บิตนี้ถูกเซ็ตโดย software เพื่อเคลียร์ the PLLRDYF flag.
     0: ไม่มีผลอะไร
     1: PLLRDYF ถูกเคลียร์

Bit 19 HSERDYC: HSE ready interrupt clear
บิตนี้ถูกเซ็ตโดย software เพื่อเคลียร์ the HSERDYF flag.
     0: ไม่มีผลอะไร
     1: HSERDYF ถูกเคลียร์

Bit 18 HSIRDYC: HSI ready interrupt clear
บิตนี้ถูกเซ็ตโดย software เพื่อเคลียร์ the HSIRDYF flag.
     0: ไม่มีผลอะไร
     1: HSIRDYF ถูกเคลียร์

Bit 17 LSERDYC: LSE ready interrupt clear
บิตนี้ถูกเซ็ตโดย software เพื่อเคลียร์ the LSERDYF flag.
     0: ไม่มีผลอะไร
     1: LSERDYF ถูกเคลียร์

Bit 16 LSIRDYC: LSI ready interrupt clear
บิตนี้ถูกเซ็ตโดย software เพื่อเคลียร์ the LSIRDYF flag.
     0: ไม่มีผลอะไร
     1: LSIRDYF ถูกเคลียร์

Bits 15:13 Reserved, must be kept at reset value.

Bit 12 PLLRDYIE: PLL ready interrupt enable
บิตนี้ถูกเซ็ตและเคลียร์โดย software เพื่อ enable/disable interrupt ที่เป็นเหตุโดย PLL lock.
     0: PLL lock interrupt ถูกปิดการใช้งาน
     1: PLL lock interrupt ถูกเปิดการใช้งาน

Bit 11 HSERDYIE: HSE ready interrupt enable
Set and cleared by software to enable/disable interrupt caused by the external 4-16 MHz oscillator stabilization.
     0: HSE ready interrupt disabled
     1: HSE ready interrupt enabled

Bit 10 HSIRDYIE: HSI ready interrupt enable
Set and cleared by software to enable/disable interrupt caused by the internal 8 MHz RC oscillator stabilization.
     0: HSI ready interrupt disabled
     1: HSI ready interrupt enabled

Bit 9 LSERDYIE: LSE ready interrupt enable
Set and cleared by software to enable/disable interrupt caused by the external 32 kHz oscillator stabilization.
     0: LSE ready interrupt disabled
     1: LSE ready interrupt enabled

Bit 8 LSIRDYIE: LSI ready interrupt enable
Set and cleared by software to enable/disable interrupt caused by internal RC 40 kHz
oscillator stabilization.
     0: LSI ready interrupt disabled
     1: LSI ready interrupt enabled

Bit 7 CSSF: Clock security system interrupt flag
เซ็ตโดย hardware เมื่อ a failure ถูกตรวจจับได้ใน the external 4-16 MHz oscillator.
ถูกเคลียร์โดย software โดยการเซ็ต the CSSC bit.
     0: ไม่มี clock security interrupt เหตุโดย HSE clock failure
     1: Clock security interrupt เหตุโดย HSE clock failure

Bits 6:5 Reserved, must be kept at reset value
.
Bit 4 PLLRDYF: PLL ready interrupt flag
เซ็ตโดย hardware เมื่อ the PLL locks และ PLLRDYDIE ถูก set.
ถูกเคลียร์โดย software โดยการเซ็ต the PLLRDYC bit.
     0: ไม่มี clock ready interrupt เหตุโดย PLL lock
     1: Clock ready interrupt เหตุโดย PLL lock

Bit3 HSERDYF: HSE ready interrupt flag
เซ็ตโดย hardware เมื่อ External High Speed clock มีความเสถียรและ HSERDYDIE ถูก set.
ถูกเคลียร์โดย software โดยการเซ็ต the HSERDYC bit.
     0: No clock ready interrupt caused by the external 4-16 MHz oscillator
     1: Clock ready interrupt caused by the external 4-16 MHz oscillator

Bit 2 HSIRDYF: HSI ready interrupt flag
Set by hardware when the Internal High Speed clock becomes stable and HSIRDYDIE is set.
Cleared by software setting the HSIRDYC bit.
     0: No clock ready interrupt caused by the internal 8 MHz RC oscillator
     1: Clock ready interrupt caused by the internal 8 MHz RC oscillator

Bit 1 LSERDYF: LSE ready interrupt flag
Set by hardware when the External Low Speed clock becomes stable and LSERDYDIE is set.
Cleared by software setting the LSERDYC bit.
     0: No clock ready interrupt caused by the external 32 kHz oscillator
     1: Clock ready interrupt caused by the external 32 kHz oscillator

Bit 0 LSIRDYF: LSI ready interrupt flag
Set by hardware when the internal low speed clock becomes stable and LSIRDYDIE is set.
Cleared by software setting the LSIRDYC bit.
     0: No clock ready interrupt caused by the internal RC 40 kHz oscillator
     1: Clock ready interrupt caused by the internal RC 40 kHz oscillator
Title: Re: STM32F1 RCC
Post by: tha on November 13, 2020, 08:33:48 AM
(https://i.imgur.com/vq17Xpl.png)
(https://i.imgur.com/XfoNVVh.png)
(https://i.imgur.com/ihIqe3E.png)
Title: Re: STM32F1 RCC
Post by: tha on November 13, 2020, 08:40:55 AM
(https://i.imgur.com/IiFVsTy.png)
(https://i.imgur.com/3q1tk0x.png)
(https://i.imgur.com/wDRV4kR.png)
Title: Re: STM32F1 RCC
Post by: tha on November 14, 2020, 08:12:40 AM
7.3.6 AHB peripheral clock enable register (RCC_AHBENR)
Address offset: 0x14
Reset value: 0x0000 0014
Access: no wait state, word, half-word and byte access
Note: เมื่อ the peripheral clock ไม่ทำงาน, the peripheral register values อาจไม่ถูกอ่านได้โดย software และ the returned value เป็น 0x0 เสมอ.

(https://i.imgur.com/zLVpWVN.png)

Bits 31:11 Reserved, must be kept at reset value.
Bit 10 SDIOEN: SDIO clock enable
เซ็ตและเคลียร์โดย software.
     0: SDIO clock ถูกปิดการใช้งาน
     1: SDIO clock ถูกเปิดการใช้งาน

Bits 9 Reserved, always read as 0.

Bit 8 FSMCEN: FSMC clock enable
Set and cleared by software.
     0: FSMC clock disabled
     1: FSMC clock enabled

Bit 7 Reserved, always read as 0.

Bit 6 CRCEN: CRC clock enable
Set and cleared by software.
     0: CRC clock disabled
     1: CRC clock enabled

Bit 5 Reserved, must be kept at reset value.

Bit 4 FLITFEN: FLITF clock enable
เซ็ตและเคลียร์โดย software เพื่อ disable/enable FLITF clock ในระหว่าง Sleep mode.
     0: FLITF clock ถูกปิดการใช้งานในระหว่าง Sleep mode
     1: FLITF clock ถูกเปิดการใช้งานในระหว่าง Sleep mode

Bit 3 Reserved, must be kept at reset value.

Bit 2 SRAMEN: SRAM interface clock enable
เซ็ตและเคลียร์โดย software เพื่อ disable/enable SRAM interface clock ในระหว่าง Sleep mode.
     0: SRAM interface clock ถูกปิดการใช้งานในระหว่าง Sleep mode.
     1: SRAM interface clock ถูกเปิดการใช้งานในระหว่าง Sleep mode

Bit 1 DMA2EN: DMA2 clock enable
Set and cleared by software.
     0: DMA2 clock disabled
     1: DMA2 clock enabled

Bit 0 DMA1EN: DMA1 clock enable
Set and cleared by software.
     0: DMA1 clock disabled
     1: DMA1 clock enabled

ปล. ตามกันทันมั๊ย ช้าหรือเร็วไปก็บอกกันมา เข้าหน้าหนาวแล้ว อากาศกำลังเย็นสบายก็ไปได้เรื่อยๆครับ
Title: Re: STM32F1 RCC
Post by: tha on November 14, 2020, 08:22:24 AM
7.3.7 APB2 peripheral clock enable register (RCC_APB2ENR)
Address: 0x18
Reset value: 0x0000 0000
Access: word, half-word and byte access

ไม่มี wait states, ยกเว้นถ้าการเข้าถึงเกิดขึ้นขณะที่การเข้าถึง a peripheral ใน the APB2 domain กำลังดำเนินการอยู่. ในกรณีนี้, wait states จะถูกแทรกจนกระทั่งการเข้าถึง APB2 peripheral ถูกทำให้สำเร็จลง.

Note: เมื่อ the peripheral clock ไม่ทำงาน, the peripheral register values อาจไม่ถูกอ่านได้โดย software และ the returned value เป็น 0x0 เสมอ.

(https://i.imgur.com/xPvQaoJ.png)
(https://i.imgur.com/Spck5DJ.png)


Title: Re: STM32F1 RCC
Post by: tha on November 14, 2020, 08:42:55 AM
7.3.8 APB1 peripheral clock enable register (RCC_APB1ENR)
Address: 0x1C
Reset value: 0x0000 0000
Access: word, half-word and byte access

ไม่มี wait states, ยกเว้นถ้าการเข้าถึงเกิดขึ้นขณะที่การเข้าถึง a peripheral ใน the APB1 domain กำลังดำเนินการอยู่. ในกรณีนี้, wait states จะถูกแทรกจนกระทั่งการเข้าถึง APB1 peripheral ถูกทำให้สำเร็จลง.

Note: เมื่อ the peripheral clock ไม่ทำงาน, the peripheral register values อาจไม่ถูกอ่านได้โดย software และ the returned value เป็น 0x0 เสมอ.

(https://i.imgur.com/tlALvba.png)
(https://i.imgur.com/IeFq2Jf.png)
(https://www.img.in.th/images/d37126b2118cc8b5136e452cc2b01fd4.png)

Title: Re: STM32F1 RCC
Post by: tha on November 14, 2020, 12:15:50 PM
7.3.9 Backup domain control register (RCC_BDCR)
Address offset: 0x20
Reset value: 0x0000 0000, reset by Backup domain Reset.
Access: 0 ≤ wait state ≤ 3, word, half-word and byte access
Wait states ถูกแทรกในกรณีของการเข้าถึงอย่างต่อเนื่องไปยัง register นี้

Note: The LSEON, LSEBYP, RTCSEL and RTCEN bits ของ the Backup domain control register (RCC_BDCR) อยู่ใน the Backup domain. ผลที่ตามมา, หลังจาก Reset, บิตเหล่านี้ถูกป้องกันการเขียนและ the DBP bit ใน the Power control register (PWR_CR) ต้องถูกเซ็ตก่อนบิตเหล่านี้สามารถถูกแก้ไข. อ้างอิงถึง Section 5: Power control (PWR) สำหรับข้อมูลเพิ่มเติม. บิตเหล่านี้ถูกรีเซ็ตได้เพียงหลังจาก a Backup domain Reset (ดู Section 7.1.3: Backup domain reset). internal or external Reset ใดๆจะไม่มีผลใดๆบนบิตเหล่านี้

(https://i.imgur.com/HbVCXVM.png)

Bits 31:17 Reserved, must be kept at reset value.

Bit 16 BDRST: Backup domain software reset
เซ็ตและเคลียร์โดย software.
     0: Reset ไม่ได้ทำงาน
     1: รีเซ็ต the entire Backup domain

Bit 15 RTCEN: RTC clock enable
เซ็ตและเคลียร์โดย software
     0: RTC clock ถูกปิดการใช้งาน
     1: RTC clock ถูกเปิดการใช้งาน

Bits 14:10 Reserved, must be kept at reset value.

Bits 9:8 RTCSEL[1:0]: RTC clock source selection
เซ็ตโดย software เพื่อเลือก the clock source สำหรับ the RTC. เมื่อOnce the RTC clock source ถูกเลือกแล้วจะไม่สามารถเปลี่ยนแปลงได้อีกต่อไปเว้นแต่ the Backup domain ถูกรีเซ็ต. The BDRST bit สามารถถูกใช้เพื่อรีเซ็ตมัน.
     00: No clock
     01: LSE oscillator clock ใช้เป็น RTC clock
     10: LSI oscillator clock used as RTC clock
     11: HSE oscillator clock หารด้วย 128 used as RTC clock

Bits 7:3 Reserved, must be kept at reset value.

Bit 2 LSEBYP: External low-speed oscillator bypass
เซ็ตและเคลียร์โดย software เพื่อข้ามผ่าน oscillator ใน debug mode. บิตนี้สามารถถูกเขียนได้เพียงเมื่อ the external 32 kHz oscillator ถูกปิดการใช้งาน.
     0: LSE oscillator ไม่ถูกข้ามผ่าน
     1: LSE oscillator ถูกข้ามผ่าน

Bit 1 LSERDY: External low-speed oscillator ready
เซ็ตและเคลียร์โดย hardware เพื่อแสดงเมื่อ the external 32 kHz oscillator มีความเสถียร. หลังจาก the LSEON bit ถูกเคลียร์, LSERDY ลงไป low หลังจาก 6 external low-speed oscillator clock cycles.
     0: External 32 kHz oscillator not ready
     1: External 32 kHz oscillator ready

Bit 0 LSEON: External low-speed oscillator enable
Set and cleared by software.
     0: External 32 kHz oscillator OFF
     1: External 32 kHz oscillator ON
Title: Re: STM32F1 RCC
Post by: tha on November 14, 2020, 01:05:43 PM
7.3.10 Control/status register (RCC_CSR)
Address: 0x24
Reset value: 0x0C00 0000, รีเซ็ต system Reset, เว้นแต่ reset flags โดย power Reset เท่านั้น.
Access: 0 ≤ wait state ≤ 3, word, half-word and byte access
Wait states ถูกแทรกในกรณีของการเข้าถึงอย่างต่อเนื่องไปยัง register นี้

(https://i.imgur.com/mk5q0cU.png)

Bit 31 LPWRRSTF: Low-power reset flag
เซ็ตโดย hardware เมื่อ a Low-power management reset เกิดขึ้น.
เคลียร์โดยการเขียนไปยัง the RMVF bit.
     0: ไม่มี Low-power management reset เกิดขึ้น
     1: Low-power management reset เกิดขึ้น
สำหรับข้อมูลเพิ่มเติมบน Low-power management reset, อ้างอิงถึง Low-power management reset.

Bit 30 WWDGRSTF: Window watchdog reset flag
เซ็ตโดย hardware เมื่อ a window watchdog reset เกิดขึ้น.
เคลียร์โดยการเขียนไปยัง the RMVF bit.
     0: No window watchdog reset occurred
     1: Window watchdog reset occurred

Bit 29 IWDGRSTF: Independent watchdog reset flag
เซ็ตโดย hardware เมื่อ an independent watchdog reset จาก VDD domain เกิดขึ้น.
เคลียร์โดยการเขียนไปยัง the RMVF bit.
     0: No watchdog reset occurred
     1: Watchdog reset occurred

Bit 28 SFTRSTF: Software reset flag
Set by hardware when a software reset occurs.
Cleared by writing to the RMVF bit.
     0: No software reset occurred
     1: Software reset occurred

Bit 27 PORRSTF: POR/PDR reset flag
Set by hardware when a POR/PDR reset occurs.
Cleared by writing to the RMVF bit.
     0: No POR/PDR reset occurred
     1: POR/PDR reset occurred

Bit 26 PINRSTF: PIN reset flag
เซ็ตโดย hardware เมื่อ a reset จาก the NRST pin เกิดขึ้น.
Cleared by writing to the RMVF bit.
     0: No reset from NRST pin occurred
     1: Reset from NRST pin occurred

Bit 25 Reserved, must be kept at reset value.

Bit 24 RMVF: Remove reset flag
เซ็ตโดย software เพื่อเคลียร์ the reset flags.
     0: No effect
     1: Clear the reset flags

Bits 23:2 Reserved, must be kept at reset value.

Bit 1 LSIRDY: Internal low-speed oscillator ready
เซ็ตและเคลียร์โดย hardware เพื่อแสดงเมื่อ  the internal RC 40 kHz oscillator มีความเสถียร. หลังจาก the LSION bit ถูกเคลียร์, LSIRDY ลงไป low หลังจาก 3 internal RC 40 kHz oscillator clock cycles.
     0: Internal RC 40 kHz oscillator not ready
     1: Internal RC 40 kHz oscillator ready

Bit 0 LSION: Internal low-speed oscillator enable
Set and cleared by software.
     0: Internal RC 40 kHz oscillator OFF
     1: Internal RC 40 kHz oscillator ON
Title: Re: STM32F1 RCC
Post by: tha on November 14, 2020, 01:10:59 PM
(https://i.imgur.com/R5QGgQY.png)
(https://i.imgur.com/Hnklnwa.png)