Page 5
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Port A Output Set/Reset Control Register – PASRR ..............136 Port A Output Reset Register – PARR ..................137 Port B Data Direction Control Register – PBDIRCR ..............137 Port B Input Function Enable Control Register – PBINER ............138 Port B Pull-Up Selection Register –...
Page 6
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 EXTI Source Selection Register 0 – ESSR0 ................171 EXTI Source Selection Register 1 – ESSR1 ................172 GPIO Port x Configuration Low Register – GPxCFGLR, x = A, B, C, D ........173 GPIO Port x Configuration High Register –...
Page 7
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Voltage Monitor ........................196 Register Map ........................196 Register Descriptions ......................197 ADC Conversion Control Register – ADCCR ................197 ADC Conversion List Register 0 – ADCLST0 ................199 ADC Conversion List Register 1 – ADCLST1 ................200 ADC Input Sampling Time Register –...
HT32F54231/HT32F54241/HT32F54243/HT32F54253 Introduction Overview This user manual provides detailed information including how to use the HT32F54231/ HT32F54241/HT32F54243/HT32F54253 devices, system and bus architecture, memory organization and peripheral instructions. The target audiences for this document are software developers, application developers and hardware developers. For more information regarding pin assignment, package and electrical characteristics, please refer to the HT32F54231/HT32F54241/ HT32F54243/HT32F54253 datasheet.
Page 26
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Reset Control Unit – RSTCU ▆ ● Supply supervisor: ♦ Power-On Reset / Power-Down Reset – POR / PDR ♦ Brown-Out Detector – BOD ♦ Programmable Low Voltage Detector – LVD Clock Control Unit – CKCU ▆...
Page 27
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 I/O Ports – GPIO ▆ ● Up to 54 GPIOs ● Port A, B, C, D are mapped on 16 external interrupts – EXTI ● Almost all I/O pins have configurable output driving current Motor Control Timer –...
Page 28
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Inter-integrated Circuit – I ▆ ● Supports both master and slave modes with a frequency of up to 1 MHz ● Provides an arbitration function and clock synchronization ● Supports 7-bit and 10-bit addressing modes and general call addressing ●...
Page 29
Hardware Upper or lower threshold comparators ● Keys are organised into several groups, with each group known as a module For the HT32F54231/HT32F54241, having a module number, M0 to M5 ♦ For the HT32F54243/HT32F54253, having a module number, M0 to M6 ♦...
32 kHz Touch key TKEY23 WAKEUP VDDA 32,768 Hz VSSA nRST Powered by V Powered by V CORE X32KIN X32KOUT Power supply: Bus: Control signal: Alternate function: Figure 1. HT32F54231/HT32F54241 Block Diagram Rev. 1.00 31 of 576 January 28, 2022...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Document Conventions The conventions used in this document are shown in the following table. Table 2. Document Conventions Notation Example Description The number string with a 0x prefix indicates a hexadecimal 0x5a05 number.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 System Architecture The system architecture of the device that includes the Arm Cortex -M0+ processor, bus ® ® architecture and memory organization will be described in the following sections. The Cortex ®...
-M0+ Block Diagram Bus Architecture The HT32F54231/HT32F54241 series consist of one master and four slaves in the bus architecture. The HT32F54243/HT32F54253 series consist of two masters and four slaves in the bus architecture. The system bus and Peripheral Direct Memory Access (PDMA) are the masters while the internal SRAM access bus, the internal Flash memory access bus, the AHB peripherals access bus and the AHB to APB bridge are the slaves.
-M0+ system peripherals. Refer to the Arm ® Cortex ® -M0+ Technical Reference Manual for more information. The following figure shows the memory map of the HT32F54231/HT32F54241/HT32F54243/HT32F54253 series of devices, including Code, SRAM, peripheral, and other pre-defined regions. Rev. 1.00 36 of 576 January 28, 2022...
Programming (ISP), In Application Programming (IAP) or In Circuit Programming (ICP). For more information, refer to the Flash Memory Controller section. Embedded SRAM Memory The HT32F54231/HT32F54241/HT32F54243/HT32F54253 device series contain an up to 16 KB on-chip SRAM which is located at address 0x2000_0000. It supports byte, half-word and word access operations.
● 64 KB (instruction/data + Option Byte) for the HT32F54241 and HT32F54243 ● 32 KB (instruction/data + Option Byte) for the HT32F54231 Page size of 1 KB, totally up to 128 pages depending on the main Flash size ▆ Wide access interface with a pre-fetch buffer to reduce instruction gaps ▆...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 the Boot Loader Block with a capacity of 2 KB.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Flash Memory Architecture The Flash memory consists of up to 128 KB main Flash Block with 1 KB per page and 2 KB Information Block for Boot Loader. The main Flash memory contains a total of 128 pages (or 64 pages for 64 KB device and so on) which can be erased individually.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Booting Configuration The system provides two kinds of booting modes which can be selected using the BOOT pin. The BOOT pin status is sampled during the 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 booting mode.
® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Note that a correct address of the target page must be confirmed. The software may run out of control if the target erase page is under the code fetching or data accessing status. The FMC will not provide any notification when this happens.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Mass Erase The FMC provides a mass erase function which is used to initialize all the main Flash memory contents to a high state. The following steps show the mass erase operation register access sequence.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Word Programming The FMC provides a 32-bit word programming function which is used to modify the Flash memory contents. The following steps show the word programming operation register access sequence. 1. Check the OPCR register to confirm that no Flash memory operation is in progress (OPM [3:0] is equal to 0xE or 0x6).
0x008 Reserved 0xFFFF_FFFF 0x00C For the HT32F54231 the variable “X” is equal to 31. 0xFFFF_FFFF For the HT32F54241 the variable “X” is equal to 62. For the HT32F54243 the variable “X” is equal to 63. For the HT32F54253 the variable “X” is equal to 126.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Page Erase/Program Protection The FMC provides a page erase/program protection function to prevent unexpected operations on the protected Flash memory area. The page erase (CMD [3:0] = 0x8 in the OCMR register) or word programming (CMD [3:0] = 0x4) command will not be accepted by the FMC on the protected pages.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Security Protection The FMC provides a security protection function to prevent illegal code/data access to the Flash memory. This function is useful for protecting the software/firmware from illegal users. The function is activated by setting OB_CP [0] in the Option Byte. 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Flash Write Data Register – WRDR This register specifies the data to be written for the 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Flash Operation Command Register – OCMR This register is used to specify the Flash operation commands that include word programming, page erase and mass erase. Offset: 0x00C Reset value: 0x0000_0000 Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Flash Operation Interrupt Enable Register – OIER This register is used to enable or disable the FMC interrupt function. The FMC will generate the interrupt when the corresponding interrupt enable bit is set and the interrupt condition occurs.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 if an error has occurred. The status bits, bit [4:0], if set high, are available to trigger the interrupts when the corresponding enable bits in the OIER register are set high.
Page 60
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions OBEF Option Byte Checksum Error Flag 0: Option Byte checksum is correct 1: Option Byte checksum is incorrect This bit will be set high when the Option Byte checksum is incorrect. The Option Byte Checksum Error interrupt will be generated if the OBEIEN bit in the OIER register is set.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 activated when any kind of reset occurs.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Flash Manufacturer and Device ID Register – MDID This register specifies the manufacture ID and device part number information which can be used as the product identity. Offset: 0x180 Reset value: 0x0376_XXXX...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Custom ID Register n – CIDRn (n = 0 ~ 3) This register specifies the custom ID information which can be used as the custom identity. Offset: 0x310 (0) ~ 0x31C (3) Reset value: 0xXXXX_XXXX –...
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 and Deep-Sleep2 modes.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Features Two power domains: V and V power domains ▆ CORE Three power saving modes: Sleep, Deep-Sleep1 and Deep-Sleep2 modes ▆ Internal Voltage regulator supplies V voltage source ▆ CORE Additional ultra-low power voltage regulator supplies V voltage source with low static ▆...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Hysteresis Time POR Delay Time RSTD RESET Figure 14. Power-On Reset / Power-Down Reset Waveform Low Voltage Detector / Brown-Out Detector The Low Voltage Detector, LVD, can detect whether the supply voltage V...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Power Domain CORE The main functions that include high speed internal oscillator, HSI, MCU core logic, AHB/APB peripherals and memories and so on are located in this power domain. Once the V...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 WAKEUPn Pin Wakeup The software can set the WUPnEN bit in register PWRCR to 1 to enable the WAKEUPn pin function before entering the power saving mode, waiting for a wakeup trigger signal occurrence on the WAKEUPn pin to wake up the system from the power saving mode.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Descriptions Power Control Status Register – PWRSR This register indicates power control status. Offset: 0x100 Reset value: 0x0000_0010 (Reset only by V domain power on reset) CORE Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Power Control Register – PWRCR This register provides power control bits for the different kinds of power saving modes. Offset: 0x104 Reset value: 0x0000_0000 Reserved Type/Reset Reserved WUP1TYPE WUP0TYPE Type/Reset 0 RW...
Page 77
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions WUP0EN External WAKEUP0 Pin Enable 0: Disable WAKEUP0 pin function 1: Enable WAKEUP0 pin function The software can set the WUP0EN bit as 1 to enable the WAKEUP0 pin function before entering the power saving mode.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Low Voltage / Brown Out Detect Control and Status Register – LVDCSR This register specifies flags, enable bits and option bits for low voltage detector. Offset: 0x110 Reset value: 0x0000_0000 Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [16] LVDEN Low Voltage Detect Enable 0: Disable Low Voltage Detect 1: Enable Low Voltage Detect Setting this bit to 1 will generate an LVD event when the V power is equal to or lower than the voltage set by LVDS bits.
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 = 5.0 V and T = 25 °C.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Phase Locked Loop – PLL This PLL can provide a 4 ~ 60 MHz clock output which is 1 ~ 15 multiples of a fundamental reference frequency of 4 ~ 16 MHz. The rationale of the clock synthesizer relies on the digital Phase...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Low Speed Internal RC Oscillator – LSI The low speed internal RC oscillator with a frequency of about 32 kHz produces a low power clock source for the circuits of Real-Time-Clock peripheral, Watchdog Timer or system clock. The LSI is also a low cost clock source because no external component is needed to make it oscillate.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 HSE Clock Monitor The main function of the oscillator check is enabled by the HSE Clock Monitor Enable bit CKMEN in the Global Clock Control Register (GCCR). The HSE clock monitor should be enabled after the HSE oscillator start-up delay and be disabled when the HSE oscillator is stopped.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Map The following table shows the CKCU registers and reset values. Table 19. CKCU Register Map Register Offset Description Reset Value GCFGR 0x000 Global Clock Configuration Register 0x0000_0302 GCCR 0x004 Global Clock Control Register...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions HSEGAIN External High Speed Clock Gain Selection 0: HSE low gain mode 1: HSE high gain mode [2:0] System Clock Switch 00x: CK_PLL clock out as system clock 010: CK_HSE as system clock...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions HSIRDY Internal High Speed Clock Ready Flag 0: Internal 8 MHz RC oscillator clock is not ready 1: Internal 8 MHz RC oscillator clock is ready Set by hardware to indicate whether the HSI is stable or not.
Page 98
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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. Users can set APBEN as 0 to reduce power consumption if the APB bridge is unused during Sleep mode.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 APB Clock Control Register 0 – APBCCR0 This register specifies clock enable bits of APB peripherals. Offset: 0x02C Reset value: 0x0000_0000 Reserved LEDC Reserved Type/Reset Reserved Type/Reset EXTIEN AFIOEN UR3EN UR2EN UR1EN...
Page 101
0: USART0 clock is disabled 1: USART0 clock is enabled Set and reset by software. Since there is only one USART in the HT32F54231/HT32F54241 devices, the pins, registers and control bits related to the USART do not have the serial number “0”. SPI1EN...
Page 103
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [18] TOUCHKEYEN Touch Key Clock Enable 0: Touch Key clock is disabled 1: Touch Key clock is enabled Set and reset by software. [17] BFTM1EN BFTM1 Clock Enable 0: BFTM1 clock is disabled 1: BFTM1 clock is enabled Set and reset by software.
11: PCLK = CK_AHB / 8 PCLK = Peripheral Clock; CK_AHB = AHB and CPU clock Since there is only one USART in the HT32F54231/HT32F54241 devices, the pins, registers and control bits related to the USART do not have the serial number “0”.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions TMSEL Trimming Mode Selection 0: Automatic by Auto Trimming Controller 1: Manual by user program This bit is used to select the HSI RC oscillator trimming function by ATC hardware or user programming via the HSIFINE field in this register.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 MCU Debug Control Register – MCUDBGCR This register specifies the debug control of MCU. Offset: 0x304 Reset value: 0x0000_0000 Reserved DBLEDC DBI2C2 DBUR3 DBUR2 DBSCTM3 DBSCTM2 Type/Reset RW 0 0 RW 0 RW...
Page 113
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [23] DBSCTM1 SCTM1 Debug Mode Enable 0: SCTM1 counter continues even if the core is halted 1: SCTM1 counter is stopped when the core is halted Set and reset by software.
Page 114
1: USART0 FIFO timeout is frozen when the core is halted Set and reset by software. Since there is only one USART in the HT32F54231/HT32F54241 devices, the pins, registers and control bits related to the USART do not have the serial number “0”.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 APB Peripheral Reset Register 0 – APBPRSTR0 This register specifies several APB peripherals software reset control bits. Offset: 0x108 Reset value: 0x0000_0000 Reserved LEDCRST Reserved Type/Reset Reserved Type/Reset EXTIRST AFIORST UR3RST UR2RST...
Page 120
This bit is set by software and cleared to 0 by hardware automatically. Since there is only one USART in the HT32F54231/HT32F54241 devices, the pins, registers and control bits related to the USART do not have the serial number “0”.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 APB Peripheral Reset Register 1 – APBPRSTR1 This register specifies several APB peripherals software reset control bits. Offset: 0x10C Reset value: 0x0000_0000 SCTM3RST SCTM2RST SCTM1RST SCTM0RST Reserved ADCRST Type/Reset RW 0 RW...
Page 122
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [17] BFTM1RST BFTM1 Reset Control 0: No reset 1: Reset BFTM1 This bit is set by software and cleared to 0 by hardware automatically. [16] BFTM0RST BFTM0 Reset Control...
There are up to 40 General Purpose I/O ports, GPIO, named PA0 ~ PA15, PB0 ~ PB15 and PC0 ~ PC7 for the HT32F54231/HT32F54241 devices and up to 54 General Purpose I/O ports, GPIO, named PA0 ~ PA15, PB0 ~ PB15, PC0 ~ PC15 and PD0 ~ PD5 for the HT32F54243/HT32F54253 devices to implement the logic input/output functions.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Features Input/output direction control ▆ Schmitt Trigger Input function enable control ▆ Input weak pull-up/pull-down control ▆ Output push-pull/open-drain enable control ▆ Output set/reset control ▆ Output drive current selection ▆ External interrupt with programmable trigger edge – using EXTI configuration registers ▆...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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...
Page 127
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Offset Description Reset Value PCDINR 0x01C Port C Data Input Register 0x0000_0000 PCDOUTR 0x020 Port C Data Output Register 0x0000_0000 PCSRR 0x024 Port C Output Set/Reset Control Register 0x0000_0000 PCRR 0x028...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Descriptions Port A Data Direction Control Register – PADIRCR This register is used to control the direction of the GPIO Port A pin as input or output. Offset: 0x000 Reset value: 0x0000_0000...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 PAOD Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Port A Drive Current Selection Register – PADRVR This register specifies the GPIO Port A output driving current. Offset: 0x014 Reset value: 0x0000_0000 PADV15 PADV14 PADV13 PADV12 Type/Reset 0 RW 0 RW...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 PBOD Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Port B Drive Current Selection Register – PBDRVR This register specifies the GPIO Port B output driving current. Offset: 0x014 Reset value: 0x0000_0000 PBDV15 PBDV14 PBDV13 PBDV12 Type/Reset 0 RW 0 RW...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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...
GPIO Port C pin n Direction Control Bits (n = 0 ~ x) 0: Pin n is in input mode 1: Pin n is in output mode For the HT32F54231/HT32F54241 devices the variable “x” is equal to 7 while the variable “x” is equal to 15 for the HT32F54243/HT32F54253 devices. Rev. 1.00...
When the pin n input function is disabled, the input Schmitt trigger will be turned off and the Schmitt trigger output will remain at a zero state. For the HT32F54231/HT32F54241 devices the variable “x” is equal to 7 while the variable “x” is equal to 15 for the HT32F54243/HT32F54253 devices.
0: Pin n pull-up function is disabled 1: Pin n pull-up function is enabled For the HT32F54231/HT32F54241 devices the variable “x” is equal to 7 while the variable “x” is equal to 15 for the HT32F54243/HT32F54253 devices. Note: When the pull-up and pull-down functions are both enabled, the pull-up function will have the higher priority and therefore the pull-down function will be blocked and disabled.
0: Pin n pull-down function is disabled 1: Pin n pull-down function is enabled For the HT32F54231/HT32F54241 devices the variable “x” is equal to 7 while the variable “x” is equal to 15 for the HT32F54243/HT32F54253 devices. Note: When the pull-up and pull-down functions are both enabled, the pull-up function will have the higher priority and therefore the pull-down function will be blocked and disabled.
0: Pin n Open-Drain output is disabled (The output type is CMOS output) 1: Pin n Open-Drain output is enabled (The output type is open-drain output) For the HT32F54231/HT32F54241 devices the variable “x” is equal to 7 while the variable “x” is equal to 15 for the HT32F54243/HT32F54253 devices.
01: 8 mA source/sink current 10: 12 mA source/sink current 11: 16 mA source/sink current For the HT32F54231/HT32F54241 devices the variable “x” is equal to 7 while the variable “x” is equal to 15 for the HT32F54243/HT32F54253 devices Rev. 1.00...
PCLKEY and PCLOCKn (lock control bit) should be written together and cannot be changed until a system reset or GPIO Port C reset occurs. For the HT32F54231/HT32F54241 devices the variable “x” is equal to 7 while the variable “x” is equal to 15 for the HT32F54243/HT32F54253 devices.
0: The input data of corresponding pin is 0 1: The input data of corresponding pin is 1 For the HT32F54231/HT32F54241 devices the variable “x” is equal to 7 while the variable “x” is equal to 15 for the HT32F54243/HT32F54253 devices.
0: Data to be output on pin n is 0 1: Data to be output on pin n is 1 For the HT32F54231/HT32F54241 devices the variable “x” is equal to 7 while the variable “x” is equal to 15 for the HT32F54243/HT32F54253 devices.
Note that when the PCRSTn bit in this register or the PCRSTn bit in the PCRR register is enabled, the reset function on the PCDOUTn bit will take effect. For the HT32F54231/HT32F54241 devices the variable “x” is equal to 7 while the variable “x” is equal to 15 for the HT32F54243/HT32F54253 devices.
GPIO Port C pin n Output Reset Control Bits (n = 0 ~ x) 0: No effect on the PCDOUTn bit 1: Reset the PCDOUTn bit For the HT32F54231/HT32F54241 devices the variable “x” is equal to 7 while the variable “x” is equal to 15 for the HT32F54243/HT32F54253 devices. Rev. 1.00...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Port D Data Direction Control Register – PDDIRCR This register is used to control the direction of GPIO Port D pin as input or output. Offset: 0x000 Reset value: 0x0000_0000 Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Alternate Function Input/Output Control Unit (AFIO) Introduction In order to expand the flexibility of the GPIO or the usage of peripheral functions, each I/O 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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+.
3. Refer to the PWRCU chapter for the relevant configuration descriptions about the WAKEUP-pin wakeup interrupt. 4. These exception types are only available for the HT32F54243/HT32F54253 devices. 5. Since there is only one USART in the HT32F54231/HT32F54241 devices, this exception type related to the USART do not have the serial number "0". Features...
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Functional Descriptions SysTick Calibration The SysTick Calibration Value Register (SYST_CALIB) is provided by the NVIC to give a reference time base of 1ms for the RTOS tick timer or other purposes. The TENMS field in the SYST_CALIB register has a fixed value of 7500 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 7.5 MHz...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 External Interrupt/Event Controller (EXTI) Introduction The External Interrupt/Event Controller, EXTI, comprises 16 edge detectors which can generate wakeup events or interrupt requests independently. In the interrupt mode there are five trigger types which can be selected as the external interrupt trigger type, low level, high level, negative edge, positive edge and both edges, selectable using the SRCnTYPE field in the EXTICFGRn (n = 0 ~ 15) register.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Functional 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 MCU core and the Clock Control Unit, CKCU.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Descriptions EXTI Interrupt n Configuration Register – 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Analog to Digital Converter (ADC) Introduction A 12-bit multi-channel Analog to Digital Converter (ADC) with a Voltage Reference Generator ) is integrated in the devices. There are a total of 14 multiplexed channels including 10 external channels on which the external analog signal can be supplied and 4 internal channels.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Features 12-bit SAR ADC engine ▆ Up to 1 Msps conversion rate ▆ Up to 10 external analog input channels ▆ 1 channel for internal voltage reference (V ▆ 1 channel for monitor external V power support pin ▆...
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Functional 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Conversion (ex: Sequence Length=8) Cycle Cycle Start of Conversion Single sample End of Conversion Cycle End of Conversion Figure 31. One Shot Conversion Mode Continuous Conversion Mode In the Continuous Conversion Mode, repeated conversion cycle will restart automatically without requiring additional A/D start trigger signals after a channel group conversion has completed.
Page 192
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 ADCCR 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 33.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Voltage Reference Generator (V VREFEN Bandgap VREFVAL[5:0] AFIO15 VREFSEL[1:0] Figure 34. Voltage Reference Generator Block Diagram Voltage Monitor The MVDDAEN bit in the VREFCR register allows the applications to measure the V voltage on the VDDA pin.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 an idle state.
Page 198
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Voltage Reference Value Register – VREFVALR This register contains the internal voltage reference trim value. Offset: 0x0A4 Reset value: 0x0000_00XX (Various depending on Flash Manufacture Privilege Information Block) Reserved Type/Reset Reserved Type/Reset...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Comparator (CMP) (HT32F54243/ HT32F54253 only) Introduction Two general purpose comparators (CMP) are implemented within the devices. They can be configured either as standalone comparators or combined with the different kinds of peripheral IP.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Functional Descriptions Comparator Inputs and Output The I/O pins used as comparator input or output must be configured in the AFIO controller registers. The detailed comparator input and output information will be referred in pin assignment table in the datasheet.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Interrupts and Wakeup The comparator can generate an interrupt when its output waveform generates a rising or falling edge and its corresponding interrupt enable control bit is also set. For example, when a comparator output rising edge occurs, the comparator rising edge flag bit CMPRF in the Comparator Transition Flag Register CMPTFRn will be set.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Power Mode and Hysteresis The comparator response time can be programmed to meet the trade-off between the power consumption and application speed requirements. The bit CMPSM in the CMPCRn register can be programmed as “0” to make the comparator operate in the low speed mode with low power consumption.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Descriptions Comparator Control Register n – CMPCRn, n = 0 or 1 This register contains the comparator function and voltage reference control bits. Offset: 0x000 (n = 0), 0x100 (n = 1)
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Comparator Voltage Reference Value Register n – CVRVALRn, n = 0 or 1 The register is used to set the comparator voltage reference level. Offset: 0x004 (n = 0), 0x104 (n = 1)
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Comparator Interrupt Enable Register n – CMPIERn, n = 0 or 1 The register is used to enable the comparator n interrupt when the comparator output transition event occurs. Offset: 0x008 (n = 0), 0x108 (n = 1)
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Features 16-bit up/down auto-reload counter ▆ 16-bit programmable prescaler that allows division of the prescaler clock source by any factor ▆ between 1 and 65536 to generate the counter clock frequency Up to 4 independent channels for: ▆...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 Update the new value Software clearing Figure 40. Up-counting Example Down-Counting...
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Trigger Controller The trigger controller is used to select the trigger source and setup the trigger level or trigger edge condition. For the internal trigger input, it can be selected by the Trigger Selection bits TRSEL in the TRCFR register.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 can be selected by the SMSEL field in the MDCFR register.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Master Controller The GPTMs and TMs 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 TM, if exists, which is configured in the Slave Mode.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Channel Controller The GPTM has four independent channels which can be used as capture inputs or compare match outputs. Each capture input or compare match output channel is composed of a preload register and a shadow register. Data access of the APB bus is always implemented by reading/writing the preload register.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Capture Counter Value Transferred to CHxCCR When the channel is used as a capture input, the counter value is captured into the Channel Capture/Compare Register (CHxCCR) when an effective input signal transition occurs. Once the capture event occurs, the CHxCCIF flag in the INTSR register is set accordingly.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Restart mode Restart mode Reset counter value Reset counter value GT_CH0 (TI0) Capture CH0 Capture CH1 CNTR CH0CCR CH1CCR Figure 53. PWM Pulse Width Measurement Example Input Stage The input stage consists of a digital filter, a channel polarity selection, edge detection and a channel prescaler.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Quadrature Decoder The Quadrature Decoder function uses two quadrantal inputs TI0 and TI1 derived from the GT_CH0 and GT_CH1 pins respectively to interact to generate the counter value. The DIR bit is modified by hardware automatically during each input source transition. The input source can be either TI0 only, TI1 only or both TI0 and TI1, the selection made by setting the SMSEL field to 0x1, 0x2 or 0x3.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Channel Output Reference Signal When the GPTM is used in the compare match output mode, the Channel x Output Reference signal, CHxOREF, is defined by the CHxOM field 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Counter Value CHxOM=0x3, 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 61. Toggle Mode Channel Output Reference Signal (CHxPRE = 1)
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Update Management The Update event is used to update the CRR, the PSCR, the CHxACR and the CHxCCR values from the actual registers to the corresponding shadow registers. An update event occurs when the counter overflows or underflows, the software update control bit is triggered or an update event from the slave controller is generated.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 In the Single Pulse mode, the STI active edge which sets the TME bit to 1 will enable the counter. However, there exist several clock delays to perform the comparison result between the counter value and the CHxCCR value. In order to reduce the delay to a minimum value, the user can set the CHxIMAE bit in each CHxOCFR register.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Asymmetric PWM Mode Asymmetric PWM mode allows two center-aligned PWM signals to be generated 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.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Master GPTM CLKIN GPTM CH0OREF GPTM CNTR Slave PWM0 PWM0 CNTR PWM0 TEVIF Software clearing Figure 69. Pausing PWM0 Using the GPTM CH0OREF Signal Using one Timer to Trigger another Timer Start Counting Configure GPTM to operate in the master mode to send its Update Event UEV as the trigger ▆...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 = 0x1). Configure GPTM slave mode to receive its input trigger source from GT_CH0 pin (TRSEL = 0x1).
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Trigger Peripherals Start To interconnect to the peripherals, such as ADC, Timer and so on, the GPTM could output the MTO signal or the channel compare match output signal CHxOREF (x = 0 ~ 3) to be used as peripherals input trigger signal and depending on the MCU specification.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Map The following table shows the GPTM registers and reset values. The PDMA related describes are only available for the HT32F54243/HT32F54253 devices. Table 33. GPTM Register Map Register Offset Description Reset Value...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions UGDIS Update event interrupt generation disable control 0: Any of the following events will generate an update PDMA request or interrupt - Counter overflow/underflow - Setting the UEVG bit...
Page 251
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 252
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [10:8] SMSEL Slave Mode Selection SMSEL [2:0] Mode Descriptions The prescaler is clocked directly by the internal Disable Mode clock. The counter uses the clock pulse generated from the interaction between the TI0 and TI1 signals to Quadrature drive the counter prescaler.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 257
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [17:16] CH1CCS Channel 1 Capture/Compare Selection 00: Channel 1 is configured as an output 01: Channel 1 is configured as an input derived from the TI1 signal 10: Channel 1 is configured as an input derived from the TI0 signal...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 260
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [17:16] CH3CCS Channel 3 Capture/Compare Selection 00: Channel 3 is configured as an output 01: Channel 3 is configured as an input derived from the TI3 signal 10: Channel 3 is configured as an input derived from the TI2 signal...
Page 262
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 264
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 266
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 268
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions CH1CCIE Channel 1 Capture/Compare Interrupt Enable 0: Channel 1 interrupt is disabled 1: Channel 1 interrupt is enabled CH0CCIE Channel 0 Capture/Compare Interrupt Enable 0: Channel 0 interrupt is disabled 1: Channel 0 interrupt is enabled Timer Event Generator Register –...
Page 273
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 275
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 CH0CCIF bit is already set and it is not yet cleared by software.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions CH0CCIF Channel 0 Capture/Compare Interrupt Flag - Channel 0 is configured as an output: 0: No match event occurs 1: The content of the counter CNTR has matched the content of the CH0CCR...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Features 16-bit up/down auto-reload counter ▆ 16-bit programmable prescaler that allows division the prescaler clock source by any factor ▆ between 1 and 65536 to generate the counter clock frequency Up to 4 independent channels for: ▆...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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, then restarts from 0 and generates a counter overflow event.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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, then restarts from the counter-reload value and generates a counter underflow event. This action will continue repeatedly. The counting direction bit DIR in the CNTCFR register should be set to 1 for the down-counting mode.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Trigger Controller The trigger controller is used to select the trigger source and setup the trigger level and edge trigger conditions. For the internal trigger input (ITIx), it can be selected by the Trigger Selection bits, TRSEL, in the TRCFR register.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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. Data access of the APB bus is always implemented by reading/writing the preload register.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Capture Counter Value Transferred to CHxCCR When the channel is used as a capture input, the counter value is captured into the Channel Capture/Compare Register (CHxCCR) when an effective input signal transition occurs. Once the capture event occurs, the CHxCCIF flag in the INTSR register is set accordingly.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 MT_CH0 signal or the Excusive-OR function of the MT_CH0, MT_CH1 and MT_CH2 signals.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Output Stage The MCTM supports complementary outputs for channels 0, 1 and 2 with dead time insertion. The MCTM channel 3 output function is almost the same as that of GPTM channel 3 except for the break function.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Channel Output Reference Signal When the MCTM is used in the compare match output mode, the CHxOREF signal (Channel x Output Reference signal) is defined by the CHxOM field 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Counter Value CHxOM=0x3, CHxPRE=1 (Output toggle, preload enable) CHxCCR (New value 2) CHxCCR (New value 3) CHxCCR (New value 1) CHxCCR Time Update CHxCCR value CHxOREF UEV1 (Update Event 1) Figure 94. Toggle Mode Channel Output Reference Signal – CHxPRE = 1...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Dead Time Generator An 8-bit dead time generator function is included for channels 0 ~ 2. The dead time insertion is enabled by setting both the CHxE and CHxNE bits. The relationship between the CHxO and...
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Break Function The MCTM includes break function and one input signal for MCTM break. The MT_BRK is default function and from the external MT_BRK pin. The detailed block diagram is shown as below figure.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 When using the break function, the channel output enable signals and output levels are changed depending on several control bits which include the CHMOE, CHOSSI, CHOSSR, CHxOIS and CHxOISN bits. Once a break event occurs, the output enable bit CHMOE will be cleared asynchronously.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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. Break event CHMOE...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 The CHxO and CHxNO complementary outputs should not be set to an active level at the same time. The hardware will protect the MCTM circuitry to force only one channel output to be in the active state.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Table 36. Output Control Bits for Complementary Output with a Break Event Occurrence Control Bits Output Status MT_CHxN Pin Output CHMOE CHOSSI CHOSSR CHxE CHxNE MT_CHx Pin Output State State Output disabled - floating...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Using one timer to trigger another timer to start counting Configure MCTM to operate in the master mode and to send its Update Event 1 UEV1 as the ▆ trigger output (MMSEL = 0x2).
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 = 0x1). Configure MCTM slave mode to receive its input trigger source from MT_CH0 pin (TRSEL = 0x1).
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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= ▆...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Trigger Peripheral Start To interconnect to the peripherals, such as ADC, Timer and so on, the MCTM can output the MTO signal or the channel compare match output signal CHxOREF (x = 0 ~ 3) to be used as a peripheral input trigger signal, depending on the MCU specification.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 PDMA Request (HT32F54243/HT32F54253 only) 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Map The following table shows the MCTM registers and reset values. The PDMA related describes are only available for the HT32F54243/HT32F54253 devices. Table 38. MCTM Register Map Register Offset Description Reset Value...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 326
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 327
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [10:8] SMSEL Slave Mode Selection SMSEL [2:0] Mode Descriptions Disable mode The prescaler is clocked directly by the internal clock. Reserved Reserved Reserved The counter value restarts from 0 or the CRR shadow...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 331
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 333
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 335
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 337
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 339
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 341
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 343
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 345
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 347
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions CH0P Channel 0 Capture/Compare Polarity - When Channel 0 is configured as an input (CH0CCS = 0x1/0x2/0x3) 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Channel Break Control Register – CHBRKCTR This register specifies the channel break control bits. Offset: 0x070 Reset value: 0x0000_0000 CHDTG Type/Reset 0 RW 0 RW 0 RW 0 RW 0 RW 0 RW...
Page 351
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 355
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 357
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions CH2OCF Channel 2 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 CH2CCIF bit is already set and it is not...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [15:0] CH1CCV Channel 1 Capture/Compare Value - When Channel 1 is configured as an output The CH1CCR value is compared with the counter value and the comparison result is used to trigger the CH1OREF output signal.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 PWM output.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Features 16-bit auto-reload up-counter ▆ 16-bit programmable prescaler that allows division of the prescaler clock source by any factor ▆ between 1 and 65536 to generate the counter clock frequency Single channel for: ▆...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Clock Controller The following describes the Timer Module clock controller which determines the clock source of the internal prescaler counter. Internal APB clock f ▆ CLKIN The default internal clock source is the APB clock f...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Trigger Controller The trigger controller is used to select the trigger source and setup the trigger level or edge trigger condition. For the internal trigger input, it can be selected by the Trigger Selection bits TRSEL in the TRCFR register.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Channel Controller The SCTM channel can be used as the capture input or compare match output. The capture input or compare match output channel is composed of a preload register and a shadow register. Data access of the APB bus is always implemented by reading/writing the preload register.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Capture Counter Value Transferred to CHCCR When the channel is used as a capture input, the counter value is captured into the Channel Capture/Compare Register (CHCCR) when an effective input signal transition occurs. Once the capture event occurs, the CHCCIF flag in the INTSR register is set accordingly.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Output Stage The SCTM output has function for compare match or PWM output. The channel output SCTM_ CHO is controlled by the CHOM, CHP and CHE bits in the corresponding CHOCFR, CHPOLR and CHCTR registers.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Counter Value CHOM=0x3, CHPRE=0 (Output toggle, preload disable) CHCCR (New value 2) CHCCR (New value 3) CHCCR (New value 1) CHCCR Time Update CHCCR value CHOREF (Update Event) Figure 129. Toggle Mode Channel Output Reference Signal (CHPRE = 0)
Page 384
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Basic Function Timer (BFTM) Introduction The Basic Function Timer 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Functional Descriptions RTC Related Register Reset The RTC registers can be reset by either a V Domain power on reset, POR, or by a V Domain software reset by setting the PWCURST bit in the PWRCR register. Other reset events have no effect to clear the RTC registers.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 RTC Counter Operation The RTC provides a 24-bit up-counter which increases 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 45. RTC Register Map Register...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 RTC Compare Register – RTCCMP This register defines a specific value to be compared with the RTC counter value. Address: 0x004 Reset value: 0x0000_0000 Reserved Type/Reset RTCCMPV Type/Reset 0 RW 0 RW...
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Features Clock source from either the internal 32 kHz RC oscillator (LSI) or the external 32,768 Hz ▆ oscillator (LSE) Can be independently setup to keep running or to stop when entering the Sleep or Deep-Sleep1 ▆...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 When the system enters the Sleep mode or Deep-Sleep1 mode, the Watchdog Timer counter will either continue to count or stop depending on the WDTSHLT field setup in the WDTMR0 register. However, the Watchdog Timer will always stop when the system is in the Deep-Sleep2 mode.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 START Condition STOP Condition Figure 141. 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.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Sent by master Slave address Sent by slave S = START condition R/W = 1: Read direction = 0: Write direction ACK = Acknowledge bit Figure 143. 7-bit Addressing Mode 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.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Data Transfer and Acknowledge Once the slave device address has been matched, the data can be transmitted to or received from the slave device according to the transfer direction specified by the R/W bit. Each byte is followed by an acknowledge bit on the 9 SCL clock.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Address Mask Enable The I C module provides an address mask function for users 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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.
® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 to 1, the RXBF bit in the I2CSR register will be set to 1 and the SCL line will be held at a logic low state. When this situation occurs, data from the I2CDR register should be read to continue the data transfer process.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Receive Not-Acknowledge When the slave device receives a Not-Acknowledge signal, the RXNACK bit in the I2CSR Register is set but it will not hold the SCL line. Writing “1” to RXNACK will clear the RXNACK flag.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 STOP Condition When the slave device detects a STOP condition, the STO flag bit in the I2CSR register is set to indicate that the I C interface transmission is terminated. Reading the I2CSR register can clear the STO flag bit.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Type Condition Description Eliminating Condition No matter in address or data frame, once Set TAR Master receives NACK received an NACK signal will hold SCL line in Set STOP master mode. Event...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Map The following table shows the I C registers and reset values. The PDMA related describes are only available for the HT32F54243/HT32F54253 devices. Table 48. I C Register Map Register Offset...
Page 432
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [13] COMBFILTEREN SDA or SCL Input Combinational Filter Enable Bit 0: Combinational filter is disabled 1: Combinational filter is enabled [12] ENTOUT C Timeout Function Enable Control 0: Timeout Function is disabled...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions STOIE STOP Condition Detected Interrupt Enable Bit 0: Interrupt is disabled 1: Interrupt is enabled The bit is used for the I C slave mode only. STAIE START Condition Transmit Interrupt Enable Bit...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 436
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [17] TXDE Data Register Empty in Transmitter Mode 0: Data register I2CDR is not empty 1: Data register I2CDR is 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 437
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 the serial data input and output lines SPI_MISO and SPI_MOSI, the clock line SPI_SCK, and the slave select line SPI_SEL.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 ▆ FIFO Depth: 8 levels ▆...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 SPI Serial Frame Format The SPI interface format is based 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 The accompanying 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)
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 CPOL = 1, CPHA = 0 In this format, the received data is sampled on the SCK line falling edge while the transmitted data is changed on the SCK line rising edge. In the master mode, the first bit is driven when data is written into the SPIDR register.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 CPOL = 1, CPHA = 1 In this format, the received data is sampled on the SCK line rising edge while the transmitted data is changed on the SCK line falling edge. In the master mode, the first bit is driven when data is written into the SPIDR register.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 SPI Dual Mode When in the Master mode, the SPI interface operation can be configured to Dual mode. A more efficient data transfer can then be implemented by using this Dual mode together with the four formats described above.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 The accompanying figure shows the bit sequence of the SPI Dual mode reading data from an external serial SPI Flash. DUALEN Command Address Dummy Data ∙∙∙∙ ∙∙∙∙ ∙∙∙∙ ∙∙∙∙ MOSI ∙∙∙∙ ∙∙∙∙...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 set as an input signal.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 PDMA Interface (HT32F54243/HT32F54253 only) 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 458
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 set the SEL output to an active or inactive state by configuring the SSELC bit.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 460
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions RXBNE RX Buffer Not Empty flag 0: RX buffer is empty 1: RX buffer is 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 value.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Features Supports both asynchronous and clocked synchronous serial communication modes ▆ Full Duplex Communication Capability ▆ Programmable baud rate clock frequency up to (f /16) MHz for asynchronous mode and ▆ PLCK...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 7-Bit Data Format (WLS[1:0]=b00,PBE=0) Next Start Start Bit Bit0 Bit1 Bit2 Bit3 Bit4 Bit5 Bit6 Stop Bit 8-Bit Data Format (WLS[1:0]=b01,PBE=0) Next Start Start Bit Bit0 Bit1 Bit2 Bit3 Bit4 Bit5 Bit6...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Hardware Flow Control The USART supports the hardware flow control function which is enabled by setting the HFCEN bit in the USRCR register to 1. It is possible to control the serial data flow between two USART devices by using the CTS input and the RTS output.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 When the USART CTS pin is forced to a logic high state during a data transmission period, the current data transmission will be continued until the stop bit is completed. The following figure shows an example of communication with CTS flow control.
Page 474
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 IrDA Normal Mode For the IrDA normal mode, the width of each transmitted pulse generated by the transmitter modulator is specified as 3/16 of the baud rate clock period. The receiver pulse width for the IrDA receiver demodulator is based on the IrDA receive debounce filter which is implement using an 8-bit down-counting counter.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 TX_Data Transmitter Modulation TXSEL RX_Data Receiver Demodulation IrDAEN Figure 176. USART I/O and IrDA Block Diagram RS485 Mode The RS485 mode of USART provides the data transmission on interface transmitted over a 2-wire twisted pair bus.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 field to 1 in the RS485CR register.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Interrupts and Status The USART can generate interrupts when the following events occur and the corresponding interrupt enable bits are set: Receive FIFO time-out interrupt: An interrupt is generated when the USART receive FIFO is not ▆...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Descriptions USART Data Register – USRDR The register is used to access the USART transmitted and received FIFO data. Offset: 0x000 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Type/Reset...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 USART Control Register – USRCR The register specifies the serial parameters such as data length, parity and stop bit for the USART. It also contains the USART enable control bits together with the USART mode and data transfer mode selection.
Page 482
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [10] Number of STOP bit 0: One STOP bit is generated in the transmitted data 1: Two STOP bits are generated when 8-bit or 9-bit word length is selected...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 USART FIFO Control Register – USRFCR This register specifies the USART FIFO control and configurations including threshold level and reset function together with the USART FIFO status. Offset: 0x008 Reset value: 0x0000_0000...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions TX FIFO Reset Setting this bit will generate a reset pulse to reset the 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.
Page 485
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions FEIE Framing Error Interrupt Enable 0: Disable 1: Enable If this bit is set, an interrupt will be generated when the FEI bit in the USRSIFR register is set.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 USART Status & Interrupt Flag Register – USRSIFR This register contains the corresponding USART status. Offset: 0x010 Reset value: 0x0000_0980 Reserved Type/Reset Reserved Type/Reset Reserved CTSS CTSC RSADD Type/Reset 1 WC 0 WC...
Page 487
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions RXTOF Receive FIFO Time-Out Flag 0: RX FIFO Time-Out does not occur 1: RX FIFO Time-Out occurs The RXTOF bit will be set if the RX FIFO is not empty and no activities have occurred in the RX FIFO during the time-out duration specified by the RXTOC field.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions IrDAEN IrDA Enable control 0: Disable IrDA mode 1: Enable IrDA mode USART RS485 Control Register – RS485CR This register is used to control the RS485 mode of USART.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Universal Asynchronous Receiver Transmitter (UART) Introduction The Universal Asynchronous Receiver Transceiver, UART, provides a flexible full duplex data exchange using asynchronous transfer. The UART is used to translate data between parallel and serial interfaces, and is also commonly used for RS232 standard communication.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Features Supports asynchronous serial communication modes ▆ Full Duplex Communication Capability ▆ Programming baud rate clock frequency up to (f /16) MHz ▆ PCLK Fully programmable serial communication functions including: ▆ ●...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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.
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 PDMA Interface (HT32F54243/HT32F54253 only) The PDMA interface is integrated in the UART. The PDMA function can be enabled by setting the TXDMAEN or RXDMAEN bit in the URCR register to 1 in the transmit or receive mode respectively.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Descriptions UART Data Register – URDR The register is used to access the UART transmitted and received data. Offset: 0x000 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Type/Reset 0 RW...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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...
Page 502
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions PEIE Parity Error Interrupt Enable 0: Disable 1: Enable If this bit is set, an interrupt will be generated when the PEI bit in the URSIFR register is set.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions 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. The...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 bridge 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 513
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 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 increased or decreased, determined by the SRCAINCn bit value during a complete transfer.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions CHnEN Channel n Enable control 0: Disable the PDMA channel n 1: Enable the PDMA channel n Setting this bit will enable a software or hardware transfer request on the PDMA channel n.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 PDMA Channel n Current Transfer Size Register – PDMACHnCTSR (n = 0 ~ 5) This register is used to indicate the current block transaction count. Offset: 0x014 (0), 0x02C (1), 0x044 (2), 0x05C (3), 0x074 (4), 0x08C (5)
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 PDMA Interrupt Status Register – PDMAISR This register is used to indicate the corresponding interrupt status of the PDMA channel 0 ~ 5. Offset: 0x120 Reset value: 0x0000_0000 Reserved TEISTA5 TCISTA5 HTISTA5...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [25], [20], GEISTAn Channel n Global Transfer Interrupt Status (n = 0 ~ 5) [15], [10], 0: No TE, TC, HT or BE event occurs 1: TE, TC, HT, or BE event occurs [5], [0] This bit is set by hardware and is cleared by writing a “1”...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [26], [21], BEICLRn Channel n Block Transaction End Interrupt Status Clear (n = 0 ~ 5) [16], [11], 0: No Operation 1: Clear the corresponding BEISTAn bit in the PDMAISR register [6], [1] Writing a “1”...
Page 521
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [26], [21], BEIEn Channel n Block Transaction End Interrupt Enable control (n = 0 ~ 5) [16], [11], 0: Block Transaction End interrupt is disabled 1: Block Transaction End interrupt is enabled [6], [1] This bit is set and cleared by software.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Divider (DIV) Introduction In order to enhance MCU performance, a divider is implemented within the device. Features Signed/unsigned 32-bit divider ▆ Operation in 8 clock cycles, Load in 1 clock cycle ▆...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Map The following table shows the DIV registers and reset values. Table 65. DIV Register Map Register Offset Description Reset Value 0x000 Divider Control Register 0x0000_0008 0x004 Dividend Data Register 0x0000_0000...
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Cyclic Redundancy Check (CRC) Introduction The CRC (Cyclic Redundancy Check) calculation unit is an error detection technique test algorithm and is used 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 Functional Descriptions This unit only enables the calculation in the CRC16, CCITT CRC16 and IEEE-802.3 CRC32 polynomials. 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 HT32F54231/HT32F54241/HT32F54243/HT32F54253 CRC with PDMA A PDMA channel with software trigger may be used to transfer data into the CRC unit. If a huge block data needs to be calculated, the recommended PDMA model is to use the PDMA to transfer all available words of data and use software writes to transfer the other remaining bytes.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions SUMBIRV Bit Reverse operation on Checksum Output 0: Disable 1: Enable DATCMPL 1’s Complement operation on Data 0: Disable 1: Enable DATBYRV Byte Reverse operation on Data 0: Disable...
LED Controller (LEDC) Introduction The LED controller is used to drive 8-segment digital displays. For the HT32F54231/HT32F54241 devices, the LED controller can drive up to eight 8-segment digital displays. For the HT32F54243/ HT32F54253 devices, the LED controller can drive up to twelve 8-segment digital displays. Users have the flexibility to configure the pin position and number of the COMs according to the digital displays in their application.
▆ Functional Description The position of each pixel point is represented by SEGx and COMy. The HT32F54231/HT32F54241 devices can drive up to eight 8-segment digital displays, x = 0 ~ 7, y = 0 ~ 7. The HT32F54243/ HT32F54253 devices can drive up to twelve 8-segment digital displays, x = 0 ~ 7, y = 0 ~ 11. The number of COMs to be enabled is N.
® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Each digital display scanning cycle can be subdivided into a dead time duty and a COM duty. The LED will not be illuminated during the dead time. The dead time clock number is selected by the DEADNUM[5:0] bit field.
CK_LED Where N is the number of COMs selected. For the HT32F54231/HT32F54241, the maximum value of N is 8. For the HT32F54243/HT32F54253, the maximum value of N is 12. The duty clock number can be configured as 8, 16, 32 or 64 by the DTYNUM[1:0] bit field in the LEDDTCR register.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Map The following table shows the LEDC registers and their reset values. Table 68. LEDC Register Map Register Offset Description Reset Value LEDCR 0x000 LED Control Register 0x0000_0000 LEDCER 0x004 LED COM Enable Register...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Descriptions LED Control Register – LEDCR This register is used to control the LEDC clock source, prescaler, duty clock number and LEDC function enable. Offset: 0x000 Reset value: 0x0000_0000 Reserved LEDPS...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions LEDEN LEDC Enable Bit 0: Disable 1: Enable The LEDC state machine will be enabled when this bit is set to 1. If this bit is set to 0, the state machine will continue to output until the current frame operation is completed, then the state of the state machine will be cleared and finally the LEDEN bit will be cleared to zero by the hardware.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 LED Polarity Control Register – LEDPCR This register controls the polarity of the COMy and SEGx. (x = 0 ~ 7, y = 0 ~ 11) Offset: 0x008 Reset value: 0x0000_0000 Reserved...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 LED Interrupt Enable Register – LEDIER This register is used to control the frame interrupt enable. Offset: 0x00C Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Reserved FIEN Type/Reset Bits Field...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 LED Status Register – LEDSR This register specifies the frame interrupt flag. Offset: 0x010 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Bits Field Descriptions Frame interrupt flag 0: No frame interrupt occurs 1: Frame interrupt occurs Set by hardware and reset by software writing 1.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 LED Dead Time Control Register – LEDDTCR This register specifies the dead time duty. Offset: 0x014 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Reserved DEADNUM Type/Reset 0 RW 0 RW...
Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 LED Data Register n – LEDDRn (n = 0 ~ 11) This register specifies that the LCD pixel points that are represented by SEGx and COMy are to be illuminated. (x = 0 ~ 7, y = n = 0 ~ 11)
Keys are organised into several groups, with each group known as a module Mn. For the HT32F54231/HT32F54241 devices contain touch key up to 24, having a module number M0 to M5. For the HT32F54243/ HT32F54253 contain touch key up to 28.
® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Manual Mode In the manual scan mode, the reference oscillator capacitor value should be properly configured before the scan operation begins and the touch key module 16-bit C/F counter value should be read by application program after the scan operation finishes. In the Manual mode, at the end of the fixed reference clock time interval a Touch key interrupt signal will be generated.
® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 When the time slot counter in all the touch key modules or in the touch key module 0 overflows, an actual touch key TKRCOV interrupt will take place. The touch keys mentioned here are the keys which are enabled.
® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 mode. When any key C/F counter value is less than the lower threshold if MnKmTHS = 0, or larger than the upper threshold if MnKmTHS = 1, this indicates that the touch key state changes, then the MnKmTHF flag will be set high by the hardware, and an interrupt signal will be generated.
Page 552
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Start Write Ref. OSC internal Capacitor value to the TKMnRO_Km bit field Touch Key Auto Scan Operation Start Set Start bit TKST 0 → 1 Busy flag TKBUSY = 1 Load Ref. OSC internal...
Page 553
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Start Write Ref. OSC internal Capacitor value to the TKMn16D_Km bit filed Touch Key Auto Scan Operation Start Set Start bit TKST 0 → 1 → Busy flag TKBUSY = 1 MCU Hold (Optional) Load Ref.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Register Descriptions Touch Key Control Register – TKCR This register specifies the corresponding Touch Key function enable control. Offset: 0x000 Reset value: 0x0000_091A TKCLKSEL Reserved Type/Reset Reserved Type/Reset RODLY ASMTO ASMP Type/Reset...
Page 556
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [9:8] ASMP Periodic Auto Scan Mode Period, T , Selection 00: T ASMTO 01: T / 4 (default) ASMTO 10: T ASMTO 11: T / 16 ASMTO These bits are used to determine the touch key scan period and only available when the touch key function is configured to operate in the periodic auto scan mode.
Page 557
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [2:1] TKMOD Touch Key Scan Mode Selection 00: Auto scan mode 01: Manual mode (default) 10: Periodic auto scan mode 11: Periodic auto scan mode In the manual scan mode, the reference oscillator capacitor value should be properly configured before the scan operation begins and the touch key module 16-bit C/F counter value should be read by application program after the scan operation finishes.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Touch Key Counter Register – TKCNTR This register is used to store the touch key function 16-bit counter value. Offset: 0x004 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset TK16D Type/Reset 0 RO...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Touch Key Status Register – TKSR This register contains the relevant Touch Key status. Offset: 0x010 Reset value: 0x0000_0000 Reserved Type/Reset Reserved Type/Reset Reserved Type/Reset Reserved PCKRDY TKBUSY TKCFOV TK16OV TKRCOVF TKTHF...
Page 562
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions TKRCOVF 8-bit Time Slot Counter Overflow Flag 0: No overflow occurs 1: Overflow occurs Set by hardware when 8-bit Time slot overflows. Reset by software writing 1. In the manual scan mode, if all module time slot counters are overflow, the TKRCOV bit and the Touch Key TKRCOV Interrupt request flag, TKRCOVF, will be set and all modules’...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Touch Key Module n Control Register – TKMnCR This register specifies the corresponding Module n function enable bit. Offset: 0x100 × (n + 1) + 0x000 Reset value: 0x0000_0000 Reserved Type/Reset Reserved...
Page 564
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions MnKOEN Touch Key Module n Key Oscillator Control 0: Disable 1: Enable In the manual scan mode, this bit is used to enable/disable the module n key oscillator. When the module n key oscillator is enabled, if the relevant key is enabled to be scanned and will be disabled automatically when the TKBUSY bit is changed from high to low.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 TKMn Key Configuration Register – TKMnKCFGR This register specifies the corresponding Key 0 to Key 3 function enable control. Offset: 0x100 × (n + 1)+0x004 Reset value: 0x00E4_0000 Reserved Type/Reset MnSK3 MnSK2...
Page 566
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Bits Field Descriptions [17:16] MnSK0 Touch Key Module n Time Slot 0 Key Scan Selection (TKMOD = 01) 00: Key 0 01: Key 1 10: Key 2 11: Key 3 These bits are used to select the desired scan key in time slot 0 in the auto scan mode or the periodic auto scan mode or used as the multiplexer for scan key selection in the manual mode.
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Touch Key Module n Reference Oscillator Capacitor Register – TKMnROCPR This register is used to store the touch key module n reference oscillator capacitor value. Offset: 0x100 × (n + 1) + 0x00C...
32-Bit Arm ® Cortex ® -M0+ MCU HT32F54231/HT32F54241/HT32F54243/HT32F54253 Touch Key Module n Key 1 Threshold Register – TKMnK1THR This register specifies the touch key module n Key 1 threshold value. Offset: 0x100 × (n + 1) + 0x03C Reset value: 0x0000_0000...
Page 576
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 HT32F54231 and is the answer not in the manual?
Questions and answers