Page 5
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port B Pull-Up Selection Register – PBPUR ................121 Port B Pull-Down Selection Register – PBPDR ................122 Port B Open Drain Selection Register – PBODR ................. 123 Port B Output Current Drive Selection Register – PBDRVR ............124 Port B Lock Register –...
Page 6
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 EXTI Interrupt Software Set Command Register – EXTISSCR ............ 148 EXTI Interrupt Wakeup Control Register – EXTIWAKUPCR ............149 EXTI Interrupt Wakeup Polarity Register – EXTIWAKUPPOLR ........... 150 EXTI Interrupt Wakeup Flag Register – EXTIWAKUPFLG ............151 12 Analog to Digital Converter (ADC) ..............
Nested Vectored Interrupt Controller (NVIC), SysTick timer, and including advanced debug support. The devices operate at a frequency of up to 40 MHz for HT32F52220/52230 with a Flash accelerator to obtain maximum efficiency. It provides up to 32 KB of embedded Flash memory for code/data storage and 4 KB of embedded SRAM memory for system operation and application program usage.
Features ▄ Core ● 32-bit Arm ® Cortex ® -M0+ processor core ● Up to 40MHz operating frequency for HT32F52220/52230 ● 0.93 DMIPS/MHz (Dhrystone v2.1) ● Single-cycle multiplication ● Integrated Nested Vectored Interrupt Controller (NVIC) ● 24-bit SysTick timer ▄...
Page 19
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 ▄ Analog to Digital Converter – ADC ● 12-bit SAR ADC engine ● Up to 1 MSPS conversion rate – 1 μs at 28 MHz, 1.4 μs at 40 MHz ● Up to 8 external analog input channels ▄...
Page 20
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 ▄ Serial Peripheral Interface – SPI ● Supports both master and slave mode ● Frequency of up to (f /2) MHz for master mode and (f /3) MHz for slave mode PCLK PCLK ●...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Device Information Table 1. Features and Peripheral List Peripherals HT32F52220 HT32F52230 Main Flash (KB) Option Bytes Flash (KB) SRAM (KB) GPTM SCTM Timers BFTM USART Communication UART EXTI 12-bit ADC Number of channels...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Document Conventions The conventions used in this document are shown in the following table. Table 2. Document Conventions Notation Example Description The number string with a 0x prefix indicates a hexadecimal 0x5a05 number.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 System Architecture The system architecture of devices that includes the Arm ® Cortex ® -M0+ processor, bus architecture and memory organization will be described in the following sections. The Cortex ® -M0+ is a next generation processor core which offers many new features.
Figure 2. Cortex -M0+ Block Diagram ® Bus Architecture The HT32F52220/HT32F52230 series consists of one master and four slaves in the bus architecture. The Cortex ® -M0+ AHB-Lite bus is the master while the internal SRAM access bus, the internal Flash memory access bus, the AHB peripherals access bus and the AHB to APB bridges are the slaves.
-M0+ system peripherals. Refer to the Arm ® Cortex ® -M0+ Technical Reference Manual for more information. The following figure shows the memory map of HT32F52220/HT32F52230 series of devices, including Code, SRAM, peripheral, and other pre- defined regions. Rev. 1.10 26 of 366 November 09, 2018...
Programming (IAP) or In Circuit Programming (ICP). For more information, refer to the Flash Memory Controller section. Embedded SRAM Memory The HT32F52220/HT32F52230 series contain up to 4 KB on-chip SRAM which is located at address 0x2000_0000. It support byte, half-word and word access operations. AHB Peripherals The address of the AHB peripherals ranges from 0x4008_0000 to 0x400F_FFFF.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Flash Memory Controller (FMC) Introduction The Flash Memory Controller, FMC, provides all the necessary flash operation functions and pre- fetch buffer for the embedded on-chip Flash memory. Figure below shows the block diagram of the FMC which includes programming interface, control register, pre-fetch buffer and access interface.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Functional Descriptions Flash Memory Map The following figure is the Flash memory map of the system. The address ranges from 0x0000_0000 to 0x1FFF_FFFF (0.5 GB). The address from 0x1F00_0000 to 0x1F00_07FF is mapped to Boot Loader Block (2 KB).
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Flash Memory Architecture The Flash memory consists of up to 32 KB main Flash with 1 KB per page and 2 KB Information Block for Boot Loader. The main Flash memory contains a total of 32 pages (or 16 pages for 16 KB device) which can be erased individually.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Booting Configuration The system provides two kinds of boot modes which can be selected using the BOOT pin. The BOOT pin is sampled during a power-on reset or system reset. Once the logic value is decided, the first 4 words of vector will be remapped to the corresponding source according to the boot modes.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Page Erase The FMC provides a page erase function which is used to initialize the contents of the specific Flash memory page. Each page can be erased independently without affecting the contents of other pages.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Mass Erase The FMC provides a mass erase function which is used to initialize all the main Flash memory contents to a high state. The following steps show the mass erase operation register access sequence.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Word Programming The FMC provides a 32-bit word programming function which is used to modify the specific Flash memory word contents. The following steps show the word programming operation register access sequence.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Option Byte Description The Option Byte region can be treated as an independent Flash memory in which the base address is 0x1FF0_0000. The following table shows the functional description and the Option Byte memory map.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Page Erase/Program Protection The FMC provides the page erase/program protection function to prevent unexpected operation of the Flash memory. The page erase (CMD [3:0] = 0x8 in the OCMR register) or word program (CMD [3:0] = 0x4) command will not be accepted by the FMC on the protected pages.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Security Protection The FMC provides a Security protection function to prevent an illegal code/data access of the Flash memory. This function is useful for protecting the software / firmware from the illegal users. The function is activated by configuring the Option Byte OB_CP [0] bit. Once the function has been enabled, all the main Flash data access through ICP/Debug mode, programming and page erase operation will not be allowed except via the user’s application.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Flash Write Data Register – WRDR This register specifies the data to be written for programming operation. Offset: 0x004 Reset value: 0x0000_0000 WRDB Type/Reset 0 RW 0 RW 0 RW 0 RW...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Flash Operation Command Register – OCMR This register is used to specify the Flash operation commands that include word program, page erase and mass erase. Offset: 0x00C Reset value: 0x0000_0000 Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Flash Operation Control Register – OPCR This register is used for controlling the command commitment and checking the status of the FMC operations. Offset: 0x010 Reset value: 0x0000_000C Reserved Type/Reset Reserved Type/Reset...
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Flash Operation Interrupt Enable Register – OIER This register is used to enable or disable the FMC interrupt function. The FMC generates interrupts to the controller when corresponding interrupt enable bits are set. Offset:...
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Flash Operation Interrupt and Status Register – OISR This register indicates the FMC interrupt status which is used to check if a Flash operation has been finished or an error occurs. The status bits, bit [4:0], are available when the corresponding bits in the OIER register are set.
Page 47
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions ITADF Invalid Target Address Flag 0: The target address is valid 1: The target address is invalid The data in the TADR field must be in the range from 0x0000_0000 to 0x1FFF_ FFFF.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Flash Security Protection Status Register – CPSR This register indicates the Flash Memory Security protection status. The content of this register is not dynamically updated and will only be reloaded by the Option Byte loader which is active when any kind of reset occurs.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Flash Vector Mapping Control Register – VMCR This register is used to control the vector mapping. The reset value of the VMCR register is determined by the external BOOT pin during the power-on reset period.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Flash Manufacturer and Device ID Register – MDID This register is used to store the manufacture ID and device part number information which can be used as the product identity. Offset: 0x180...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Device ID Register – DID This register is used to store the device part number information which can be used as the product identity. Offset: 0x18C Reset value: 0x000X_XXXX Reserved Type/Reset Reserved...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Flash Pre-fetch Control Register – CFCR This register is used to control the FMC pre-fetch module. Offset: 0x200 Reset value: 0x0000_0011 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Reserved PFBE Reserved WAIT Type/Reset...
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Custom ID Register n – CIDRn ( n = 0 ~3) This register is used to store the custom ID information which can be used as the custom identity. Offset: 0x310 (0) ~ 0x31C (3) Reset value: Various depending on Flash Manufacture Privilege Information Block.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Power Control Unit (PWRCU) Introduction The power consumption can be regarded as one of the most important issues for many embedded system applications. Accordingly the Power Control Unit, PWRCU, provides many types of power saving modes such as Sleep, Deep-Sleep1, Deep-Sleep2, and Power-Down modes.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Features ▄ Two power domains: V 3.3 V and V 1.5 V power domains. DD15 ▄ Four power saving modes: Sleep, Deep-Sleep1, Deep-Sleep2 and Power-Down modes. ▄ Internal Voltage regulator supplies 1.5 V voltage source.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Power On Reset (POR) / Power Down Reset (PDR) The device has an integrated POR/PDR circuitry that allows proper operation starting from/down to 2.0 V. The device remains in Power-Down mode when V is below a specified threshold V without the need for an external reset circuit.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 High Speed External Oscillator The High Speed External Oscillator, HSE, is located in the V power domain. The HSE crystal oscillator can be switched on or off using the HSEEN bit in the Global Clock Control Register, GCCR.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Sleep Mode By default, only the CPU clock will be stopped in the Sleep mode. Clearing the FMCEN or SRAMEN bit in the CKCU AHBCCR register to 0 will have the effect of stopping the Flash clock or SRAM clock after the system enters the Sleep mode.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Power-Down Mode The Power-Down mode is derived from the Deep-Sleep mode of the CPU together with the additional control bits LDOOFF and DMOSON. To enter the Power-Down mode, users can configure the registers shown in the preceding Mode-Entering table and execute the WFI or WFE instruction.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Register Descriptions Power Control Status Register – PWRSR This register indicates the power control status. Offset: 0x100 Reset value: 0x0000_0001 (Reset only by V domain power on reset) Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Power Control Register – PWRCR This register provides power control bits for the different kinds of power saving modes. Offset: 0x104 Reset value: 0x0000_0000 (Reset only by V domain power on reset)
Page 65
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions WUPEN External WAKEUP Pin Enable 0: Disable WAKEUP pin function. 1: Enable WAKEUP pin function. The Software can set the WUPEN bit as 1 to enable the WAKEUP pin function before entering the power saving mode.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Power Domain Test Register – PWRTEST This register specifies a read-only value for the software to recognize whether V Power Domain is ready for access. Offset: 0x108 Reset value: 0x0000_0027 Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Low Voltage / Brown Out Detect Control and Status Register – LVDCSR This register specifies flags, enable bits and option bits for low voltage detector. Offset: 0x110 Reset value: 0x0000_0000 (Reset only by V...
Page 68
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [16] LVDEN Low Voltage Detect Enable 0: Disable Low Voltage Detect 1: Enable Low Voltage Detect Setting this bit to 1 will generate a LVD event when the V power is lower than the voltage set by LVDS bits.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 The HSE crystal oscillator can be switched on or off using the HSEEN bit in the Global Clock Control Register (GCCR). The HSERDY flag in the Global Clock Status Register (GCSR) will indicate if the high-speed external crystal oscillator is stable. When switching on the HSE oscillator, the HSE clock will still not be released until this HSERDY bit is set by the hardware.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Phase Locked Loop – PLL This PLL can provide 4 ~ 48 MHz clock output which is 1~12 multiples of a fundamental reference frequency of 4 ~ 16 MHz. The rationale of the clock synthesizer relies on the digital Phase Locked...
Cortex ® -M0+ MCU HT32F52220/HT32F52230 System Clock (CK_SYS) Selection After the system reset occurs, the default system clock source, CK_SYS, will be the high speed internal RC oscillator, HSI. The CK_SYS may come from the HSI, HSE, LSI or PLL output clock and it can be switched from one clock source to another by configuring the System Clock Switch bits SW in the Global Clock Control Register, GCCR.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 HSE Clock Monitor The HSE Clock Monitor main function is enabled by the HSE Clock Monitor Enable bit CKMEN in the Global Clock Control Register, GCCR. The HSE clock monitor function should be enabled after the HSE oscillator start-up delay and disabled when the HSE oscillator is stopped.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Register Map The following table shows the CKCU register and reset value. Table 18. CKCU Register Map Register Offset Description Reset Value GCFGR 0x000 Global Clock Configuration Register 0x0000_0102 GCCR 0x004 Global Clock Control Register...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Global Clock Control Register – GCCR This register specifies the clock enable bits. Offset: 0x004 Reset value: 0x0000_0803 Reserved Type/Reset Reserved PSRCEN CKMEN Type/Reset 0 RW Reserved HSIEN HSEEN PLLEN HSEGAIN Type/Reset...
Page 81
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions PLLEN PLL Enable 0: PLL is disabled 1: PLL is enabled Set and reset by software. This bit cannot be reset if the PLL clock is used as the system clock.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions FMCEN Flash Memory Controller Clock Enable 0: FMC clock is automatically disabled by hardware during Sleep mode 1: FMC clock is always enabled during Sleep mode Set and reset by software. User can set the FMCEN bit to 0 to reduce the power consumption if the Flash Memory is unused during the Sleep mode.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 MCU Debug Control Register – MCUDBGCR This register specifies the MCU debug control. Offset: 0x304 Reset value: 0x0000_0000 Reserved Type/Reset DBSCTM1 DBSCTM0 Reserved DBUR Reserved DBBFTM Type/Reset 0 RW Reserved DBDSLP2 Reserved...
Page 97
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions DBUSR USART Debug Mode Enable 0: Same behavior as in normal mode 1: USART FIFO timeout is frozen when the core is halted Set and reset by software. DBGPTM...
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Reset Control Unit (RSTCU) Introduction The Reset Control Unit, RSTCU, has three kinds of reset, the power on reset, system reset and APB unit reset. The power on reset, known as a cold reset, resets the full system during a power up.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Functional Descriptions Power On Reset The Power on reset, POR, is generated by either an external reset or the internal reset generator. Both types have an internal filter to prevent glitches from causing erroneous reset operations. By referring to Figure 17, the POR15 active low signal will be de-asserted when the internal LDO voltage regulator is ready to provide 1.5 V power.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Register Map The following table shows the RSTCU registers and reset values. Table 19. RSTCU Register Map Register Offset Description Reset Value RSTCU Base Address = 0x4008_8000 GRSR 0x100 Global Reset Status Register...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions NVICRSTF NVIC Reset Flag 0: No NVIC asserting system reset occurred 1: NVIC asserting system reset occurred This bit is set by hardware when a system reset occurs and reset by writing 1 into it or by hardware when a power on reset occurs.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 General Purpose I/O (GPIO) Introduction There are up to 23 General Purpose I/O port, GPIO, named PA0~PA7, PA9, PA12~PA15, PB0~PB4, PB7~PB8 and PB12~PB14 for the device to implement the logic input/output functions. Each of the GPIO ports has related control and configuration registers to satisfy the requirement of specific applications.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Features ▄ Input/output direction control ▄ Schmitt Trigger Input function enable control ▄ Input weak pull-up/pull-down control ▄ Output push-pull/open drain enable control ▄ Output set/reset control ▄ Output drive current selection ▄...
Cortex ® -M0+ MCU HT32F52220/HT32F52230 GPIO Locking Mechanism The GPIO also offers a lock function to lock the port until a reset event occurs. The PxLOCKR (x = A ~ B) registers are used to lock the port x and lock control options. The value 0x5FA0 is written...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Register Descriptions Port A Data Direction Control Register – PADIRCR This register is used to control the direction of the GPIO Port A pin as input or output. Offset: 0x000 Reset value: 0x0000_0000...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port A Input Function Enable Control Register – PAINER This register is used to enable or disable the GPIO Port A input function. Offset: 0x004 Reset value: 0x0000_0200 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port A Pull-Up Selection Register – PAPUR This register is used to enable or disable the GPIO Port A pull-up function. Offset: 0x008 Reset value: 0x0000_3200 Reserved Type/Reset Reserved Type/Reset PAPU Reserved...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port A Pull-Down Selection Register – PAPDR This register is used to enable or disable the GPIO Port A pull-down function. Offset: 0x00C Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset PAPD Reserved...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port A Open Drain Selection Register – PAODR This register is used to enable or disable the GPIO Port A open drain function. Offset: 0x010 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port A Data Input Register – PADINR This register specifies the GPIO Port A input data. Offset: 0x01C Reset value: 0x0000_3200 Reserved Type/Reset Reserved Type/Reset PADIN Reserved PADIN Reserved Type/Reset 0 RO...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port A Output Data Register – PADOUTR This register specifies the GPIO Port A output data. Offset: 0x020 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset PADOUT Reserved PADOUT Reserved Type/Reset 0 RW...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port A Output Set/Reset Control Register – PASRR This register is used to set or reset the corresponding bit of the GPIO Port A output data. Offset: 0x024 Reset value: 0x0000_0000 PARST...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port A Output Reset Register – PARR This register is used to reset the corresponding bit of the GPIO Port A output data. Offset: 0x028 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port B Data Direction Control Register – PBDIRCR This register is used to control the direction of GPIO Port B pin as input or output. Offset: 0x000 Reset value: 0x0000_0000 Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port B Input Function Enable Control Register – PBINER This register is used to enable or disable the GPIO Port B input function. Offset: 0x004 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port B Pull-Up Selection Register – PBPUR This register is used to enable or disable the GPIO Port B pull-up function. Offset: 0x008 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved PBPU...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port B Pull-Down Selection Register – PBPDR This register is used to enable or disable the GPIO Port B pull-down function. Offset: 0x00C Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved PBPD...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port B Open Drain Selection Register – PBODR This register is used to enable or disable the GPIO Port B open drain function. Offset: 0x010 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port B Data Input Register – PBDINR This register specifies the GPIO Port B input data. Offset: 0x01C Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved PBDIN Reserved PBDIN Type/Reset 0 RO...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port B Output Data Register – PBDOUTR This register specifies the GPIO Port B output data. Offset: 0x020 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved PBDOUT Reserved PBDOUT Type/Reset 0 RW...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port B Output Set/Reset Control Register – PBSRR This register is used to set or reset the corresponding bit of the GPIO Port B output data. Offset: 0x024 Reset value: 0x0000_0000 Reserved...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Port B Output Reset Register – PBRR This register is used to reset the corresponding bit of the GPIO Port B output data. Offset: 0x028 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Alternate Function Input/Output Control Unit (AFIO) Introduction In order to expand the flexibility of the GPIO or the usage of peripheral functions, each IO pin can be configured to have up to sixteen different functions such as GPIO or IP functions by setting the GPxCFGLR or GPxCFGHR register where x is the different port name.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Features ▄ APB slave interface for register access ▄ EXTI source selection ▄ Configurable pin function for each GPIO, up to sixteen alternative functions on each pin ▄ AFIO lock mechanism Functional Descriptions External Interrupt Pin Selection The GPIO pins are connected to the 16 EXTI lines as shown in the accompanying figure.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Alternate Function Up to sixteen alternative functions can be chosen for each I/O pad by setting the PxCFGn [3:0] field in the GPxCFGLR or GPxCFGHR (n = 0~15, x = A~ B) registers. If the pin is selected as an unavailable item which is noted as a “N/A”...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 GPIO x Configuration Low Register – GPxCFGLR, x = A, B This low register specifies the alternate function of GPIO Port x. x = A, B Offset: 0x020, 0x028 Reset value: 0x0000_0000...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 GPIO x Configuration High Register – GPxCFGHR, x = A, B This high register specifies the alternate function of GPIO Port x. x = A, B Offset: 0x024, 0x02C Reset value: 0x0000_0000...
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Nested Vectored Interrupt Controller (NVIC) Introduction In order to reduce the latency and increase the interrupt processing efficiency, a tightly coupled integrated section, which is named as Nested Vectored Interrupt Controller (NVIC) is provided by the Cortex -M0+.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Function Descriptions SysTick Calibration The SysTick Calibration Value Register (SCALIB) is provided by the NVIC to give a reference time base of 1ms for the RTOS tick timer or other purpose. The TENMS field in the SCALIB register...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 External Interrupt/Event Controller (EXTI) Introduction The External Interrupt/Event Controller, EXTI, comprises 16 edge detectors which can generate a wake-up event or interrupt requests independently. In interrupt mode there are five trigger types...
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Function Descriptions Wakeup Event Management In order to wakeup the system from the power saving mode, the EXTI controller provides a function which can monitor external events and send them to the CPU core and the Clock Control Unit, CKCU.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 External Interrupt/Event Line Mapping All GPIO pins can be selected as EXTI trigger sources by configuring the EXTInPIN [3:0] field in the AFIO ESSRn (n = 0 ~ 1) register to trigger an interrupt or event. Refer to the AFIO section for more details.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Register Descriptions EXTI Interrupt Configuration Register n – EXTICFGRn, n = 0 ~ 15 This register is used to specify the debounce function and select the trigger type. Offset: 0x000 (0) ~ 0x03C (15)
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 EXTI Interrupt Control Register – EXTICR This register is used to control the EXTI interrupt. Offset: 0x040 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset EXTI15EN EXTI14EN EXTI13EN EXTI12EN EXTI11EN EXTI10EN EXTI9EN EXTI8EN...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 EXTI Interrupt Edge Flag Register – EXTIEDGEFLGR This register is used to indicate if an EXTI edge has been detected. Offset: 0x044 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset EXTI15EDF EXTI14EDF EXTI13EDF EXTI12EDF EXTI11EDF EXTI10EDF EXTI9EDF EXTI8EDF...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 EXTI Interrupt Wakeup Control Register – EXTIWAKUPCR This register is used to control the EXTI interrupt and wakeup function. Offset: 0x050 Reset value: 0x0000_0000 EVWUPIEN Reserved Type/Reset Reserved Type/Reset EXTI15WEN EXTI14WEN EXTI13WEN EXTI12WEN EXTI11WEN EXTI10WEN EXTI9WEN EXTI8WEN...
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Analog to Digital Converter (ADC) Introduction A 12-bit multi-channel Analog to Digital Converter is integrated in the device. There are a total of 10 multiplexed channels including 8 external channels on which the external analog signal can be supplied and 2 internal channels.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Features ▄ 12-bit SAR ADC engine ▄ Up to 1 MSPS conversion rate ▄ 8 external analog input channels ▄ 2 internal analog input channels for reference voltage detection ▄ Programmable sampling time for conversion channel ▄...
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Function Descriptions ADC Clock Setup The ADC clock, CK_ADC, is provided by the Clock Controller, which is synchronous and divided by with the AHB clock known as HCLK. Refer to the Clock Control Unit chapter for more details.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Conversion (ex: Sequence Length=8) Cycle Cycle Start of Conversion Single sample End of Conversion Cycle End of Conversion Figure 26. One Shot Conversion Mode Continuous Conversion Mode In the Continuous Conversion Mode, repeated conversion cycle will start automatically without requiring additional A/D start trigger signals after a channels group conversion has completed.
Page 156
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Discontinuous Conversion Mode The A/D converter will operate in the Discontinuous Conversion Mode for channels group when the A/D conversion mode bit field ADMODE [1:0] in the ADCCONV register is set to 0x3. The group to be converted can have up to 8 channels and can be arranged in a specific sequence by configuring the ADCLSTn registers where n ranges from 0 to 1.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Discontinuous Conversion Mode (ex: Sequence Length=8, Subgroup Length=3 ) Cycle Cycle Subgroup 0 Subgroup 1 Subgroup 2 Subgroup 0 Start of Conversion Single sample End of Conversion Subgroup End of Conversion Cycle End of Conversion Figure 28.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Sampling Time Setting The conversion channel sampling time can be programmed according to the input resistance of the input voltage source. This sampling time must be enough for the input voltage source to charge the internal sample and hold capacitor in the A/D converter to the input voltage level.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Interrupts When an A/D conversion is completed, an End of Conversion EOC event will occur. There are three kinds of EOC events which are known as single sample EOC, subgroup EOC and cycle EOC for A/D conversion.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Register Descriptions ADC Conversion Control Register – ADCCR This register specifies the mode setting, sequence length, and subgroup length of the ADC conversion mode. Note that once the content of ADCCR is changed, the conversion in progress will be aborted and the A/D converter will return to idle state.
Page 162
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [1:0] ADMODE ADC Conversion Mode ADMODE [1:0] Mode Descriptions After a start trigger, the conversion will be One shot mode executed on the specific channels for the whole conversion sequence once.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 ADC Conversion Data Register y – ADCDRy, y = 0 ~ 7 This register is used to store the conversion data of the ADC conversion sequence order No.y which is specified by the ADSEQy field in the ADCLSTn (n=0~1) registers.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 ADC Trigger Source Register – ADCTSR This register contains the trigger source selection and the software trigger bit of the conversion. Offset: 0x074 Reset value: 0x0000_0000 Reserved Type/Reset 0 RW 0 RW...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 ADC Watchdog Control Register – ADCWCR This register provides the control bits and status of the ADC watchdog function. Offset: 0x078 Reset value: 0x0000_0000 Reserved ADUCH Type/Reset 0 RO 0 RO 0 RO...
Cortex ® -M0+ MCU HT32F52220/HT32F52230 ADC Interrupt Status Register – ADCISR This register contains the ADC interrupt masked status bits. The corresponding interrupt status will be set to 1 if the associated interrupt event occurs and the related enable bit is set to 1.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 ADC Interrupt Clear Register – ADCICLR This register provides the clear bits used to clear the interrupt raw and masked status of the ADC. These bits are set to 1 by software to clear the interrupt status and automatically cleared to 0 by hardware after being set to 1.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 General-Purpose Timer (GPTM) Introduction The General-Purpose Timer consists of one 16-bit up/down-counter, four 16-bit Capture/ Compare Registers (CCRs), one 16-bit Counter-Reload Register (CRR) and several control/status registers. It can be used for a variety of purposes including general timer, input signal pulse width measurement or output waveform generation such as single pulse generation or PWM output.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Features ▄ 16-bit up/down auto-reload counter ▄ 16-bit programmable prescaler that allows division of the counter clock frequency by any factor between 1 and 65536 ▄ Up to 4 independent channels for: ●...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Functional Descriptions Counter Mode Up-Counting In this mode the counter counts continuously from 0 to the counter-reload value, which is defined in the CRR register, in a count-up direction. Once the counter reaches the counter-reload value, the Timer Module generates an overflow event and the counter restarts to count once again from 0.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Down-Counting In this mode the counter counts continuously from the counter-reload value, which is defined in the CRR register, to 0 in a count-down direction. Once the counter reaches 0, the Timer module generates an underflow event and the counter restarts to count once again from the counter-reload value.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Center-Align Counting In the center-aligned counting mode, the counter counts up from 0 to the counter-reload value and then counts down to 0 alternatively. The Timer module generates an overflow event when the counter counts to the counter-reload value in the up-counting mode and generates an underflow event when the counter counts to 0 in the down-counting mode.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Clock Controller The following describes the Timer Module clock controller which determines the clock source of the internal prescaler counter. ▄ Internal APB clock f CLKIN The default internal clock source is the APB clock f...
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Trigger Controller The trigger controller is used to select the trigger source and setup the trigger level or edge trigger condition. For the internal trigger input, it can be selected by the Trigger Selection bits TRSEL in the TRCFR register.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Slave Controller The GPTM can be synchronized with an external trigger in several modes including the Restart mode, the Pause mode and the Trigger mode which is selected by the SMSEL field in the MDCFR register.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Pause Mode In the Pause Mode, the selected STI input signal level is used to control the counter start/stop operation. The counter starts to count when the selected STI signal is at a high level and stops counting when the STI signal is changed to a low level, here the counter will maintain its present value and will not be reset.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Trigger Mode After the counter is disabled to count, the counter can resume counting when a STI rising edge signal occurs. When an STI rising edge occurs, the counter will start to count from the current value in the counter.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Master Controller The GPTMs and MCTMs can be linked together internally for timer synchronization or chaining. When one GPTM is configured to be in the Master Mode, the GPTM Master Controller will generate a Master Trigger Output (MTO) signal which includes a reset, a start, a stop signal or a clock source which is selected by the MMSEL field in the MDCFR register to trigger or drive another GPTM or MCTM, if exists, which is configured in the Slave Mode.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Channel Controller The GPTM has four independent channels which can be used as capture inputs or compare match outputs. Each capture input or compare match output channel is composed of a preload register and a shadow register.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Capture Counter Value Transferred to CHxCCR When the channel is used as a capture input, the counter value is captured into the Channel Capture/Compare Register (CHxCCR) when an effective input signal transition occurs. Once the capture event occurs, the CHxCCIF flag in the INTSR register is set accordingly.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Pulse Width Measurement The input capture mode can be also used for pulse width measurement from signals on the GT_ CHx pins, TIx. The following example shows how to configure the GPTM operated in the input capture mode to measure the high pulse width and the input period on the GT_CH0 pin using channel 0 and channel 1.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Input Stage The input stage consists of a digital filter, a channel polarity selection, edge detection and a channel prescaler. The channel 0 input signal (TI0) can be chosen to come from the GT_CH0 signal or the Excusive-OR function of the GT_CH0, GT_CH1 and GT_CH2 signals.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Quadrature Decoder The Quadrature Decoder function uses two quadrantal inputs TI0 and TI1 derived from the GT_ CH0 and GT_CH1 pins respectively to interact to generate the counter value. The DIR bit is modified by hardware automatically during each input source transition. The input source can be either TI0 only, TI1 only or both TI0 and TI1, the selection made by setting the SMSEL field to 0x01, 0x02 or 0x03.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Output Stage The GPTM has four channels for compare match, single pulse or PWM output function. The channel output GT_CHxO is controlled by the CHxOM, CHxP and CHxE bits in the corresponding CHxOCFR, CHPOLR and CHCTR registers.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Counter Value CHxOM=0x03, CHxPRE=0 (Output toggle, preload disable) CHxCCR (New value 2) CHxCCR (New value 3) CHxCCR (New value 1) CHxCCR Time Update CHxCCR value CHxOREF (Update Event) Figure 50. Toggle Mode Channel Output Reference Signal – CHxPRE = 0...
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Update Management The Update event is used to update the CRR, the PSCR, the CHxACR and the CHxCCR values from the actual registers to the corresponding shadow registers. An update event occurs when the counter overflows or underflows, the software update control bit is triggered or an update event from the slave controller is generated.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Single Pulse Mode Once the timer is set to operate in the single pulse mode, it is not necessary to set the timer enable bit TME in the CTR register to 1 to enable the counter. The trigger to generate a pulse can be sourced from the STI signal rising edge or by setting the TME bit to 1 using software.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 In the Single Pulse mode, the STI active edge which sets the TME bit to 1 will enable the counter. However, there exist several clock delays to perform the comparison result between the counter value and the CHxCCR value. In order to reduce the delay to a minimum value, the user can set the CHxIMAE bit in each CHxOCFR register.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Asymmetric PWM Mode The asymmetric PWM mode allows two center-aligned PWM signals to be generated with a programmable phase shift. The PWM frequency is determined by the value of the CRR register while the duty cycle and the phase-shift are determined by the CHxCCR and CHxACR register.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Trigger ADC Start To interconnect to the Analog-to-Digital Converter, the GPTM can output the MTO signal or the channel compare match output signal CHxOREF (x = 0 ~ 3) to be used as an Analog-to-Digital Converter input trigger signal.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions UEVDIS Update event Disable control 0: Enable the update event request by one of following events: - Counter overflow/underflow - Setting the UEVG bit - Update generation through the slave mode...
Page 204
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [18:16] MMSEL Master Mode Selection Master mode selection is used to select the MTO signal source which is used to synchronize the other slave timer. MMSEL [2:0] Mode Descriptions...
Page 205
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [10:8] SMSEL Slave Mode Selection SMSEL [2:0] Mode Descriptions The prescaler is clocked directly by the internal Disable mode clock. The counter uses the clock pulse generated from the interaction between the TI0 and Quadrature Decoder TI1 signals to drive the counter prescaler.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [3:0] TI0F Channel 0 Input Source TI0 Filter Setting These bits define the frequency divided ratio used to sample the TI0 signal. The Digital filter in the GPTM is an N-event counter where N is defined as how many valid transitions are necessary to output a filtered signal.
Page 210
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [17:16] CH1CCS Channel 1 Capture/Compare Selection 00: Channel 1 is configured as an output 01: Channel 1 is configured as an input derived from the TI1 signal 10: Channel 1 is configured as an input derived from the TI0 signal...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [3:0] TI2F Channel 2 Input Source TI2 Filter Setting These bits define the frequency divided ratio used to sample the TI2 signal. The Digital filter in the GPTM is an N-event counter where N is defined as how many valid transitions are necessary to output a filtered signal.
Page 213
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [17:16] CH3CCS Channel 3 Capture/Compare Selection 00: Channel 3 is configured as an output 01: Channel 3 is configured as an input derived from the TI3 signal 10: Channel 3 is configured as an input derived from the TI2 signal...
Page 215
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [8][2:0] CH0OM[3:0] Channel 0 Output Mode Setting These bits define the functional types of the output reference signal CH0OREF. 0000: No Change 0001: Output 0 on compare match 0010: Output 1 on compare match 0011: Output toggles on compare match 0100: Force inactive –...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [8][2:0] CH1OM[3:0] Channel 1 Output Mode Setting These bits define the functional types of the output reference signal CH1OREF. 0000: No Change 0001: Output 0 on compare match 0010: Output 1 on compare match 0011: Output toggles on compare match 0100: Force inactive –...
Page 218
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions CH2IMAE Channel 2 Immediate Active Enable 0: No action 1: Single pulse Immediate Active Mode is enabled The CH2OREF will be forced to the compare matched level immediately after an available trigger event occurs irrespective of the result of the comparison between the CNTR and the CH2CCR values.
Page 220
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [8][2:0] CH3OM[3:0] Channel 3 Output Mode Setting These bits define the functional types of the output reference signal CH3OREF 0000: No Change 0001: Output 0 on compare match 0010: Output 1 on compare match 0011: Output toggles on compare match 0100: Force inactive –...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions CH1CCG Channel 1 Capture/Compare Generation A Channel 1 capture/compare event can be generated by setting this bit. It is cleared by hardware automatically. 0: No action 1: Capture/compare event is generated on channel 1 If Channel 1 is configured as an input, the counter value is captured into the CH1CCR register and then the CH1CCIF bit is set.
Page 226
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions UEVIF Update Event Interrupt Flag. This bit is set by hardware on an update event and is cleared by software. 0: No update event occurs 1: Update event occurs...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions CH1CCIF Channel 1 Capture/Compare Interrupt Flag - Channel 1 is configured as an output: 0: No match event occurs 1: The contents of the counter CNTR have matched the contents of the CH1CCR...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Basic Function Timer (BFTM) Introduction The Basic Function Timer Module, BFTM, is a 32-bit up-counting counter designed to measure time intervals, generate one shot pulses or generate repetitive interrupts. The BFTM can operate in two modes which are repetitive and one shot modes.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Functional Description The BFTM is a 32-bit up-counting counter which is driven by the BFTM APB clock, PCLK. The counter value can be changed or read at any time even when the timer is counting. The BFTM supports two operating modes known as the repetitive mode and one shot mode allowing the measurement of time intervals or the generation of periodic time durations.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 One Shot Mode By setting the OSM bit in BFTMCR register to 1, the BFTM will operate in the one shot mode. The BFTM starts to count when the CEN bit is set to 1 by the application program. The counter value will remain unchanged if the CEN bit is cleared to 0 by the application program.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Register Map The following table shows the BFTM registers and their reset values. Table 33. BFTM Register Map Register Offset Description Reset Value BFTMCR 0x000 BFTM Control Register 0x0000_0000 BFTMSR 0x004 BFTM Status Register...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Single-Channel Timer (SCTM) Introduction The Single-Channel Timer consists of one 16-bit up-counter, one 16-bit Capture/Compare Registers (CCRs), one 16-bit Counter-Reload Register (CRR) and several control/status registers. It can be used for a variety of purposes including general timer, input signal pulse width measurement or output waveform generation such as single pulse generation or PWM output.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Features ▄ 16-bit auto-reload up counter ▄ 16-bit programmable prescaler that allows division of the counter clock frequency by any factor between 1 and 65536 ▄ Single channel for: ● Input Capture function ●...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Clock Controller The following describes the Timer Module clock controller which determines the clock source of the internal prescaler counter. ▄ Internal APB clock f CLKIN The default internal clock source is the APB clock f...
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Trigger Controller The trigger controller is used to select the trigger source and setup the trigger level or edge trigger condition. For the internal trigger input, it can be selected by the Trigger Selection bits TRSEL in the TRCFR register.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Slave Controller The SCTM can be synchronized with an external trigger in several modes including the Restart mode, the Pause mode and the Trigger mode which is selected by the SMSEL field in the MDCFR register.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Pause Mode In the Pause Mode, the selected STI input signal level is used to control the counter start/stop operation. The counter starts to count when the selected STI signal is at a high level and stops counting when the STI signal is changed to a low level, here the counter will maintain its present value and will not be reset.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Channel Controller The SCTM channel can be used as the capture input or compare match output. The capture input or compare match output channel is composed of a preload register and a shadow register. The Data access of the APB bus is always through the read/write preload register.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Input Stage The input stage consists of a digital filter, a channel polarity selection, edge detection and a channel prescaler. The channel input signal (TI) is sampled by a digital filter to generate a filtered input signal TIFP.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Output Stage The SCTM output has functions for compare match, single pulse or PWM output. The channel output SCTM_CHO is controlled by the CHOM, CHP and CHE bits in the corresponding CHOCFR, CHPOLR and CHCTR registers.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Counter Value CHOM=0x03, CHPRE=0 (Output toggle, preload disable) CHCCR (New value 2) CHCCR (New value 3) CHCCR (New value 1) CHCCR Time Update CHCCR value CHOREF (Update Event) Figure 76. Toggle Mode Channel Output Reference Signal – CHPRE = 0...
Page 259
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [3:0] Channel Input Source TI Filter Setting These bits define the frequency divided ratio used to sample the TI signal. The Digital filter in the SCTM is an N-event counter where N is defined as how many valid transitions are necessary to output a filtered signal.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Watchdog Timer (WDT) Introduction The Watchdog timer is a hardware timing circuitry that can be used to detect a system lock-up due to software trapped in a deadlock. The Watchdog timer can operate in a reset mode. The Watchdog timer will generate a reset when the counter counts down to a zero value.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Functional Description The Watchdog timer is formed from a 12-bit count-down counter and a fixed 3-bit prescaler. The largest time-out period is 16 seconds, using the LSI clock and a 1/128 maximum prescaler value.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 The Watchdog timer should be used in the following manners: ▄ Set the Watchdog timer reload value (WDTV) and reset in the WDTMR0 register. ▄ Set the Watchdog timer delta value (WDTD) and prescaler in the WDTMR1 register.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Inter-Integrated Circuit (I Introduction The I C Module is an internal circuit allowing communication with an external I C interface which is an industry standard two line serial interface used for connection to external hardware. These two serial lines are known as a serial data line, SDA, and a serial clock line, SCL.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Features ▄ Two-wire I C serial interface ● Serial data line (SDA) and serial clock (SCL) ▄ Multiple speed modes ● Standard mode – 100 kHz ● Fast mode – 400 kHz ●...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 STOP Condition START Condition Figure 83. START and STOP Condition Data Validity The data on the SDA line must be stable during the high period of the SCL clock. The SDA data state can only be changed when the clock signal on the SCL line is in a low state.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Addressing Format The I C interface starts to transfer data after the master device has sent the address to confirm the targeted slave device. The address frame is sent just after the START signal by master device. The addressing mode selection bit named ADRM in the I2CCR register should be defined to choose either the 7-bit or 10-bit addressing mode.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 10-bits Address Format In order to prevent address clashes, due to the limited range of the 7-bit addresses, a new 10-bit address scheme has been introduced. This enhancement can be mixed with the 7-bit addressing mode which increases the available address range about ten times.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Data Transfer and Acknowledge Once the slave device address has been matched, the data can be transmitted to or received from the slave device according to the transfer direction specified by the R/W bit. Each byte is followed by an acknowledge bit on the 9 SCL clock.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Clock Synchronization Only one master device can generate the SCL clock under normal operation. However when there is more than one master trying to generate the SCL clock, the clock should be synchronized so that the data output can be compared.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 General Call Addressing The general call addressing function can be used to address all the devices connected to the I bus. The master device can activate the general call function by writing a value “00” into the TAR and setting the RWD bit to 0 in the I2CTAR register on the addressing frame.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Master Transmitter Mode Start condition Users write the target slave device address and communication direction into the I2CTAR register after setting the I2CEN bit in the I2CCR register. The STA flag in the I2CSR register is set by hardware after a start condition occurs.
Page 287
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Master Receiver Mode Start condition The target slave device address and communication direction must be written into the I2CTAR register. The STA flag in the I2CSR register is set by hardware after a start condition occurs. In order to send the following address frame, the STA flag must be cleared to 0 if it has been set to 1.The...
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Close / Continue Transmission The master device needs to reset the AA bit in the I2CCR register to send a NACK signal to the slave device before the last data byte transfer has been completed. After the last data byte has been received from the slave device, the master device will hold the SCL line at a logic low state following after a NACK signal sent by the master device to the slave device.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Slave Transmitter Mode Address Frame In the 7-bit addressing mode, the ADRS bit in the I2CSR register is set after the slave device receives the calling address which matches with the slave device address. In the 10-bit addressing mode, the ADRS bit is set when the first header byte is matched and the second address byte is matched respectively.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Slave Receiver Mode Address Frame The ADRS bit in the I2CSR register is set after the slave device receives the calling address which matches with the slave device address. After the ADRS bit has been set to 1, it must be cleared to 0 to continue the data transfer process.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Conditions of Holding SCL Line The following conditions will cause the SCL line to be held at a logic low state by hardware resulting in all the I C transfers being stopped. Data transfer will be continued after the creating conditions are eliminated.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 C Timeout Function In order to reduce the occurrence of I C lockup problem due to the reception of erroneous clock source, a timeout function is provided. If the I C bus clock source is not received for a certain timeout period, then a corresponding I C timeout flag will be asserted.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Register Descriptions C Control Register – I2CCR This register specifies the corresponding I C function enable control. Offset: 0x000 (0) Reset value: 0x0000_2000 Reserved Type/Reset Reserved Type/Reset SEQFILTER COMBFILTEREn ENTOUT Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions GCEN General Call Enable 0: General call disabled 1: General call enabled When the device receives the calling address with a value of 0x00 and if both the GCEN and the AA bits are set to 1, then the I C interface is addressed as a slave and the GCS bit in the I2CSR register is set to 1.
Page 295
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [16] RXDNEIE Data Register Not Empty Interrupt Enable Bit in Received Mode 0: Interrupt disabled 1: Interrupt enabled When the I2CEN bit in the I2CCR register is cleared to 0, this bit is cleared to 0 by hardware.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 C Status Register – I2CSR This register contains the I C operation status. Offset: 0x00C Reset value: 0x0000_0000 Reserved Type/Reset Reserved TXNRX MASTER BUSBUSY RXBF TXDE RXDNE Type/Reset 0 RO 0 RO...
Page 298
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [17] TXDE Data Register Empty Using in Transmitter Mode 0: Data register I2CDR not empty 1: Data register I2CDR empty This bit is set when the I2CDR register is empty in the Transmitter mode. Note that the TXDE bit will be set after the address frame is being transmitted to inform that the data to be transmitted should be loaded into the I2CDR register.
Page 299
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions ADRS Address Transmit (master mode) / Address Receive (slave mode) Flag Address Sent in Master Mode 0: Address frame has not been transmitted 1: Address frame has been transmitted For the 7-bit addressing mode, this bit is set after the master device receives the address frame acknowledge bit sent from the slave device.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 C SCL High Period Generation Register – I2CSHPGR This register specifies the I C SCL clock high period interval. Offset: 0x010 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset SHPG Type/Reset 0 RW...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 C SCL Low Period Generation Register – I2CSLPGR This register specifies the I C SCL clock low period interval. Offset: 0x014 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset SLPG Type/Reset 0 RW...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Table 39. I C Clock Setting Example × [ (SHPG + d) + (SLPG + d) ] (where d = 6) PCLK SHPG + SLPG value at PCLK C Clock 8 MHz...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 C Address Mask Register – I2CADDMR This register specifies which bit of the I C address is masked and not compared with corresponding bit of the received address frame. Offset: 0x020 Reset value: 0x0000_0000...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 C Address Snoop Register – I2CADDSR This register is used to indicate the address frame value appeared on the I C bus. Offset: 0x024 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 C Timeout Register – I2CTOUT This register specifies the I C Timeout counter preload value and clock prescaler ratio. Offset: 0x028 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset 0 RW 0 RW...
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Serial Peripheral Interface (SPI) Introduction The Serial Peripheral Interface, SPI, provides an SPI protocol data transmit and receive functions in both master or slave mode. The SPI interface uses 4 pins, among which are serial data input and output lines MISO and MOSI, the clock line SCK, and the slave select line SEL.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Features ▄ Master or slave mode ▄ Master mode speed up to f PCLK ▄ Slave mode speed up to f PCLK ▄ Programmable data frame length up to 16 bits ▄...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 SPI Serial Frame Format The SPI interface format is base on the Clock Polarity, CPOL, and the Clock Phase, CPHA, configurations. ▄ Clock Polarity Bit – CPOL When the Clock Polarity bit is cleared to 0, the SCK line idle state is LOW. When the Clock Polarity bit is set to 1, the SCK line idle state is HIGH.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Figure 101 shows the continuous data transfer timing diagram of this format. Note that the SEL signal must change to an inactive level between each data frame. SEL (SELAP=0) SEL (SELAP=1) MOSI/MISO...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Figure 103 shows the continuous data transfer diagram timing. Note that the SEL signal must remain active until the last data transfer has completed. SEL (SELAP=0) SEL (SELAP=1) MOSI/MISO Data1 Data2 Figure 100. SPI Continuous Transfer Timing Diagram – CPOL = 0, CPHA = 1...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Figure 105 shows the continuous data transfer timing of this format. Note that the SEL signal must change to an inactive level between each data frame. SEL (SELAP=0) SEL (SELAP=1) ½ SCK ½...
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Status Flags TX Buffer Empty – TXBE This TXBE flag is set when the TX buffer is empty in the non-FIFO mode or when the TX FIFO data length is equal to or less than the TX FIFO threshold level as defined by the TXFTLS field in the SPIFCR register in the FIFO mode.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Write Collision – WC The following conditions will assert the Write Collision Flag. ▄ The FIFOEN bit in the SPIFCR register is cleared. The write collision flag is asserted when new data is written into the SPIDR register while both the TX buffer and the shift register are already full.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions SSELC Software Slave Select Control 0: Set the SEL output to an inactive state 1: Set the SEL output to an active state The application Software can setup the SEL output to an active or inactive state by configuring the SSELC bit.
Page 318
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [13] SELM Slave Select Mode 0: SEL signal is controlled by software – asserted or de-asserted by the SSELC 1: SEL signal is controlled by hardware – generated automatically by the SPI hardware Note that SELM bit is available for master mode only –...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions TXBEIEN TX Buffer Empty Interrupt Enable 0: Disable 1: Enable The TX buffer empty interrupt request will be generated when the TXBE flag and the TXBEIEN bit are set. In the FIFO mode, the interrupt request being generated depends upon the TX FIFO trigger level setting.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 SPI Data Register – SPIDR This register stores the SPI received or transmitted Data. Offset: 0x010 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Type/Reset 0 RW 0 RW 0 RW 0 RW...
Page 322
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions BUSY SPI Busy flag 0: SPI not busy 1: SPI busy In the master mode, this flag is reset when the TX buffer and TX shift register are both empty and is set when the TX buffer or the TX shift register are not empty.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 SPI FIFO Control Register – SPIFCR This register contains the related SPI FIFO control including the FIFO enable control and the FIFO trigger level selections. Offset: 0x018 Reset value: 0x0000_0000 Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Universal Synchronous Asynchronous Receiver Transmitter (USART) Introduction The Universal Synchronous Asynchronous Receiver Transceiver, USART, provides a flexible full duplex data exchange using synchronous or asynchronous transfer. The USART is used to translate data between parallel and serial interfaces, and is also commonly used for RS232 standard communication.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Features ▄ Supports both asynchronous and clocked synchronous serial communication modes ▄ Full Duplex Communication Capability ▄ Programming baud rate up to 3 Mbit/s for asynchronous mode and 6 Mbit/s for synchronous mode ▄...
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Function Descriptions Serial Data Format The USART module performs a parallel-to-serial conversion on data that is written to the transmit FIFO registers and then sends the data with the following format: Start bit, 7 ~ 9 LSB first data bits, optional Parity bit and finally 1 ~ 2 Stop bits.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Baud Rate Generation The baud rate for the USART receiver and transmitter are both set with the same values. The baud- rate divisor, BRD, has the following relationship with the USART clock which is known as CK_ USART.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Hardware Flow Control The USART supports the hardware flow control function which is enabled by setting the HFCEN bit in the USRCR register to 1. It is possible to control the serial data flow between 2 USART devices by using the CTS input and the RTS output.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 CTS Flow Control If the hard flow control function is enabled, the URTXEN bit in the USRCR register will be controlled by the USART CTS input signal. If the USART CTS pin is forced to a logic low state, the URTXEN bit will automatically be set to 1 to enable the data transmission.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Data Frame START STOP TX_Data IrDA TX Modulation Signal bit width 3/16 bit width IrDA RX Demodulation Signal Data Frame STOP START RX_Data Figure 112. IrDA Modulation and Demodulation The IrDA mode provides two operation modes, one is the normal mode and the other is the low- power mode.
Page 334
Cortex ® -M0+ MCU HT32F52220/HT32F52230 IrDA Normal Mode For the IrDA normal mode, the width of each transmitted pulse generated by the transmitter modulator is specified as 3/16 of the baud rate clock period. The receiver pulse width for the IrDA receiver demodulator is based on the IrDA receive debounce filter which is implemented using an 8-bit down-counting counter.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 TX_Data Transmitter Modulation TXSEL RX_Data Receiver Demodulation IrDAEN Figure 113. USART I/O and IrDA Block Diagram RS485 Mode The RS485 mode of the USART provides the data transmission on the interface transmitted over a 2-wire twisted pair bus.
Page 337
Cortex ® -M0+ MCU HT32F52220/HT32F52230 RS485 Normal Multi-drop Operation Mode – NMM When the RS485 mode is configured as an addressable slave, it will operate in the Normal Multi- drop Operation Mode, NMM. This mode is enabled when the RSNMM field is set in the RS485CR register.
® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Synchronous Master Mode The data is transmitted in a full-duplex style in the USART Synchronous Master Mode, i.e., data transmission and reception both occur at the same time and only support master mode. The USART CTS pin is the synchronous USART transmitter clock output.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Interrupts and Status The UART can generate interrupts when the following event occurs and corresponding interrupt enable bits are set: ▄ Receive FIFO time-out interrupt: An interrupt will be generated when the USART receive FIFO does not receive a new data packet during the specified time-out interval.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Register Descriptions USART Data Register – USRDR The register is used to access the USART transmitted and received FIFO data. Offset: 0x000 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Type/Reset...
Cortex ® -M0+ MCU HT32F52220/HT32F52230 USART Control Register – USRCR The register specifies the parameters such as the data length, parity and stop bit for the USART. It also contains the USART enable control bits together with the USART mode and data transfer mode selections.
Page 343
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [11] Parity Bit Enable 0: Parity bit is not generated (transmitted data) or checked (receive data) during transfer 1: Parity bit is generated or checked during transfer Note: When the WLS field is set to “10” to select the 9-bit data format, writing to the PBE bit has no effect.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 USART FIFO Control Register – USRFCR This register specifies the USART FIFO control and configurations including threshold level and reset function together with the USART FIFO status. Offset: 0x008 Reset value: 0x0000_0000...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions TX FIFO Reset Setting this bit will generate a reset pulse to reset TX FIFO which will empty the TX FIFO. i.e., the TX FIFO pointer will be reset to 0, after a reset signal. This bit returns to 0 automatically after the reset pulse is generated.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions FEIE Framing Error Interrupt Enable 0: Disable interrupt 1: Enable interrupt An interrupt will be generated when the FEI bit is set in the URSIFR register. PEIE Parity Error Interrupt Enable...
Page 347
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [10] CTSC CTS Status Change Flag This bit will be set whenever the CTS input pin status is changed and an Interrupt will be generated if the CTSC bit is set high and CTSIE = 1 in the USRIER register.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions Overrun Error Indicator An overrun error will occur only after the RX FIFO is full and when the next character has been completely received in the RX shift register. The character in the shift register is overwritten, when an overrun event occurs.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions IrDAEN IrDA Enable control 0: Disable IrDA mode 1: Enable IrDA mode USART RS485 Control Register – RS485CR This register is used to control the USART RS485 mode. Offset:...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 USART Divider Latch Register – USRDLR The register is used to determine the USART clock divided ratio to generate the appropriate baud rate. Offset: 0x024 Reset value: 0x0000_0010 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Universal Asynchronous Receiver Transmitter (UART) Introduction The Universal Asynchronous Receiver Transceiver, UART, provides a flexible full duplex data exchange using asynchronous transfer. The UART is used to translate data between parallel and serial interfaces, and is also commonly used for RS232 standard communication.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Features ▄ Supports asynchronous serial communication modes ▄ Full Duplex Communication Capability ▄ Programming baud rate up to 3 Mbit/s ▄ Fully programmable serial communication functions including: ● Word length: 7, 8, or 9-bit character ●...
Cortex ® -M0+ MCU HT32F52220/HT32F52230 Baud Rate Generation The baud rate for the UART receiver and transmitter are both set with the same values. The baud- rate divisor, BRD, has the following relationship with the UART clock which is known as CK_ UART.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Interrupts and Status The UART can generate interrupts when the following event occurs and corresponding interrupt enable bits are set: ▄ Receiver line status interrupts: The interrupts are generated when the UART receiver overrun error, parity error, framing error or break events occurs.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Register Descriptions UART Data Register – URDR The register is used to access the UART transmitted and received data. Offset: 0x000 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Type/Reset 0 RW...
Page 360
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions [14] Break Control Bit When this bit is set to 1, the serial data output on the UART TX pin will be forced to the Spacing State (logic 0). This bit acts only on the UART TX output pin and has no effect on the transmitter logic.
Cortex ® -M0+ MCU HT32F52220/HT32F52230 UART Interrupt Enable Register – URIER This register is used to enable the related UART interrupt function. The UART module generates interrupts to the controller when the corresponding events occur and the corresponding interrupt enable bits are set.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions TXDEIE Transmit Data Register Empty Interrupt Enable 0: Disable interrupt 1: Enable interrupt An interrupt is generated when the transmit data register empty interrupt is enabled and the TXDE bit is set in the URSIFR register.
Page 363
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 Bits Field Descriptions RXDR RX Data Ready 0: Receive data register is empty 1: Received data in the receive data register is ready to read This bit is set by hardware when the content of the receive shift register RDR has been transferred to the URDR register.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 UART Divider Latch Register – URDLR The register is used to determine the UART clock divided ratio to generate the appropriate baud rate. Offset: 0x024 Reset value: 0x0000_0010 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52220/HT32F52230 UART Test Register – URTSTR This register controls the UART debug mode. Offset: 0x028 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset 0 RW Bits Field Descriptions [1:0] Loopback Test Mode Select...
Page 366
Holtek's products are not authorized for use as critical components in life support devices or systems. Holtek reserves the right to alter its products without prior notification. For the most up-to-date information, please visit our web site at http://www.
Need help?
Do you have a question about the HT32F52220 and is the answer not in the manual?
Questions and answers