32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Table of Contents 1 Introduction ......................22 Overview ..........................22 Features ..........................23 Device Information ....................... 27 Block Diagram ........................28 2 Document Conventions ..................29 3 System Architecture ..................... 30 ®...
Page 3
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Flash Vector Mapping Control Register – VMCR ................55 Flash Manufacturer and Device ID Register – MDID ..............56 Flash Page Number Status Register – PNSR ................57 Flash Page Size Status Register – PSSR ..................58 Device ID Register –...
Page 4
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 AHB Configuration Register – AHBCFGR ..................87 AHB Clock Control Register – AHBCCR ..................88 APB Configuration Register – APBCFGR ..................90 APB Clock Control Register 0 – APBCCR0 ..................91 APB Clock Control Register 1 – APBCCR1 ..................92 Clock Source Status Register –...
Page 5
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port A Output Reset Register – PARR ..................125 Port B Data Direction Control Register – PBDIRCR ..............125 Port B Input Function Enable Control Register – PBINER ............126 Port B Pull-Up Selection Register – PBPUR ................127 Port B Pull-Down Selection Register –...
Page 6
Cortex ® -M0+ MCU HT32F52243/HT32F52253 EXTI Source Selection Register 1 – ESSR1 ................157 GPIO Port x Configuration Low Register – GPxCFGLR, x = A, B, C, D ........158 GPIO Port x Configuration High Register – GPxCFGHR, x = A, B, C, D ........159 10 Nested Vectored Interrupt Controller (NVIC) ..........
Page 7
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 ADC Conversion List Register 0 – ADCLST0 ................183 ADC Conversion List Register 1 – ADCLST1 ................184 ADC Input Sampling Time Register – ADCSTR ................185 ADC Conversion Data Register y – ADCDRy, y = 0 ~ 7 ............... 186 ADC Trigger Control Register –...
Page 11
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 RTC Control Register – RTCCR ....................376 RTC Status Register – RTCSR..................... 378 RTC Interrupt and Wakeup Enable Register – RTCIWEN ............379 18 Watchdog Timer (WDT) ..................380 Introduction ........................380 Features ..........................
Page 12
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 C Address Register – I2CADDR ....................407 C Status Register – I2CSR ......................408 C SCL High Period Generation Register – I2CSHPGR ...............411 C SCL Low Period Generation Register – I2CSLPGR ............... 412 C Data Register –...
Page 13
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Register Descriptions ......................453 USART Data Register – USRDR ....................453 USART Control Register – USRCR ....................454 USART FIFO Control Register – USRFCR................... 456 USART Interrupt Enable Register – USRIER ................457 USART Status &...
Page 14
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Register Descriptions ......................483 PDMA Channel n Control Register – PDMACHnCR, n = 0 ~ 5 ............ 483 PDMA Channel n Source Address Register – PDMACHnSADR, n = 0 ~ 5 ........485 PDMA Channel n Destination Address Register – PDMACHnDADR, n = 0 ~ 5 ......485 PDMA Channel n Transfer Size Register –...
Page 15
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 List of Tables Table 1. Features and Peripheral List ..................... 27 Table 2. Document Conventions ......................29 Table 3. Register Map ..........................34 Table 4. Flash Memory and Option Byte ....................38 Table 5.
Page 16
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Table 40. SCTM Register Map ......................354 Table 41. LSE Startup Mode Operating Current and Startup Time ............371 Table 42. RTCOUT Output Mode and Active Level Setting ..............373 Table 43. RTC Register Map......................... 374 Table 44.
Nested Vectored Interrupt Controller (NVIC), SysTick timer, and including advanced debug support. The devices operate at a frequency of up to 40 MHz for HT32F52243/52253 with a Flash accelerator to obtain maximum efficiency. It provides up to 128 KB of embedded Flash memory for code/ data storage and 16 KB of embedded SRAM memory for system operation and application program usage.
Features ▄ Core ● 32-bit Arm ® Cortex ® -M0+ processor core ● Up to 40 MHz operating frequency for HT32F52243/52253 ● Single-cycle multiplication ● Integrated Nested Vectored Interrupt Controller (NVIC) ● 24-bit SysTick timer ▄ On-chip Memory ● Up to 128 KB on-chip Flash memory for instruction/data and options storage ●...
Page 24
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 ▄ IO ports – GPIO ● Up to 51 GPIOs ● Port A, B, C, D are mapped as 16 external interrupts – EXTI ● Almost I/O pins are configurable output driving current ▄...
Page 25
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 ▄ Real Time Clock – RTC ● 24-bit up-counter with a programmable prescaler ● Alarm function ● Interrupt and Wake-up event ▄ Inter-integrated Circuit – I ● Supports both master and slave modes with a frequency of up to 1 MHz ●...
Page 26
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 ▄ Peripheral Direct Memory Access – PDMA ● 6 channels with trigger source grouping ● 8-bit /16-bit /32-bit width data transfer ● Supports Address increment, decrement or fixed mode ● 4-level programmable channel priority ●...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 0x5a05 hexadecimal number.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 series consist 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 ®...
-M0+ system peripherals. Refer to the Arm ® Cortex ® -M0+ Technical Reference Manual for more information. The following figure shows the memory map of HT32F52243/HT32F52253 series of devices, including Code, SRAM, peripheral, and other pre- defined regions. Rev. 1.20 32 of 501 September 19, 2018...
Programming (IAP) or In Circuit Programming (ICP). For more information, refer to the Flash Memory Controller section. Embedded SRAM Memory The HT32F52243/HT32F52253 series contain up to 16 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 HT32F52243/HT32F52253 Flash Memory Controller (FMC) Introduction The Flash Memory Controller (FMC) provides functions of flash operation and pre-fetch buffer for the embedded on-chip Flash memory. The figure below shows the block diagram of FMC which includes programming interface, control registers, pre-fetch buffer, and access interface.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Flash Memory Architecture The Flash memory consists of up to 128 KB main Flash with 1 KB per page and 2 KB Information Block for Boot Loader. The main Flash memory contains totally 128 pages (or 64 pages for 64 KB device) which can be erased individually.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Page Erase The FMC provides a page erase function which is used to reset partial content of Flash memory. Each page can be erased independently without affecting the contents of other pages. The following steps show the access sequence of the register for a page erase operation.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Mass Erase The FMC provides a complete 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 HT32F52243/HT32F52253 Word Programming The FMC provides a 32-bit word programming function which is used to modify the Flash memory content. The following steps show the word programming operation register access sequence. ▄ Check the OPCR register to confirm that no Flash memory operation is in progress (OPM [3:0] equals to 0xE, or 0x6).
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Page Erase/Program Protection The FMC provides page erase/program protection function to prevent unexpected operation of 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 FMC on the protected pages. When the page erase...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Security Protection The FMC provides a Security protection function to prevent 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 the user’s application.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Flash Operation Command Register – OCMR This register is used to specify the Flash operation commands that include the word programming, page erase and mass erase. Offset: 0x00C Reset value: 0x0000_0000 Reserved...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 within the range from 0x0000_0000 to 0x1FFF_FFFF.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 booting pin, BOOT, during the power-on reset period.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Register Descriptions Power Control Status Register – PWRSR This register indicates power control status. Offset: 0x100 Reset value: 0x0000_0001 (Reset only by V domain power on reset) Reserved Type/Reset Reserved Type/Reset Reserved...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 69
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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...
Page 71
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [21] LVDEWEN LVD Event Wakeup Enable 0: LVD event wakeup is disabled 1: LVD event wakeup is enabled Setting this bit to 1 will enable the LVD event wakeup function to wake up the system when a LVD condition occurs which result in the LVDF bit being asserted.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Function Descriptions High Speed External Crystal Oscillator – HSE The high speed external 4 to 16 MHz crystal oscillator (HSE) produces a highly accurate clock source to the system clock. The related hardware configuration is shown in the following figure.
The frequency accuracy of the high speed internal RC oscillator HSI can vary from one chip to another due to manufacturing process variations, this is why each device is factory calibrated by HOLTEK for ±2% accuracy at V = 3.3 V and T = 25°C.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Frequency of the PLL output clock can be determined by the following formula: where NR = Ref divider = 2, NF1 = Feedback Divider 1 = 4, NF2 = Feedback Divider 2 = 1 ~ 16, NO1 = Output Divider 1 = 2, NO2 = Output Divider 2 = 1, 2, 4, or 8 Considering the duty cycle with 50%, both input frequency and output frequency is divided by 2.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 Low Speed External Crystal Oscillator – LSE The low speed external crystal or ceramic resonator oscillator with 32,768 Hz frequency produces a low power but highly accurate clock source for the circuits of Real-Time-Clock peripheral, Watchdog Timer or system clock.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 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, LSE, 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 HT32F52243/HT32F52253 HSE Clock Monitor The HSE Clock Monitor 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Bits Field Descriptions [2:0] System Clock Switch 00x: CK_PLL clock out as system clock 010: CK_HSE as system clock 011: CK_HSI as system clock 110: CK_LSE as system clock 111: CK_LSI as system clock Other: CK_HSI as system clock Set and reset by software to select CK_SYS source.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions PLLRDY PLL Clock Ready Flag 0: PLL is not ready 1: PLL is ready Set by hardware to indicate whether the PLL output is stable to be used. Global Clock Interrupt Register – GCIR This register specifies interrupt enable and flag bits.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 AHB Clock Control Register – AHBCCR This register specifies the AHB clock enable control bits. Offset: 0x024 Reset value: 0x0000_0065 Reserved DIVEN Type/Reset Reserved PDEN PCEN PBEN PAEN Type/Reset 0 RW 0 RW...
Page 89
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions APBEN APB bridge Clock Enable 0: APB bridge clock is automatically disabled by hardware during Sleep mode 1: APB bridge clock is always enabled during Sleep mode Set and reset by software. User can set the APBEN bit to 0 to reduce the power consumption if the APB bridge is unused during Sleep mode.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions USR0EN USART0 Clock Enable 0: USART0 clock is disabled 1: USART0 clock is enabled Set and reset by software. SPI1EN SPI1 Clock Enable 0: SPI1 clock is disabled 1: SPI1 clock is enabled Set and reset by software.
Page 93
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [30] SCTM2EN SCTM2 Clock Enable 0: SCTM2 clock is disabled 1: SCTM2 clock is enabled Set and reset by software. [29] SCTM1EN SCTM1 Clock Enable 0: SCTM1 clock is disabled 1: SCTM1 clock is enabled Set and reset by software.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 HSI Control Register – HSICR This register is used to control the frequency trimming of the HSI RC oscillation. Offset: 0x040 Reset value: 0xXXXX_0000 where X is undefined Reserved HSICOARSE Type/Reset X RO...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions TRIMEN Trimming Enable 0: HSI Trimming is disabled 1: HSI Trimming is enabled The bit enables the HSI RC oscillator trimming function by the ATC hardware or user program.
Page 102
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [20] DBTRACE TRACESWO Debug Mode Enable 0 : Disable TRACESWO output 1 : Enable TRACESWO output Set and reset by software. [19] DBUR1 UART1 Debug Mode Enable 0: Same behavior as in normal mode 1: UART1 timeout is frozen when the core is halted Set and reset by software.
Page 103
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions DBMCTM MCTM Debug Mode Enable 0: MCTM counter continues to count even if the core is halted 1: MCTM counter stops counting when the core is halted Set and reset by software.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 19, 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Bits Field Descriptions USR0RST USART0 Reset Control 0: No reset 1: Reset USART0 This bit is set by software and cleared to 0 by hardware automatically. SPI1RST SPI1 Reset Control 0: No reset 1: Reset SPI1 This bit is set by software and cleared to 0 by hardware automatically.
Page 111
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [31] SCTM3RST SCTM3 Reset Control 0: No reset 1: Reset SCTM3 This bit is set by software and cleared to 0 by hardware automatically. [30] SCTM2RST SCTM2 Reset Control...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 General Purpose I/O (GPIO) Introduction There are up to 51 General Purpose I/O port, GPIO, named PA0 ~ PA15, PB0 ~ PB15, PC0 ~ PC15 and PD0 ~ PD3 for the devices 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 HT32F52243/HT32F52253 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 ▄...
Cortex ® -M0+ MCU HT32F52243/HT32F52253 GPIO Locking Mechanism The GPIO also offers a lock function to lock the port until a reset event occurs. The PxLOCKR (x = A ~ D) registers are used to lock the port x and lock control options. The value 0x5FA0 is...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Register Offset Description Reset Value PCDOUTR 0x020 Port C Data Output Register 0x0000_0000 PCSRR 0x024 Port C Output Set and Reset Control Register 0x0000_0000 PCRR 0x028 Port C Output Reset Control Register...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 PBPU Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 PBPD Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 PBRST...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Port C Input Function Enable Control Register – PCINER This register is used to enable or disable the GPIO Port C input function. Offset: 0x004 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port C Pull-Up Selection Register – PCPUR This register is used to enable or disable the GPIO Port C pull-up function. Offset: 0x008 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset PCPU Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port C Pull-Down Selection Register – PCPDR This register is used to enable or disable the GPIO Port C pull-down function. Offset: 0x00C Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset PCPD Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port C Open Drain Selection Register – PCODR This register is used to enable or disable the GPIO Port C open drain function. Offset: 0x010 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port C Output Set/Reset Control Register – PCSRR This register is used to set or reset the corresponding bit of the GPIO Port C output data. Offset: 0x024 Reset value: 0x0000_0000 PCRST...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port C Output Reset Register – PCRR This register is used to reset the corresponding bit of the GPIO Port C output data. Offset: 0x028 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port D Input Function Enable Control Register – PDINER This register is used to enable or disable the GPIO Port D input function. Offset: 0x004 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port D Pull-Up Selection Register – PDPUR This register is used to enable or disable the GPIO Port D pull-up function. Offset: 0x008 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port D Pull-Down Selection Register – PDPDR This register is used to enable or disable the GPIO Port D pull-down function. Offset: 0x00C Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port D Open Drain Selection Register – PDODR This register is used to enable or disable the GPIO Port D open drain function. Offset: 0x010 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port D Output Current Drive Selection Register – PDDRVR This register specifies the GPIO Port D output driving current. Offset: 0x014 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset PDDV3 PDDV2...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port D Data Input Register – PDDINR This register specifies the GPIO Port D input data. Offset: 0x01C Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Reserved PDDIN Type/Reset 0 RO...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port D Output Set/Reset Control Register – PDSRR This register is used to set or reset the corresponding bit of the GPIO Port D output data. Offset: 0x024 Reset value: 0x0000_0000 Reserved...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Port D Output Reset Register – PDRR This register is used to reset the corresponding bit of the GPIO Port D output data. Offset: 0x028 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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~ D) registers. If the pin is selected as unavailable item which is noted as "N/A"...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 GPIO Port x Configuration Low Register – GPxCFGLR, x = A, B, C, D This low register specifies the alternate function of GPIO Port x. x = A, B, C, D Offset: 0x020, 0x028, 0x030, 0x038...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 GPIO Port x Configuration High Register – GPxCFGHR, x = A, B, C, D This high register specifies the alternate function of GPIO Port x. x = A, B, C, D Offset: 0x024, 0x02C, 0x034, 0x03C...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Function Descriptions SysTick Calibration The SysTick Calibration Value Register (SCALIB) is provided by the NVIC to give a reference time base of 1 ms for the RTOS tick timer or other purpose. The TENMS field in the SCALIB register has a fixed value of 5000 which is the counter reload value to indicate 1 ms when the clock source comes from the SysTick reference input clock STCLK with a frequency of 5 MHz (40 MHz divide by 8).
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Function Descriptions Wakeup Event Management In order to wake up 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 14 multiplexed channels including 12 external channels on which the external analog signal can be supplied and 2 internal channels.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Features ▄ 12-bit SAR ADC engine ▄ Up to 1 MSPS conversion rate ▄ 12 external analog input channels ▄ 2 internal analog input channels for reference voltage detection ▄ Programmable sampling time for conversion channel ▄...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Conversion (ex: Sequence Length=8) Cycle Cycle Start of Conversion Single sample End of Conversion Cycle End of Conversion Figure 28. 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 177
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 30.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 ADC Conversion Data Register y – ADCDRy, y = 0 ~ 7 This register is used to store the conversion data of the 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 CK_PSC CNT_EN CK_CNT CNTR CRR Shadow Register PSCR PSCR Shadow Register PSC_CNT Counter Overflow Update Event Flag Write a new value Software clearing Update the new value Figure 32. Up-counting Example 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.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Center-Aligned 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.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 ▄ STIED: The counter prescaler can count during each rising edge of the STI signal. This mode can be selected by setting the SMSEL field to 0x7 in the MDCFR register. Here the counter will act as an event counter.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Digital Filter The digital filters are embedded in the input stage for the GT_CH0 ~ GT_CH3 pins respectively. The digital filter in the GPTM is an N-event counter where N refers to how many valid transitions are necessary to output a filtered signal.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Quadrature Decoder Counting on Down Both TI0 & TI1 (CH0P = 0, CH1P = 0) Figure 50. Both TI0 and TI1 Quadrature Decoder Counting 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.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 Channel Output Reference Signal When the GPTM is used in the compare match output mode, the CHxOREF signal (Channel x Output Reference signal) is defined by the CHxOM bit setup. The CHxOREF signal has several types of output function which defines what happens to the output when the counter value matches the contents of the CHxCCR register.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Counter Value CHxOM=0x03, CHxPRE=1 (Output toggle, preload enable) CHxCCR (New value 2) CHxCCR (New value 3) CHxCCR (New value 1) CHxCCR Time Update CHxCCR value CHxOREF (Update Event) Figure 53. Toggle Mode Channel Output Reference Signal (CHxPRE = 1)
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Counter Value CHxCCR Counter Counter stopped reinitialized and held Time TME bit Trigger by STI Cleared by S/W Cleared by Trigger by S/W Update Event CHxOREF delay delay (PWM1) CHxIMAE=0 delay delay...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Starting two timers synchronously in response to an external trigger ▄ Configure GPTM to operate in the master mode to send its enable signal as a trigger output (MMSEL = 0x01). ▄...
Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 223
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 224
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [10:8] SMSEL Slave Mode Selection SMSEL [2:0] Mode Descriptions The prescaler is clocked directly by the Disable mode internal clock. The counter uses the clock pulse generated from the interaction between the TI0 and Quadrature TI1 signals to drive the counter prescaler.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Timer Control Register – CTR This register specifies the timer enable bit (TME), CRR buffer enable bit (CRBE) and Channel PDMA selection bit (CHCCDS). Offset: 0x010 Reset value: 0x0000_0000 Reserved Type/Reset Reserved...
Page 228
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 230
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [3:0] TI1F Channel 1 Input Source TI1 Filter Setting These bits define the frequency divided ratio used to sample the TI1 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 232
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 234
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [3:0] TI3F Channel 3 Input Source TI3 Filter Setting These bits define the frequency divided ratio used to sample the TI3 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 236
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 –...
Page 238
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 240
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [8][2:0] CH2OM[3:0] Channel 2 Output Mode Setting These bits define the functional types of the output reference signal CH2OREF. 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 242
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Bits Field Descriptions CH2CCIE Channel 2 Capture/Compare Interrupt Enable 0: Channel 2 interrupt is disabled 1: Channel 2 interrupt is enabled CH1CCIE Channel 1 Capture/Compare Interrupt Enable 0: Channel 1 interrupt is disabled...
Page 247
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions CH3CCG Channel 3 Capture/Compare Generation A Channel 3 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 3 If Channel 3 is configured as an input, the counter value is captured into the CH3CCR register and then the CH3CCIF bit is set.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Timer Interrupt Status Register – INTSR This register stores the timer interrupt status. Offset: 0x07C Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved TEVIF Reserved UEVIF Type/Reset CH3OCF CH2OCF CH1OCF CH0OCF CH3CCIF...
Page 249
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions CH0OCF Channel 0 Over-Capture Flag This flag is set by hardware and cleared by software. 0: No over-capture event is detected 1: Capture event occurs again when the CH0CCIFbit is already set and it is not yet cleared by software.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Trigger ADC Start When a BFTM compare match event occurs, a compare match interrupt f lag, MIF, will be generated which can be used as an A/D Converter input trigger source. Register Map The following table shows the BFTM registers and their reset values.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Motor Control Timer (MCTM) Introduction The Motor Control Timer consists of one 16-bit up/down-counter, four 16-bit Capture/Compare Registers (CCRs), one 16-bit Counter-Reload Register (CRR), one 8-bit Repetition Counter (REPR) and several control/status registers. It can be used for a variety of purposes which include general time measurement, input signal pulse width measurement, output waveform generation for signals such as single pulse generation or PWM generation, including dead time insertion.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Features ▄ 16-bit up/down auto-reload counter. ▄ 16-bit programmable prescaler that allows division the counter clock frequency by any factor between 1 and 65536. ▄ Up to 4 independent channels for: ●...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 CK_PSC CNT_EN CK_CNT CNTR CRR Shadow Register PSCR PSCR Shadow Register PSC_CNT Counter Underflow Update Event 1 Flag Software clearing Write a new value Update a new value Figure 71. Down-counting Example...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Repetition Down-counter Operation The update event 1 is usually generated at each overflow or underflow event occurrence. However, when the repetition operation is active by assigning a non-zero value into the REPR register, the update event is only generated if the REPR counter has reached zero.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Clock Controller The following describes the Timer Module clock controller which determines the internal prescaler counter clock source. ▄ Internal APB clock f CLKIN The default internal clock source is the APB clock f...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Slave Controller The MCTM can be synchronised with an internal/external trigger in several modes including the Restart mode, the Pause mode and the Trigger mode which are selected by the SMSEL field in the MDCFR register.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 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.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Master Controller The MCTMs and GPTMs can be linked together internally for timer synchronisation or chaining. When one MCTM is configured to be in the Master Mode, the MCTM Master Controller will generate a Master Trigger Output (MTO) signal which can reset, restart, stop the Slave counter or be a clock source of the Slave Counter.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 Channel Controller The MCTM 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 HT32F52243/HT32F52253 Pulse Width Measurement The input capture mode can be also used for pulse width measurement from signals on the MT_CHx pins, TIx. The following example shows how to configure the MCTM when operated in the input capture mode to measure the high pulse width and the input period on the MT_CH0 pin using channel 0 and channel 1.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 Digital Filter The digital filters are embedded in the input stage and clock controller block for the MT_CH0 ~ MT_CH3 pins. The digital filter in the MCTM is an N-event counter where N refers to how many valid transitions are necessary to output a filtered signal.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Counter Value CHxOM=0x03, CHxPRE=0 (Output toggle, preload disable) CHxCCR (New value 2) CHxCCR (New value 3) CHxCCR (New value 1) CHxCC Time Update CHxCCR value CHxOREF UEV1 (Update Event 1) Figure 89. Toggle Mode Channel Output Reference Signal – CHxPRE = 0...
Cortex ® -M0+ MCU HT32F52243/HT32F52253 When the MT_BRK input has an active level or the Clock Monitor Circuitry detects a clock failure event, a break event will be generated if the break function is enabled. Meanwhile, each channel output will be forced to a reset state, an inactive or idle state. Moreover, a break event can also be generated by the software asserting the BRKG bit in the EVGR register even if the break function is disabled.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Break event CHMOE CHxOREF CH3P = 0, CH3OIS =0 CH3O CH3P = 0, CH3OIS =1 CH3O CH3P = 1, CH3OIS =0 CH3O CH3P = 1, CH3OIS =1 CH3O Figure 97. Channel 3 Output with a Break Event Occurrence The accompanying diagram shows that the complementary output states when a break event occurs where the complementary outputs are enabled by setting both the CHxE and CHxNE bits to 1.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 The accompanying diagram shows the output states in the case of the output being enabled by setting the CHxE bit to 1 and the complementary output being disabled by clearing the CHxNE to 0 when a break event occurs.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 CHMOE can be set automatically by update event 1 if the automatic output enable function is enabled by setting the CHAOE bit in the CHBRKCTR register to 1. Channel Complementary Output with Break Function The Channel complementary outputs, CHxO and CHxNO, are enabled by a combination of the CHxE, CHxNE, CHMOE, CHOSSR, CHOSSI control bits.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 Update Management The update events are categorised into two different types which are the update event 1, UEV1, and update event 2, UEV2. The update event 1 is used to update the CRR, the PSCR, the CHxACR and the CHxCCR values from the actual registers to the corresponding shadow registers.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Update Event 2 The CHxE, CHxNE, CHxOM control bits for the complementary outputs can be preloaded by setting the COMPRE bit in the CTR register. Here the shadow bits of the CHxE, CHxNE, and CHxOM bits will be updated when an update event 2 occurs.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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, users can set the CHxIMAE bit in each CHxOCFR register.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Asymmetric PWM Mode Asymmetric PWM mode allows two center-aligned PWM signals to be genetated with a programmable phase shift. While the PWM frequency is determined by the value of the CRR register, the duty cycle and the phase-shift are determined by the CHxCCR and CHxACR register.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Timer Interconnection The timers can be internally connected together for timer chaining or synchronization. This can be implemented by configuring one timer to operate in the master mode while configuring another timer to be in the slave mode. The following figures present several examples of trigger selection for the master and slave modes.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Using one timer to trigger another timer to start counting ▄ Configure MCTM to operate in the master mode and to send its Update Event UEV as the trigger output (MMSEL = 0x02).
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Starting two timers synchronously in response to an external trigger ▄ Configure MCTM to operate in the master mode to send its enable signal as a trigger output (MMSEL = 0x01). ▄...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Using one timer as a hall sensor interface to trigger another timer with update event 2 GPTM: ▄ Configure channel 0 to choose an input XOR function (TI0SRC = 1) ▄ Configure channel 0 to be in the input capture mode and TRCED as capture source (CH0CCS= 0x03) and Enable channel 0 (CH0E=1) ▄...
Cortex ® -M0+ MCU HT32F52243/HT32F52253 Trigger ADC Start To interconnect to the Analog-to-Digital Converter, the MCTM 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.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 PDMA Request The MCTM has a PDMA data transfer interface. There are certain events which can generate PDMA requests if the corresponding enable control bits are set to 1 to enable the PDMA access.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions UGDIS Update event 1 interrupt generation disable control 0: Any of the following events will generate an update PDMA request or interrupt - Counter overflow / underflow - Setting the UEV1G bit...
Page 301
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [18:16] MMSEL Master Mode Selection Master mode selection is used to select the MTO signal source which is used to synchronise the other slave timer. MMSEL [2:0] Mode Descriptions...
Page 302
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [10:8] SMSEL Slave Mode Selection SMSEL [2:0] Mode Descriptions The prescaler is clocked directly by the Disable mode internal clock. Reserved Reserved Reserved The counter value restarts from 0 or the CRR...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Timer Control Register – CTR This register specifies the timer enable bit (TME), CRR buffer enable bit (CRBE), Capture/compare control bit and Channel PDMA selection bit (CHCCDS). Offset: 0x010 Reset value: 0x0000_0000...
Page 306
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 MCTM is an N-event counter where N is defined as how many valid transitions are necessary to output a filtered signal.
Page 308
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [3:0] TI1F Channel 1 Input Source TI1 Filter Setting These bits define the frequency divide ratio used to sample the TI1 signal. The Digital filter in the MCTM is an N-event counter where N is defined as how many...
Page 310
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [3:0] TI2F Channel 2 Input Source TI2 Filter Setting These bits define the frequency divide ratio used to sample the TI2 signal. The Digital filter in the MCTM is an N-event counter where N is defined as how many valid transitions are necessary to output a filtered signal.
Page 312
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [3:0] TI3F Channel 3 Input Source TI3 Filter Setting These bits define the frequency divide ratio used to sample the TI3 signal. The digital filter in the GPTM is an N-event counter where N is defined as how many...
Page 314
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 –...
Page 316
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 318
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [8][2:0] CH2OM[3:0] Channel 2 Output Mode Setting These bits define the functional types of the output reference signal CH2OREF. 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 320
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Channel Control Register – CHCTR This register contains the channel capture input or compare output function enable control bits. Offset: 0x050 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Reserved CH3E...
Page 322
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions CH1NE Channel 1 Capture/Compare Complementary Enable 0: Off – Channel 1 complementary output CH1NO is not active. The CH1NO level is then determined by the condition of the CHMOE, CHOSSI, CHOSSR, CH1OIS, CH1OISN and CH1E bits.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions CH0P Channel 0 Capture/Compare Polarity - When Channel 0 is configured as an input 0: Capture event occurs on a Channel 0 rising edge 1: Capture event occurs on a Channel 0 falling edge...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Channel Break Control Register – CHBRKCTR This register specifies the channel break control bits. Offset: 0x070 Reset value: 0x0000_0002 CHDTG Type/Reset 0 RW 0 RW 0 RW 0 RW 0 RW 0 RW...
Page 326
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [11:8] Break Input Filter Setting These bits define the frequency ratio used to sample the MT_BRK signal. The digital filter in the MCTM is an N-event counter where N is defined as how many valid transitions are necessary to output a filtered signal.
Page 330
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions CH3CCG Channel 3 Capture/Compare Generation A Channel 3 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 3 If Channel 3 is configured as an input, the counter value is captured into the CH3CCR register and then the CH3CCIF bit is set.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Timer Interrupt Status Register – INTSR This register stores the timer interrupt status. Offset: 0x07C Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved BRKIF TEVIF UEV2IF UEV1IF Type/Reset 0 W0C 0 W0C...
Page 332
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions CH1OCF Channel 1 Over-capture Flag This flag is set by hardware and cleared by software. 0: No over-capture event is detected 1: Capture event occurs again when the CH1CCIF bit is already set and it is not cleared yet by software.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions CH0CCIF Channel 0 Capture/Compare Interrupt Flag - Channel 0 is configured as an output 0: No match event occurs 1: The contents of the counter CNTR have matched the content of the CH0CCR...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Single-Channel Timer (SCTM) Introduction The Single-Channel Timer consists of one 16-bit up-counter, one 16-bit Capture/Compare Register (CCR), 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 HT32F52243/HT32F52253 Functional Descriptions Counter Mode Up-Counting The counter counts continuously from 0 to the counter-reload value, which is defined in the CRR register. 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Channel Controller The SCTM channel can be used as the capture inpus or compare match outpus. Capture input or compare match output channel is composed of a preload register and a shadow register. Data access of the APB bus is always through the read/write preload register.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 CLKIN SCTM_CH CNTR CHCCR CHCCIF CHOCF Figure 121. Input Capture Mode 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 HT32F52243/HT32F52253 Digital Filter The digital filters are embedded in the channel input stage. The digital filter in the SCTM is an N-event counter where N refers to how many valid transitions are necessary to output a filtered signal.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 Channel Output Reference Signal When the SCTM is used in the compare match output mode, the CHOREF signal (Channel Output Reference signal) is defined by the CHOM bit setup. The CHOREF signal has several types of output function which defines what happens to the output when the counter value matches the contents of the CHCCR register.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Counter Value CHOM=0x03, CHPRE=1 (Output toggle, preload enable) CHCCR (New value 2) CHCCR (New value 3) CHCCR (New value 1) CHCCR Time Update CHCCR value CHOREF (Update Event) Figure 126. Toggle Mode Channel Output Reference Signal (CHPRE = 1)
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Update Management The Update event is used to update the CRR, the PSCR and the CHCCR values from the actual registers to the corresponding shadow registers. An update event will occur when the counter overflows, the software update control bit is triggered or an update event from the slave controller is generated.
Page 360
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Real Time Clock (RTC) Introduction The Real Time Clock, RTC, circuitry includes the APB interface, a 24-bit up-counter, a control register, a prescaler, a compare register and a status register. Most of the RTC circuits are located in the V Domain, as shown shaded in the accompanying figure, except for the APB interface.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Functional Descriptions RTC Related Register Reset The RTC registers can only be reset by either a V Domain power on reset, POR, or by a V Domain software reset by setting the PWRST bit in the PWRCR register. Other reset events have no effect to clear the RTC registers.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 RTC Counter Operation The RTC provides a 24-bit up-counter which increments at the falling edge of the CK_SECOND clock and whose value can be read from the RTCCNT register asynchronously via the APB bus.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 RTCOUT Output Pin Configuration The following table shows RTCOUT output format according to the mode, polarity, and event selection setting. Table 42. RTCOUT Output Mode and Active Level Setting ROWM ROES RTCOUT Output Waveform...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Register Map The following table shows the RTC registers and reset values. Note all the registers in this unit are located at the V power domain. Table 43. RTC Register Map Register...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 RTC Compare Register – RTCCMP This register defines a specific value to be compared with the RTC counter value. Offset: 0x004 Reset value: 0x0000_0000 (Reset by V Power Domain reset only) Reserved...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 RTC Control Register – RTCCR This register specifies a range of RTC circuitry control bits. Offset: 0x008 Reset value: 0x0000_0F04 (Reset by V Power Domain reset only) Reserved Type/Reset Reserved ROLF ROAP...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 RTC Status Register – RTCSR This register stores the counter flags. Offset: 0x00C Reset value: 0x0000_0000 (Reset by V Power Domain reset and RTCEN bit change from 1 to 0) Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 RTC Interrupt and Wakeup Enable Register – RTCIWEN This register contains the interrupt and wakeup enable bits. Offset: 0x010 Reset value: 0x0000_0000 (Reset by V Power Domain reset only) Reserved Type/Reset Reserved...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 be operated in a reset mode. The Watchdog timer will generate a reset when the counter counts down to a zero value.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 Functional Description The Watchdog timer is formed from a 12-bit count-down and a fixed 3-bit prescaler. The largest time-out period is 16 seconds, using the LSE or LSI clock and a 1/128 maximum prescaler value.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Register Descriptions Watchdog Timer Control Register – WDTCR This register is used to reload the Watchdog timer. Offset: 0x000 Reset value: 0x0000_0000 RSKEY Type/Reset 0 WO 0 WO 0 WO 0 WO...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 START Condition STOP Condition Figure 133. 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 10-bit 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.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Data Frame Acknowledge bit SCL from Master Data output Transmitter Not acknowledge Data output Receiver acknowledge Figure 138. I C Bus Acknowledge 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 HT32F52243/HT32F52253 Arbitration A master may start a transfer only if the I C bus line is in the free or idle mode. If two or more masters generate a START signal at approximately the same time, an arbitration procedure will occur.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Address Mask Enable The I C module provides address mask function for user to decide which address bit can be ignored during the comparison with the address frame sent from the master. The ADRS flag will be asserted when the unmasked address bits and the address frame sent from the master are matched.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 Close / Continue Transmission After transmitting the last data byte, the STOP bit in the I2CCR register can be set to terminate the transmission or re-assign another slave device by configuring the I2CTAR register to restart a new transfer.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 Data Frame In the master receiver mode, data is transmitted from the slave device. Once a data is received by the master device, the RXDNE flag in the I2CSR register is set but it will not hold the SCL line.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Register Map The following table shows the I C registers and reset values. Table 46. I C Register Map Register Offset Description Reset Value I2CCR 0x000 C Control Register 0x0000_2000 I2CIER 0x004...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Register Descriptions C Control Register – I2CCR This register specifies the corresponding I C function enable control. Offset: 0x000 (0) Reset 0x0000_2000 value: Reserved Type/Reset Reserved Type/Reset SEQFILTER COMBFILTEREn ENTOUT Reserved DMANACK RXDMAE TXDMAE...
Page 405
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions RXDMAE DMA Mode RX Request Enable Control 0: RX DMA request disabled 1: RX DMA request enabled If the data register is not empty in the receiver mode and the RXDMAE bit is set to 1, the relevant PDMA channel will be activated to move the data from the data register to a specific location which is defined in the corresponding PDMA register.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions ARBLOSIE Arbitration Loss Interrupt Enable Bit in the I2C multi-master 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 HT32F52243/HT32F52253 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 409
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 410
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 C Data Register – I2CDR This register specifies the data to be transmitted or received by the I C module. Offset: 0x018 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset DATA...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 The following figure 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)
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 The following figure 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) Data1 Data2 MOSI/MISO Figure 150.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 The following figure 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) ½...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 The following figure shows the continuous data transfer timing of this format. Note that the SEL signal must remain active until the last data transfer has completed. SEL (SELAP=0) SEL (SELAP=1) Data1...
Cortex ® -M0+ MCU HT32F52243/HT32F52253 Mode Fault – MF The mode fault flag can be used to detect SPI bus usage in the SPI multi-master mode. For the multi-master mode, the SPI module is configured as a master device and the SEL signal is setup as an input signal.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Table 50. SPI Master Mode SEL Pin Status. SEL as Input – SELOEN = 0 SEL as Output – SELOEN = 1 Multi-master Support Not support SPI SEL control Use Another GPIO to replace the SEL...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 PDMA Interface The PDMA interface is integrated in the SPI module. The PDMA function can be enabled by setting the TXDMAE or RXDMAE bit to 1 in the transmitter or receiver mode respectively. When...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Register Descriptions SPI Control Register 0 – SPICR0 This register specifies the SEL control and the SPI enable bits. Offset: 0x000 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset SELHT GUADT Type/Reset 0 RW...
Page 429
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 SPI Control Register 1 – SPICR1 This register specifies the SPI parameters including the data length, the transfer format, the SEL active polarity/ mode, the LSB/MSB control, and the master/slave mode. Offset:...
Page 431
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [10:8] FORMAT SPI Data Transfer Format These three bits are used to determine the data transfer format of the SPI interface FORMAT [2:0] CPOL CPHA Others Reserved CPOL: Clock Polarity...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions RXBNE Receive Buffer Not Empty flag 0: RX buffer empty 1: RX buffer not empty This bit indicates the RX buffer status in the non-FIFO mode. It is also used to indicate if the RX FIFO trigger level has been reached in the FIFO mode.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [7:4] RXFTLS RX FIFO Trigger Level Select 0000: Trigger level is 0 0001: Trigger level is 1 1000: Trigger level is 8 Others: Reserved The RXFTLS field is used to specify the RX FIFO trigger level. When the number of...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [3:0] TXFS TX FIFO Status 0000: TX FIFO empty 0001: TX FIFO contains 1 data … 1000: TX FIFO contains 8 data Others: Reserved SPI FIFO Time Out Counter Register – SPIFTOCR This register stores the SPI RX FIFO time out counter compared value.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 RTS Flow Control In the RTS flow control, the USART RTS pin is active with a logic low state when the receive data register is empty. It means that the receiver is ready to receive a new data. When the RX FIFO reaches the trigger level which is specified by configuring the RFTL field in the USRFCR register, the USART RTS pin is inactive with a logic high state.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 IrDA The USART IrDA mode is provided half-duplex point-to-point wireless communication. The USART module includes an integrated modulator and demodulator which allow a wireless communication using infrared transceivers. The transmitter specifies a logic data ‘0’ as a ‘high’...
Page 446
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 The IrDA mode provides two operation modes, one is the normal mode, and the other is the low- power mode. IrDA Normal Mode For the IrDA normal mode, the width of each transmitted pulse generated by the transmitter modulator is specified as 3/16th of the baud rate clock period.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 TX_Data Transmitter Modulation TXSEL RX_Data Receiver Demodulation IrDAEN Figure 163. USART I/O and IrDA Block Diagram RS485 Mode The RS485 mode of USART provides the data on interface is transmitted over a 2-wire twisted pair bus.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 RS-485 Transceiver Differential USART TG = 4 Reference Divisor Clock D7 Parity Stop Start D3 D4 D5 TXENP =0 TXENP =1 Figure 164. RS485 Interface and Waveform 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.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 RS485 Auto Address Detection Operation Mode – AAD Except in the Normal Multi-drop Operation Mode, the RS485 mode can operate in the Auto Address Detection Operation Mode, AAD, when it is configured as an addressable slave. This mode is enabled by setting the RSAAD filed to 1 in the RS485CR register.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 USART Control Register – USRCR The register specifies the serial parameters such as data length, parity, and stop bit for the USART. Offset: 0x004 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Type/Reset...
Page 455
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [10] Number of "STOP bit" 0: One "STOP bit" is generated in the transmitted data 1: Two "STOP bit" is generated when 8- and 9-bit word length is selected.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 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 HT32F52243/HT32F52253 Bits Field Descriptions PEIE Parity Error Interrupt Enable 0: Disable interrupt. 1: Enable interrupt An interrupt is generated when the PEI bit is set in the USRSIFR register. OEIE Overrun Error Interrupt Enable 0: Disable interrupt.
Page 459
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions RSADD RS485 Address Detection 0: Address is not detected 1: Address is detected This bit is set to 1 when the receiver detects the address. An interrupt is generated if RSADDIE = 1 in the USRIER register.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 USART Timing Parameter Register – USRTPR This register contains the USART timing parameters including the transmitter time guard parameters and the receive FIFO time-out value together with the RX FIFO time-out interrupt enable control.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 USART IrDA Control Register – IrDACR This register is used to control the IrDA mode of USART. Offset: 0x018 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset IrDAPSC Type/Reset 0 RW 0 RW...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 USART RS485 Control Register – RS485CR This register is used to control the RS485 mode of USART. Offset: 0x01C Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset ADDMATCH Type/Reset 0 RW 0 RW...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Univer sal Asynchr onous 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 UART Control Register – URCR The register specifies the serial parameters such as data length, parity, and stop bit for the UART. Offset: 0x004 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved...
Cortex ® -M0+ MCU HT32F52243/HT32F52253 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 HT32F52243/HT32F52253 Bits Field Descriptions Parity Error Indicator This bit is set to 1 whenever the received character does not have a valid "parity bit". Writing 1 to this bit clears the flag. Overrun Error Indicator An overrun error will occur only after the receive data register is full and when the next character has been completely received in the receive shift register.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Peripheral Direct Memory Access (PDMA) Introduction The Peripheral Direct Memory Access circuitry, PDMA, provides 6 unidirectional channels for dedicated peripherals to implement the peripheral-to-memory and memory-to-peripheral data transfer. The memory-to-memory data transfer such as the FLASH-to-SRAM or SRAM-to- SRAM type is also supported and requested by the application program.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Functional Description AHB Master The PDMA is an AHB master connected to other AHB peripherals such as the FLASH memory, the SRAM memory and the AHB-to-APB bridges through the bus-matrix. The CPU and PDMA can access different AHB slaves at the same time via the bus-matrix.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Linear Address Mode After data is transferred, the current address will be increased or decreased by 1, 2 or 4 depending upon the data bit width setting. Circular Address Mode After data is transferred, the current address will be increased or decreased by 1, 2 or 4 depending upon the data bit width setting.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Register Map The following table shows the PDMA registers and the reset values. Table 60. PDMA Register Map Register Offset Description Reset Value PDMA Base Address = 0x4009_0000 PDMA Channel 0 Registers...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Register Descriptions PDMA Channel n Control Register – PDMACHnCR, n = 0 ~ 5 This register is used to specify the PDMA channel n data transfer configuration. Offset: 0x000 (0), 0x018 (1), 0x030 (2), 0x048 (3), 0x060 (4), 0x078 (5)
Page 484
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions SRCAMODn Channel n Source Address Mode selection 0: Linear address mode 1: Circular address mode In the linear address mode, the current source address value can be incremented or decremented, determined by the SRCAINCn bit value during a complete transfer.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 PDMA Channel n Current Transfer Size Register – PDMACHnCTSR, n = 0 ~ 5 This register is used to indicate the current block transaction count. Address: 0x014 (0), 0x02C (1), 0x044 (2), 0x05C (3), 0x074 (4), 0x08C (5)
Page 488
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Bits Field Descriptions [29], [24], TEISTAn Channel n Transfer Error Interrupt Status (n = 0 ~ 5) 0: No Transfer Error occurs [19], [14], 1: Transfer Error occurs [9], [4] This bit is set by hardware and is cleared by writing a "1" into the corresponding interrupt status clear bit in the PDMAISR register.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 PDMA Interrupt Status Clear Register – PDMAISCR This register is used to clear the corresponding interrupt status bits in the PDMAISR Register. Offset: 0x128 Reset value: 0x0000_0000 Reserved TEICLR5 TCICLR5 HTICLR5 BEICLR5...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 PDMA Interrupt Enable Register – PDMAIER This register is used to enable or disable the related interrupts of the PDMA channel 0 ~ 5. Offset: 0x130 Reset value: 0x0000_0000 Reserved TEIE5 TCIE5...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Cyclic Redundancy Check (CRC) Introduction The CRC (Cyclic Redundancy Check) calculation unit is an error detection technique test algorithm and uses to verify data transmission or storage data correctness. A CRC calculation takes a data stream or a block of data as input and generates a 16-bit or 32-bit output remainder.
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Function Descriptions This unit only enables the calculation in the CRC16, CCITT CRC16 and IEEE-802.3 CRC32 polynomial. In this unit, the generator polynomial is fixed to the numeric values for those modes; therefore, the CRC value based on other generator polynomials cannot be calculated.
Cortex ® -M0+ MCU HT32F52243/HT32F52253 CRC with PDMA A PDMA channel with software trigger may be used to transfer data into the CRC unit. If a huge block data is needed to calculate. The recommended PDMA model is to use the PDMA to transfer all available words of data and uses software writes to transfer the other remaining bytes.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 CRC Seed Register – CRCSDR This register is used to specify the CRC seed. Offset: 0x004 Reset value: 0x0000_0000 SEED Type/Reset 0 WO 0 WO 0 WO 0 WO 0 WO 0 WO...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 CRC Data Register – CRCDR This register is used to specify the CRC input data. Offset: 0x00C Reset value: 0x0000_0000 CRCDATA Type/Reset 0 WO 0 WO 0 WO 0 WO 0 WO...
® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Divider (DIV) Introduction In order to enhance the MCU performance, a divider is integrated in this device. The divider can implement the signed or unsigned 32-bit data division operation. An error flag will be generated when the divide by zero condition occurs.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Register Map The following table shows the DIV registers and reset values. Table 62. DIV Register Map Register Offset Description Reset Value 0x000 Divider control register 0x0000_0008 0x004 Dividend data register 0x0000_0000...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F52243/HT32F52253 Quotient Data Register – QTR The register is used to store the quotient data. Offset: 0x00C Reset value: 0x0000_0000 Type/Reset 0 RO 0 RO 0 RO 0 RO 0 RO 0 RO...
Page 501
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 HT32F52243 and is the answer not in the manual?
Questions and answers