Page 1
The information described in this document is the exclusive intellectual property of Nuvoton Technology Corporation and shall not be reproduced without permission from Nuvoton. Nuvoton is providing this document only for reference purposes of NuMicro microcontroller based system design. Nuvoton assumes no responsibility for errors or omissions.
Mini57 GENERAL DESCRIPTION ® ® ® The NuMicro Mini57 series 32-bit microcontrollers are embedded with ARM Cortex -M0 core for ® industrial applications which need high performance, high integration, and low cost. The Cortex ® M0 is the newest ARM embedded processor with 32-bit performance at a cost equivalent to the traditional 8-bit microcontroller.
Mini57 FEATURES Core ARM® Cortex® -M0 core running up to 48 MHz One 24-bit system timer Supports low power Idle mode A single-cycle 32-bit hardware multiplier NVIC for the 32 interrupt inputs, each with 4-level of priority Supports Serial Wire Debug (SWD) interface and two watchpoints/four breakpoints ...
Page 14
Mini57 Supports software selectable slew rate control GPIO built-in Pull-up/Pull-low resistor for selection. Timer Provides two channel 32-bit Timers; one 8-bit pre-scalar counter with 24-bit up- timer for each timer Independent clock source for each timer Provides One-shot, Periodic, Toggle and Continuous operation modes 24-bit up counter value is readable through CNT (Timer Data Register) Provides trigger counting/free counting/counter reset function triggered by external capture pin or internal comparator signal...
Page 15
Mini57 Hardware fault brake and software brake protections Supports rising, falling, central, period, and fault break interrupts Supports duty/period trigger A/D conversion Timer comparing matching event trigger PWM to do phase change Supports comparator event trigger PWM to force PWM output low for current period Provides interrupt accumulation function ...
Mini57 ABBREVIATIONS Acronym Description ACMP Analog Comparator Controller Analog-to-Digital Converter Advanced High-Performance Bus Advanced Peripheral Bus Brown-out Detection BPWM Basic Pulse Width Modulation Debug Access Port EPWM Enhanced Pulse Width Modulation FIFO First In, First Out Flash Memory Controller GPIO General-Purpose Input/Output HCLK The Clock of Advanced High-Performance Bus...
Mini57 PARTS INFORMATION LIST AND PIN CONFIGURATION ® 4.1 NuMicro Mini57 Naming Rule ARM–Based Mini57-X X X 32-bit Microcontroller CPU Core Corte ® Temperature E: -40 C ~ +105 Flash ROM : 29.5 KB Flash ROM Reserved Package Type F: TSSOP 20 E: TSSOP 28 T: QFN 33 4x4mm ®...
Mini57 ® 4.2 NuMicro Mini57 Series Selection Guide * USCI can be set to UART, SPI or I Connectivity Part APROM RAM Data Flash Loader Timer Comp. PWM 10 kHz Package Number USCI* 48 MHz Mini57TDE 29.5 KB 4 KB Configurable 2.5 KB up to 22 2x32-bit 8x12-bit QFN33(4x4) Mini57EDE 29.5 KB 4 KB Configurable 2.5 KB up to 22 2x32-bit...
Mini57 4.4 Pin Description 4.4.1 Mini57 Series Pin Description MFP* = Multi-function pin. (Refer to section SYS_GPx_MFP) PA.0 MFP0 means SYS_GPA_MFP[3:0]=0x0. PA.4 MFP5 means SYS_GPA_MFP[19:16]=0x5. MFP only configures the ouput data or input data of PAD; the direction of PAD is configured by PMD. The priority of MFP in the same multi-function was GPA >...
Page 25
Mini57 Pin No. Pin Name Type MFP* Description STADC MFP3 ADC external trigger input. ACMP0_P3 MFP4 Analog comparator0 positive input pin. ACMP1_P1 MFP5 Analog comparator1 positive input pin. SPI0_MOSI MFP9 SPI0 1st MOSI (Master Out, Slave In) pin. SPI1_MISO MFPA SPI1 MISO (Master In, Slave Out) pin.
Page 26
Mini57 Pin No. Pin Name Type MFP* Description BPWM_CH0 MFP3 PWM channel0 output/capture input. ACMP1_P0 MFP5 Analog comparator1 positive input pin. I2C1_SCL MFP8 C1 clock pin. SPI0_SS MFP9 SPI0 slave select pin. SPI1_CLK MFPA SPI1 serial clock pin UART1_TXD MFPB Data transmitter output pin for UART1.
Mini57 Pin No. Pin Name Type MFP* Description SPI0_CLK MFP9 SPI0 serial clock pin. SPI1_SS MFPA SPI1 slave select pin UART0_TXD MFPB Data transmitter output pin for UART0. PA.2 MFP0 General purpose digital I/O pin. EPWM_CH2 MFP3 PWM channel2 output/capture input. I2C0_SDA MFP8 C0 data input/output pin.
Page 28
Mini57 4.4.1.2 Mini57 Series TSSOP20 Pin Description Pin No. Pin Name Type MFP* Description MFP0 Power supply for I/O ports and LDO source for internal PLL and digital function. PB.0 MFP0 General purpose digital I/O pin. ADC0_CH0 MFP2 ADC0 channel0 analog input. ACMP0_P0 MFP4 Analog comparator0 positive input pin.
Page 29
Mini57 Pin No. Pin Name Type MFP* Description ADC1_CH2 MFP2 ADC1 channel2 analog input. BRAKE MFP3 Brake input pin of EPWM. CCAP_P1 MFP7 Timer Continuous Capture input pin I2C1_SDA MFP8 C1 data input/output pin. SPI0_MISO MFP9 SPI0 1st MISO (Master In, Slave Out) pin. SPI1_MOSI MFPA SPI1 MOSI (Master Out, Slave In) pin.
Page 30
Mini57 Pin No. Pin Name Type MFP* Description SPI0_CLK MFP9 SPI0 serial clock pin. SPI1_SS MFPA SPI1 slave select pin PA.5 MFP0 General purpose digital I/O pin. XT_OUT MFP1 External 4~24 MHz (high speed) crystal output pin. EPWM_CH5 MFP3 PWM channel5 output/capture input. ACMP0_O MFP4 Analog comparator0 output.
Mini57 Pin No. Pin Name Type MFP* Description UART1_TXD MFPB Data transmitter output pin for UART1. MFP0 Ground pin for digital circuit. Table 4.4-2 TSSOP20 Pin Description Apr. 06, 2017 Page 31 of 475 Rev.1.00...
Page 32
Mini57 4.4.1.3 Mini57 Series QFN33 Pin Description QFN33 Pin Pin Name Type MFP* Description LDO_CAP MFP0 LDO output pin. MFP0 Ground pin for digital circuit. Power supply for I/O ports and LDO source for internal PLL and digital MFP0 function. PD.6 MFP0 General purpose digital I/O pin.
Page 33
Mini57 PB.3 MFP0 General purpose digital I/O pin. ACMP1_N MFP5 Analog comparator1 negative input pin. PGA_I MFP6 PGA input pin MFP7 Timer0event counter input / toggle output PC.2 MFP0 General purpose digital I/O pin. ADC1_CH2 MFP2 ADC1 channel2 analog input. BRAKE MFP3 Brake input pin of EPWM.
Mini57 FUNCTIONAL DESCRIPTION ® ® 6.1 ARM Cortex -M0 Core 6.1.1 Overview ® The Cortex -M0 processor is a configurable, multistage, 32-bit RISC processor, which has an AMBA AHB-Lite interface and includes an NVIC component. It also has optional hardware debug ®...
Page 41
Mini57 C Application Binary Interface compliant exception model. This is the ARMv6-M, C Application Binary Interface (C-ABI) compliant exception model that enables the use of pure C functions as interrupt handlers Low Power Sleep mode entry using the Wait For Interrupt (WFI), Wait For Event (WFE) instructions, or return from interrupt sleep-on-exit feature ...
Mini57 6.2 System Manager 6.2.1 Overview System management includes the following sections: System Reset System Power Architecture System Memory Map System management registers for Part Number ID, chip reset and on-chip controllers reset, and multi-functional pin control ...
Mini57 0.7 V and the state keeps longer than 36 us (glitch filter). The PINRF (SYS_RSTSTS[1]) will be set to 1 if the previous reset source is nRESET reset. Figure 6.2-2 shows the nRESET reset waveform. nRESET 0.7 V 16.8 us 0.2 V 16.8 us nRESET Reset...
Mini57 keeps longer than De-glitch time. The PINRF (SYS_RSTSTS[1]) will be set to 1 if the previous reset source is nRESET reset. Figure 6.2-4 shows the Low Voltage Reset waveform. ( < de-glitch time) ( = de-glitch time) Low Voltage Reset ( = de-glitch time) Figure 6.2-4 Low Voltage Reset (LVR) Waveform 6.2.2.4...
Mini57 BODH Hysteresis BODL (< de-glitch time) (= de-glitch time) BODOUT (= de-glitch time) BODRSTEN Brown-out Reset Figure 6.2-5 Brown-out Detector (BOD) Waveform 6.2.2.5 Watchdog Timer Reset In most industrial applications, system reliability is very important. To automatically recover the MCU from failure status is one way to improve system reliability.
Mini57 6.2.3 Power Modes and Wake-up Sources There are several wake-up sources in Idle mode and Power-down mode. Table 6.2-2 lists the available clocks for each power mode. Power Mode Normal Mode Idle Mode Power-Down Mode Definition CPU is in active state CPU is in sleep state CPU is in sleep state and all clocks stop except LXT and...
Mini57 LXT (32768 Hz XTL) ON/OFF LIRC (10 kHz OSC) ON/OFF Halt Halt HCLK/PCLK Halt SRAM retention FLASH Halt GPIO Halt TIMER ON/OFF BPWM Halt EPWM Halt ON/OFF USCI Halt Halt ACMP Halt ECAP Halt HDIV Halt Halt Table 6.2-3 Clocks in Power Modes Wake-up sources in Power-down mode: WDT, I²C, Timer, UART, SPI, BOD, ACMP and GPIO After chip enters power down, the following wake-up sources can wake chip up to normal mode.
Mini57 USCI SPI SS transaction wake-up After software writes 1 to clear WKF (USPI_WKSTS[0]). USCI I Data toggle After software writes 1 to clear WKF (UI2C_WKSTS[0]). After software writes 1 to clear WKAKDONE (UI2C_PROTSTS[16], then writes 1 Address match to clear WKF (UI2C_WKSTS[0]). Comparator Power-down After software writes 1 to clear ACMPF0 (ACMP_STATUS[0]) and ACMPF1 ACMP...
Mini57 6.2.4 System Power Architecture In this chip, the power distribution is divided into three segments. Analog power from AV and AV provides the power for analog components operation. AV must be equal to V to avoid leakage current. ...
Mini57 6.2.5 System Memory Mapping Mini57 System Control 4 GB 0xFFFF_FFFF System C ontrol 0xE000_ED00 SC S_BA Reserved External Interrupt C ontrol 0xE000_E100 SC S_BA 0xE000_F000 System Timer C ontrol 0xE000_E010 SC S_BA 0xE000_EFFF System C ontrol 0xE000_E000 0xE000_E00F Reserved 0x6002_0000 0x6001_FFFF Reserved...
Mini57 6.2.6 Register Protection Some of the system control registers need to be protected to avoid inadvertent write and disturb the chip operation. These system control registers are protected after the power on reset till user to disable register protection. For user to program these protected registers, a register protection disable sequence needs to be followed by a special programming.
Mini57 6.2.7 Memory Organization 6.2.7.1 Overview ® The NuMicro Mini57 series provides 4G-byte addressing space. The addressing space assigned to each on-chip controllers is shown in Figure 6.2-8. The detailed register definition, addressing space, and programming details will be described in the following sections for each on-chip peripheral.
Mini57 6.2.9 Register Description Part Device Identification Number Register (SYS_PDID) Register Offset Description Reset Value 0xXXXX_XXXX SYS_PDID SYS_BA+0x00 Part Device Identification Number Register [1] Every part number has a unique default reset value. PDID PDID PDID PDID Bits Description Part Device Identification Number (Read Only) [31:0] PDID This register reflects device part number code.
Page 60
Mini57 System Reset Status Register (SYS_RSTSTS) This register provides specific information for software to identify this chip’s reset source from last operation. Register Offset Description Reset Value SYS_RSTSTS SYS_BA+0x04 System Reset Status Register 0x0000_00XX Reserved Reserved Reserved CPURF Reserved SYSRF BODRF LVRF WDTRF...
Page 61
Mini57 Bits Description LVR Reset Flag The LVR reset flag is set by the “Reset Signal” from the Low Voltage Reset Controller to indicate the previous reset source. LVRF 0 = No reset from LVR. 1 = LVR controller had issued the reset signal to reset the system. Note: Write 1 to clear this bit to 0.
Page 62
Mini57 Peripheral Reset Control Register 0 (SYS_IPRST0) Register Offset Description Reset Value Peripheral Reset Control Register 0 SYS_IPRST0 SYS_BA+0x08 0x0000_0000 Reserved Reserved Reserved Reserved CPURST CHIPRST Bits Description [31:2] Reserved Reserved. Processor Core One-shot Reset (Write Protect) Setting this bit will only reset the processor core and Flash Memory Controller(FMC), and this bit will automatically return to 0 after the 2 clock cycles.
Page 63
Mini57 Peripheral Reset Control Register 1 (SYS_IPRST1) Setting these bits 1 will generate asynchronous reset signals to the corresponding module controller. Users need to set these bits to 0 to release corresponding module controller from reset state. Register Offset Description Reset Value SYS_IPRST1 SYS_BA+0x0C...
Page 65
Mini57 HCLK Wait State Cycle Control Register (SYS_WAIT) Register Offset Description Reset Value SYS_WAIT SYS_BA+0x10 HCLK Wait State Cycle Control Register 0x0000_0001 Reserved Reserved Reserved Reserved HCLKWS Bits Description [31:1] Reserved Reserved. HCLK Wait State Cycle Control Bit This bit is used to enable/disable HCLK wait state when access Flash. HCLKWS 0 = No wait state.
Page 66
Mini57 Brown-out Detector Control Register (SYS_BODCTL) Partial of the SYS_BODCTL control registers values are initiated by the Flash configuration and partial bits are write-protected bit. Register Offset Description Reset Value SYS_BODCTL SYS_BA+0x18 Brown-Out Detector Control Register 0x0000_80XX Reserved Reserved LVREN Reserved BODOUT BODLPM...
Page 67
Mini57 Bits Description Brown-out Detector Interrupt Flag 0 = Brown-out Detector does not detect any voltage draft at V down through or up through the voltage of BODVL setting. BODIF 1 = When Brown-out Detector detects the V is dropped down through the voltage of BODVL setting or the V is raised up through the voltage of BODVL setting, this bit is set to 1 and the brown-out interrupt is requested if brown-out interrupt is enabled.
Page 68
Mini57 Internal Voltage Source Control Register (SYS_IVSCTL) Register Offset Description Reset Value SYS_IVSCTL SYS_BA+0x1C Internal Voltage Source Control Register 0x0000_0000 Reserved Reserved Reserved Reserved VTEMPEN Bits Description [31:1] Reserved Reserved. Temperature Sensor Enable Bit This bit is used to enable/disable temperature sensor function. 0 = Temperature sensor function Disabled (default).
Page 69
Mini57 Power-on Reset Controller Register (SYS_PORCTL) Register Offset Description Reset Value SYS_PORCTL SYS_BA+0x24 Power-On-Reset Controller Register 0x0000_00XX Reserved Reserved POROFF POROFF Bits Description [31:16] Reserved Reserved. Power-on Reset Enable Bit (Write Protect) When powered on, the POR circuit generates a reset signal to reset the whole chip function, but noise on the power may cause the POR active again.
Page 70
Mini57 GPIOA Multiple Function Control Register (SYS_GPA_MFP) Please refer to GPIO Multi-function Pin Summary Register Offset R/W Description Reset Value SYS_GPA_MFP SYS_BA+0x30 R/W GPIOA Multiple Function Control Register 0x0000_0000 Reserved PA5MFP PA4MFP PA3MFP PA2MFP PA1MFP PA0MFP Bits Description [31:24] Reserved Reserved.
Page 71
Mini57 GPIOB Multiple Function Control Register (SYS_GPB_MFP) Please refer to GPIO Multi-function Pin Summary Register Offset Description Reset Value SYS_GPB_MFP SYS_BA+0x34 R/W GPIOB Multiple Function Control Register 0x0000_0000 Reserved Reserved PB4MFP PB3MFP PB2MFP PB1MFP PB0MFP Bits Description [31:20] Reserved Reserved. [19:16] PB4MFP PB.4 Multi-function Pin Selection...
Page 72
Mini57 GPIOC Multiple Function Control Register (SYS_GPC_MFP) Please refer to GPIO Multi-function Pin Summary Register Offset R/W Description Reset Value SYS_GPC_MFP SYS_BA+0x38 R/W GPIOC Multiple Function Control Register 0x0000_0000 Reserved Reserved PC4MFP PC3MFP PC2MFP PC1MFP PC0MFP Bits Description [31:20] Reserved Reserved.
Page 73
Mini57 GPIOD Multiple Function Control Register (SYS_GPD_MFP) Please refer to GPIO Multi-function Pin Summary Register Offset Description Reset Value SYS_GPD_MFP SYS_BA+0x3C R/W GPIOD Multiple Function Control Register 0x0000_0111 Reserved PD6MFP PD5MFP PD4MFP PD3MFP PD2MFP PD1MFP Reserved Bits Description [31:28] Reserved Reserved.
Page 74
Mini57 HIRC Trim Control Register (SYS_IRCTCTL) Register Offset Description Reset Value SYS_IRCTCTL SYS_BA+0x80 HIRC Trim Control Register 0x0000_0030 Reserved Reserved Reserved RETRYCNT LOOPSEL Reserved FREQSEL Bits Description [31:8] Reserved Reserved. Trim Value Update Limitation Count This field defines that how many times the auto trim circuit will try to update the HIRC trim value before the frequency of HIRC locked.
Page 75
Mini57 HIRC Trim Interrupt Enable Register (SYS_IRCTIEN) Register Offset Description Reset Value SYS_IRCTIEN SYS_BA+0x84 HIRC Trim Interrupt Enable Register 0x0000_0000 Reserved Reserved Reserved Reserved CLKEIEN TFAILIEN Reserved Bits Description [31:3] Reserved Reserved. Clock Error Interrupt Enable Bit This bit controls if CPU would get an interrupt while clock is inaccuracy during auto trim operation.
Page 76
Mini57 HIRC Trim Interrupt Status Register (SYS_IRCTISTS) Register Offset Description Reset Value SYS_IRCTISTS SYS_BA+0x88 HIRC Trim Interrupt Status Register 0x0000_0000 Reserved Reserved Reserved Reserved CLKERRIF TFAILIF FREQLOCK Bits Description [31:3] Reserved Reserved. Clock Error Interrupt Status When the frequency of 32.768 kHz external low speed crystal oscillator (LXT) or 48 MHz internal high speed RC oscillator (HIRC) is shift larger to unreasonable value, this bit will be set and to be an indicate that clock frequency is inaccuracy CLKERRIF...
Page 77
Mini57 Register Lock Control Register (SYS_REGLCTL) Some of the system control registers need to be protected to avoid inadvertent write and disturb the chip operation. These system control registers are protected after the power-on reset till user to disable register protection. For user to program these protected registers, a register protection disable sequence needs to be followed by a special programming.
Page 78
Mini57 Temperature Sensor Offset Register (SYS_TSOFFSET) Register Offset Description Reset Value SYS_TSOFFSE SYS_BA+0x114 Temperature sensor offset Register 0x0XXX_0XXX Reserved VTEMP1 VTEMP1 Reserved VTEMP0 VTEMP0 Bits Description [31:28] Reserved Reserved. Temperature Sensor Offset Value VTEMP1 [27:16] This field reflects temperature sensor output voltage offset at 125 [15:12] Reserved Reserved.
Mini57 6.2.10 System Timer (SysTick) ® The Cortex -M0 includes an integrated system timer, SysTick, which provides a simple, 24-bit cleared-on-write, decrementing, wrap-on-zero counter with a flexible control mechanism. The counter can be used in several different ways, for example: An RTOS tick timer fires at a programmable rate (for example 100Hz) and invokes a SysTick routine.
Page 80
Mini57 6.2.10.1 System Timer Control Register Map R: read only, W: write only, R/W: both read and write, W&C: write 1 to clear Register Offset Description Reset Value SCS Base Address: SCS_BA = 0xE000_E000 SYST_CTL SCS_BA+0x10 SysTick Control and Status 0x0000_0004 SYST_RVR SCS_BA+0x14...
Page 81
Mini57 6.2.10.2 System Timer Control Register Description SysTick Control and Status (SYST_CTL) Register Offset Description Reset Value SYST_CTL SCS_BA+0x10 SysTick Control and Status 0x0000_0004 Reserved Reserved COUNTFLAG Reserved Reserved CLKSRC TICKINT ENABLE Bits Description [31:17] Reserved Reserved. System Tick Counter Flag Return 1 If Timer Counted to 0 Since Last Time this Register Was Read [16] COUNTFLAG...
Page 82
Mini57 SysTick Reload Value Register (SYST_RVR) Register Offset Description Reset Value SYST_RVR SCS_BA+0x14 SysTick Reload Value Register 0xXXXX_XXXX Reserved RELOAD RELOAD RELOAD Bits Description [31:24] Reserved Reserved. System Tick Reload Value [23:0] RELOAD Value to load into the Current Value register when the counter reaches 0. Apr.
Page 83
Mini57 SysTick Current Value Register (SYST_CVR) Register Offset Description Reset Value SYST_CVR SCS_BA+0x18 SysTick Current Value Register 0xXXXX_XXXX Reserved CURRENT CURRENT CURRENT Bits Description [31:24] Reserved Reserved. System Tick Current Value Current counter value. This is the value of the counter at the time it is sampled. The [23:0] CURRENT counter does not provide read-modify-write protection.
Mini57 6.2.11 Nested Vectored Interrupt Control (NVIC) 6.2.11.1 Overview ® The Cortex -M0 CPU provides an interrupt controller as an integral part of the exception mode, named as “Nested Vectored Interrupt Controller (NVIC)”, which is closely coupled to the processor core and provides following features. 6.2.11.2 Features ...
Mini57 Reserved Reserved Reserved Reserved Reserved Reserved HIRCTRIM_INT HIRC TRIM interrupt TMR0_INT Timer 0 interrupt TMR1_INT Timer 1 interrupt Reserved Reserved Reserved Reserved Analog Comparator 0 or Comparator 1 interrupt ACMP_INT Reserved Reserved Chip wake-up from Power-down state interrupt PWRWU_INT ADC0 interrupt ADC0_INT ADC1 interrupt...
Page 87
Mini57 to enable/disable the interrupts, named the Set-Pending Register and Clear-Pending Register respectively. The registers use a write-1-to-enable and write-1-to-clear policy, both registers reading back the current pended state of the corresponding interrupts. The Clear-Pending Register has no effect on the execution status of an Active interrupt. NVIC interrupts are prioritized by updating an 8-bit field within a 32-bit register (each register supporting four interrupts).
Page 88
Mini57 6.2.11.6 NVIC Control Registers Map R: read only, W: write only, R/W: both read and write Register Offset Description Reset Value SCS Base Address: SCS_BA = 0xE000_E000 NVIC_ISER SCS_BA+0x100 IRQ0 ~ IRQ31 Set-Enable Control Register 0x0000_0000 NVIC_ICER SCS_BA+0x180 IRQ0 ~ IRQ31 Clear-Enable Control Register 0x0000_0000 NVIC_ISPR SCS_BA+0x200...
Page 89
Mini57 IRQ0 ~ IRQ31 Set-enable Control Register (NVIC_ISER) Register Offset Description Reset Value NVIC_ISER SCS_BA+0x100 IRQ0 ~ IRQ31 Set-Enable Control Register 0x0000_0000 SETENA SETENA SETENA SETENA Bits Description Interrupt Enable Register Enable one or more interrupts. Each bit represents an interrupt number from IRQ0 ~ IRQ31 (Vector number from 16 ~ 47).
Page 90
Mini57 IRQ0 ~ IRQ31 Clear-enable Control Register (NVIC_ICER) Register Offset Description Reset Value NVIC_ICER SCS_BA+0x180 IRQ0 ~ IRQ31 Clear-Enable Control Register 0x0000_0000 CLRENA CLRENA CLRENA CLRENA Bits Description Interrupt Disable Register Disable one or more interrupts. Each bit represents an interrupt number from IRQ0 ~ IRQ31 (Vector number from 16 ~ 47).
Page 91
Mini57 IRQ0 ~ IRQ31 Set-pending Control Register (NVIC_ISPR) Register Offset Description Reset Value NVIC_ISPR SCS_BA+0x200 IRQ0 ~ IRQ31 Set-Pending Control Register 0x0000_0000 SETPEND SETPEND SETPEND SETPEND Bits Description Set Interrupt Pending Register Write operation: 0 = No effect. 1 = Write 1 to set pending state. Each bit represents an interrupt number from IRQ0 ~ IRQ31 (Vector number from 16 ~ 47).
Page 92
Mini57 IRQ0 ~ IRQ31 Clear-pending Control Register (NVIC_ICPR) Register Offset Description Reset Value NVIC_ICPR SCS_BA+0x280 IRQ0 ~ IRQ31 Clear-Pending Control Register 0x0000_0000 CLRPEND CLRPEND CLRPEND CLRPEND Bits Description Clear Interrupt Pending Register Write operation: 0 = No effect. 1 = Write 1 to clear pending state. Each bit represents an interrupt number from IRQ0 ~ IRQ31 (Vector number from 16 ~ 47).
Page 93
Mini57 IRQ0 ~ IRQ3 Interrupt Priority Register (NVIC_IPR0) Register Offset Description Reset Value NVIC_IPR0 SCS_BA+0x400 IRQ0 ~ IRQ3 Interrupt Priority Control Register 0x0000_0000 PRI_3 Reserved PRI_2 Reserved PRI_1 Reserved PRI_0 Reserved Bits Description Priority of IRQ3 [31:30] PRI_3 0 denotes the highest priority and 3 denotes the lowest priority. [29:24] Reserved Reserved.
Page 94
Mini57 IRQ4 ~ IRQ7 Interrupt Priority Register (NVIC_IPR1) Register Offset Description Reset Value NVIC_IPR1 SCS_BA+0x404 IRQ4 ~ IRQ7 Interrupt Priority Control Register 0x0000_0000 PRI_7 Reserved PRI_6 Reserved PRI_5 Reserved PRI_4 Reserved Bits Description Priority of IRQ7 [31:30] PRI_7 0 denotes the highest priority and 3 denotes the lowest priority. [29:24] Reserved Reserved.
Page 95
Mini57 IRQ8 ~ IRQ11 Interrupt Priority Register (NVIC_IPR2) Register Offset Description Reset Value NVIC_IPR2 SCS_BA+0x408 IRQ8 ~ IRQ11 Interrupt Priority Control Register 0x0000_0000 PRI_11 Reserved PRI_10 Reserved PRI_9 Reserved PRI_8 Reserved Bits Description Priority of IRQ11 [31:30] PRI_11 0 denotes the highest priority and 3 denotes the lowest priority. [29:24] Reserved Reserved.
Page 96
Mini57 IRQ12 ~ IRQ15 Interrupt Priority Register (NVIC_IPR3) Register Offset Description Reset Value NVIC_IPR3 SCS_BA+0x40C IRQ12 ~ IRQ15 Interrupt Priority Control Register 0x0000_0000 PRI_15 Reserved PRI_14 Reserved PRI_13 Reserved PRI_12 Reserved Bits Description Priority of IRQ15 [31:30] PRI_15 0 denotes the highest priority and 3 denotes the lowest priority. [29:24] Reserved Reserved.
Page 97
Mini57 IRQ16 ~ IRQ19 Interrupt Priority Register (NVIC_IPR4) Register Offset Description Reset Value NVIC_IPR4 SCS_BA+0x410 IRQ16 ~ IRQ19 Interrupt Priority Control Register 0x0000_0000 PRI_19 Reserved PRI_18 Reserved PRI_17 Reserved PRI_16 Reserved Bits Description Priority of IRQ19 [31:30] PRI_19 0 denotes the highest priority and 3 denotes the lowest priority. [29:24] Reserved Reserved.
Page 98
Mini57 IRQ20 ~ IRQ23 Interrupt Priority Register (NVIC_IPR5) Register Offset Description Reset Value NVIC_IPR5 SCS_BA+0x414 IRQ20 ~ IRQ23 Interrupt Priority Control Register 0x0000_0000 PRI_23 Reserved PRI_22 Reserved PRI_21 Reserved PRI_20 Reserved Bits Description Priority of IRQ23 [31:30] PRI_23 0 denotes the highest priority and 3 denotes the lowest priority. [29:24] Reserved Reserved.
Page 99
Mini57 IRQ24 ~ IRQ27 Interrupt Priority Register (NVIC_IPR6) Register Offset Description Reset Value NVIC_IPR6 SCS_BA+0x418 IRQ24 ~ IRQ27 Interrupt Priority Control Register 0x0000_0000 PRI_27 Reserved PRI_26 Reserved PRI_25 Reserved PRI_24 Reserved Bits Description Priority of IRQ27 [31:30] PRI_27 0 denotes the highest priority and 3 denotes the lowest priority. [29:24] Reserved Reserved.
Page 100
Mini57 IRQ28 ~ IRQ31 Interrupt Priority Register (NVIC_IPR7) Register Offset Description Reset Value NVIC_IPR7 SCS_BA+0x41C IRQ28 ~ IRQ31 Interrupt Priority Control Register 0x0000_0000 PRI_31 Reserved PRI_30 Reserved PRI_29 Reserved PRI_28 Reserved Bits Description Priority of IRQ31 [31:30] PRI_31 0 denotes the highest priority and 3 denotes the lowest priority. [29:24] Reserved Reserved.
Page 101
Mini57 6.2.11.7 Interrupt Source Control Registers Besides the interrupt control registers associated with the NVIC, the Mini57 series also implements some specific control registers to facilitate the interrupt functions, including ”NMI source selection” and “IRQ number identity”, which are described below. R: read only, W: write only, R/W: both read and write Register Offset...
Page 103
Mini57 MCU Interrupt Request Source Register (INT_IRQSTS) Register Offset Description Reset Value INT_IRQSTS INT_BA+0x84 MCU IRQ Number Identity Register 0x0000_0000 Bits Description MCU IRQ Source Register The IRQ collects all the interrupts from the peripherals and generates the synchronous ® ®...
Mini57 6.2.12 System Control Registers ® Key control and status features of Cortex -M0 are managed centrally in a System Control Block within the System Control Registers. ® ® For more detailed information, please refer to the “ARM Cortex -M0 Technical Reference ®...
Page 105
Mini57 6.2.12.1 System Control Register Memory Map R: read only, W: write only, R/W: both read and write Register Offset Description Reset Value SCS Base Address: SCS_BA = 0xE000_E000 SCS_CPUID SCS_BA+0xD00 CPUID Base Register 0x410C_C200 SCS_ICSR SCS_BA+0xD04 Interrupt Control State Register 0x0000_0000 Application Interrupt...
Page 106
Mini57 6.2.12.2 System Control Register Description CPUID Base Register (CPUID) Register Offset Description Reset Value SCS_CPUID SCS_BA+0xD00 CPUID Base Register 0x410C_C200 IMPLEMENTER Reserved PART PARTNO PARTNO REVISION Bits Description Implementer Code [31:24] IMPLEMENTER Implementer code assigned by ARM ( ARM = 0x41). [23:20] Reserved Reserved.
Page 107
Mini57 Interrupt Control State Register (ICSR) Register Offset Description Reset Value SCS_ICSR SCS_BA+0xD04 Interrupt Control State Register 0x0000_0000 NMIPENDSET Reserved PENDSVSET PENDSVCLR PENDSTSET PENDSTCLR Reserved ISRPREEMPT ISRPENDING Reserved VECTPENDING VECTPENDING Reserved VECTACTIVE VECTACTIVE Bits Description NMI Set-pending Bit Write Operation: 0 = No effect.
Page 108
Mini57 Write Operation: 0 = No effect. 1 = Changes SysTick exception state to pending. Read Operation: 0 = SysTick exception is not pending. 1 = SysTick exception is pending. SysTick Exception Clear-pending Bit Write Operation: 0 = No effect. [25] PENDSTCLR 1 = Removes the pending state from the SysTick exception.
Page 109
Mini57 Application Interrupt and Reset Control Register (AIRCR) Register Offset Description Reset Value SCS_AIRCR SCS_BA+0xD0C Application Interrupt and Reset Control Register 0xFA05_0000 VECTORKEY VECTORKEY Reserved Reserved SYSRESETRE VECTCLRAC Reserved TIVE Bits Description Register Access Key Write Operation: When writing to this register, the VECTORKEY field need to be set to 0x05FA, otherwise VECTORKEY the write operation would be ignored.
Page 110
Mini57 System Control Register (SCR) Register Offset Description Reset Value SCS_SCR SCS_BA+0xD10 System Control Register 0x0000_0000 Reserved Reserved Reserved Reserved SEVONPEND Reserved SLEEPDEEP SLEEPONEXI Reserved Bits Description [31:5] Reserved Reserved. Send Event on Pending Bit 0 = Only enabled interrupts or events can wake-up the processor, disabled interrupts areexcluded.
Page 111
Mini57 System Handler Priority Register 2 (SHPR2) Register Offset Description Reset Value SCS_SHPR2 SCS_BA+0xD1C System Handler Priority Register 2 0x0000_0000 PRI_11 Reserved Reserved Reserved Reserved Bits Description Priority of System Handler 11 – SVCall [31:30] PRI_11 “0” denotes the highest priority and “3” denotes the lowest priority. [29:0] Reserved Reserved.
Page 112
Mini57 System Handler Priority Register 3 (SHPR3) Register Offset Description Reset Value SCS_SHPR3 SCS_BA+0xD20 System Handler Priority Register 3 0x0000_0000 PRI_15 Reserved PRI_14 Reserved Reserved Reserved Bits Description Priority of System Handler 15 – SysTick [31:30] PRI_15 “0” denotes the highest priority and “3” denotes the lowest priority. [29:24] Reserved Reserved.
Mini57 6.3 Clock Controller 6.3.1 Overview The clock controller generates clocks for the whole chip, including system clocks and all peripheral clocks. The clock controller also implements the power control function with the individually clock ON/OFF control, clock source selection and clock divider. The chip enters ®...
Mini57 6.3.2 Auto Trim This chip supports auto-trim function: the HIRC trim (48 MHz RC oscillator), according to the accurate LXT (32.768 kHz crystal oscillator), automatically gets accurate HIRC output frequency, 0.25 % deviation within all temperature ranges. For instance, the system needs an accurate 48MHz clock. In such case, if users do not want to use PLL as the system clock source, they need to solder 32.768 kHz crystal in system, and set FREQSEL (SYS_IRCTCTL[0] trim frequency selection) to “1”, and the auto-trim function will be enabled.
Mini57 multiplexer is reflected to the CKO pin. Therefore there are 16 options of power-of-2 divided clocks with the frequency from F to F where F is input clock frequency to the clock divider. (N+1) The output formula is F , where F is the input clock frequency, F is the clock...
Mini57 6.3.8 Register Description Power-down Control Register (CLK_PWRCTL) Except the BIT[6], all the other bits are protected, and programming these bits need to write 0x59, 0x16, 0x88 to address 0x5000_0100 to disable register protection. Refer to the SYS_REGLCTL register at address SYS_BA + 0x100. Register Offset Description...
Page 122
Mini57 peripheral clock source is from LXT or LIRC. 0 = Chip operating normally or chip in idle mode because of WFI/WFE command. 1 = Chip enters Power-down mode when CPU sleep command WFI/WFE. Note: This bit is write protected. Refer to the SYS_REGLCTL register. Power-down Mode Wake-up Interrupt Status Set by “Power-down wake-up event”, it indicates that resume from Power-down mode”...
Mini57 Register/Instruction SLEEPDEEP PDEN Clock Disable Instruction Mode (SCS_SCR[2]) (CLK_PWRCTL [7]) Normal operation All clocks are controlled by control register. Idle mode Only CPU clock is disabled. (CPU enters Sleep mode) Power-down mode Most clocks are disabled except LIRC/LXT, only (CPU enters Deep Sleep RTC/WDT/Timer peripheral...
Page 124
Mini57 AHB Devices Clock Enable Control Register (CLK_AHBCLK) The bits in this register are used to enable/disable clock for system clock, AHB bus devices clock. Register Offset Description Reset Value CLK_AHBCLK CLK_BA+0x04 AHB Devices Clock Enable Control Register 0x0000_0014 Reserved Reserved Reserved Reserved...
Page 125
Mini57 APB Devices Clock Enable Control Register (CLK_APBCLK) The bits in this register are used to enable/disable clock for peripheral controller clocks. Register Offset Description Reset Value CLK_APBCLK CLK_BA+0x08 APB Devices Clock Enable Control Register 0x0000_0001 Reserved ACMPCKEN Reserved ADCCKEN Reserved USCI1CKEN USCI0CKEN...
Page 128
Mini57 Clock Source Select Control Register 1 (CLK_CLKSEL1) Before clock switching, the related clock sources (pre-selected and newly-selected) must be turned Register Offset Description Reset Value CLK_CLKSEL CLK_BA+0x14 Clock Source Select Control Register 1 0xC307_7733 CLKOSEL Reserved Reserved Reserved TMR1SEL Reserved TMR0SEL Reserved...
Page 129
Mini57 ADC Peripheral Clock Source Selection 00 = Clock source from external crystal oscillator (HXT or LXT). [5:4] ADCSEL 01 = Reserved. 10 = Clock source is from HCLK. 11 = Clock source from 48 MHz internal high speed RC oscillator (HIRC). Reserved [3:2] Reserved.
Page 130
Mini57 Clock Divider Number Register (CLK_CLKDIV) Register Offset Description Reset Value CLK_CLKDIV CLK_BA+0x20 Clock Divider Number Register 0x0000_0000 Reserved ADCDIV Reserved Reserved HCLKDIV Bits Description [31:24] Reserved Reserved. ADC Clock Divide Number From ADC Clock Source ADCDIV [23:16] ADC clock frequency = (ADC clock source frequency) / (ADCDIV + 1). [15:4] Reserved Reserved.
Page 131
Mini57 Clock Status Monitor Register (CLK_STATUS) The bits in this register are used to monitor if the chip clock source is stable or not, and whether the clock switch is failed. Register Offset Description Reset Value CLK_STATUS CLK_BA+0x50 R Clock Status Monitor Register 0x0000_00XX Reserved Reserved...
Page 132
Mini57 Clock Output Control Register (CLK_CLKOCTL) Register Offset Description Reset Value CLK_CLKOCTL CLK_BA+0x60 Clock Output Control Register 0x0000_0000 Reserved Reserved Reserved Reserved DIV1EN CLKOEN FREQSEL Bits Description [31:6] Reserved Reserved. Clock Output Divide One Enable Bit DIV1EN 0 = Clock Output will output clock with source frequency divided by FREQSEL. 1 = Clock Output will output clock with source frequency.
Mini57 6.4 Flash Memory Controller (FMC) 6.4.1 Overview The Mini57 series is equipped with 29.5 Kbytes on chip embedded Flash for application program memory (APROM) that can be updated through ISP procedure. In System Programming (ISP) function enables user to update program memory when chip is soldered on PCB. After chip ®...
Mini57 Cortex-M0 Debug Access Port AHB Lite interface AHB Bus DFBADR AHB Slave Interface ISP Controller Flash Operation Power On Control Initialization Data Out Config & Map Control Figure 6.4-1 Flash Memory Control Block Diagram Apr. 06, 2017 Page 134 of 475 Rev.1.00...
Mini57 6.4.4 Functional Description 6.4.4.1 Flash Memory Organization The Mini57 Flash memory consists of program memory (APROM), Data Flash, ISP loader program memory (LDROM), and user configuration. Program memory is main memory for user applications and called APROM. User can write their application to APROM and set system to boot from APROM.
Mini57 0x0000_75FF DataFlash 0.5*N k bytes Programmable start DFBA[31:0] address Application Program (29.5-0.5*N)K bytes 29.5K Flash Memory Device Figure 6.4-3 Data Flash Shared with APROM 6.4.4.3 Security Program Memory (SPROM) The Mini57 series provides security program memory for user to store instruction of security. It is read/write through ISP procedure and ICE, and this memory cannot be erased by “whole chip erase command”...
Page 138
Mini57 (The last byte=Others): Secured code ICE Debug ISP/IAP CPU Data CPU Instruction Whole chip erase √ Page-erase Program Read CPU Instruction SPROM0/1/2 0x200000 ~ 0x2001FF/0x240000 ~ 0x2401FF/0x280000 ~ 0x2801FF ISP/IAP/ICP/Writer Lock unLock Lock unLock whole chip erase √ √...
Page 141
Mini57 Config0 Address = 0x0030_0000 Bits Description 01 = Pull-high Resistor Enabled. 1x = Pull-high/low Resistor Disabled. GPA0 is set as this state mode after power-on. Brown-out Voltage Selection Brown-out voltages are as follows: 000 = 2.0V. 001 = 2.2V. 010 = 2.4V.
Page 142
Mini57 Config0 Address = 0x0030_0000 Bits Description Data Flash Enabled DFEN 0 = Data Flash Enabled. 1 = Data Flash Disabled. Note: The reserved bits of user configuration should be kept as ‘1’. Apr. 06, 2017 Page 142 of 475 Rev.1.00...
Page 143
Mini57 Config1 (Address = 0x0030_0004) Reserved Reserved Reserved DFBA DFBA Config1 Address = 0x0030_0004 Bits Description [31:14] Reserved Reserved Data Flash Base Address [13:0] DFBA The Data Flash base address is defined by user. Since on chip Flash erase unit is 512 bytes, it is mandatory to keep bit 8-0 as 0.
Mini57 6.4.4.5 Brown-out Detection The Mini57 series includes the brown-out detection function for monitoring the voltage on V pin. If V voltage falls below level setting CBOV, the BOD event will be triggered when BOD enabled. User can decide to use BOD reset by enable CBORST or just enable BOD interrupt by NVIC when BOD detected.
Mini57 be access by ISP commands. APROM is write-protected in this mode. Table 6.4-3 Boot Selection Run In LDROM Run In APROM Boot Vector Run In APROM Run In LDROM CBS[1:0] Write To Write To Write To LDROM Write To LDROM From Re-Map APROM...
Mini57 6.4.4.7 In Application Programming The Mini57 series provides In-application-programming (IAP) function for user to switch the code executing between APROM and LDROM without reset. User can enable the IAP function by re- booting chip and setting the chip boot selection bits in Config0 (CBS[1:0]) as 10’b or 00’b. In the case that the chip boots from APROM with the IAP function enabled (CBS[1:0] = 10’b), the executable range of code includes all of APROM and LDROM.
Mini57 6.4.4.8 In System Programming (ISP) The Mini57 series supports In-System-Programming which allows a device to be reprogrammed under software control and avoids system fail risk when download or programming fail. Furthermore, the capability to update the application firmware makes a wide range of applications possible.
Page 148
Mini57 Updating APROM by software in LDROM or updating LDROM by software in APROM can avoid a system failure when update fails. The ISP controller supports to read, erase and program embedded Flash memory. Several control bits of ISP controller are write-protected, thus it is necessary to unlock before we can set them.
Mini57 6.4.6 Register Description ISP Control Register (FMC_ISPCTL) Register Offset Description Reset Value FMC_ISPCTL FMC_BA+0x00 ISP Control Register 0x0000_0000 Reserved Reserved Reserved Reserved ISPFF LDUEN CFGUEN APUEN SPUEN ISPEN Bits Description [31:7] Reserved Reserved. ISP Fail Flag (Write Protect) This bit is set by hardware when a triggered ISP meets any of the following conditions: (1) APROM writes to itself if APUEN is set to 0.
Page 152
Mini57 Bits Description Boot Select (Write Protect) Set/clear this bit to select next booting from LDROM/APROM, respectively. This bit also functions as chip booting status flag, which can be used to check where chip booted from. This bit is initiated with the inversed value of CBS in CONFIG0 after any reset is happened except CPU reset (CPURF is 1) or system reset (SYSRF) is happened.
Page 153
Mini57 ISP Address (FMC_ISPADDR) Register Offset Description Reset Value FMC_ISPADD FMC_BA+0x04 ISP Address Register 0x0000_0000 ISPADR ISPADR ISPADR ISPADR Bits Description ISP Address ISPADR [31:0] The Mini57 series supports word program only. ISPADR[1:0] must be kept 00 for ISP operation. Apr.
Page 154
Mini57 FMC_ISPDAT (ISP Data Register) Register Offset Description Reset Value FMC_ISPDAT FMC_BA+0x08 ISP Data Register 0x0000_0000 ISPDAT ISPDAT ISPDAT ISPDAT Bits Description ISP Data [31:0] ISPDAT Write data to this register before ISP program operation. Read data from this register after ISP read operation. Apr.
Page 155
Mini57 ISP Command (FMC_ISPCMD) Register Offset Description Reset Value FMC_ISPCMD FMC_BA+0x0C ISP Command Register 0x0000_0000 Reserved Reserved Reserved Reserved Bits Description [31:6] Reserved Reserved. ISP Command ISP commands are shown below: 0x00 = Read. 0x04 = Read Unique ID. 0x0B = Read Company ID (0xDA). [5:0] 0x0D = Read CRC32 Checksum Result After Calculating.
Page 156
Mini57 ISP Trigger Control Register (FMC_ISPTRG) Register Offset Description Reset Value FMC_ISPTRG FMC_BA+0x10 ISP Trigger Register 0x0000_0000 Reserved Reserved Reserved Reserved ISPGO Bits Description [31:1] Reserved Reserved. ISP Start Trigger (Write Protect) Write 1 to start ISP operation and this bit will be cleared to 0 by hardware automatically when ISP operation is finished.
Page 157
Mini57 Data Flash Base Address Register (FMC_DFBA) Register Offset Description Reset Value FMC_DFBA FMC_BA+0x14 Data Flash Start Address 0x0000_3800 DFBA DFBA DFBA DFBA Bits Description Data Flash Base Address This register indicates Data Flash start address. It is a read only register. DFBA [31:0] The Data Flash start address is defined by user.
Page 158
Mini57 ISP Status Register (FMC_ISPSTS) Register Offset Description Reset Value FMC_ISPSTS FMC_BA+0x40 ISP Status Register 0xXXXX_XXXX SCODE Reserved Reserved VECMAP VECMAP Reserved Reserved ISPFF Reserved ISPBUSY Bits Description Security Code Active Flag This bit field set by hardware when detecting SPROM secured code is active at Flash initiation, or software writes 1 to this bit to make secured code active;...
Page 159
Mini57 ISP Start Trigger (Read Only) Write 1 to start ISP operation and this bit will be cleared to 0 by hardware automatically when ISP operation is finished. ISPBUSY 0 = ISP operation is finished. 1 = ISP operation is progressed. Note: This bit is the same with FMC_ISPTRG bit 0.
Page 160
Mini57 ISP CRC Seed Register (FMC_CRCSEED) Register Offset Description Reset Value FMC_CRCSE FMC_BA+0x50 ISP CRC Seed Register 0xFFFF_FFFF CRCSEED CRCSEED CRCSEED CRCSEED Bits Description CRC Seed Data This register was provided to be the initial value for CRC operation. [31:0] CRCSEED Write data to this register before ISP CRC operation.
Page 161
Mini57 ISP CRC Current Value Register (FMC_CRCCV) Register Offset Description Reset Value FMC_CRCCV FMC_BA+0x54 ISP CRC Current Value Register 0xXXXX_XXXX CRCCV CRCCV CRCCV CRCCV Bits Description CRC Current Value [31:0] CRCCV This register provided current value of CRC durning calculation. Apr.
Mini57 6.5 General Purpose I/O (GPIO) 6.5.1 Overview The Mini57 series has up to 22 General Purpose I/O pins. These pins could be shared with other functions depending on the chip configuration. 22 pins are arranged in 4 ports named as PA, PB, PC, and PD.
Mini57 I/O pin can be configured as interrupt source with edge/level setting Supports High Drive and High Sink I/O mode Supports software selectable slew rate control Configurable default I/O mode of all pins after reset by CIOINI (CONFIG0[10]) setting ...
Mini57 6.5.5.1 Input Mode Set MODEn (Px_MODE[2n+1:2n]) to 00 as the Px.n pin is in Input mode and the I/O pin is in tri- state (high impedance) without output drive capability. The PIN (Px_PIN[n]) value reflects the status of the corresponding port pins. 6.5.5.2 Push-pull Output Mode Set MODEn (Px_MODE[2n+1:2n]) to 01 as the Px.n pin is in Push-pull Output mode and the I/O...
Mini57 Port Pin Port Pin Port Latch Data Port Latch Data Input Data Input Data Figure 6.5-4 Open-Drain Output 6.5.5.4 Quasi-bidirectional Mode Set MODEn (Px_MODE[2n+1:2n]) to 11 as the Px.n pin is in Quasi-bidirectional mode and the I/O pin supports digital output and input function at the same time but the source current is only up to hundreds uA.
Mini57 6.5.6 GPIO Interrupt and Wake-up Function Each GPIO pin can be set as chip interrupt source by setting correlative RHIEN (Px_INTEN[n+16])/ FLIEN (Px_INTEN[n]) bit and TYPE (Px_INTTYPE[n]). There are five types of interrupt conditions to be selected: low level trigger, high level trigger, falling edge trigger, rising edge trigger and both rising and falling edge trigger.
Mini57 6.5.7 Register Map R: read only, W: write only, R/W: both read and write Register Offset Description Reset Value GPIO Base Address: GPIO_BA = 0x5000_4000 PA_MODE GPIO_BA+0x000 PA I/O Mode Control 0x0000_0XXX PA_DINOFF GPIO_BA+0x004 PA Digital Input Path Disable Control 0x0000_0000 PA_DOUT GPIO_BA+0x008...
Page 168
Mini57 PB_PHEN GPIO_BA+0x070 PB Pull-High Control Register 0x0000_001F PC_MODE GPIO_BA+0x080 PC I/O Mode Control 0x0000_0XXX PC_DINOFF GPIO_BA+0x084 PC Digital Input Path Disable Control 0x0000_0000 PC_DOUT GPIO_BA+0x088 PC Data Output Value 0x0000_001F PC_DATMSK GPIO_BA+0x08C PC Data Output Write Mask 0x0000_0000 PC_PIN GPIO_BA+0x090 PC Pin Value 0x0000_00XX...
Mini57 6.5.8 Register Description Port A-D I/O Mode Control (Px_MODE) Register Offset Description Reset Value PA_MODE GPIO_BA+0x000 PA I/O Mode Control 0x0000_0XXX PB_MODE GPIO_BA+0x040 PB I/O Mode Control 0x0000_0XXX PC_MODE GPIO_BA+0x080 PC I/O Mode Control 0x0000_0XXX PD_MODE GPIO_BA+0x0C0 PD I/O Mode Control 0x0000_00XX Reserved Reserved...
Page 171
Mini57 Port A-D Digital Input Path Disable Control (Px_DINOFF) Register Offset Description Reset Value PA_DINOFF GPIO_BA+0x004 PA Digital Input Path Disable Control 0x0000_0000 PB_DINOFF GPIO_BA+0x044 PB Digital Input Path Disable Control 0x0000_0000 PC_DINOFF GPIO_BA+0x084 PC Digital Input Path Disable Control 0x0000_0000 PD_DINOFF GPIO_BA+0x0C4...
Page 172
Mini57 Port A-D Data Output Value (Px_DOUT) Register Offset Description Reset Value PA_DOUT GPIO_BA+0x008 PA Data Output Value 0x0000_003F PB_DOUT GPIO_BA+0x048 PB Data Output Value 0x0000_001F PC_DOUT GPIO_BA+0x088 PC Data Output Value 0x0000_001F PD_DOUT GPIO_BA+0x0C8 PD Data Output Value 0x0000_007F Reserved Reserved Reserved...
Page 173
Mini57 Port A-D Data Output Write Mask (Px_DATMSK) Register Offset Description Reset Value PA_DATMSK GPIO_BA+0x00C PA Data Output Write Mask 0x0000_0000 PB_DATMSK GPIO_BA+0x04C PB Data Output Write Mask 0x0000_0000 PC_DATMSK GPIO_BA+0x08C PC Data Output Write Mask 0x0000_0000 PD_DATMSK GPIO_BA+0x0CC PD Data Output Write Mask 0x0000_0000 Reserved Reserved...
Page 174
Mini57 Port A-D Pin Value (Px_PIN) Register Offset Description Reset Value PA_PIN GPIO_BA+0x010 PA Pin Value 0x0000_00XX PB_PIN GPIO_BA+0x050 PB Pin Value 0x0000_00XX PC_PIN GPIO_BA+0x090 PC Pin Value 0x0000_00XX PD_PIN GPIO_BA+0x0D0 PD Pin Value 0x0000_00XX Reserved Reserved Reserved PINn Bits Description Reserved [31:8]...
Page 175
Mini57 Port A-D De-bounce Enable Control Register (Px_DBEN) Register Offset Description Reset Value PA_DBEN GPIO_BA+0x014 PA De-Bounce Enable Control Register 0x0000_0000 PB_DBEN GPIO_BA+0x054 PB De-Bounce Enable Control Register 0x0000_0000 PC_DBEN GPIO_BA+0x094 PC De-Bounce Enable Control Register 0x0000_0000 PD_DBEN GPIO_BA+0x0D4 PD De-Bounce Enable Control Register 0x0000_0000 Reserved Reserved...
Page 176
Mini57 Port A-D Interrupt Type Control (Px_INTTYPE) Register Offset Description Reset Value PA_INTTYPE GPIO_BA+0x018 PA Interrupt Trigger Type Control 0x0000_0000 PB_INTTYPE GPIO_BA+0x058 PB Interrupt Trigger Type Control 0x0000_0000 PC_INTTYPE GPIO_BA+0x098 PC Interrupt Trigger Type Control 0x0000_0000 PD_INTTYPE GPIO_BA+0x0D8 PD Interrupt Trigger Type Control 0x0000_0000 Reserved Reserved...
Page 177
Mini57 Port A-D Interrupt Enable Control Register (Px_INTEN) Register Offset Description Reset Value PA_INTEN GPIO_BA+0x01C PA Interrupt Enable Control Register 0x0000_0000 PB_INTEN GPIO_BA+0x05C PB Interrupt Enable Control Register 0x0000_0000 PC_INTEN GPIO_BA+0x09C PC Interrupt Enable Control Register 0x0000_0000 PD_INTEN GPIO_BA+0x0DC PD Interrupt Enable Control Register 0x0000_0000 Reserved RHIENn...
Page 178
Mini57 If the interrupt is edge trigger(TYPE (Px_INTTYPE[n]) bit is set to 0), the input Px.n pin will generate the interrupt while this pin state changed from high to low. 0 = Px.n level low or high to low interrupt Disabled. 1 = Px.n level low or high to low interrupt Enabled.
Page 179
Mini57 Port A-D Interrupt Source Flag (Px_INTSRC) Register Offset Description Reset Value PA_INTSRC GPIO_BA+0x020 PA Interrupt Source Flag 0x0000_00XX PB_INTSRC GPIO_BA+0x060 PB Interrupt Source Flag 0x0000_00XX PC_INTSRC GPIO_BA+0x0A0 PC Interrupt Source Flag 0x0000_00XX PD_INTSRC GPIO_BA+0x0E0 PD Interrupt Source Flag 0x0000_00XX Reserved Reserved Reserved...
Page 181
Mini57 Port A-D High Slew Rate Control Register (Px_SLEWCTL) Register Offset Description Reset Value PA_SLEWCTL GPIO_BA+0x028 PA High Slew Rate Control Register 0x0000_0000 PB_SLEWCTL GPIO_BA+0x068 PB High Slew Rate Control Register 0x0000_0000 PC_SLEWCTL GPIO_BA+0x0A8 PC High Slew Rate Control Register 0x0000_0000 PD_SLEWCTL GPIO_BA+0x0E8 PD High Slew Rate Control Register...
Page 182
Mini57 Port Pull-low Resistor Control Register (Px_PLEN) Register Offset Description Reset Value PA_PLEN GPIO_BA+0x02C PA Pull-Low Control Register 0x0000_0000 PB_PLEN GPIO_BA+0x06C PB Pull-Low Control Register 0x0000_0000 PC_PLEN GPIO_BA+0x0AC PC Pull-Low Control Register 0x0000_0000 PD_PLEN GPIO_BA+0x0EC PD Pull-Low Control Register 0x0000_0000 Reserved Reserved Reserved...
Page 183
Mini57 Port Pull High Resistor Control Register (Px_PHEN) Register Offset Description Reset Value PA_PHEN GPIO_BA+0x030 PA Pull-High Control Register 0x0000_003F PB_PHEN GPIO_BA+0x070 PB Pull-High Control Register 0x0000_001F PC_PHEN GPIO_BA+0x0B0 PC Pull-High Control Register 0x0000_001F PD_PHEN GPIO_BA+0x0F0 PD Pull-High Control Register 0x0000_007F Reserved Reserved...
Page 184
Mini57 Interrupt De-bounce Control Register (GPIO_DBCTL) Register Offset Description Reset Value GPIO_DBCTL GPIO_BA+0x440 Interrupt De-bounce Control Register 0x0000_0020 Reserved Reserved Reserved Reserved ICLKON DBCLKSRC DBCLKSEL Bits Description [31:6] Reserved Reserved. Interrupt Clock on Mode 0 = Edge detection circuit is active only if I/O pin corresponding RHIEN (Px_INTEN[n+16])/FLIEN (Px_INTEN[n]) bit is set to 1.
Page 185
Mini57 Bits Description De-bounce Sampling Cycle Selection 0000 = Sample interrupt input once per 1 clocks. 0001 = Sample interrupt input once per 2 clocks. 0010 = Sample interrupt input once per 4 clocks. 0011 = Sample interrupt input once per 8 clocks. 0100 = Sample interrupt input once per 16 clocks.
Mini57 6.6 Timer Controller (TIMER) 6.6.1 Overview The Timer Controller includes two 32-bit timers, TIMER0 ~ TIMER1, allowing user to easily implement a timer control for applications. The timer can perform functions, such as frequency measurement, delay timing, clock generation, and event counting by external input pins, and interval measurement by external capture pins.
Mini57 6.6.3 Block Diagram Each channel is equipped with an 8-bit pre-scale counter, a 24-bit up-timer, a 24-bit compare register and an interrupt request signal. Refer to Figure 6.6-1. There are five options of clock sources for each channel. Figure 6.6-2 illustrates the clock source control function. WKEN (TIMERx_CTL[23]) CMPDAT...
Mini57 6.6.4 Basic Configuration The peripheral clock source of Tiimer0 ~ Timer1 can be enabled in TMRxCKEN (CLK_APBCLK[3:2]) and selected as different frequency in TMR0SEL (CLK_CLKSEL1[10:8]) for Timer0, TMR1SEL (CLK_CLKSEL1[14:12]) for Timer1. 6.6.5 Functional Description The timer controller provides One-shot, Period, Toggle and Continuous Counting operation modes.
Mini57 (TIMERX_CTL[30]) bit is set, the timer counter starts up counting. The counting operation of toggle-out mode is almost the same as periodic mode, except toggle-out mode has associated output pin to output signal while specify TIF bit is set. Thus, the toggle-output signal on output pin is changing back and forth with 50% duty cycle.
Mini57 less than 1/8 HCLK if TMx pin de-bounce enabled to assure the returned CNT value is incorrect, and software can also select edge detection phase of TMx pin by CNTPHASE (TIMERx_EXTCTL[0]) bit. In event counting mode, the timer counting operation mode can be selected as one-shot, periodic and continuous counting mode to counts the CNT value by input event from TMx pin.
Mini57 select ACMPOx (x= 0~1) transition is using to trigger reset counter value. The operation method is also described in Table 6.6-1. TIMERx_CNT ACMPOx (CAPEDGE=0x02) Clear by software CAPIF Figure 6.6-5 External Reset Counter Mode 6.6.5.11 Trigger-Counting Capture Mode If CAPMODE (TIMERx_EXTCTL[8]) is set to 1, CAPEN (TIMERx_EXTCTL[3]) is set to 1 and CAPFUNCS (TIMERx_EXTCTL[4]) is set to 0, the CNT will be reset to 0 then captured into CAPDAT register when ACMPOx (x= 0~1) trigger condition occurred.
Mini57 pin is detected to reset CNT as 0 and then starts counting, while the 2nd 1 to 0 transition stops counting. Rising Edge Trigger: The 1st 0 to 1 transition to on ACMPOx (x= 0~1) pin is detected to reset CNT as 0 and then starts counting, while the 2nd 0 to 1 transition stops counting.
Mini57 CCAPEN Input Signal H/W clears 'CCAPEN' bit S/W sets 'CCAPEN' bit H/W loads Timer0/1's counter value into 'TIMER_CCAP3' register at the 2nd falling edge and set CAPF2F to 1. H/W loads Timer0/1's counter value into 'TIMER_CCAP2' register at the 2nd rising-edge and set CAPR2F to 1. H/W loads Timer0/1's counter value into 'TIMER_CCAP1' register at the 1st falling edge and set CAPF1F to 1.
Mini57 6.6.7 Register Description Timer Control Register (TIMERx_CTL) Register Offset Description Reset Value TIMER0_CTL TMR_BA+0x00 Timer0 Control and Status Register 0x0000_0005 TIMER1_CTL TMR_BA+0x20 Timer1 Control and Status Register 0x0000_0005 ICEDEBUG CNTEN INTEN OPMODE RSTCNT ACTSTS EXTCNTEN WKEN Reserved CMPCTL CNTDATEN Reserved Bits Description...
Page 198
Mini57 Bits Description 11 = The timer is operating in Continuous Counting mode. The associated interrupt signal is generated when TIMERx_CNT = TIMERx_CMP (if INTEN is enabled). However, the 24-bit up-timer counts continuously. Please refer to 6.12.5.2 for detailed description about Continuous Counting mode operation.
Page 199
Mini57 Timer Compare Register (TIMERx_CMP) Register Offset Description Reset Value TIMER0_CMP TMR_BA+0x04 Timer0 Compare Register 0x0000_0000 TIMER1_CMP TMR_BA+0x24 Timer1 Compare Register 0x0000_0000 Reserved CMPDAT CMPDAT CMPDAT Bits Description [31:24] Reserved Reserved. Timer Compared Value CMPDAT is a 24-bit compared value register. When the internal 24-bit up counter value is equal to CMPDAT value, the TIF flag will set to 1.
Page 200
Mini57 Timer Interrupt Status Register (TIMERx_INTSTS) Register Offset Description Reset Value TIMER0_INTST TMR_BA+0x08 Timer0 Interrupt Status Register 0x0000_0000 TIMER1_INTST TMR_BA+0x28 Timer1 Interrupt Status Register 0x0000_0000 Reserved Reserved Reserved Reserved TWKF Bits Description [31:2] Reserved Reserved. Timer Wake-up Flag This bit indicates the interrupt wake-up flag status of Timer. 0 = Timer does not cause chip wake-up.
Page 201
Mini57 Timer Data Register (TIMERx_CNT) Register Offset Description Reset Value TIMER0_CNT TMR_BA+0x0C Timer0 Data Register 0x0000_0000 TIMER1_CNT TMR_BA+0x2C Timer1 Data Register 0x0000_0000 Reserved Bits Description [31:24] Reserved Reserved. Timer Data Register [23:0] If CNTDATEN is set to 1, CNT register value will be updated continuously to monitor 24- bit up counter value.
Page 202
Mini57 Timer Capture Data Register (TIMERx_CAP) Register Offset Description Reset Value TIMER0_CAP TMR_BA+0x10 Timer0 Capture Data Register 0x0000_0000 TIMER1_CAP TMR_BA+0x30 Timer1 Capture Data Register 0x0000_0000 Reserved CAPDAT CAPDAT CAPDAT Bits Description [31:24] Reserved Reserved. Timer Capture Data Register When CAPEN (TIMERx_EXTCTL[3]) bit is set, CAPFUNCS (TIMERx_EXTCTL[4]) bit is [23:0] CAPDAT 0, and a transition on ACMPOx matched the CAPEDGE (TIMERx_EXTCTL[2:1]) setting,...
Page 204
Mini57 Bits Description Timer Capture Function Enable Bit This bit enables the Timer Capture Function CAPEN 0 = Timer Capture Function Disabled. 1 = Timer Capture Function Enabled. Timer Capture Pin Edge Detection 00 = A falling edge on ACMPOx will be detected. [2:1] CAPEDGE 01 = A rising edge on ACMPOx will be detected.
Page 207
Mini57 Bits Description Capture Rising Edge 1 Flag First rising edge already captured, this bit will be set to 1. CAPR1F 0 = None. 1 = CAPDAT(TIMER_CCAP0[23:0]) data is ready for read. Note: This bit is cleared by hardware automatically when writing 1 to this bit. [7:5] Reserved Reserved.
Mini57 6.7 Enhanced Input Capture Timer (ECAP) 6.7.1 Overview This device provides an Input Capture Timer/Counter whose capture function can detect the digital edge-changed signal at channel inputs. This unit has three input capture channels. The timer/counter is equipped with up counting, reload and compare-match capabilities. 6.7.2 Features ...
Mini57 ECAPCKEN (CLK_APBCLK[8]) ECAP_CLK HCLK Figure 6.7-2 Enhanced Input Capture Timer/Counter Clock Source Control Figure 6.7-1 illustrates the architecture of the Input Capture. This input capture timer/counter unit supports 3 input channels with programmable input signal sources. The port pins ECAP_P0 to ECAP_P2 can be fed to the inputs of capture unit through noise filter or bypass it (CAPNFDIS = 1).
Mini57 6.7.5 Operation of Input Capture Timer/Counter The Input Capture Timer/Counter unit consists of 2 main functional blocks, Capture block and Operation block. There are 3 Input Capture units in Capture block for 3 input channel. The capture units function as detecting and measuring the pulse width and the period of a square wave.
Mini57 6.7.5.3 Reload Mode The Input Capture Timer/Counter can also be configured for reload mode. The reload function is enabled by setting RLDEN (ECAP_CTL0[27]) to 1. In this mode, ECAP_CNTCMP serves as a reload register. A reload event is generated and causes the content of the ECAP_CNTCMP register to be loaded into the ECAP_CNT register when ECAP_CNT overflows, CAPTF2, CAPTF1 or CAPTF0 setting by configuring the CPRLDS (ECAP_CTL1[10:8]).
Mini57 6.7.8 Register Description Input Capture Counter (ECAP_CNT) Register Offset Description Reset Value ECAP_CNT ECAP_BA+0x00 Input Capture Counter 0x0000_0000 Reserved Bits Description [31:24] Reserved Reserved. Input Capture Timer/Counter [23:0] The input Capture Timer/Counter is a 24-bit up-counting counter. The clock source for the counter is from thme clock divider.
Page 216
Mini57 Input Capture Counter Hold Register 0-2 (ECAP_HLD0-2) Register Offset Description Reset Value ECAP_HLD0 ECAP_BA+0x04 Input Capture Counter Hold Register 0 0x0000_0000 ECAP_HLD1 ECAP_BA+0x08 Input Capture Counter Hold Register 1 0x0000_0000 ECAP_HLD2 ECAP_BA+0x0C Input Capture Counter Hold Register 2 0x0000_0000 Reserved HOLD HOLD...
Page 217
Mini57 Input Capture Counter Compare Register (ECAP_CNTCMP) Register Offset Description Reset Value ECAP_CNTCMP ECAP_BA+0x10 Input Capture Counter Compare Register 0x0000_0000 Reserved CNTCMP CNTCMP CNTCMP Bits Description [31:24] Reserved Reserved. Input Capture Counter Compare Register If the compare function is enabled (CMPEN = 1), t this register (ECAP_CNTCMP) is used to [23:0] CNTCMP compare with the capture counter (ECAP_CNT).
Page 219
Mini57 Bits Description Input Capture Counter Clear by Compare-match Control If this bit is set to 1, the capture counter (ECAP_CNT) will be cleared to 0 when the compare-match event (CAPCMPF = 1) occurs. [25] CMPCLR 0 = Compare-match event (CAPCMPF) can clear capture counter (ECAP_CNT) Disabled. 1 = Compare-match event (CAPCMPF) can clear capture counter (ECAP_CNT) Enabled.
Page 220
Mini57 Bits Description CAP0 Input Source Selection 00 = CAP0 input is from port pin ECAP_P0. CAPSEL0 01 = CAP0 input is from signal ACMP0_O (Analog comparator 0 output). [9:8] 10 = CAP0 input is from signal ACMP1_O (Analog comparator 1 output). 11 = CAP0 input is from signal ADC_CPR (ADC compare output).
Page 222
Mini57 Bits Description ECAP_CNT Reload Trigger Source Selection If the reload function is enabled (RLDEN = 1), when a reload trigger event comes, the ECAP_CNT is reloaded with ECAP_CNTCMP. CPRLDS[2:0] determines the ECAP_CNT reload trigger source 000 = CAPTF0. [10:8] CPRLDS 001 = CAPTF1.
Page 224
Mini57 Bits Description Input Capture Channel 2 Captured Flag When the input capture channel 2 detects a valid edge change at CAP2 input, it will set flag CAPTF2 to high. CAPTF2 0 = No valid edge change has been detected at CAP2 input since last clear. 1 = At least a valid edge change has been detected at CAP2 input since last clear.
Mini57 6.8 Enhanced PWM Generator (EPWM) 6.8.1 Overview The Mini57 series has built in one PWM unit which is specially designed for motor driving control applications. The PWM unit supports six PWM generators which can be configured as six independent PWM outputs, PWM0~PWM5, or as three complementary PWM pairs, (PWM0, PWM1), (PWM2, PWM3) and (PWM4, PWM5) with three programmable dead-zone generators.
Mini57 fault brake source: BRK0: ACMP0, ACMP1, EADC and External pin (BRAKE). BRK1: ACMP0, ACMP1, EADC and External pin (BRAKE). The PWM signals before polarity control stage are defined in the view of positive logic. The PWM ports is active high or active low are controlled by polarity control register.
Mini57 Figure 6.8-2 EPWM Block Diagram Figure 6.8-3 illustrates the architecture of PWM in pair (e.g. PWM-Timer 0/1 are in one pair and PWM- Timer 2/3 are in another one, and PWM-Timer 4/5 are in one pair.). DTCNT01 (EPWM_DTCTL[7:0]) 0000 EPWM_CH0 signal 0001 (from ECAP)
Mini57 at this moment, it toggles the EPWM_CHn generator output to low and CMPDATn (new) and PERIOD (new) are updated with CNTMODE=1 and requests the PWM interrupt if PWM interrupt is enabled (EPWM_INTEN). Figure 6.8-6 shows the Edge-aligned PWM timing and operation flow. If 16-bit down counter underflow 1.
Mini57 Set GPA_MFP, PA_MODE, APBCLK[20] = 1 Set EPWM_CTL[31] = 0 (Edge-Aligned type) Set CLKDIV, CTL, PERIOD,CMPDATn Set INTEN Start: Set CNTENn = 1 Set CNTCLR = 1 H/w will load CMPDATn and PERIOD to working registers. Down-counting start from PERIOD. PWMn output: 0 if counter >...
Mini57 The EPWM period and duty control are decided by PWM down-counter register (PERIOD) and PWM comparator register (CMPDATn). The PWM-Timer timing operation is shown in Figure 6.8-11 EPWM-Timer Operation Timing. The pulse width modulation follows the formula below and the legend of PWM-Timer Comparator is shown in Figure 6.8-10 EPWM Legend of Internal Comparator Output of PWM-Timer.
Mini57 The center-aligned PWM signals are produced by the module when the PWM time base is configured in an Down/Up Counting mode. The PWM counter first state is Down-counter mode which it will start from PERIOD plus one value and decrase to match the value of CMPDATn (old); this will cause the toggling of the EPWM_CHn generator output to high.
Mini57 Set GPA_MFP, PA_MODE, APBCLK[20] = 1 Set EPWM_CTL[31] = 1 (Central-Aligned type) Set CLKDIV, CTL, PERIOD, CMPDATn Set INTEN Start: Set CNTENn= 1 Set CNTCLR= 1 H/W will load CMPDATn and PERIOD to working registers. Down-counting start from (PERIOD + 1) value. PWMn output: 0 if counter >...
Page 238
Mini57 6.8.5.2 EPWM Port Output Control EPWM unit has six output pins in this device. The PWM port outputs are PA.0~PA.5. The driving type of PWM output ports can be initialized as Tri-state type or other types depending on the PA_MODE register setting after any reset, as shown in Figure 6.8-10. 6.8.5.3 Independent Mode The EPWM is set as independent mode when MODE (EPWM_CTL[29:28]) = 00, there are six...
Mini57 EPWM0_CH0 without dead-time EPWM0_CH1 without dead-time EPWM0_CH0 with dead-time EPWM0_CH1 with dead-time Dead-time Interval Effect of dead-time for complementary pairs Figure 6.8-17 EPWM Dead-time Insertion 6.8.5.7 Group Mode Group mode is enabled when GROUPEN (EPWM_CTL[30]) = 1. This device supports Group mode control which allows all even PWM channels output to be duty controllable by EPWM_CH0 duty register.
Mini57 Figure 6.8-18 EPWM Asymmetric Mode Timing Diagram 6.8.5.9 One-Shot Mode The EPWM set as one-shot mode when CNTMODE (EPWM_CTL[8]) = 0. The EPWM output one pulse in one period when EPWM start run is set. Figure 6.8-19 shows one-shot mode status. period period CMRDAT = 0...
Mini57 Original waveform without Dead-time Initial State PWM Starts and ploarity control PWM_CH0 PWM_CH1 (NEGPOLAR0=0) PWM_CH0 (NEGPOLAR1=0) PWM_CH1 PWM_CH0 (NEGPOLAR0=0) PWM_CH1 (NEGPOLAR1=1) NEGPOLARn: Negative Polarity control bits; It controls the PWM output initial state and polarity Dead-time insertion; It is only effective in complementary mode Figure 6.8-20 EPWM Initial State and Polarity Control with Rising Edge Dead-time Insertion 6.8.5.11 Interrupt Architecture There are sixteen interrupt sources for EPWM unit, which are PIF (EPWM_INTSTS[0]) PWM...
Mini57 cycle comparison units. MSKENn register contains bits, MSKEN[5:0] (EPWM_PHCHG[13:8] / EPWM_PHCHGNXT[13:8]) determine which PWM I/O pins will be overridden. On reset MSKENn is 00H. The MSKDATn register contains six bits, MSKDAT[5:0] (EPWM_PHCHG[5:0] / EPWM_PHCHGNXT[5:0]) determine the state of the PWM I/O pins when a particular output is masked via the MSKDATn bits.
Mini57 MSKENn MSKDATn PWM0 PWM2MD PWM4MD PWM1MD PWM3MD PWM5MD Current path = (0,3) Figure 6.8-24 EPWM 3-phase Motor Mask Example 1 For example 2, Motor activating path is path 2 connects path 5, and path 2 is used as EPWM2 and path 5 is ON (short).
Page 246
Mini57 1.1.1.1.2 EPWM Phase Change Hall_State Sensor Mode The EPWM can also direct check Hall sensor state to change motor phase. When TRGSEL = 011b (EPWM_PHCHGNXT[22:20]) trigger by next Hall state, the Phase-Change controller will check CAPn_PCHG (n:0,2) status. If matched HALLSTS (EPWM_PHCHGNXT[18:16]) setting value then EPWM output data can be copied to EPWM_PHCHG from EPWM_PHCHGNEXT and change status of MOTOR simultaneously.
Mini57 6.8.6 Register Map R: read only, W: write only, R/W: both read and write, C: Only value 0 can be written Register Offset Description Reset Value EPWM Base Address: EPWM_BA = 0x4004_0000 EPWM_NPCTL EPWM_BA+0x00 EPWM Negative Polarity Control Register 0x0000_0000 EPWM_CLKDIV EPWM_BA+0x04...
Mini57 6.8.7 Register Description EPWM Negative Polarity Control Register (EPWM_NPCTL) Register Offset R/W Description Reset Value EPWM_NPCTL EPWM_BA+0x00 R/W EPWM Negative Polarity Control Register 0x0000_0000 Reserved Reserved Reserved Reserved NEGPOLAR5 NEGPOLAR4 NEGPOLAR3 NEGPOLAR2 NEGPOLAR1 NEGPOLAR0 Bits Description [31:6] Reserved Reserved. PWM5 Negative Polarity Control The register bit controls polarity/active state of real PWM output.
Page 249
Mini57 Bits Description PWM0 Negative Polarity Control The register bit controls polarity/active state of real PWM output. NEGPOLAR0 0 = PWM output is active high. 1 = PWM output is active low. Apr. 06, 2017 Page 249 of 475 Rev.1.00...
Page 252
Mini57 Bits Description Dead-zone 0 Generator Enable/Disable (PWM0 and PWM1 Pair for PWM Group) 0 = Dead-zone 0 Generator Disabled. [24] DTCNT01 1 = Dead-zone 0 Generator Enabled. Note: When the dead-zone generator is enabled, the pair of PWM0 and PWM1 becomes a complementary pair for PWM group.
Page 254
Mini57 EPWM Period Counter Register (EPWM_PERIOD) Register Offset Description Reset Value EPWM_PERIOD EPWM_BA+0x0C EPWM Period Counter Register 0x0000_0000 Reserved Reserved PERIOD PERIOD Bits Description [31:16] Reserved Reserved. PWM Counter/Timer Loaded Value PERIODn determines the PWM Period. Edge-aligned mode: where xy, could be 01, 23, 45 depending on the selected PWM channel.
Page 256
Mini57 Bits Description PWM Comparator Register CMP determines the PWM Duty. Edge-aligned mode: where xy, could be 01, 23, 45 depending on the selected PWM channel. Period = (PERIOD + 1) unit. Duty ratio = CMP / (PERIOD+1). CMP > PERIOD: PWM output is always high CMP <= PERIOD: PWM output high duty = (CMP) unit.
Page 257
Mini57 EPWM Data Register (EPWM_CNT) Register Offset Description Reset Value EPWM_CNT EPWM_BA+0x3C EPWM Data Register 0x0000_0000 CNTDIR Reserved Reserved Bits Description PWM Counter (Up/Down) Direction [31] CNTDIR 0 = PWM counter is down counting. 1 = PWM counter is up counting. Reserved [30:16] Reserved.
Page 259
Mini57 Bits Description PWM Channel 0 DOWN Interrupt Enable Bit DOWN for Edge-aligned and Center-aligned [24] CMPDIEN0 0 = Interrupt compare Disabled. 1 = interrupt when EPWM_CH0 PWM DOWN counter reaches EPWM_CMPDAT0 Enabled. Reserved [23:19] Reserved. PWM Central Interrupt Enable Bit for Center-aligned only CIEN [18]...
Page 260
Mini57 Bits Description Reserved [7:1] Reserved. PWM Channel 0 Period Interrupt Enable Bit for Edge-aligned and Center-aligned PIEN 0 = EPWM Period interrupt Disabled . 1 = EPWM Period interrupt Enabled . Apr. 06, 2017 Page 260 of 475 Rev.1.00...
Page 262
Mini57 Bits Description PWM Brake1 Flag 0 = PWM Brake does not recognize a falling signal at BKP1. [17] BRK1IF 1 = When PWM Brake detects a falling signal at pin BKP1, this flag will be set to high. Note: Software can write 1 to clear this bit. PWM Brake0 Flag 0 = PWM Brake does not recognize a falling signal at BKP0.
Page 268
Mini57 Bits Description Phase Change Trigger Selection Select the trigger condition to load PHCHG from PHCHG_NXT. When the trigger condition occurs it will load PHCHG_NOW with PHCHG_NXT. Phase Change: PWM outputs are masked according with the definition of MSKENn and MSKDATn in PHCHG_NOW.
Page 269
Mini57 Bits Description Enable PWM2 Mask Data MSKDAT2 0 = PWM2 state is masked with zero. 1 = PWM2 state is masked with one. Enable PWM1 Mask Data MSKDAT1 0 = PWM1 state is masked with zero. 1 = PWM1 state is masked with one. Enable PWM0 Mask Data MSKDAT0 0 = PWM0 state is masked with zero.
Page 271
Mini57 Bits Description Phase Change Trigger Selection Preset Bits This bit field will be load to bit field TRGSEL in PHCHG_NOW when load trigger condition occurs. 000 = Triggered by Timer0 event. 001 = Triggered by Timer1 event. 010 = Triggered by Timer2 event. [22:20] TRGSEL 011 = Triggered by HALLSTS (EPWM_PHCHGNXT[18:16]) matched hall sensor state.
Page 272
Mini57 Bits Description Enable PWM4 Mask Data Preset Bit MSKDAT4 This bit will be load to bit MSKDAT4 in PHCHG_NOW when load trigger condition occurs. Refer to register PHCHG_NOW for detailed definition. Enable PWM3 Mask Data Preset Bit MSKDAT3 This bit will be load to bit MSKDAT3 in PHCHG_NOW when load trigger condition occurs. Refer to register PHCHG_NOW for detailed definition.
Page 273
Mini57 EPWM Phase Change Alternative Control Register (EPWM_PHCHGALT) Register Offset Description Reset Value EPWM_PHCHGA EPWM_BA+0x80 R/W EPWM Phase Change Alternative Control Register 0x0000_0000 Reserved Reserved Reserved Reserved POSCTL1 POSCTL0 Bits Description [31:2] Reserved Reserved. Positive Input Control for ACMP1 0 = The input of ACMP1 is controlled by ACMP_CTL1. POSCTL1 1 = The input of ACMP1 is controlled by A1POSSEL in PHCHG_NOW register.
Page 274
Mini57 EPWM Period Interrupt Accumulation Control Register (EPWM_IFA) Register Offset Description Reset Value EPWM_IFA EPWM_BA+0x84 R/W EPWM Period Interrupt Accumulation Control Register 0x0000_00F0 Reserved Reserved IFDAT Reserved IFCNT Reserved IFAEN Bits Description [31:16] Reserved Reserved. Period Interrupt Down-counter Data Register (Read Only) When IFAEN is set, IFDAT will decrease when every PWM Interrupt flag is set, [15:12] IFDAT...
Mini57 6.9 Basic PWM Generator (BPWM) 6.9.1 Overview The Mini57 series has one set of BPWM group supporting one set of PWM generator that can be configured as 2 independent PWM outputs, BPWM CH0~BPWM CH1, or as 1 complementary PWM pairs, (BPWM CH0, BPWM CH1) with programmable Dead-zone generators. The PWM generator has one 8-bit pre-scalar, one clock divider with 5 divided frequencies (1, 1/2, 1/4, 1/8, 1/16), two PWM Timers including two clock selectors, two 16-bit PWM down-counters for PWM period control, two 16-bit comparators for PWM duty control and one dead-zone generator.
Mini57 output to high and CMP and PERIOD are updated with CNTMODEn=1 and request the BPWM interrupt if BPWM interrupt is enabled BPWM_INTEN(PWM_INTEN.n=1). The PWM period and duty control are configured by BPWM counter register (BPWM_PERIOD0- 1) and BPWM comparator register (BPWM_CMPDAT0-1). The PWM-timer timing operation is shown in Figure 6.9-4.
Mini57 down- counter PWM- Timer output CMP = 1 PERIOD = 3 CMP = 0 Auto reload = 1 PERIOD = 4 (S/W write new value) (CNTMODEx=1) (Write initial setting) Auto-load Auto-load Set CNTENx=1 (H/W update value) (PIFx is set by H/W) (PWM-Timer starts running) (PIFx is set by H/W) Note: x = 0,1...
Mini57 configured in an Up/Down Counting mode. The PWM counter will start counting-up from 0 to match the value of CMP (BPWM_CMPDAT0-1[15:0]); this will cause the toggling of the PWMn generator output to low. The counter will continue counting to match with the PERIOD (BPWM_PERIOD0-1[15:0]) .
Mini57 PERIOD (7FF) (BPWM_PERIODn[15:0]) CMP (3FF) (BPWM_CMPDATn[15:0) PIF(PINTTYPE=0) (BPWM_INTSTS[0],[1]) clear clear clear PIF(PINTTYPE=1) clear (BPWM_INTSTS[0], [1]) clear DIF(BPWM_INTSTS[0], [1]) clear clear PWMn generator ouput PWM period PWM period Note: n = 0,1 denote BPWM0/1 Figure 6.9-7 PWM Center-aligned Interrupt Generate Timing Waveform 6.9.4.3 PWM Double Buffering, Auto-reload and One-shot Operation PWM Timers have double buffering function the reload value is updated at the start of next period...
Mini57 Write Write Write Write PERIOD=150 PERIOD=199 PERIOD=99 PERIOD=0 CMP=50 CMP=49 CMP=0 CMP=XX Start Stop Waveform write a nonzero number to prescaler & setup clock dividor Figure 6.9-8 PWM Double Buffering Illustration 6.9.4.4 Modulate Duty Ratio The double buffering function allows CMP written at any point in current cycle. The loaded value will take effect from next cycle.
Mini57 PWM-Timer Output 0 PWM-Timer Inversed output Dead-Zone Generator output 0 Dead-Zone Generator output 1 Dead zone interval Figure 6.9-10 Paired-PWM Output with Dead-zone Generation Operation 6.9.4.6 PWM-Timer Interrupt Architecture There are two PWM interrupts, BPWM0_INT and BPWM1_INT. Figure 6.9-11 demonstrates the architecture of PWM Timer interrupts.
Page 283
Mini57 6.9.4.8 PWM-Timer Re-Start Procedure in Single-shot mode After PWM waveform is generated once in PWM One-shot mode, PWM-Timer will be stopped automatically. The following procedure is recommended for re-starting PWM single-shot waveform. Set comparator register (BPWM_CMPDAT) for setting PWM duty. ...
Mini57 6.9.5 Register Map R: read only, W: write only, R/W: both read and write, C: Only value 0 can be written Register Offset R/W Description Reset Value BPWM Base Address: BPWM_BA = 0x4014_0000 BPWM_CLKPSC BPWM_BA+0x00 R/W Basic PWM Pre-scalar Register 0x0000_0000 BPWM_CLKDIV BPWM_BA+0x04...
Page 288
Mini57 PWM-timer 0 Auto-reload/One-shot Mode 0 = One-shot mode. CNTMODE0 1 = Auto-reload mode. Note: If there is a transition at this bit, it will cause BPWM_PERIOD0 and BPWM_CMPDAT0 be cleared. PWM-timer 0 Output Inverter Enable Bit CMPINV0 0 = Inverter Disabled. 1 = Inverter Enabled.
Page 289
Mini57 BPWM Counter Register 0-1 (BPWM_PERIOD0-1) Register Offset Description Reset Value BPWM_PERI BPWM_BA+0x0C Basic PWM Period Counter Register 0 0x0000_0000 BPWM_PERI BPWM_BA+0x18 Basic PWM Period Counter Register 1 0x0000_0000 Reserved Reserved PERIOD PERIOD Bits Description [31:16] Reserved Reserved. Basic PWM Period Counter Register PERIOD data determines the PWM period.
Page 291
Mini57 BPWM Data Register 0-1 (BPWM_CNT0-1) Register Offset Description Reset Value BPWM_CNT0 BPWM_BA+0x14 Basic PWM Data Register 0 0x0000_0000 BPWM_CNT1 BPWM_BA+0x20 Basic PWM Data Register 1 0x0000_0000 Reserved Reserved Bits Description [31:16] Reserved Reserved. PWM Data Register [15:0] User can monitor CNT to know the current value in 16-bit counter. Apr.
Page 292
Mini57 BPWM Interrupt Enable Register (BPWM_INTEN) Register Offset Description Reset Value BPWM_INTEN BPWM_BA+0x40 Basic PWM Interrupt Enable Register 0x0000_0000 Reserved Reserved PINTTYPE Reserved DIEN1 DIEN0 Reserved PIEN1 PIEN0 Bits Description [31:17] Reserved Reserved. BPWM Interrupt Period Type Selection 0 = PIFn will be set if BPWM counter underflow. [16] PINTTYPE 1 = PIFn will be set if BPWM counter matches PERIODn register.
Page 293
Mini57 BPWM Interrupt Indication Register (BPWM_INTSTS) Register Offset R/W Description Reset Value BPWM_INTSTS BPWM_BA+0x44 R/W Basic PWM Interrupt Indication Register 0x0000_0000 Reserved Reserved Reserved DIF1 DIF0 Reserved PIF1 PIF0 Bits Description [31:10] Reserved Reserved. BPWM Channel 1 Duty Interrupt Flag Flag is set by hardware when channel 1 BPWM counter down count and reaches DIF1 BPWM_CMPDAT 1, software can clear this bit by writing a one to it.
Mini57 6.10 Watchdog Timer (WDT) 6.10.1 Overview The Watchdog Timer is used to perform a system reset when system runs into an unknown state. This prevents system from hanging for an infinite period of time. Besides, the Watchdog Timer supports the function to wake-up system from Idle/Power-down mode. 6.10.2 Features ...
Mini57 6.10.4 Clock Control The Watchdog Timer clock control and block diagram are shown as follows. WDTSEL (CLK_CLKSEL1[1:0]) WDTCEN (CLK_APBCLK[0]) 10 kHz LIRC WDT_CLK HCLK/2048 HXT or LXT Legend: LIRC = Low-Speed Internal clock signal Figure 6.10-2 Watchdog Timer Clock Control Diagram 6.10.5 Basic Configuration The WDT peripheral clock is enabled in WDTKEN (CLK_APBCLK[0]) and clock source can be selected in WDTSEL (CLK_CLKSEL1[1:0]).
Mini57 6.10.6.3 WDT Wake-up If WDT clock source is selected to 10 kHz, system can be woken-up from Power-down mode while WDT time-out interrupt signal is generated and WKEN (WDT_CTL[4]) bit enabled. In the meanwhile, the WKF (WDT_CTL[5]) flag will set to 1 automatically, and user can check WKF (WDT_CTL[5]) flag by software to recognize if the system has been woken-up by WDT time-out interrupt or not.
Mini57 6.10.8 Register Description Watchdog Timer Control Register (WDT_CTL) Register Offset Description Reset Value WDT_CTL WDT_BA+0x00 Watchdog Timer Control Register 0x0000_0700 Note: All bits in this register are write-protected. To program it, an open lock sequence is needed, by sequentially writing 0x59, 0x16, and 0x88 to register REGWRPROT at address SYS_BA + 0x100. ICEDEBUG Reserved Reserved...
Page 300
Mini57 Bits Description Watchdog Timer Time-out Wake-up Flag This bit indicates the interrupt wake-up flag status of WDT. 0 = WDT does not cause chip wake-up. 1 = Chip wake-up from Idle or Power-down mode if WDT time-out interrupt signal generated.
Mini57 6.11 USCI – Universal Serial Control Interface Controller 6.11.1 Overview The Universal Serial Control Interface (USCI) is a flexible interface module covering several serial communication protocols. The user can configure this controller as UART, SPI, or I C functional protocol.
Mini57 6.11.4 Functional Description The structure of the Universal Serial Control Interface (USCI) controller is shown in Figure 6.11-1. The input signal is implemented in an input processor. The data buffers and the data shift unit support the data transfers. Each protocol-specific function is handled by the protocol processor unit.
Mini57 ININV SYNCSEL (USCI_DATIN0[2] / ( USCI_DATIN0[0] / USCI_CTLIN0[2]) USCI_CTLIN0[0]) USCIx_DAT[1:0] Data Shift Unit IN_SYNC Digital USCIx_CTL[1:0] Filter Protocol Processor Unit Edge Detection (data signal only) Note: x = 0, 1 Figure 6.11-2 Input Conditioning for USCIx_DAT[1:0] and USCIx_CTL[1:0] The input structure of USCIx_CLK is similar to USCIx_CTL[1:0] input structure, except it does not support inverse function.
Mini57 synchronized to f ). The synchronized input signal is taken into account by SYNCSEL = 1. The PCLK synchronization leads to a delay in the signal path of 2-3 times the period of f PCLK Output Signals Table 6.11-2 shows the relative output signals for each protocol. The number of actually used outputs depends on the selected protocol and they can be classified according to their meaning for the protocols.
Mini57 Figure 6.11-4 Block Diagram of Data Buffering The operation of data handling includes: The peripheral device user interface (APB) is used to handle data, interrupts, status and control information. A transmitter includes transmit shift register (TX_SFTR) and a transmit data buffer (TX_BUF).
Mini57 data is valid for transmission. Serial Bus Shift Data Control Input Clock Input Output USCI_LINECTL Control Shift Control USCI_BUFSTS Status & Status Data USCI_TXDAT TX_SFTR TX_BUF Transmit Buffer Figure 6.11-6 Transmit Data Path Transmit Data Validation The status of TXEMPTY (USCI_BUFSTS[8]) indicates the transmission data is valid or not in the transmit buffer (TX_BUF) and the TXSTIF (USCI_PROTSTS[1]) labels the start conditions for each data.
Mini57 Receive Data Path The receive data path is based on 16-bit wide receive shift register RX_SFTR and receive buffers RX_BUF0 and RX_BUF1. The data transfer parameters like data word length, or the shift direction are controlled commonly for transmission and reception by the line control register USCI_LINECTL.
Mini57 SAMP_CLK RCLKSEL Protocol (USCI_BRGEN[0] Processor Unit DS_CNT Enable Protocol PCLK Protocol REF_CLK Related Clock Output Related Configration Counter HXT/LXT Note: Refer the Basic Clock Divider Counter section to get the SAMP_CLK Figure 6.11-8 Protocol-Relative Clock Generator The protocol related counter contains basic clock divider counter and timing measurement counter.
Mini57 SAMP_CLK Divide by Divider CLKDIV +1 by 2 Divider REF_CLK PROT_CLK DIV_CLK SCLK by 2 REF_CLK2 SPCLKSEL PTCLKSEL (USCI_BRGEN[3:2]) (USCI_BRGEN[1]) Figure 6.11-9 Basic Clock Divider Counter Timing Measurement Counter The timing measurement counter is used for time interval measurement and is enabled by TMCNTEN (USCI_BRGEN [4]) = 1.
Mini57 C: The timing measurement counter indicates time-out clock cycle. Sample Time Counter A sample time counter associated to the protocol related counter defining protocol specific timings, such shift control signals or bit timings, based on the input frequency f .
Mini57 Receive event to indicate that a data word has been received: If a new received word becomes available in the receive buffer, a receive event occurs. It is indicated by flag RXENDIF (USCI_PROTSTS [4]) and, if enabled, leads to receive interrupt. ...
Mini57 6.11.4.6 Protocol-specific Events and Interrupts These events are related to protocol-specific actions that are described in the corresponding protocol chapters. The related indication flags are located in register USCI_PROTSTS. All events can be individually enabled for the generation of the common protocol interrupt. Interrupt Enabled Event Indication Flag...
Mini57 6.12 USCI – UART Mode 6.12.1 Overview The asynchronous serial channel UART covers the reception and the transmission of asynchronous data frames. It performs a serial-to-parallel conversion on data received from the peripheral, and a parallel-to-serial conversion on data transmitted from the controller. The receiver and transmitter are independent, frames can start at different points in time for transmission and reception.
Mini57 6.12.4 Basic Configuration The basic configurations of USCI0 for UART mode are as follows. USCI0 pins are configured in SYS_GPA_MFP, SYS_GPC_MFP, SYS_GPD_MFP registers. Enable USCI0 peripheral clock in USCI0CKEN (CLK_APBCLK[24]). Reset USCI0 controller in USCI0RST (SYS_IPRST1[24]). The basic configurations of USCI1 for UART mode are as follows.
Mini57 Input Signals For UART protocol, the number of input signals is demonstratedTable 6.12-1 Each input signal is handled by an input processor for signal conditioning, such as signal inverse selection control, or a digital input filter. The input signals can be classified according to their meaning for the protocols, as shown in Table 6.12-1.
Mini57 IDLE DATA STOP IDLE 1 Bit 6~13 Bit 0~1 Bit 1~2 Bit Figure 6.12-3 UART Standard Frame Format The protocol specific bits (SOF, P, STOP) are automatically handled by the UART protocol state machine and do not appear in the data flow via the receive and transmit buffers. Start Bit The receiver input signal USCIx_DAT0 is checked for a falling edge.
Page 317
Mini57 6.12.5.4 Operating Mode In order to operate the UART protocol, the following issues have to be considered: Select UART Mode The UART protocol can be selected by setting FUNMODOE (UUART_CTL[2:0]) to 0x2 and the UART protocol can be enabled by setting PROTEN (UUART_PROTCTL [31]) to 1. Note that the FUNMODE must be set 0 before protocol changing and it is recommended to configure all parameters of the UART before UART protocol is enabled.
Mini57 Sample Time sample taken Figure 6.12-4 UART Bit Timing (Data Sample Time) 6.12.5.6 Baud Rate Generation The baud rate f in UART mode depends on the number of data sample time per bit time and UART their timing. The baud rate setting should only be changed while the transmitter and the receiver are idle.
Mini57 is 0x1FE for BRDETITV. Clear this bit by H/W at the 4th falling edge Enable this bit by User ABREN falling edge falling edge 3th falling edge 4th falling edge USCI_DATAIN0 CLKDIV DSCNT BRDETITV ABRDETIF Can be cleared by write 1 Falling edge clear the TMCNT Timing measurement...
Mini57 device can either receive this symbol without any further action (and can discard it) or use the falling edges for baud rate measurement. ABREN is used to capture a timer counter value for the receiver synchronization byte. The valid captured values can be read out after the frame is transmitted done.
Page 322
Mini57 6.12.5.10 Interrupt Events Protocol Interrupt Events The following protocol-related events are generated in UART mode and can lead to a protocol interrupt. Please note that the bits in register UUART_PROTSTS are not automatically cleared by hardware and have to be cleared by software in order to monitor new incoming events. Receiver line status protocol-related error...
Page 323
Mini57 TXENDIF (UUART_PROTSTS [2]) becomes set at the end of the last stop bit. The controller wil issue an interrupt if TXENDIEN (UUART_INTEN[2]) is also set to 1. Receiver starts interrupt Bit RXSTIF (UUART_PROTSTS [3]) is set after the sample point of the start bit. The controller wil issue an interrupt if RXSTIEN (UUART_INTEN[3]) is also set to 1.
Mini57 6.12.7 Register Description USCI Control Register (UUART_CTL) Register Offset Description Reset Value UUART_CTL UUARTx_BA+0x00 R/W USCI Control Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved FUNMODE Bits Description [31:3] Reserved Reserved. Function Mode This bit field selects the protocol for this USCI controller. Selecting a protocol that is not available or a reserved combination disables the USCI.
Page 326
Mini57 USCI Interrupt Enable Register (UUART_INTEN) Register Offset Description Reset Value UUART_INTEN UUARTx_BA+0x04 R/W USCI Interrupt Enable Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved RXENDIEN RXSTIEN TXENDIEN TXSTIEN Reserved Bits Description [31:5] Reserved Reserved. Receive End Interrupt Enable Bit This bit enables the interrupt generation in case of a receive finish event.
Page 328
Mini57 Sample Clock Source Selection This bit field used for the clock source selection of a sample clock (f ) for the SAMP_CLK protocol processor. 00 = f [3:2] SPCLKSEL SAMP_CLK DIV_CLK. 01 = f SAMP_CLK PROT_CLK. 10 = f SAMP_CLK SCLK.
Page 329
Mini57 USCI Input Data Signal Configuration (UUART_DATIN0) Register Offset R/W Description Reset Value UUART_DATIN0 UUARTx_BA+0x10 R/W USCI Input Data Signal Configuration Register 0 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved EDGEDET ININV Reserved SYNCSEL Bits Description [31:5] Reserved Reserved.
Page 330
Mini57 USCI Input Control Signal Configuration (UUART_CTLIN0) Register Offset R/W Description Reset Value UUART_CTLIN0 UUARTx_BA+0x20 R/W USCI Input Control Signal Configuration Register 0 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved ININV Reserved SYNCSEL Bits Description [31:3] Reserved Reserved. Input Signal Inverse Selection This bit defines the inverter enable of the input asynchronous signal.
Page 331
Mini57 USCI Input Clock Signal Configuration (UUART_CLKIN) Register Offset Description Reset Value UUART_CLKIN UUARTx_BA+0x28 R/W USCI Input Clock Signal Configuration Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved SYNCSEL Bits Description [31:1] Reserved Reserved. Input Synchronization Signal Selection This bit selects if the un-synchronized input signal or the synchronized (and optionally filtered) signal can be used as input for the data shift unit.
Page 332
Mini57 USCI Line Control Register (UUART_LINECTL) Register Offset R/W Description Reset Value UUART_LINECTL UUARTx_BA+0x2C R/W USCI Line Control Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved DWIDTH CTLOINV Reserved DATOINV Reserved Bits Description [31:12] Reserved Reserved. Word Length of Transmission This bit field defines the data word length (amount of bits) for reception and transmission.
Page 333
Mini57 Reserved [4:1] Reserved. LSB First Transmission Selection 0 = The MSB, which bit of transmit/receive data buffer depends on the setting of DWIDTH, is transmitted/received first. 1 = The LSB, the bit 0 of data buffer, will be transmitted/received first. Apr.
Page 334
Mini57 USCI Transmit Data Register (UUART_TXDAT) Register Offset Description Reset Value UUART_TXDAT UUARTx_BA+0x30 W USCI Transmit Data Register 0x0000_0000 x = 0, 1 Reserved Reserved TXDAT TXDAT Bits Description [31:16] Reserved Reserved. Transmit Data [15:0] TXDAT Software can use this bit field to write 16-bit transmit data for transmission. Apr.
Page 335
Mini57 USCI Receive Data Register (UUART_RXDAT) Register Offset R/W Description Reset Value UUART_RXDAT UUARTx_BA+0x34 R USCI Receive Data Register 0x0000_0000 x = 0, 1 Reserved Reserved RXDAT RXDAT Bits Description [31:16] Reserved Reserved. Received Data This bit field monitors the received data which stored in receive data buffer. [15:0] RXDAT Note: RXDAT[15:13] indicate the same frame status of BREAK, FRMERR and...
Page 336
Mini57 USCI Transmitter/Receive Buffer Control Register (UUART_BUFCTL) Register Offset R/W Description Reset Value UUART_BUFCTL UUARTx_BA+0x38 R/W USCI Transmit/Receive Buffer Control Register 0x0000_0000 x = 0, 1 Reserved Reserved RXRST TXRST RXCLR RXOVIEN Reserved TXCLR Reserved Bits Description [31:18] Reserved Reserved. Receive Reset 0 = No effect.
Page 337
Mini57 pointer value). Should only be used while the buffer is not taking part in data traffic. Note: It is cleared automatically after one PCLK cycle. [6:0] Reserved Reserved. Apr. 06, 2017 Page 337 of 475 Rev.1.00...
Page 338
Mini57 USCI Transmit/Receive Buffer Status Register (UUART_BUFSTS) Register Offset R/W Description Reset Value UUART_BUFSTS UUARTx_BA+0x3C R USCI Transmit/Receive Buffer Status Register 0x0000_0101 x = 0, 1 Reserved Reserved Reserved TXFULL TXEMPTY Reserved RXOVIF Reserved RXFULL RXEMPTY Bits Description [31:10] Reserved Reserved.
Page 339
Mini57 USCI Wake-up Control Register (UUART_WKCTL) Register Offset R/W Description Reset Value UUART_WKCTL UUARTx_BA+0x54 R/W USCI Wake-up Control Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved PDBOPT Reserved WKEN Bits Description [31:3] Reserved Reserved. Power Down Blocking Option 0 = If user attempts to enter Power-down mode by executing WFI while the protocol is in transferring, MCU will stop the transfer and enter Power-down mode immediately.
Page 340
Mini57 USCI Wake-up Status Register (UUART_WKSTS) Register Offset R/W Description Reset Value UUART_WKSTS UUARTx_BA+0x58 R/W USCI Wake-up Status Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved Bits Description [31:1] Reserved Reserved. Wake-up Flag When chip is woken up from Power-down mode, this bit is set to 1. Software can write 1 to clear this bit.
Page 342
Mini57 [10] Reserved Reserved. Data Wake-up Mode Enable Bit DATWKEN 0 = Data wake-up mode Disabled. 1 = Data wake-up mode Enabled. LIN RX Duplex Mode Enable Bit 0 = LIN RX Duplex mode Disabled. LINRXEN 1 = LIN RX Duplex mode Enabled. The LIN can be play as Slave to receive the LIN frame. Note: This bit is used to check the break duration for incoming data when the LIN operation is active.
Page 343
Mini57 USCI Protocol Interrupt Enable Register – UART (UUART_PROTIEN) Register Offset R/W Description Reset Value UUART_PROTIEN UUARTx_BA+0x60 R/W USCI Protocol Interrupt Enable Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved RLSIEN ABRIEN BRKIEN Bits Description [31:3] Reserved Reserved. Receive Line Status Interrupt Enable Bit 0 = Receive line status interrupt Disabled.
Page 345
Mini57 1 = LIN Break is detected. Note: This bit is read only, but can be cleared by writing ‘1’ to it. Break Flag This bit is set to logic 1 whenever the received data input (RX) is held in the “spacing state” (logic 0) for longer than a full word transmission time (that is, the total time of “start bit”...
Mini57 6.13 USCI – SPI Mode 6.13.1 Overview The SPI protocol of USCI controller applies to synchronous serial data communication and allows full duplex transfer. It supports both master and Slave operation mode with the 4-wire bi-direction interface. SPI mode of USCI controller performs a serial-to-parallel conversion on data received from a peripheral device, and a parallel-to-serial conversion on data transmitted to a peripheral device.
Mini57 Supports master or slave mode operation (the maximum frequency for Master = f PCLK 2, for Slave < f / 5) PCLK Configurable bit length of a transfer word from 4 to 16-bit Supports one transmit buffer and two receive buffers for data payload ...
Mini57 USCI1 pins are configured in SYS_GPA_MFP, SYS_GPC_MFP, and SYS_GPD_MFP registers. Enable USCI1 peripheral clock in USCI1CKEN (CLK_APBCLK[25]). Reset USCI1 controller in USCI1RST (SYS_IPRST1[25]). 6.13.5 Functional Description 6.13.5.1 USCI Common Function Description Please refer to section 6.11.4 for detailed information. 6.13.5.2 Signal Description A device operating in master mode controls the start and end of a data transfer, as well as the generation of the SPI bus clock and slave select signal.
Mini57 SPI_SS Data Frame (USCIx_CTL0) SPI_CLK (USCIx_CLK) SPI_MOSI RX Data Word 0 RX Data Word N (USCIx_DAT0) SPI_MISO TX Data Word 0 TX Data Word N (USCIx_DAT1) Note: x = 0, 1 Figure 6.13-5 4-Wire Full-Duplex SPI Communication Signals (Slave Mode) 6.13.5.3 Serial Bus Clock Configuration The USCI controller needs the peripheral clock to drive the USCI logic unit to perform the data transfer.
Mini57 needed to set as 1 for the external SPI Slave device whose slave select signal is active low. The duration between the slave select active edge and the first SPI clock input edge shall over 2 USCI peripheral clock cycles. The input slave select signal of SPI Slave has to be keep inactive for at least 2 USCI peripheral clock cycles between two consecutive frames in order to correctly detect the end of a frame.
Mini57 (USPI_PROTCTL[2]) CTLOINV (USPI_LINECTL[7]) TXEMPTY (USPI_BUFSTS[8]) SPI_SS (USCIx_CTL0) 1 SPI clock 1.5 SPI clock SPI_CLK (USCIx_CLK) Note: Automatic slave select is enabled Figure 6.13-12 Auto Slave Select (SUSPITV ≧ 0x3) (USPI_PROTCTL[2]) CTLOINV (USPI_LINECTL[7]) TXEMPTY (USPI_BUFSTS[8]) SPI_SS (USCIx_CTL0) One word One word transaction transaction SPI_CLK...
Page 355
Mini57 is set to 1, the SPI Slave will be ready to transmit/receive data after the SPI protocol is enabled by setting FUNMODE(USPI_CTL [2:0]) to 0x1. 6.13.5.9 Data Transfer Mode The USCI controller supports full-duplex SPI transfer. In full-duplex SPI transfer, there are two data pins. One is used for transmitting data and the other is used for receiving data.
Page 356
Mini57 Slave time-out interrupt In SPI slave mode, there is Slave time-out function for user to know that there is no serial clock input during the period of one word transaction. The Slave time-out function uses the timing measurement counter for the calculation of Slave time-out period which is defined by SLVTOCNT (USPI_PROTCTL[25:16]).
Page 359
Mini57 3. Set FUNMODE (USPI_CTL[2:0]) to 0x1 to select SPI mode. 4. Set USPI_BRGEN register to determine the SPI bus clock frequency. 5. According to the requirements of user’s application, configured the settings as follows. CTLOINV (USPI_LINECTL[7]): If the slave selection signal is active low, set this bit to 1; otherwise, set it to 0.
Page 360
Mini57 6.13.5.13 Wake-up Function The USCI Controller in SPI mode supports wake-up system function. The wake-up source in SPI protocol is the transition of input slave select signal. Apr. 06, 2017 Page 360 of 475 Rev.1.00...
Mini57 6.13.7 Register Description USCI Control Register (USPI_CTL) Register Offset Description Reset Value USPI_CTL USPIx_BA+0x00 USCI Control Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved FUNMODE Bits Description [31:3] Reserved Reserved. Function Mode This bit field selects the protocol for this USCI controller. Selecting a protocol that is not available or a reserved combination disables the USCI.
Page 363
Mini57 USCI Interrupt Enable Register (USPI_INTEN) Register Offset Description Reset Value USPI_INTEN USPIx_BA+0x04 USCI Interrupt Enable Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved RXENDIEN RXSTIEN TXENDIEN TXSTIEN Reserved Bits Description [31:5] Reserved Reserved. Receive End Interrupt Enable Bit This bit enables the interrupt generation in case of a receive finish event.
Page 364
Mini57 USCI Baud Rate Generator Register (USPI_BRGEN) Register Offset Description Reset Value USPI_BRGEN USPIx_BA+0x08 USCI Baud Rate Generator Register 0x0000_3C00 x = 0, 1 Reserved CLKDIV CLKDIV Reserved Reserved TMCNTSRC TMCNTEN SPCLKSEL PTCLKSEL RCLKSEL Bits Description [31:26] Reserved Reserved. Clock Divider [25:16] CLKDIV This bit field defines the ratio between the protocol clock frequency f...
Page 365
Mini57 Reference Clock Source Selection This bit selects the source of reference clock (f REF_CLK RCLKSEL 0 = Peripheral device clock f PCLK. 1 = HXT/LXT. Apr. 06, 2017 Page 365 of 475 Rev.1.00...
Page 366
Mini57 USCI Input Data Signal Configuration (USPI_DATIN0) Register Offset Description Reset Value USPI_DATIN0 USCI Input Data Signal Configuration Register 0 0x0000_0000 x = 0, 1 USPIx_BA+0x10 Reserved Reserved Reserved Reserved ININV Reserved SYNCSEL Bits Description [31:0] Reserved Reserved. Input Signal Inverse Selection This bit defines the inverter enable of the input asynchronous signal.
Page 367
Mini57 USCI Input Control Signal Configuration (USPI_CTLIN0) Register Offset Description Reset Value USPI_CTLIN0 USPIx_BA+0x20 USCI Input Control Signal Configuration Register 0 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved ININV Reserved SYNCSEL Bits Description [31:3] Reserved Reserved. Input Signal Inverse Selection This bit defines the inverter enable of the input asynchronous signal.
Page 368
Mini57 USCI Input Clock Signal Configuration (USPI_CLKIN) Register Offset Description Reset Value USPI_CLKIN USPIx_BA+0x28 USCI Input Clock Signal Configuration Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved SYNCSEL Bits Description [31:1] Reserved Reserved. Input Synchronization Signal Selection This bit selects if the un-synchronized input signal or the synchronized (and optionally filtered) signal can be used as input for the data shift unit.
Page 369
Mini57 USCI Line Control Register (USPI_LINECTL) Register Offset Description Reset Value USPI_LINECTL USPIx_BA+0x2C USCI Line Control Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved DWIDTH CTLOINV Reserved DATOINV Reserved Bits Description [31:12] Reserved Reserved. Word Length of Transmission This bit field defines the data word length (amount of bits) for reception and transmission. The data word is always right-aligned in the data buffer.
Page 370
Mini57 Reserved [4:1] Reserved. LSB First Transmission Selection 0 = The MSB, which bit of transmit/receive data buffer depends on the setting of DWIDTH, is transmitted/received first. 1 = The LSB, the bit 0 of data buffer, will be transmitted/received first. Apr.
Page 371
Mini57 USCI Transmit Data Register (USPI_TXDAT) Register Offset Description Reset Value USPI_TXDAT USPIx_BA+0x30 USCI Transmit Data Register 0x0000_0000 x = 0, 1 Reserved Reserved TXDAT TXDAT Bits Description [31:16] Reserved Reserved. Transmit Data Software can use this bit field to write 16-bit transmit data for transmission. In order to [15:0] TXDAT avoid overwriting the transmit data, user have to check TXEMPTY (USPI_BUFSTS[8])
Page 372
Mini57 USCI Receive Data Register (USPI_RXDAT) Register Offset Description Reset Value USPI_RXDAT USPIx_BA+0x34 USCI Receive Data Register 0x0000_0000 x = 0, 1 Reserved Reserved RXDAT RXDAT Bits Description [31:16] Reserved Reserved. Received Data [15:0] RXDAT This bit field monitors the received data which stored in receive data buffer. Apr.
Page 373
Mini57 USCI Transmit/Receive Buffer Control Register (USPI_BUFCTL) Register Offset Description Reset Value USPI_BUFCTL USPIx_BA+0x38 USCI Transmit/Receive Buffer Control Register 0x0000_0000 x = 0, 1 Reserved Reserved RXRST TXRST RXCLR RXOVIEN Reserved TXCLR TXUDRIEN Reserved Bits Description [31:18] Reserved Reserved. Receive Reset 0 = No effect.
Page 376
Mini57 1 = Receive buffer is full. Apr. 06, 2017 Page 376 of 475 Rev.1.00...
Page 377
Mini57 USCI Wake-up Control Register (USPI_WKCTL) Register Offset Description Reset Value USPI_WKCTL USPIx_BA+0x54 USCI Wake-up Control Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved PDBOPT Reserved WKEN Bits Description [31:3] Reserved Reserved. Power Down Blocking Option 0 = If user attempts to enter Power-down mode by executing WFI while the protocol is in transferring, MCU will stop the transfer and enter Power-down mode immediately.
Page 378
Mini57 USCI Wake-up Status Register (USPI_WKSTS) Register Offset Description Reset Value USPI_WKSTS USPIx_BA+0x58 USCI Wake-up Status Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved Bits Description [31:1] Reserved Reserved. Wake-up Flag When chip is woken up from Power-down mode, this bit is set to 1. Software can write 1 to clear this bit.
Page 379
Mini57 USCI Protocol Control Register – SPI (USPI_PROTCTL) Register Offset Description Reset Value USPI_PROTCTL USPIx_BA+0x5C R/W USCI Protocol Control Register 0x0000_0300 x = 0, 1 PROTEN Reserved TXUDRPOL Reserved SLVTOCNT SLVTOCNT Reserved TSMSEL SUSPITV SCLKMODE Reserved AUTOSS SLV3WIRE SLAVE Bits Description SPI Protocol Enable Bit PROTEN...
Page 380
Mini57 transmit/receive transaction in a transfer. The definition of the suspend interval is the interval between the last clock edge of the preceding transaction word and the first clock edge of the following transaction word. The default value is 0x3. The period of the suspend interval is obtained according to the following equation.
Page 381
Mini57 USCI Protocol Interrupt Enable Register – SPI (USPI_PROTIEN) Register Offset Description Reset Value USPI_PROTIEN USPIx_BA+0x60 USCI Protocol Interrupt Enable Register 0x0000_0000 x = 0, 1 Reserved Reserved Reserved Reserved SLVBEIEN SLVTOIEN SSACTIEN SSINAIEN Bits Description [31:4] Reserved Reserved. Slave Mode Bit Count Error Interrupt Enable Bit If data transfer is terminated by slave time-out or slave select inactive event in Slave mode, so that the transmit/receive data bit count does not match the setting of DWIDTH SLVBEIEN...
Page 383
Mini57 software writes one to this bit 0 = The slave select signal has not changed to active. 1 = The slave select signal has changed to active. Note: The internal slave select signal is active high. Slave Select Inactive Interrupt Flag (for Slave Only) This bit indicates that the internal slave select signal has changed to inactive.
Mini57 6.14 USCI – I C Mode 6.14.1 Overview On I C bus, data is transferred between a Master and a Slave. Data bits transfer on the SCL and SDA lines are synchronously on a byte-by-byte basis. Each data byte is 8-bit. There is one SCL clock pulse for each data bit with the MSB being transmitted first, and an acknowledge bit follows each transferred byte.
Mini57 6.14.3 Block Diagram PCLK Baud Rate USCI_CLK Generation Peripheral Input Protocol USCI_DATx Device Data Processor Processor Buffer Data User Shift Control Buffer Unit Interface Unit Output Configuration Wake-up Control Control Register To Interrupt Interrupt Signal Generation Figure 6.14-2 USCI - I²C Mode Block Diagram 6.14.4 Basic Configuration The basic configurations of USCI0 for I2C are as follows: ...
Mini57 6.14.5.2 START or Repeated START Signal Figure 6.14-3 shows the typical I C protocol. Normally, a standard communication consists of four parts: START or Repeated START signal generation Slave address and R/W bit transfer Data transfer ...
Page 387
Mini57 6.14.5.4 Slave Address Transfer After a (repeated) start condition, the master sends a slave address to identify the target device of the communication. The start address can comprise one or two address bytes (for 7-bit or for 10- bit addressing schemes). After an address byte, a slave sensitive to the transmitted address has to acknowledge the reception.
Mini57 Data line stable; Change of data data valid allowed Figure 6.14-5 Bit Transfer on I C Bus If the master received data, does Not Acknowledge (NACK) the slave, the slave releases the SDA line for the master to generate a STOP or Repeated START signal. Clock pulse for acknowledgement from Master...
Page 389
Mini57 to define the number of data sample time per bit time The standard setting is given by RCLKSEL = 0 (f ), PTCLKSEL = 0 (f REF_CLK PCLK PROT_CLK ) and SPCLKSEL = 2’b00 (f ). Under these conditions, the baud rate is REF_CLK SAMP_CLK DIV_CLK...
Mini57 Master 1 loses arbitration DATA 1 ≠ SDA DATA1 DATA2 Figure 6.14-7 Arbitration Lost In this case, during the address and data transmission, the master transmitter checks at the rising edge of SCL for each data bit if the value it is sending is equal to the value read on the SDA line. If yes, the next data bit values can be 0.
Page 391
Mini57 C Protocol Interrupt Events The following protocol-related events are generated in I C mode and can lead to a protocol interrupt. Please note that the bits in register UI2C_PROTSTS are not all automatically cleared by hardware and have to be cleared by software to monitor new incoming events. ...
Mini57 Control flow The on-chip I C ports support three operation modes, Master, Slave, and General Call Mode. In a given application, I C port may operate as a master or as a slave. In Slave mode, the I C port hardware looks for its own slave address and the general call address.
Mini57 Data Transfer on the I C Bus Figure 6.14-9 shows a master transmits data to slave. A master addresses a slave with a 7-bit address and 1-bit write index to denote that the master wants to transmit data to the slave. The master keeps transmitting data after the slave returns acknowledge to the master.
Mini57 ADDRESS 1st byte ADDRESS 2nd byte ‘0’ : write 11110XX ADDRESS 1st byte DATA DATA data transfer ‘1’ : read (n bytes + acknowlegde) 11110XX Figure 6.14-12 Master Reads Data from Slave by 10-bit Address Master Mode In Figure 6.14-13, all possible protocols for I C master are shown.
Mini57 arbitration lost, the ARBLOIF will be set to 1. C communication, the SCL clock will be released when writing ‘1’ to PTRG Note: During I (UI2C_PROTCTL [5]) in Slave mode. ACKIF = 1 ACKIF = 1 Switch to not addressed mode Own SLA will be recognized RXDAT RXDAT...
Page 397
Mini57 START, the register STORIF (UI2C_PROTSTS [9]) or STARIF (UI2C_PROTSTS [8]) will be set. User could follow the action for NACKIF (UI2C_PROTSTS [10]) as shown in Figure 6.14-15 when got STARIF (UI2C_PROTSTS [8]) is set. Note: After slave gets interrupt flag of NACKIF (UI2C_PROTSTS [10]) and start/stop symbol including STARIF (UI2C_PROTSTS [8]) and STORIF (UI2C_PROTSTS [9]), slave can switch to not address mode and own SLA will not be recognized.
Mini57 Protocol Functional Description Programmable Setup and Hold Time To guarantee a correct data setup and hold time, the timing must be configured. By programming HTCTL [5:0] (UI2C_TMCTL[11:6]) to configure hold time and STCTL [5:0] (UI2C_TMCTL[5:0]) to configure setup time. The delay timing refer peripheral clock (PCLK).
Mini57 decides PCLK = 12MHz and baud rate =100k, the UI2C_BRGEN[25:16] must set 59, and the HTCTL [5:0] maximum value is 51. Bus error SDA delay over SCL low duty Figure 6.14-18 Hold Time Wrong Adjustment C Time-out Function There is a time-out counter TOCNT (UI2C_PROTCTL [25:16]) which can be used to deal with the C bus hang-up.
Mini57 confirm this frame has transaction done and then to do the wake-up procedure. Therefore, when the chip is woken-up by address match with one of the device address register (UI2C_DEVADDR0), the user shall check the WKAKDONE (UI2C_PROTSTS [16]) bit is set to 1 to confirm the address wake-up frame has done.
Mini57 Figure 6.14-21 shows how to use the I C controller to implement the protocol of EEPROM random read. STARIF = 1 ACKIF = 1 TXDAT TXDAT (SLA+W) ROM Address High Byte TXDAT = SLA+W TXDAT = Data (PTRG, STA, STO, AA)=(1, 0, 0, x) STORIF = 1 NACKIF = 1 ((PTRG, STA, STO, AA)=(1, 0, 0, x)
Mini57 6.14.7 Register Description USCI Control Register (UI2C_CTL) Register Offset Description Reset Value UI2C_CTL UI2Cx_BA+0x00 USCI Control Register 0x0000_0000 Reserved Reserved Reserved Reserved FUNMODE Bits Description [31:3] Reserved Reserved. Function Mode This bit field selects the protocol for this USCI controller. Selecting a protocol that is not available or a reserved combination disables the USCI.
Page 405
Mini57 USCI Baud Rate Generator Register (UI2C_BRGEN) Register Offset Description Reset Value UI2C_BRGEN UI2Cx_BA+0x08 USCI Baud Rate Generator Register 0x0000_3C00 Reserved CLKDIV CLKDIV Reserved DSCNT PDSCNT Reserved TMCNTSRC TMCNTEN SPCLKSEL PTCLKSEL RCLKSEL Bits Description [31:26] Reserved Reserved. Clock Divider This bit field defines the ratio between the protocol clock frequency f and the clock PROT_CLK divider frequency f...
Page 406
Mini57 This bit field used for the clock source selection of a sample clock (f ) for the SAMP_CLK protocol processor. 00 = f SAMP_CLK DIV_CLK. 01 = f SAMP_CLK PROT_CLK. 10 = f SAMP_CLK SCLK. 11 = f SAMP_CLK REF_CLK.
Page 407
Mini57 USCI Line Control Register (UI2C_LINECTL) Register Offset Description Reset Value UI2C_LINECTL UI2Cx_BA+0x2C USCI Line Control Register 0x0000_0000 Reserved Reserved Reserved DWIDTH Reserved Bits Description [31:12] Reserved Reserved. Word Length of Transmission This bit field defines the data word length (amount of bits) for reception and transmission. The data word is always right-aligned in the data buffer.
Page 408
Mini57 USCI Transmit Data Register (UI2C_TXDAT) Register Offset Description Reset Value UI2C_TXDAT UI2Cx_BA+0x30 USCI Transmit Data Register 0x0000_0000 Reserved Reserved TXDAT TXDAT Bits Description [31:16] Reserved Reserved. Transmit Data [15:0] TXDAT Software can use this bit field to write 16-bit transmit data for transmission. Apr.
Page 409
Mini57 USCI Receive Data Register (UI2C_RXDAT) Register Offset Description Reset Value UI2C_RXDAT UI2Cx_BA+0x34 USCI Receive Data Register 0x0000_0000 Reserved Reserved RXDAT RXDAT Bits Description [31:16] Reserved Reserved. Received Data [15:0] RXDAT This bit field monitors the received data which stored in receive data buffer. Note 1: In I C protocol, only use RXDAT[7:0].
Page 410
Mini57 USCI Device Address Register (UI2C_DEVADDR) Register Offset R/W Description Reset Value UI2C_DEVADDR0 UI2Cx_BA+0x44 R/W USCI Device Address Register 0 0x0000_0000 Reserved Reserved Reserved DEVADDR DEVADDR Bits Description [31:10] Reserved Reserved. Device Address In I C protocol, this bit field contains the programmed slave address. If the first received address byte is b1111 0AAX, the AA bits are compared to the bits DEVADDR[9:8] to [9:0] DEVADDR...
Page 411
Mini57 USCI Device Address Mask Register (UI2C_ADDRMSK) – for I C Only Register Offset R/W Description Reset Value UI2C_ADDRMSK0 UI2Cx_BA+0x4C R/W USCI Device Address Mask Register 0 0x0000_0000 Reserved Reserved Reserved ADDRMSK ADDRMSK Bits Description [31:10] Reserved Reserved. USCI Device Address Mask 0 = Mask Disabled (the received corresponding register bit should be exact the same as address register.).
Page 412
Mini57 USCI Wake-up Control Register (UI2C_WKCTL) Register Offset Description Reset Value UI2C_WKCTL UI2Cx_BA+0x54 USCI Wake-up Control Register 0x0000_0000 Reserved Reserved Reserved Reserved WKADDREN WKEN Bits Description [31:2] Reserved Reserved. Wake-up Address Match Enable Bit WKADDREN 0 = The chip is woken up according to data toggle. 1 = The chip is woken up according to address match.
Page 413
Mini57 USCI Wake-up Status Register (UI2C_WKSTS) Register Offset Description Reset Value UI2C_WKSTS UI2Cx_BA+0x58 USCI Wake-up Status Register 0x0000_0000 Reserved Reserved Reserved Reserved Bits Description [31:1] Reserved Reserved. Wake-up Flag When chip is woken up from Power-down mode, this bit is set to 1. Software can write 1 to clear this bit.
Page 414
Mini57 USCI Protocol Control Register – I C (UI2C_PROTCTL) Register Offset Description Reset Value UI2C_PROTCTL UI2Cx_BA+0x5C USCI Protocol Control Register 0x0000_0000 PROTEN Reserved TOCNT TOCNT Reserved Reserved PTRG ADDR10EN GCFUNC Bits Description C Protocol Enable Bit [31] PROTEN 0 = I C Protocol disable.
Page 415
Mini57 Assert Acknowledge Control When AA =1 prior to address or data received, an acknowledged (low level to SDA) will be returned during the acknowledge clock pulse on the SCL line when 1.) A slave is acknowledging the address sent from master, 2.) The receiver devices are acknowledging the data sent by transmitter.
Page 416
Mini57 USCI Protocol Interrupt Enable Register – I C (UI2C_PROTIEN) Register Offset Description Reset Value UI2C_PROTIEN UI2Cx_BA+0x60 USCI Protocol Interrupt Enable Register 0x0000_0000 Reserved Reserved Reserved Reserved ACKIEN ERRIEN ARBLOIEN NACKIEN STORIEN STARIEN TOIEN Bits Description [31:7] Reserved Reserved. Acknowledge Interrupt Enable Bit This bit enables the generation of a protocol interrupt if an acknowledge is detected by a master.
Page 417
Mini57 Start Condition Received Interrupt Enable Bit This bit enables the generation of a protocol interrupt if a start condition is detected. STARIEN 0 = The start condition interrupt Disabled. 1 = The start condition interrupt Enabled. Time-out Interrupt Enable Bit In I C protocol, this bit enables the interrupt generation in case of a time-out event.
Page 418
Mini57 USCI Protocol Status Register – I C (UI2C_PROTSTS) Register Offset Description Reset Value UI2C_PROTSTS UI2Cx_BA+0x64 USCI Protocol Status Register 0x0000_0000 Reserved Reserved BUSHANG WRSTSWK WKAKDONE SLAREAD SLASEL ACKIF ERRIF ARBLOIF NACKIF STORIF STARIF Reserved ONBUSY TOIF Reserved Bits Description [31:19] Reserved Reserved.
Page 419
Mini57 Acknowledge Received Interrupt Flag This bit indicates that an acknowledge has been received in master mode. This bit is not set in slave mode. A protocol interrupt can be generated if UI2C_PROTCTL.ACKIEN = 1. ACKIF [13] 0 = An acknowledge has not been received. 1 = An acknowledge has been received.
Page 420
Mini57 1 = The bus is busy. Time-out Interrupt Flag 0 = A time-out interrupt status has not occurred. TOIF 1 = A time-out interrupt status has occurred. Note: It is cleared by software writing one into this bit [4:3] Reserved Reserved.
Page 421
Mini57 USCI Timing Configure Control Register (UI2C_TMCTL) Register Offset Description Reset Value UI2C_TMCTL UI2Cx_BA+0x8C C Timing Configure Control Register 0x0000_0000 Reserved Reserved Reserved HTCTL HTCTL STCTL Bits Description [31:8] Reserved Reserved. Hold Time Configure Control Register This field is used to generate the delay timing between SCL falling edge SDA edge in [11:6] HTCTL transmission mode.
Mini57 6.15 Hardware Divider (HDIV) 6.15.1 Overview The hardware divider (HDIV) is useful to the high performance application. The hardware divider is a signed, integer divider with both quotient and remainder outputs. 6.15.2 Features Signed (two’s complement) integer calculation ...
Mini57 6.15.4 Functional Description To use hardware divider, it needs to set dividend first. Then set divisor and the hardware divider will trigger calculation automatically after divisor written. The calculation results including the quotient and remainder could be got by reading QUOTIENT (HDIV_QUOTIENT[31:0]) and REM (HDIV_REM[31:0]) register.
Mini57 6.15.6 Register Description Dividend Source Register (HDIV_DIVIDEND) Register Offset Description Reset Value HDIV_DIVIDEND HDIV_BA+0x00 Dividend Source Register 0x0000_0000 DIVIDEND DIVIDEND DIVIDEND DIVIDEND Bits Description Dividend Source [31:0] DIVIDEND This register is given the dividend of divider before calculation is started. Apr.
Page 426
Mini57 Divisor Source Register (HDIV_DIVISOR) Register Offset Description Reset Value HDIV_DIVISOR HDIV_BA+0x04 Divisor Source Resister 0x0000_FFFF Reserved Reserved DIVISOR DIVISOR Bits Description [31:16] Reserved Reserved. Divisor Source [15:0] DIVISOR This register is given the divisor of divider before calculation starts. Note: When this register is written, hardware divider will start calculation.
Page 427
Mini57 Quotient Result Register (HDIV_QUOTIENT) Register Offset Description Reset Value HDIV_QUOTIENT HDIV_BA+0x08 Quotient Result Resister 0x0000_0000 QUOTIENT QUOTIENT QUOTIENT QUOTIENT Bits Description Quotient Result [31:0] QUOTIENT This register holds the quotient result of divider after calculation is completed. Apr. 06, 2017 Page 427 of 475 Rev.1.00...
Page 428
Mini57 Remainder Result Register (HDIV_REM) Register Offset Description Reset Value HDIV_REM HDIV_BA+0x0C Remainder Result Register 0x0000_0000 Bits Description Remainder Result [31:0] The remainder of hardware divider is 16-bit sign integer (REM[15:0]) with sign extension (REM[31:16]) to 32-bit integer. Apr. 06, 2017 Page 428 of 475 Rev.1.00...
Page 429
Mini57 Divider Status Register (HDIV_STATUS) Register Offset Description Reset Value HDIV_STATUS HDIV_BA+0x10 Divider Status Register 0x0000_0001 Reserved Reserved Reserved Reserved DIVBYZERO Reserved Bits Description [31:2] Reserved Reserved. Divisor Zero Warning (Read Only) 0 = The divisor is not 0. DIVBYZERO 1 = The divisor is 0.
Mini57 6.16 Analog to Digital Converter (ADC) 1.1.1 Overview The Mini57 series contains one 12-bit successive approximation analog-to-digital converter (SAR A/D converter) with 8 single-end external input channels. The A/D converters can be started by software, external pin (STADC/PC.1) or PWM trigger. 1.1.2 Features ...
Mini57 6.16.1 Basic Configuration The Mini57 series has two sample and hold (S/H) to sampling two input ADC channel simultaneously. And support four type operating mode for BLDC motor used. The ADC pin functions are configured in SYS_PB_MFP, SYS_PC_MFP and SYS_PD_MFP register.
Mini57 6.16.2.2 ADC Operation A/D conversion is performed only once on the specified single channel. The operation is as follows: A/D conversion will be started when the ADCnSWTRG bit of ADC_CTL is set to 1 by software or hardware trigger input. When A/D conversion is finished, the result is stored in the A/D data register.
Mini57 ADCnSTADCSEL (ADC_TRGSOR[23:22]/[7:6]) Trigger level select STADC Rising/Falling/ (external pin) Rising-Falling EPWM0 EPWM1 Trigger level select EPWM2 Falling/Center/ EPWM3 Rising/Period TM0_ADC EPWM4 TM1_ADC trigger EPWM5 TM2_ADC source ADC0F ADC1F ADCnPWMTRGSEL (ADC_TRGSOR[21:20]/[5:4]) ADCnTRGSOR Note: n = 0,1 (ADC_TRGSOR[3:0]) Figure 6.16-4 ADC Hardware Trigger Source 6.16.2.5 Conversion Result Monitor by Window Compare Mode Function The ADC controller in the Mini57 series provides a window comparator function, Software can write ADC_WCMPDAT register to set low and high bound range and to monitor three step ADC...
Mini57 6.16.2.8 Independent 2SH Mode The Mini57 can also be set to independent, but it needs to convert S/H twice continuously (S/H0 and S/H1) and only generates ADC0IF interrupt when ADCMODE is set as 01b (ADC_CTL[7:6]). For example, ADC0 trigger source is set as PWM0 and ADC1 trigger source is set as PWM2. If PWM0 triggers ADC0 first, when ADC0 conversion is finished, it does not generate interrupts, and needs to wait for ADC1 conversion.
Mini57 6.16.4 Register Description ADC Data Register 0 (ADC_DAT0) Register Offset R/W Description Reset Value ADC_DAT0 ADC_BA+0x00 ADC data register 0 0x0000_0000 ADC1VALID ADC1OV Reserved ADC1DAT0 ADC1DAT0 ADC0VALID ADC0OV Reserved ADC0DAT0 ADC0DAT0 Bits Description ADC1 Valid Flag 0 = Data in ADC1DAT0[27:16] bits not valid. [31] ADC1VALID 1 = Data in ADC1DAT0[27:16] bits valid.
Page 437
Mini57 Bits Description ADC0 over Run Flag 0 = Data in ADC0DAT0[11:0] is recent conversion result. 1 = Data in ADC0DAT0[11:0] overwritten. [14] ADC0OV Note1: If converted data in ADC0DAT0[11:0] has not been read before the new conversion result is loaded to this register, OV is set to “1”. Note2: It is cleared by hardware after the ADC_DAT0 register is read.
Page 438
Mini57 ADC Data Register 1 (ADC_DAT1) Register Offset Description Reset Value ADC_DAT1 ADC_BA+0x04 ADC Data Register 1 0x0000_0000 ADC1VALID ADC1OV Reserved ADC1DAT1 ADC1DAT1 ADC0VALID ADC0OV Reserved ADC0DAT1 ADC0DAT1 Bits Description ADC1 Valid Flag 0 = Data in ADC1DAT1[27:16] bits not valid. ADC1VALID [31] 1 = Data in ADC1DAT1[27:16] bits valid.
Page 439
Mini57 Bits Description ADC0 Conversion Result for FIFO1 [11:0] ADC0DAT1 This field contains conversion result of ADC. Apr. 06, 2017 Page 439 of 475 Rev.1.00...
Page 442
Mini57 Bits Description Reserved Reserved. ADC0 Conversion Start 0 = Conversion stopped and A/D converter entered idle state. ADC0SWTRG 1 = Conversion start. Note: ADC0SWTRG can be set to “1” from two sources: software and external pin STADC. This bit will be cleared to “0” by hardware automatically. Hardware Trigger ADC Convertion Enable Enable or disable triggering of A/D conversion by Hardware (PWM, Timer, ADC self) ADC0HWTRGEN...
Page 445
Mini57 ADC Trigger Delay Control Register (ADC_TRGDLY) Register Offset Description Reset Value ADC_TRGDLY ADC_BA+0x28 ADC Trigger Delay Control Register 0x0000_0000 Reserved ADC1DELAY Reserved ADC0DELAY Bits Description [31:24] Reserved Reserved. ADC1 Trigger Delay Timer Setting this field will delay ADC start conversion time after ADCxTRGCTL trigger is [23:16] ADC1DELAY coming.
Page 446
Mini57 ADC Sampling Time Counter Register (ADC_SMPCNT) Register Offset Description Reset Value ADC_SMPCNT ADC_BA+0x2C ADC Sampling Time Counter Register 0x0000_0005 Reserved Reserved Reserved Reserved ADCSMPCNT Bits Description [31:4] Reserved Reserved. ADC Sampling Counter ADC sampling counters are 6 ADC clock is suggestion 0 = 1 * ADC Clock.
Page 447
Mini57 ADC Status Register (ADC_STATUS) Register Offset Description Reset Value ADC_STATUS ADC_BA+0x30 ADC Status Register 0x0000_0000 Reserved Reserved HIGHFG MIDFG LOWFG WCMPIF ADC1CH ADC1BUSY Reserved ADC1OV ADC1IF ADC0CH ADC0BUSY Reserved ADC0OV ADC0IF Bits Description [31:20] Reserved Reserved. Window Comparator High Bound Flag When A/D conversion result higher than the setting condition in High Bound (WCMPHIGHDAT), this bit is set to “1”.
Page 448
Mini57 Bits Description Current Conversion Channel This filed reflects the current conversion channel when ADC1BUSY =1. [15:12] ADC1CH When ADC1BUSY =0, it shows the number of the next converted channel. It is read only. BUSY/IDLE 0 = A/D converter is in idle state. [11] ADC1BUSY 1 = A/D converter is busy at conversion.
Page 449
Mini57 ADC Window Comparator Control Register (ADC_WCMPCTL) Register Offset Description Reset Value ADC_WCMPC ADC_BA+0x34 ADC Window Comparator Control Register 0x0000_0000 Reserved Reserved Reserved WCMPMCNT WFLAGCTL WCMPHIGHE WCMPMIDEN WCMPLOWE Reserved WCMPIEN WCMPEN Bits Description [31:12] Reserved Reserved. Window Compare Match Count When the A/D conversion result matches the compare condition defined Flag...
Mini57 6.17 Analog Comparator (ACMP) 6.17.1 Overview The Mini57 series contains two comparators which can be used in a number of different configurations. The comparator output is logic 1 when positive input greater than negative input, otherwise the output is 0. Each comparator can be configured to generate interrupt when the comparator output value changes.
Mini57 6.17.5 Functional Description 6.17.5.1 Interrupt Sources The output of comparators are sampled by PCLK and reflected at ACMPOx(ACMP_STATUS[3] and ACMP_STATUS[2]). If ACMPIE(ACMP_CTLx[1]) is set to 1, the comparator interrupt will be enabled. As the output state of comparator is changed, the comparator interrupt will be asserted and the corresponding flag, ACMPFx(ACMP_STATUS[1] and ACMP_STATUS[0]), will be set.
Mini57 6.17.6 Comparator Reference Voltage (CRV) 6.17.6.1 Introduction The comparator reference voltage (CRV) module is responsible for generating reference voltage for comparators. The CRV module consists of resisters ladder and analog switch, and user can set the CRV output voltage using CRVCTL(ACMP_VREF[3:0]) and select the reference voltage to ACMP by setting CPNSEL ( ACMP_CTL[25:24]).
Mini57 6.17.8 Register Description Analog Comparator0 Control Register (ACMP_CTL0) Register Offset Description Reset Value ACMP_CTL0 ACMP_BA+0x00 Analog Comparator0 Control Register 0x0000_0000 PRESET CPPSEL Reserved CPNSEL NFDIS Reserved NFCLKS POLARITY Reserved Reserved DLYTRGIE DLYTRGEN DLYTRGSOR DLYTRGSEL Reserved PBRKSEL EDGESEL ACMPHYSEN ACMPIE ACMPEN Bits Description...
Page 458
Mini57 Bits Description Noise Filter Clock Pre-divided Selection To determine the sampling frequency of the Noise Filter clock 00 = PCLK. [21:20] NFCLKS 01 = PCLK / 2. 10 = PCLK / 4. 11 = PCLK / 16. Analog Comparator Polarity Control [19] POLARITY 0 = Analog Comparator normal output.
Page 459
Mini57 Bits Description Comparator Interrupt Enable Bit 0 = ACMP interrupt function Disabled. ACMPIE 1 = ACMP interrupt function Enabled. Note1: Interrupt is generated if ACMPIE bit is set to “1” after ACMP conversion is finished. Note2: ACMP interrupt will wake CPU up in Power-down mode. Comparator Enable Bit 0 = Comparator Disabled.
Page 460
Mini57 Analog Comparator1 Control Register (ACMP_CTL1) Register Offset Description Reset Value ACMP_CTL1 ACMP_BA+0x04 Analog Comparator1 Control Register 0x0000_0000 PRESET CPPSEL Reserved CPNSEL NFDIS Reserved NFCLKS POLARITY Reserved Reserved DLYTRGIE DLYTRGEN DLYTRGSOR DLYTRGSEL Reserved PBRKSEL EDGESEL ACMPHYSEN ACMPIE ACMPEN Bits Description Comparator Result Preset Value [31] PRESET...
Page 461
Mini57 Bits Description Analog Comparator Polarity Control [19] POLARITY 0 = Analog Comparator normal output. 1 = Analog Comparator invert output. [18:14] Reserved Reserved. Analog Comparator Delay Trigger Mode Interrupt Enable DLYTRGIE [13] 0 = Analog Comparator Delay Trigger Mode Interrupt Disabled. 1 = Analog Comparator Delay Trigger Mode Interrupt Enabled.
Page 462
Mini57 Bits Description Comparator Enable Bit 0 = Comparator Disabled. ACMPEN 1 = Comparator Enabled. Note: Comparator output needs to wait 2 us stable time after ACMPEN is set. Apr. 06, 2017 Page 462 of 475 Rev.1.00...
Page 463
Mini57 Analog Comparator Status Register (ACMP_STATUS) Register Offset Description Reset Value ACMP_STATUS ACMP_BA+0x08 R/W Analog Comparator Status Register 0x0000_0000 Reserved Reserved Reserved DLYTRGO1 DLYTRGO0 DLYTRGF1 DLYTRGF0 ACMPO1 ACMPO0 ACMPF1 ACMPF0 Bits Description [31:8] Reserved Reserved. Analog Comparator1 Delay Trigger Mode Comparator Output DLYTRGO1 Synchronized to the APB clock to allow reading by software.
Page 464
Mini57 Bits Description Comparator0 Flag This bit is set by hardware whenever the comparator0 output changes state. This will ACMPF0 cause an interrupt if ACMPIE set. Note: Write “1” to clear this bit to 0. Apr. 06, 2017 Page 464 of 475 Rev.1.00...
Page 465
Mini57 Analog Comparator Reference Voltage Control Register (ACMP_VREF) Register Offset Description Reset Value ACMP_VREF ACMP_BA+0x0C Analog Comparator Reference Voltage Control Register 0x0000_0000 Reserved Reserved Reserved Reserved CRVCTL Bits Description [31:4] Reserved Reserved. Comparator Reference Voltage Setting [3:0] CRVCTL CRVS = AV x (1/6+CRV[3:0]/24).
Mini57 6.18 Programmable Gain Amplifier (PGA) 6.18.1 Overview The Mini57 series contains a programmable gain amplifier (PGA) which can be enabled through the PGAEN bit. User can measure the outputs of the programmable gain amplifier as the programmable gain amplifier output to the integrated A/D converter channel, where digital results can be taken.
Mini57 ELECTRICAL CHARACTERISTICS ® For information on the Mini57 series electrical characteristics, please refer to NuMicro Mini57 Series Datasheet. Apr. 06, 2017 Page 470 of 475 Rev.1.00...
Mini57 10 REVISION HISTORY Date Revision Description 2017.04.06 1.00 Preliminary version. Apr. 06, 2017 Page 474 of 475 Rev.1.00...
Page 475
Mini57 Important Notice Nuvoton Products are neither intended nor warranted for usage in systems or equipment, any malfunction or failure of which may cause loss of human life, bodily injury or severe property damage. Such applications are deemed, “Insecure Usage”.
Need help?
Do you have a question about the NuMicro Family and is the answer not in the manual?
Questions and answers