Nations N32G003 Series User Manual

32-bit arm cortex-m0 microcontroller
Table of Contents

Advertisement

Quick Links

N32G003 series
32-bit ARM® Cortex®-M0 microcontroller
User manual V1.0

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the N32G003 Series and is the answer not in the manual?

Questions and answers

Summary of Contents for Nations N32G003 Series

  • Page 1 N32G003 series 32-bit ARM® Cortex®-M0 microcontroller User manual V1.0...
  • Page 2: Table Of Contents

    Power reset ..............................55 System reset ..............................55 Clock control unit ..............................57 Clock Tree Diagram ............................58 Nations Technologies Inc. 2 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 3 GPIO alternate function high register (GPIOx_AFH) ................94 GPIO driver strength register (GPIOx_DS) ....................95 AFIO registers ................................96 Nations Technologies Inc. 3 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 4 Clock selection ............................. 120 Capture/compare channels ........................... 123 Input capture mode ............................126 PWM input mode ............................127 Nations Technologies Inc. 4 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 5 Clock selection .............................. 176 Capture/compare channels ..........................180 Input capture mode ............................183 PWM input mode ............................184 Nations Technologies Inc. 5 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 6 Prescaler (TIMx_PSC) ..........................220 Automatic reload register (TIMx_AR) ....................220 Independent watchdog (IWDG) ..........................221 IWDG introduction ............................... 221 Nations Technologies Inc. 6 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 7 ADC watchdog low threshold register (ADC_WDGLOW) ................. 240 ADC regular data register x (ADC_DATx) (x= 0..4) ................. 241 Nations Technologies Inc. 7 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 8 I2C master receive byte register (I2C_BYTENUM) ................273 Universal asynchronous receiver transmitter (UART) ................... 274 Introduction ................................274 Nations Technologies Inc. 8 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 9 Beeper ..................................312 Introduction ................................312 Function description ............................. 312 Beeper registers ..............................312 Beeper register overview ......................... 312 Nations Technologies Inc. 9 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 10 UID register ................................316 UCID register ............................... 316 DBGMCU_ID register ............................316 Version history ................................318 Notice ..................................319 Nations Technologies Inc. 10 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 11 Table 5-17 TIM3 ..............................83 Table 5-18 UART .............................. 83 Table 5-19 I2C ..............................83 Table 5-20 SPI ..............................83 Nations Technologies Inc. 11 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 12 Table 15-2 Data sampling for noise detection ....................281 Table 15-3 Error calculation when setting baud rate ..................282 Nations Technologies Inc. 12 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 13 Table 16-2 SPI register overview ........................307 Table 17-1 Beeper register overview ....................... 312 Table 19-1 DBGMCU_ID bit description ......................316 Nations Technologies Inc. 13 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 14 Figure 8-13 Control circuit in external clock mode 1 ..................122 Figure 8-14 External trigger input block diagram ................... 122 Nations Technologies Inc. 14 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 15 Figure 9-12 Control circuit in external clock mode 2 ..................180 Figure 9-13 Capture/compare channel (example: channel 1 input stage) ............181 Nations Technologies Inc. 15 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 16 Figure 15-2 Word length = 8 setting ........................ 276 Figure 15-3 Word length = 9 setting ........................ 276 Nations Technologies Inc. 16 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 17 Figure 16-10 Schematic diagram of TE/BUSY change when BIDIRMODE = 0 and RONLY = 0 are transmitted discontinuously ............................305 Figure 18-1 N32G003 level and Cortex®-M0 level debugging block diagram ..........314 Nations Technologies Inc. 17 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 18: Abbreviations In The Text

    For all models of N32G003 microcontroller series, the existence and number of a peripheral, please refer to the data sheet of the corresponding model. Nations Technologies Inc. 18 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 19: Memory And Bus Architecture

     ADC  AHB2APB bridge, which connects APB modules The system bus architecture is shown as in Figure 2-1: Nations Technologies Inc. 19 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 20: Bus Address Mapping

    The address mapping includes all AHB peripherals, APB peripherals, Flash, SRAM, System Memory, etc. The specific mapping is as follows: Nations Technologies Inc. 20 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 21: Table 2-1 List Of Peripheral Register Addresses

    0x4000_7400 – 0x4001_FFFF Reserved 0x4000_7000 – 0x4000_73FF 0x4000_5C00 – 0x4000_6FFF Reserved 0x4000_5800 – 0x4000_5BFF 0x4000_5400 – 0x4000_57FF I2C1 Nations Technologies Inc. 21 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 22: Boot Management

    FLASH specification Flash consists of the main memory area and the information area, which are described separately below: Nations Technologies Inc. 22 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 23: Table 2-2 Flash Bus Address List

    There is two ways to protect flash memory from illegal access (read, write and erase):  Permissions protect  Readout protection (RDP) Nations Technologies Inc. 23 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 24 Select the page to be erased with the FLASH_ADD register;  Set the FLASH_CTRL.START bit to '1';  Wait for the FLASH_STS.BUSY bit to change to '0'; Nations Technologies Inc. 24 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 25 Unlock the FLASH_CTRL.OPTWE bit;  Set the FLASH_CTRL.OPTER bit to '1';  Set the FLASH_CTRL.START bit to '1'; Nations Technologies Inc. 25 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 26: Option Byte

    0xFF (the erased state), the above verification steps are skipped and no verification is required. Nations Technologies Inc. 26 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 27: Table 2-3 Option Byte List

     USER3[4]: LVR enable, which can be queried through FLASH_USER[12]  USER3[5]: LVR filter enable, which can be queried through FLASH_USER[13] Nations Technologies Inc. 27 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 28: Table 2-4 Read Protection Configuration List

    0xFF, equivalent to a still in a state of L1 level of protection)  Write the correct sequence of keys to the OPTKEY unlock option byte area; Nations Technologies Inc. 28 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 29: Table 2-5 Flash Read-Write-Erase Permission Control Table

    Flash main memory area first 3KB Change to L1 or L2 is Read-Write-Erase Read-Write-Erase Level FLASH_OB.BOOT_LOCK = 0 allowed Nations Technologies Inc. 29 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 30: Sram

    The main features are as follows:  The maximum total capacity is 3KB  Support byte/half word/word reading and writing Nations Technologies Inc. 30 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 31: Flash Register Description

    Reset Value FLASH_ECC 024h Reserved Reset Value FLASH access control register (FLASH_AC) Address offset: 0x00 Reset value: 0x0000 0030 Nations Technologies Inc. 31 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 32 FKEY Used to unlock the FLASH_CTRL.LOCK bit. FLASH OPTKEY register (FLASH_OPTKEY) Address offset: 0x08 Reset value: 0xXXXX XXXX Nations Technologies Inc. 32 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 33 When trying to program to an address whose content is not '0xFFFF_FFFF', the hardware sets this to '1'. Writing '1' clears this state. Nations Technologies Inc. 33 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 34 Hardware clears this bit to '0' after detecting a correct unlock sequence. After an unsuccessful unlock operation, this bit cannot be changed until the next system reset. START Start Nations Technologies Inc. 34 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 35 Note: When the FLASH_STS.BUSY bit is '1', this register cannot be written. FLASH option byte register (FLASH_OB) Address offset: 0x1C Reset value: 0x03FF FFDC Nations Technologies Inc. 35 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 36 Note: This bit is read-only. RDPRT1 Read protection level L1 0: L1 level of read protection is disabled. Nations Technologies Inc. 36 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 37 LVR level select. Value = 0x0F - LVRLS Value Voltage 0000 1.8v 0001 2.0v 0010 2.2v 0011 2.4v Nations Technologies Inc. 37 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 38 If the first address of the interrupt vector table needs to be remapped to the 0x08000C00, the VTOR_VALUE is configured to 0x08000C00. Nations Technologies Inc. 38 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 39: Power Control (Pwr)

    PWR_CTRL.PDRS[1:0] must be configured as '10' (V PDR trigger voltage 1.0V).  Power-down mode Voltage regulator off, mainly used in PD mode. Nations Technologies Inc. 39 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 40: Figure 3-1 Power Supply Diagram

    For more information about the reset threshold of the switching power supply, please refer to the electrical characteristics section of the relevant data sheet. Nations Technologies Inc. 40 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 41: Figure 3-2 Power On Reset (Por) / Power Down Reset (Pdr) Waveform

    The threshold of LVR is controlled by PWR_CTRL2.LVRLS [3:0]. LVR can be enabled/disabled by PWR_CTRL2.LVREN bit. Nations Technologies Inc. 41 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 42: Power Modes

    NRST and PA1_WKUP0/ PA2_WKUP1 two interrupt (for WFI) or event (for WFE) is configured, NRST Nations Technologies Inc. 42 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 43: Table 3-2 Peripheral Running Status

    ) , : , : enable optional Disabled by default and enabled by software configuration disable DSTB deep-standby. Nations Technologies Inc. 43 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 44: Stop Mode

    If the access to the APB area is in progress, entering PD mode will be delayed until the APB access is complete. Nations Technologies Inc. 44 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 45: Debug Mode

    Table 3-3 PWR register overview Offset Register PWR_CTRL PVDCNT[7:0] PLS[3:0] 0x00 Reserved Reserved Reset value PWR_CTRLSTS 0x04 Reserved Reserved Reset value Nations Technologies Inc. 45 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 46: Power Control Register (Pwr_Ctrl)

    0: PVD filter disabled. 1: PVD filter enabled. 24:17 PVDCNT PVD filter control counter value. 0x00: Not filtered Nations Technologies Inc. 46 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 47 The software writes a '1' to this bit to clear the DBGPDF status bit. Always read as 0: Invalid. 1: Clear the DBGPDF status bit. Nations Technologies Inc. 47 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 48: Power Control Status Register (Pwr_Ctrlsts)

    It is valid only if PWR_CTRL.PVDEN = 1. 0: V is higher than the PVD threshold selected with PWR_CTRL.PLS [3:0]. Nations Technologies Inc. 48 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 49: Power Control Register 2 (Pwr_Ctrl2)

    LVR level selection. LVR threshold is controlled below: PWR_CTRL2.LVRLS Voltage 0000 1.8v 0001 2.0v 0010 2.2v 0011 2.4v Nations Technologies Inc. 49 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 50: Power Control Register 3 (Pwr_Ctrl3)

    After exit STOP, user can delay starting the LSI to stabilize the LSI. The delay is determined by the LSISTPCNT configuration. Nations Technologies Inc. 50 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 51: Power Control Register 4 (Pwr_Ctrl4)

    1: After the software set this bit to '1', the Flash enter deep standby mode. FLHWKUP Enable Flash fast wake-up. Nations Technologies Inc. 51 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 52: Power Control Register 5 (Pwr_Ctrl5)

    Address offset:0x28 Reset value:0x0000 0000 Bit field Name Description 31:4 Reserved Reserved, the reset value must be maintained. Nations Technologies Inc. 52 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 53: Debug Control Register (Dbg_Ctrl)

    0: The counter of IWDG still works normally. 1: The counter of IWDG stops working. Reserved Reserved, the reset value must be maintained. Nations Technologies Inc. 53 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 54 1: (FCLK on, HCLK on) system enters DBGSTOP mode, FCLK clock is provided by the internal RC oscillator. Reserved Reserved, the reset value must be maintained. Nations Technologies Inc. 54 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 55: Reset And Clock Control (Rcc)

    A software reset can be generated by setting the SYSRESETREQ bit in Cortex -M0 Application Interrupt and Reset Nations Technologies Inc. 55 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 56: Low-Power Management Reset

    Schmit Filter IWDG reset SW reset Pulse EMC reset Generator (min 20us) LVR reset Low Power Management reset Nations Technologies Inc. 56 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 57: Clock Control Unit

     AHB clock (HCLK) FCLK is the free running clock of the Cortex®-M0. See ARM's Cortex®-M0 Technical Reference Manual for details. Nations Technologies Inc. 57 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 58: Clock Tree Diagram

    48MHz or 40MHz RC oscillator, which can be used directly as a system clock or input after dividing. The HSI RC Nations Technologies Inc. 58 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 59: Lsi Clock

    The clock is supplied to the IWDG after the LSI oscillator is stable. Nations Technologies Inc. 59 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 60: Tim6 Clock

    Reset Value RCC_PRST 00Ch Reserved Reset Value RCC_AHBPCLKEN 010h Reserved Reserved Reserved Reset Value RCC_APBPCLKEN 014h Reserved Reset Value Nations Technologies Inc. 60 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 61: Hsi Clock Control Register (Rcc_Hsictrl)

    40M ready flag Set by hardware to indicate that internal 40 MHz RC oscillator is stable. Nations Technologies Inc. 61 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 62: Clock Configuration Register (Rcc_Cfg)

    Set and cleared by software. 00: no clock 01: LSI clock 10: LSE clock Others: Not allowed to set Nations Technologies Inc. 62 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 63: Peripheral Reset Register (Rcc_Prst)

    Reserved, the reset value must be maintained. Peripheral reset register (RCC_PRST) Address offset: 0x0c Reset value: 0x0000 0000 Nations Technologies Inc. 63 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 64 1: Reset the power interface I2CRST I2C reset Set and cleared by software. 0: Clear reset 1: Reset I2C UART2RST UART2 reset Nations Technologies Inc. 64 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 65: Ahb Peripheral Clock Enable Register (Rcc_Ahbpclken)

    Set and cleared by software. 0: Disable ADC clock 1: Enable ADC clock 11:7 Reserved Reserved, the reset value must be maintained. Nations Technologies Inc. 65 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 66: Apb Peripheral Clock Enable Register (Rcc_Apbpclken)

    1: Enable SPI clock PWREN Power interface clock enable Set and cleared by software. 0: Disable the power interface clock Nations Technologies Inc. 66 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 67: Low Speed Clock Control Register (Rcc_Lsictrl)

    1: Enable the alternate function IO clock Low speed clock control register (RCC_LSICTRL) Address offset: 0x18 Reset value: 0x0000 0042 Nations Technologies Inc. 67 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 68: Control/Status Register (Rcc_Ctrlsts)

    Address offset: 0x1c Reset value: 0x0000 0018 Bit field Name Description 31:12 Reserved Reserved, the reset value must be maintained Nations Technologies Inc. 68 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 69 Reserved, the reset value must be maintained RMRSTF Remove reset flag Set and clear by software 0: No effect 1: Clear these reset flags Nations Technologies Inc. 69 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 70: Clock Configuration Register 2 (Rcc_Cfg2)

    0001: HSI divided by 2 as ADC work clock 0010: HSI divided by 3 as ADC work clock Nations Technologies Inc. 70 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 71: Emc Control Register (Rcc_Emcctrl)

    Reserved, the reset value must be maintained. EMCDETEN EMC clamp detect enable Set and cleared by software. 0: Disable detect 1: Enable detect Nations Technologies Inc. 71 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 72: Gpio And Afio

    Each I/O port bit can be programmed arbitrarily, but the I/O port register must be accessed as a 32-bit word (16-bit half-word or 8-bit byte are not allowed).The following figure shows the basic structure of an I/O port. Nations Technologies Inc. 72 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 73: Io Function Description

    Alternate function push-pull + pull-down Reserved Alternate function open-drain Alternate function open-drain + pull-up Alternate function open-drain + pull-down Nations Technologies Inc. 73 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 74: Table 5-2 I/O List Of Functional Features Of The Lipin

    When I/O port is configured in input mode:  Output buffer is disabled  The schmidt trigger input is activated Nations Technologies Inc. 74 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 75: Figure 5-2 Input Mode

    Read access to input data register to get I/O status.  Read access to the output data register to get the last written value. Nations Technologies Inc. 75 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 76: Figure 5-3 Output Mode

    Read access to input data register to get I/O status.  Read access to the output data register to get the last written value. Nations Technologies Inc. 76 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 77: Figure 5-4 Alternate Function Mode

    Analog From on-chip peripheral I/O Pin diode Read Input data register TTL Schmitt trigger Analog To on-chip peripheral Nations Technologies Inc. 77 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 78: Status After Reset

    Table 5-3 Correspondence between EXTI Line and Pin EXTI Line Selection EXTI Line0 EXTI Line1 EXTI Line2 EXTI Line3 EXTI Line4 EXTI Line5 Nations Technologies Inc. 78 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 79: Alternate Function

    5.2.5.3.1 TIM1 alternate function I/O remapping Table 5-5 TIM1 alternate function I/O remapping Alternate function Remap PA14 TIM1_ETR PA15 TIM1_BKIN Nations Technologies Inc. 79 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 80: Table 5-6 Tim3 Alternate Function I/O Remapping

    5.2.5.3.2 TIM3 alternate function I/O remapping Table 5-6 TIM3 alternate function I/O remapping Alternate function Remap TIM3_ETR TIM3_CH1 Nations Technologies Inc. 80 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 81: Table 5-7 Uart1 Alternate Function I/O Remapping

    5.2.5.4.2 UART2 alternate function I/O remapping Table 5-8 UART2 alternate function I/O remapping Alternate function Remap UART2_TX UART2_RX Nations Technologies Inc. 81 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 82: Table 5-9 I2C Alternate Function I/O Remapping

    PA14 BEEPER1_N_OUT EVENTOUT alternate function I/O remapping Table 5-13 EVENTOUT alternate function I/O remapping Alternate function Remap EVENTOUT Nations Technologies Inc. 82 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 83: I/O Configuration Of Peripherals

    Open drain alternate function Table 5-20 SPI SPI pin Configuration PAD configuration SPI_SCK Master mode Push-pull alternate function Nations Technologies Inc. 83 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 84: Gpio Locking Mechanism

    PLOCKK, that is, GPIOx_PLOCK [16], becomes 1 only after the correct sequence w1-> w0-> w1-> r0 (r0 here is also a must). After that, it becomes 0 only if the system reset is performed. GPIOx_PLOCK.PLOCK[15:0] Nations Technologies Inc. 84 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 85: Gpio Registers

    Table 5-24 GPIOA register overview Offset Register GPIOA_PMODE 0x00 Reset value GPIOA_POTYPE 0x04 Reserved Reset value GPIOA_SR 0x08 Reserved Reset value Nations Technologies Inc. 85 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 86 GPIOA_PBC 0x28 Reserved Reset value GPIOA_PLOCK 0x1C Reserved Reset value GPIOA_AFL 0x20 Reset value GPIOA_AFH 0x24 Reset value Nations Technologies Inc. 86 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 87: Gpiob Register Overview

    Reserved Reset value GPIOA_PUPD 0x0C Reserved Reset value GPIOA_PID 0x10 Reserved Reset value GPIOA_POD 0x14 Reserved Reset value Nations Technologies Inc. 87 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 88: Gpio Port Mode Register (Gpiox_Pmode)

    Mode bits y for port GPIOx (x = A,B) 29:28 00: Input mode 27:26 01: General purpose output mode Nations Technologies Inc. 88 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 89: Gpio Port Type Register (Gpiox_Potype)

    GPIO slew rate register (GPIOx_SR) Address offset: 0x08 Reset value (Port A) : 0x0000 FFFF Reset value (Port B) : 0x0000 0003 Nations Technologies Inc. 89 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 90: Gpio Port Pull-Up/Pull-Down Register (Gpiox_Pupd)

    Note: x = A, y = 0...15. 19:18 x = B, y =0, 1. 17:16 15:14 13:12 11:10 Nations Technologies Inc. 90 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 91: Gpio Port Input Data Register (Gpiox_Pid)

    POD bits can be independently set/cleared by GPIOx_PBSC (x = A,B) register. Note: x = A, y = 0...15. x = B, y =0, 1. Nations Technologies Inc. 91 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 92: Gpio Port Bit Set/Clear Register (Gpiox_Pbsc)

    Reset value (Port B) : 0x0000 0000 Bit Field Name Description 31:16 Reserved The reset value must be maintained. Nations Technologies Inc. 92 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 93: Gpio Port Lock Register (Gpiox_Plock)

    1: Lock the configuration of the port Note: x = A, y = 0...15. x = B, y =0, 1. Nations Technologies Inc. 93 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 94: Gpio Alternate Function Low Register (Gpiox_Afl)

    = B, y =0, 1. GPIO alternate function high register (GPIOx_AFH) Address offset: 0x24 Reset value (Port A) : 0xFFFF FF00 Nations Technologies Inc. 94 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 95: Gpio Driver Strength Register (Gpiox_Ds)

    Port GPIOx drive capability configuration bits y (x = A,B): 0: High drive capacity (16mA(5V)/8mA(3.3V)/4mA(2V)) 1: Low drive capacity (8mA(5V)/4mA(3.3V)/2mA(2V) Nations Technologies Inc. 95 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 96: Afio Registers

    EXTI_ETRR[4:0] Select an external pin to trigger the ADC regular conversion. 00000: Select PA0 to trigger the conversion Nations Technologies Inc. 96 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 97 01111: Select PA15 to trigger the conversion 10000: Select PB0 to trigger the conversion 10001: Select PB1 to trigger the conversion Nations Technologies Inc. 97 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 98: Interrupts And Events

    18) Settable FLASH Flash global interrupt 0x0000 0044 Settable EXTI0_1 EXTI line [1:0] is interrupted 0x0000 0048 Nations Technologies Inc. 98 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 99: External Interrupt/Event Controller (Exti)

    3 trigger events are supported: rising edge, falling edge, and double edge  Can wake up to exit low power mode Nations Technologies Inc. 99 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 100: Functional Description

    In addition, interrupt/event requests can also be generated by software by writing a '1' in the software interrupt/event register. Nations Technologies Inc. 100 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 101: Exti Line Mapping

    EXTI line 14 is connected to PA14  EXTI line 15 is connected to PA15  EXTI line 16 is connected to PB0 Nations Technologies Inc. 101 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 102: Exti Registers

    Address offset : 0x00 Reset value : 0x00000000 Bit field name describe 31:20 Reserved Reserved,the reset value must be maintained. Nations Technologies Inc. 102 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 103: Event Mask Register(Exti_Emask)

    1: Enable rising edge trigger (interrupts and events) on input line x. Falling edge trigger selection register(EXTI_FT_CFG) Address offset : 0x0C Nations Technologies Inc. 103 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 104: Software Interrupt Enable Register(Exti_Swie)

    Note: This bit can be cleared to '0' by writing '1' to clear the corresponding bit of EXTI_PEND. Interrupt request pending register(EXTI_PEND) Address offset : 0x14 Reset value : 0x00000000 Nations Technologies Inc. 104 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 105 This bit is set to '1' when a selected edge trigger event occurs on the external interrupt line. It can be cleared by writing '1' to the bit. Nations Technologies Inc. 105 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 106: Crc Calculation Unit

    The initial value of CRC calculation can be configured by writing the CRC_CRC16D register. By default, the initial value is the result of the last calculation. Nations Technologies Inc. 106 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 107: Crc Software Calculation Method

    Reset Value LRCDAT[7:0] 018h Reserved Reset Value CRC16 control register (CRC_CRC16CTRL) Address offset: 0x0C Reset value: 0x0000 0000 Nations Technologies Inc. 107 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 108: Crc16 Input Data Register (Crc_Crc16Dat)

    Address offset: 0x14 Reset value: 0x0000 0000 Bit field Name Description 31:16 Reserved Reserved,the reset value must be maintained Nations Technologies Inc. 108 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 109: Lrc Result Register (Crc_Lrc)

    CRC_CRC16DAT is "XOR" with the value of the CRC_LCR register. The result will be stored in CRC_LCR. Software read the result. It should be cleared before next use. Nations Technologies Inc. 109 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 110: Advanced-Control Timers (Tim1)

    Timer can be controlled by external signal  Timers are linked internally for timer synchronization or chaining  TIM1_CC5 for COMP blanking Nations Technologies Inc. 110 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 111: Tim1 Function Description

    UEV. An update event is generated when the counter reaches the overflow/underflow condition and it can be generated by software when Nations Technologies Inc. 111 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 112: Prescaler Description

    TIMx_STS.UDITF is set:  The repetition counter reloads the contents of the TIMx_REPCNT Nations Technologies Inc. 112 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 113: Figure 8-3 Timing Diagram Of Up-Counting. The Internal Clock Divider Factor = 2/N

    Internal clock CK_PSC divided by N Timer clock = CK_CNT Counter register Counter overflow Update interrupt flag(UDITF) Update event(UEV) Nations Technologies Inc. 113 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 114 Counter overflow Update event(UEV) Update interrupt flag(UDITF) Auto-reload preload register Write a new value in TIMx_AR Auto-reload shadow register Nations Technologies Inc. 114 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 115: Down-Counting Mode

    The update events can be generated each time the counter overflows and each time the counter underflows. Alternatively, an update event can also be generated by setting the TIMx_EVTGEN. UDGN bit (either by software Nations Technologies Inc. 115 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 116: Figure 8-6 Timing Diagram Of The Center-Aligned, Internal Clock Divided Factor =2/N

    Internal clock divided by N CK_PSC Timer clock = CK_CNT Counter register Counter underflow Update event(UEV) Update interrupt flag(UDITF) Nations Technologies Inc. 116 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 117: Repetition Counter

    This means that data is transferred from the preload registers to the shadow registers every N+1 counter overflow or underflow, where N is the value in the TIMx_REPCNT. Nations Technologies Inc. 117 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 118: Figure 8-8 Repeat Count Sequence Diagram In Down-Counting Mode

    36 35 register Underflow Overflow TIMx_REPCNT = 0x0 UDITF TIMx_REPCNT = 0x1 UDITF TIMx_REPCNT = 0x2 UDITF Software clear Nations Technologies Inc. 118 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 119: Figure 8-9 Repeat Count Sequence Diagram In Up-Counting Mode

    35 34 register Underflow Overflow TIMx_REPCNT = 0x0 UDITF TIMx_REPCNT = 0x1 UDITF TIMx_REPCNT = 0x2 UDITF Software clear Nations Technologies Inc. 119 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 120: Clock Selection

    Counter clock = CK_CNT=CK_PSC Counter register 63 64 65 66 00 01 02 03 04 05 06 07 Nations Technologies Inc. 120 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 121: Figure 8-12 Ti2 External Clock Connection Example

    The delay between the rising edge of TI2 and the actual clock of the counter depends on the resynchronization circuit at the input of TI2. Nations Technologies Inc. 121 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 122: Figure 8-13 Control Circuit In External Clock Mode 1

    Select the polarity on ETR pin by setting TIMx_SMCTRL.EXTP equal to ‘0’, The rising edge of ETR is valid Nations Technologies Inc. 122 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 123: Capture/Compare Channels

    ICx is sent to the capture register after frequency division. The following figure shows a block diagram of a capture/compare channel. Nations Technologies Inc. 123 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 124: Figure 8-16 Capture/Compare Channel (Example: Channel 1 Input Stage)

    The output part generates an intermediate waveform OCxRef (active high) as reference. The polarity acts at the end of the chain. Nations Technologies Inc. 124 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 125: Figure 8-17 Capture/Compare Channel 1 Main Circuit

    Comparator mode Write CCDAT1H Write in progress CNT>CCDAT1 CNT=CCDAT1 Write CCDAT1L CC1SEL[0] CC1SEL[1] TIM1_CCMOD1.OC1PEN From time base unit Nations Technologies Inc. 125 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 126: Input Capture Mode

    The TIMx_STS. CCxITF bit is set by hardware when a capture event occurs and is cleared by software or by reading the TIMx_CCDATx register. Nations Technologies Inc. 126 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 127: Pwm Input Mode

    Configure TIMx_CCEN.CC2P equal to 1 to select the valid polarity of filtered timer input 2(TI1FP2), valid on the falling edge.  Configure TIMx_SMCTRL.TSEL=101 to select Filtered timer input 1 (TI1FP1) as valid trigger input. Nations Technologies Inc. 127 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 128: Forced Output Mode

    When the capture/compare register and the counter have the same value, the output compare function’s operations are as follow: Nations Technologies Inc. 128 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 129 Otherwise the TIMx_CCDATx shadow register will be updated at the next update event. Here is an example. Nations Technologies Inc. 129 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 130: Pwm Mode

    User should not modified TIMx_CTRL1.DIR by software, it is updated by hardware. Nations Technologies Inc. 130 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 131: Figure 8-22 Center-Aligned Pwm Waveform (Ar=8)

    To be on the safe side, user is suggested setting TIMx_EVTGEN.UDGN to generate an update by software before starting the counter, and not writing the counter while it is running. Nations Technologies Inc. 131 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 132: Figure 8-23 Edge-Aligned Pwm Waveform (Apr=8)

    (n+1)th PWM cycle is 0. At the moment when the counter is 0 in the (n+1)th PWM cycle, although the value of the Nations Technologies Inc. 132 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 133: One-Pulse Mode

    DELAY the pulse width t PULSE 5. Configure TIMx_CTRL1.ONEPM=1 to enable single pulse mode, configure TIMx_CCMOD1.OC1MD = ‘111’to Nations Technologies Inc. 133 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 134: Clearing The Ocxref Signal On An External Event

    Here is an example for the case that when ETRF input becomes high, the behavior of OCxREF signal for different value of OCxCEN. Timer is set to be in PWM mode in this case. Nations Technologies Inc. 134 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 135: Complementary Outputs With Dead-Time Insertion

    The relationships between the output signals of the dead-time generator and the reference signal OCxREF are as follow. Assume that TIMx_CCEN.CCxP=0, TIMx_CCEN.CCxNP=0, TIMx_BKDT.MOEN=1, TIMx_CCEN.CCxEN=1, Nations Technologies Inc. 135 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 136: Figure 8-26 Complementary Output With Dead-Time Insertion

    TIMx_CCEN.CCxNEN=1, OCx will become active when OCxREF is high. On the contrary, OCxN will become active when OCxREF is low. Nations Technologies Inc. 136 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 137: Break Function

     Timer will release the output control if TIMx_BKDT.OSSI=0. Otherwise, if the enable output was high, it Nations Technologies Inc. 137 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 138: Debug Mode

    (CCxEN=1,CCxNEN=0,CCxP=0,CCxNP=0,OIx=OIxN) Debug mode When the microcontroller is in debug mode (the Cortex-M0 core halted), depending on the DBG_CTRL.TIMx_STOP Nations Technologies Inc. 138 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 139: Timx And External Trigger Synchronization

    In trigger mode, the trigger event (rising edge/falling edge) of the input port can trigger the counter to start counting. Nations Technologies Inc. 139 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 140: Slave Mode: Gated Mode

    The delay between the rising edge on TI1 and the actual stop of the counter is due to the resynchronization circuit on TI1 input. Nations Technologies Inc. 140 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 141: Figure 8-30 Control Circuit In Gated Mode

    When TI1 detects a rising edge, the counter starts counting on the rising edge of ETR, and the trigger flag is set (TIMx_STS.TITF=1); Nations Technologies Inc. 141 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 142: Timer Synchronization

    The following figure shows the output timing diagram of OCx and OCxN when a COM commutation event occurs in three different configurations: Nations Technologies Inc. 142 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 143: Timx Register Description(X=1)

    Table 8-1 Register overview Offset Register TIMx_CTRL1 000h Reset Value TIMx_CTRL2 004h Reset Value TIMx_SMCTRL 008h Reset Value Nations Technologies Inc. 143 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 144 Reserved Reset Value TIMx_BKDT DTGN[7:0] 044h Reserved Reset Value TIMx_CCMOD3 054h Reserved Reset Value 058h TIMx_CCDAT5 Reserved CCDAT5[15:0] Nations Technologies Inc. 144 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 145: Control Register 1 (Timx_Ctrl1)

    0: Shadow register disable for TIMx_AR register 1: Shadow register enable for TIMx_AR register CAMSEL[1:0] Center-aligned mode selection Nations Technologies Inc. 145 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 146 Note: external clock, gating mode can only work after TIMx_CTRL1.CNTEN bit is set in the software. Trigger mode can automatically set TIMx_CTRL1.CNTEN bit by hardware. Nations Technologies Inc. 146 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 147: Control Register 2 (Timx_Ctrl2)

    When the counter enable signal is controlled by the trigger input, there is a delay on TRGO except if the master/slave mode is selected (see the description of the TIMx_SMCTRL.MSMD bit). Nations Technologies Inc. 147 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 148: Slave Mode Control Register (Timx_Smctrl)

    ETRF signal in this mode. 0: External clock mode 2 disable. 1: External clock mode 2 enable. Nations Technologies Inc. 148 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 149 (via TRGO) and its slaves. This is useful when several timers are required to be synchronized to a single external event. Nations Technologies Inc. 149 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 150: Interrupt Enable Registers (Timx_Dinten)

    ITR0 (TSEL = 000) ITR1 (TSEL = 001) ITR2 (TSEL = 010) ITR3 (TSEL = 011) TIM3 TIM1 Interrupt enable registers (TIMx_DINTEN) Offset address: 0x0C Reset value: 0x0000 Nations Technologies Inc. 150 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 151: Status Registers (Timx_Sts)

    0: Disable update interrupt 1: Enables update interrupt Status registers (TIMx_STS) Offset address: 0x10 Reset value: 0x0000 0000 Nations Technologies Inc. 151 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 152 See TIMx_STS.CC1ITF description. CC1ITF Capture/Compare 1 interrupt flag When the corresponding channel of CC1 is in output mode: Nations Technologies Inc. 152 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 153: Event Generation Registers (Timx_Evtgen)

    This bit is automatically cleared by hardware. 0: No action 1: Generated a break event Nations Technologies Inc. 153 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 154: Capture/Compare Mode Register 1 (Timx_Ccmod1)

    0: No action 1: Generated an update event Capture/compare mode register 1 (TIMx_CCMOD1) Offset address: 0x18 Nations Technologies Inc. 154 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 155 1 is high, otherwise it is low. In down-counting mode, if TIMx_CNT > TIMx_CCDAT1, OC1REF signal of channel 1 is low, otherwise it is high. Nations Technologies Inc. 155 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 156 Input capture mode: Bit field Name Description 15:12 IC2F[3:0] Input Capture 2 Filter 11:10 IC2PSC[1:0] Input Capture 2 Prescaler Nations Technologies Inc. 156 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 157 TIMx_SMCTRL.TSEL. Note: CC1SEL is writable only when the channel is off (TIMx_CCEN.CC1EN = 0). Nations Technologies Inc. 157 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 158: Capture/Compare Mode Register 2 (Timx_Ccmod2)

    TIMx_SMCTRL.TSEL. Note: CC3SEL is writable only when the channel is off (TIMx_CCEN.CC3EN = 0). Input capture mode: Nations Technologies Inc. 158 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 159: Capture/Compare Enable Registers (Timx_Ccen)

    Capture/Compare 5 output enable See TIMx_CCEN.CC1EN description. 15:14 Reserved Reserved, the reset value must be maintained CC4P Capture/Compare 4 output polarity Nations Technologies Inc. 159 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 160 1: inverted: Capture action occurs when IC1 generates a falling edge. When used as external trigger, IC1 is inverted. Note: If TIMx_BKDT.LCKCFG = 3 or 2, these bits cannot be modified. Nations Technologies Inc. 160 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 161: Table 8-3 Output Control Bits Of Complementary Ocx And Ocxn Channels With Break Function

    Complementary to OCxREF + polarity + OCxREF + polarity + dead-time, dead-time, OCx_EN=1 OCxN_EN=1 Output disabled(not driven by timer) Asynchronously: OCx=CCxP, OCx_EN=0, OCxN=CCxNP,OCxN_EN=0; Nations Technologies Inc. 161 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 162: Counters (Timx_Cnt)

    Each time an update event occurs, the PSC value is loaded into the active prescaler register. Auto-reload register (TIMx_AR) Offset address: 0x2C Reset values: 0xFFFF Nations Technologies Inc. 162 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 163: Repeat Count Registers (Timx_Repcnt)

    CC1 channel is configured as output: CCDAT1 contains the value to be compared to the counter TIMx_CNT, signaling on the OC1 output. Nations Technologies Inc. 163 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 164: Capture/Compare Register 2 (Timx_Ccdat2)

    When configured as output mode, register CCDAT2 and CCDDAT2 are readable and writable. Capture/compare register 3 (TIMx_CCDAT3) Offset address: 0x3C Reset value: 0x0000 Nations Technologies Inc. 164 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 165: Capture/Compare Register 4 (Timx_Ccdat4)

    AOEN, BKP, BKEN, OSSI, OSSR, and DTGN [7:0] bits can all be write protected depending on the LOCK Nations Technologies Inc. 165 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 166 These bits offer a write protection against software errors. – No write protected. – LOCK Level 1 TIMx_BKDT.DTGN, TIMx_BKDT.BKEN, TIMx_BKDT.BKP, TIMx_BKDT.AOEN, Nations Technologies Inc. 166 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 167: Capture/Compare Mode Registers 3(Timx_Ccmod3)

    Output compare 5 clear enable OC5MD[2:0] Output compare 5 mode OC5PEN Output compare 5 Preload enable OC5FEN Output compare 5 fast enable Nations Technologies Inc. 167 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 168: Capture/Compare Register 5 (Timx_Ccdat5)

    Otherwise, this preloaded value is transferred to the active register only when an update event occurs. TIM1_CC5 and TIM8_CC5 is used for comparator blanking. Nations Technologies Inc. 168 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 169: General-Purpose Timers (Tim3)

    Timer can be controlled by external signal  Timers are linked internally for timer synchronization or chaining  Supports capturing internal comparator output signals Nations Technologies Inc. 169 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 170: General-Purpose Timer Description

    1 and 65536. It can be changed on the fly as it is buffered. The prescaler value is only taken into account at the next update event. Nations Technologies Inc. 170 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 171: Counter Mode

    When an update event occurs, the counter will still be cleared and the prescaler counter will also be set to 0 (but the prescaler value will remain unchanged). Nations Technologies Inc. 171 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 172: Figure 9-3 Timing Diagram Of Up-Counting. The Internal Clock Divider Factor = 2/N

    Internal clock CK_PSC divided by N Timer clock = CK_CNT Counter register Counter overflow Update interrupt flag(UDITF) Update event(UEV) Nations Technologies Inc. 172 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 173: Figure 8-4 Timing Diagram Of The Up-Counting, Update Event When Arpen=0/1

    Counter overflow Update event(UEV) Update interrupt flag(UDITF) Auto-reload preload register Write a new value in TIMx_AR Auto-reload shadow register Nations Technologies Inc. 173 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 174: Figure 9-5 Timing Diagram Of The Down-Counting, Internal Clock Divided Factor = 2/N

    Center-aligned mode is valid when the TIMx_CTRL1. CAMSEL bit is not equal to "00". The update events can be generated each time the counter overflows and each time the counter underflows. Nations Technologies Inc. 174 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 175: Figure 9-6 Timing Diagram Of The Center-Aligned, Internal Clock Divided Factor =2/N

    Internal clock divided by N CK_PSC Timer clock = CK_CNT Counter register Counter underflow Update event(UEV) Update interrupt flag(UDITF) Nations Technologies Inc. 175 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 176: Clock Selection

    Auto-reload active register Clock selection  The internal clock of timers :CK_INT  Two kinds of external clock mode : Nations Technologies Inc. 176 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 177: Figure 9-8 Control Circuit In Normal Mode, Internal Clock Divided By 1

    Counter clock = CK_CNT=CK_PSC Counter register 63 64 65 66 00 01 02 03 04 05 06 07 Nations Technologies Inc. 177 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 178: Figure 9-9 Ti2 External Clock Connection Example

    The delay between the rising edge of TI2 and the actual clock of the counter depends on the resynchronization circuit at the input of TI2. Nations Technologies Inc. 178 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 179: Figure 9-10 Control Circuit In External Clock Mode 1

    Select the polarity on ETR pin by setting TIMx_SMCTRL.EXTP equal to ‘0’, The rising edge of ETR is valid  External clock mode 2 is selected by setting TIMx_SMCTRL .EXCEN equal to ‘1’ Nations Technologies Inc. 179 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 180: Capture/Compare Channels

    ICx is sent to the capture register after frequency division. The following figure shows a block diagram of a capture/compare channel. Nations Technologies Inc. 180 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 181: Figure 9-13 Capture/Compare Channel (Example: Channel 1 Input Stage)

    The output part generates an intermediate waveform OCxRef (active high) as reference. The polarity acts at the end of the chain. Nations Technologies Inc. 181 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 182: Figure 9-14 Capture/Compare Channel 1 Main Circuit

    Comparator mode Write CCDAT1H Write in progress CNT>CCDAT1 CNT=CCDAT1 Write CCDAT1L CC1SEL[0] CC1SEL[1] TIMx_CCMOD1.OC1PEN From time base unit Nations Technologies Inc. 182 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 183: Input Capture Mode

    Define the sampling frequency of the TI1 input and the length of the digital filter by configuring the Nations Technologies Inc. 183 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 184: Pwm Input Mode

    Configure TIMx_SMCTRL.SMSEL=100 to configure the slave mode controller to reset mode.  Configure TIMx_CCEN. CC1EN=1 and TIMx_CCEN.CC2EN=1 to enable capture. Nations Technologies Inc. 184 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 185: Forced Output Mode

    When the capture/compare register and the counter have the same value, the output compare function’s operations are as follow:  TIMx_CCMODx.OCxMD is for output compare mode, and TIMx_CCEN.CCxP is for output polarity. When Nations Technologies Inc. 185 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 186: Figure 9-17 Output Compare Mode, Toggle On Oc1

    8801 TIMx_CCDAT1 006A 8801 Write 8801h in CCDAT1 register OC1REF=OC1 Match detected on CCDAT1 Interrupt generated if enabled Nations Technologies Inc. 186 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 187: Pwm Mode

    Examples of center-aligned PWM waveforms is as follow, and the setting of the waveform are: TIMx_AR=8, PWM mode 1, the compare flag is set when the counter counts down corresponding to TIMx_CTRL1. CAMSEL=01. Nations Technologies Inc. 187 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 188: Figure 9-18 Center-Aligned Pwm Waveform (Ar=8)

    PWM edge-aligned mode There are two kinds of configuration in edge-aligned mode, up-counting and down-counting.  Up-counting Nations Technologies Inc. 188 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 189: One-Pulse Mode

    In the one-pulse mode (ONEPM), a trigger signal is received, and a pulse t with a controllable pulse width is PULSE Nations Technologies Inc. 189 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 190: Figure 9-20 Example Of One-Pulse Mode

    In one-pulse mode, an edge is detected through the TIx input, and triggers the start of the counter to count to the Nations Technologies Inc. 190 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 191: Clearing The Ocxref Signal On An External Event

    Figure 9-21 Control circuit in reset mode ETRF (CCDATx) Counter(CNT) OCxREF (OCxCEN='0') OCxREF (OCxCEN='1') still ETRF ETRF becomes high high Nations Technologies Inc. 191 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 192: Debug Mode

    User need to do the following steps for this configuration.  Setting TIM1_CTRL2.MMSEL=’ 010’ to use the update event of TIM1 as trigger output. Nations Technologies Inc. 192 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 193: Figure 9-23 Tim3 Gated By Oc1Ref Of Tim1

    Note: The TIM3 clock is not synchronized with the TIM1 clock, this mode only affects the TIM3 counter enable signal. Figure 9-23 TIM3 gated by OC1REF of TIM1 TIM1 CK_INT OC1REF TIM3 TITF Clear TIF = 0 Nations Technologies Inc. 193 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 194: Figure 9-24 Tim3 Gated By Enable Signal Of Tim1

     Setting TIM3_SMCTRL. SMSEL = ‘110’ to set TIM3 to trigger mode.  Setting TIM1_CTRL1.CNTEN=1 to start TIM1. Nations Technologies Inc. 194 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 195: Figure 9-25 Trigger Tim3 With An Update Of Tim1

    TITF flags are set simultaneously. The following figure shows a delay between CNTEN and CK_PSC of TIM1 in master/slave mode. Nations Technologies Inc. 195 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 196: Timx Register Description(X=3)

    Table 9-1 Register overview Offset Register TIMx_CTRL1 000h Reset Value TIMx_CTRL2 004h Reset Value TIMx_SMCTRL 008h Reset Value 00Ch TIMx_DINTEN Nations Technologies Inc. 196 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 197: Control Register 1 (Timx_Ctrl1)

    0: Select the external OCxREF clear from ETR 1: Select the internal OCxREF clear from comparator 14:12 Reserved Reserved, the reset value must be maintained Nations Technologies Inc. 197 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 198 Update generation from the slave mode controller 1: If update interrupt is enabled, only counter overflow/underflow will generate update interrupt Nations Technologies Inc. 198 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 199: Control Register 2 (Timx_Ctrl2)

    Nations Technologies Inc. 199 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 200: Slave Mode Control Register (Timx_Smctrl)

    Note 3: Setting the TIMx_SMCTRL.EXCEN bit has the same effect as selecting external clock mode 1 and connecting TRGI to ETRF (TIMx_SMCTRL.SMSEL = 111 and TIMx_SMCTRL.TSEL = 111). Nations Technologies Inc. 200 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 201 Note: These bits must be changed only when not in use (e. g. TIMx_SMCTRL.SMSEL=000) to avoid false edge detection at the transition. Reserved Reserved, the reset value must be maintained Nations Technologies Inc. 201 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 202: Interrupt Enable Registers (Timx_Dinten)

    Trigger interrupt enable 0: Disable trigger interrupt 1: Enable trigger interrupt Reserved Reserved, the reset value must be maintained Nations Technologies Inc. 202 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 203: Status Registers (Timx_Sts)

    See TIMx_STS.CC1ITF description. CC1ITF Capture/Compare 1 interrupt flag When the corresponding channel of CC1 is in output mode: Nations Technologies Inc. 203 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 204: Event Generation Registers (Timx_Evtgen)

    0: No action 1: Generated a trigger event Reserved Reserved, the reset value must be maintained Nations Technologies Inc. 204 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 205: Capture/Compare Mode Register 1 (Timx_Ccmod1)

    14:12 OC2MD[2:0] Output Compare 2 mode OC2PEN Output Compare 2 preload enable OC2FEN Output Compare 2 fast enable Nations Technologies Inc. 205 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 206 Note 1: Only when TIMx_CTRL1.ONEPM = 1(In one-pulse mode), PWM mode can be used without verifying the preload register, otherwise no other behavior can be predicted. Nations Technologies Inc. 206 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 207 SAMPLING CK_INT 0010: f , N = 4 SAMPLING CK_INT 0011: f , N = 8 SAMPLING CK_INT Nations Technologies Inc. 207 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 208: Capture/Compare Enable Registers (Timx_Ccen)

    Reserved, the reset value must be maintained. CC2P Capture/Compare 2 output polarity See TIMx_CCEN.CC1P description. CC2EN Capture/Compare 2 output enable See TIMx_CCEN.CC1EN description. Nations Technologies Inc. 208 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 209: Counters (Timx_Cnt)

    GPIO and AFIO registers. Counters (TIMx_CNT) Offset address: 0x24 Reset value: 0x0000 Bit field Name Description 15:0 CNT[15:0] Counter value Nations Technologies Inc. 209 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 210: Prescaler (Timx_Psc)

    CC1 channel is configured as output: CCDAT1 contains the value to be compared to the counter TIMx_CNT, signaling on the OC1 output. Nations Technologies Inc. 210 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 211: Capture/Compare Register 2 (Timx_Ccdat2)

     16-bit programmable prescaler. (The frequency division factor can be configured with any value between 1 and 65536) Nations Technologies Inc. 211 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 212: Basic Timers Description

    1 and 65536. It can be changed on the fly as it is buffered. The prescaler value is only taken into account at the next update event. Nations Technologies Inc. 212 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 213: Counter Mode

    When an update event occurs, the counter will still be cleared and the prescaler counter will also be set to 0 (but the prescaler value will remain unchanged). Nations Technologies Inc. 213 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 214: Figure 10-3 Timing Diagram Of Up-Counting. The Internal Clock Divider Factor = 2/N

    Internal clock CK_PSC divided by N Timer clock = CK_CNT Counter register Counter overflow Update interrupt flag(UDITF) Update event(UEV) Nations Technologies Inc. 214 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 215: Figure 10-4 Timing Diagram Of The Up-Counting, Update Event When Arpen=0/1

    Counter overflow Update event(UEV) Update interrupt flag(UDITF) Auto-reload preload register Write a new value in TIMx_AR Auto-reload shadow register Nations Technologies Inc. 215 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 216: Clock Selection

    For abbreviations used in registers, see section 1.1 These peripheral registers can be operated as half word (16-bits) or word (32-bits). Nations Technologies Inc. 216 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 217: Register Overview

    Bit field Name Description 15:8 Reserved Reserved, the reset value must be maintained ARPEN ARPEN: Auto-reload preload enable Nations Technologies Inc. 217 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 218: Interrupt Enable Registers (Timx_Dinten)

    Reserved, the reset value must be maintained UIEN Update interrupt enable 0: Disable update interrupt 1: Enables update interrupt Nations Technologies Inc. 218 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 219: Status Registers (Timx_Sts)

    1: Timer counter will restart and all shadow register will be updated. It will restart prescaler counter also. Counters (TIMx_CNT) Offset address: 0x24 Reset value: 0x0000 Nations Technologies Inc. 219 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 220: Prescaler (Timx_Psc)

    These bits define the value that will be loaded into the actual auto-reload register. See 10.3.1 for more details. When the TIMx_AR.AR [15:0] value is null, the counter does not work. Nations Technologies Inc. 220 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 221: Independent Watchdog (Iwdg)

    Can choose to stop counting or work normally in debug mode  Support low power consumption mode: you can choose to work or freeze in stop mode Nations Technologies Inc. 221 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 222: Iwdg Function Description

    IWDG_STS.PVU bit and/or IWDG_STS.CRVU bit. The reload operation (IWDG_KEY.KEYV[15:0] configured with value of 0xAAAA) will also cause the registers to Nations Technologies Inc. 222 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 223: Debug Mode

    Pre-scale register and reload register controls the time that generates reset, as shown in Table 13 1. Nations Technologies Inc. 223 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 224: Iwdg Configuration Flow

    Reserved Reset Value IWDG_PREDIV PD[2:0] 004h Reserved Reset Value IWDG_RELV REL[11:0] 008h Reserved Reset Value 00Ch IWDG_STS Reserved Nations Technologies Inc. 224 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 225: Iwdg Key Register (Iwdg_Key)

    IWDG_STS.PVU bit must be 0 otherwise PD [2:0] value cannot be changed. Divide number is as follow: 000: Prescaler divider =4 001: Prescaler divider =8 Nations Technologies Inc. 225 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 226: Iwdg Reload Register (Iwdg_Relv)

    IWDG_STS.CRVU bit is ‘0’. IWDG Status register (IWDG_STS) Address offset:0x0C Reset value:0x0000 0000 Nations Technologies Inc. 226 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 227: Iwdg Freeze Register (Iwdg_Freeze)

    The current value of IWDG_FREEZE.FREEZE can be determined by reading the freeze register firstly, and then the switch freeze operation can be performed. Nations Technologies Inc. 227 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 228: Analog To Digital Conversion (Adc)

    ADC function description Below is a block diagram of an ADC module. Table 12-1 shows the description of ADC pins. Nations Technologies Inc. 228 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 229: Table 12-1 Adc Pins

    Input, analog power supply ground Equivalent to V analog power supply ground ADCx_IN[8:0] Analog input signal 9 analog external input channels Nations Technologies Inc. 229 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 230: Adc Clock

    Internal channel The V is connected with channel ADC_IN9. REFINT Internal channels can be converted by regular channels. Nations Technologies Inc. 230 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 231: Single Conversion Mode

    ADC_CTRL2.ON to 1 again through software. To start the conversion and after 24 cycles, the end of conversion flag bit will be set to 1 after the conversion is completed. Nations Technologies Inc. 231 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 232: Analog Watchdog

    By configuring ADC_CTRL1.SCAMD to 1, the scan mode can be turned on, and by configuring the registers ADC_DATx.SEQx[3:0], the conversion sequence can be selected, and the ADC will scan and convert all the selected Nations Technologies Inc. 232 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 233: Data Aligned

    Table 12-5 ADC is used for external triggering of regular channels EXTRSEL[3:0] Trigger source Type 0000 TIM1_CC1 event Internal signal from the on-chip timer Nations Technologies Inc. 233 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 234: Adc Interrupt

    Reserved Reset Value ADC_CTRL1 004h Reserved Reset Value ADC_CTRL2 008h Reserved Reset Value ADC_CTRL3 00Ch Reserved Reset Value Nations Technologies Inc. 234 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 235: Adc Status Register (Adc_Sts)

    This bit is set by hardware at the end of channel group conversion and cleared by software 0: the conversion is not complete. 1: The conversion is complete. Nations Technologies Inc. 235 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 236: Adc Control Register 1 (Adc_Ctrl1)

    Analog watchdog channel select bits These bits are set and cleared by software. They select the input channel to be guarded by Nations Technologies Inc. 236 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 237: Adc Control Register 2 (Adc_Ctrl2)

    It starts a conversion of a group of channels if SWSTRRCH is selected as trigger event by the ADC_CTRL2.EXTRSEL[3:0] bits. 0: Reset state 1: Starts conversion of channels Nations Technologies Inc. 237 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 238: Adc Control Register 3 (Adc_Ctrl3)

    ADC control register 3 (ADC_CTRL3) Address offset: 0x0C Reset value: 0x0000 0040 Nations Technologies Inc. 238 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 239: Adc Sampling Time Register (Adc_ Sampt)

    Reserved,the reset value must be maintained. ADC sampling time register (ADC_ SAMPT) Address offset: 0x10 Reset value: 0x0000 0000 Nations Technologies Inc. 239 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 240: Adc Watchdog High Threshold Register (Adc_Wdghigh)

    These bits define the high threshold for simulating a watchdog. ADC watchdog low threshold register (ADC_WDGLOW) Address offset: 0x18 Nations Technologies Inc. 240 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 241: Adc Regular Data Register X (Adc_Datx) (X= 0

    These bits are read-only and contain the conversion results of the regular channel.The data is left- aligned or right-aligned. Nations Technologies Inc. 241 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 242: Comparator (Comp)

    Filter window size can be configured  Filter threshold size can be configured  The sampling frequency for filtering can be configured Nations Technologies Inc. 242 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 243: Comp Configuration Process

    For interconnection of comparator output ports, please refer to the AFIO remapping chapter,Remap IO multiplexing function in GPIOx_AFL/AFH. COMP_OUT can be mapped to PA8, The comparator INP pins have the following configuration: Nations Technologies Inc. 243 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 244: Interrupt

    Table 13-1 Register overview Offset Register COMP_INTEN 000h Reserved Reset Value COMP_INTSTS 004h Reserved Reset Value 008h Reserved 00Ch COMP_LOCK Reserved Nations Technologies Inc. 244 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 245: Comp Interrupt Enable Register (Comp_Inten)

    Comparator interrupt enable register. 0: Disable 1: Enable COMP interrupt status register (COMP_INTSTS) Address offset :0x04 Reset value :0x0000 0000 Nations Technologies Inc. 245 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 246: Comp Lock Register (Comp_Lock)

    Comparator output is selected by blanking source control 0: No blanking 1: TIM1 OC5 selected as blanking source Nations Technologies Inc. 246 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 247: Comp Filter Control Register (Comp_Filc)

    This bit switches COMP ON/OFF. 0: Disable 1: Enable COMP filter control register (COMP_FILC) Address offset :0x14 Reset value :0x0000 0000 Nations Technologies Inc. 247 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 248: Comp Filter Clock Register (Comp_Filp)

    CLKPSC + 1. 0: Every clock 1: Every 2 clocks 2: Every 3 clocks 65535: Every 65536 clocks Nations Technologies Inc. 248 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 249: Inter-Integrated Circuit Bus(I 2 C)

    Since devices of different processors may be connected to the I2C bus, the levels of logic '0' and logic '1' are not fixed Nations Technologies Inc. 249 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 250: Software Communication Process

    The functional block diagram of I C interface is shown in the figure below. Nations Technologies Inc. 250 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 251: Figure 14-1 I2C Functional Block Diagram

    SDA and SCL are drain open circuit structures, and the signal "wire-and" logic is realized through an external Nations Technologies Inc. 251 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 252: Clock Synchronization

    The I2C module supports 7-bit and 10-bit addresses, and the user can configure the address of the I2C slave through Nations Technologies Inc. 252 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 253 I2C_STS1.ACKFAIL bit (acknowledge fail) of the I2C slave will be set to notify the software Nations Technologies Inc. 253 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 254: Figure 14-3 Slave Transmitter Transfer Sequence Diagram

    I2C_DAT register, and then the I2C_STS1.RXDATNE bit is cleared to 0. Note that if the Nations Technologies Inc. 254 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 255: Figure 14-4 Slave Receiver Transfer Sequence Diagram

    I2C timing. When these two steps are completed, I2C runs in the slave mode by default, waiting for receiving the start bit and address. Nations Technologies Inc. 255 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 256 I2C_STS1.BSF bit (byte transmission end), and the I2C interface will keep SCL low before clearing the I2C_STS1.BSF bit. After reading I2C_STS1, writing to the I2C_DAT register will clear the I2C_STS1.BSF Nations Technologies Inc. 256 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 257: Figure 14-5 Master Transmitter Transfer Sequence Diagram

    START/STOP conditions, of course, you can also use the ordinary master receive mode. In master mode, software receiving data from I2C bus should follow the following steps: Nations Technologies Inc. 257 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 258 In this mode, the I2C interface receives data bytes from the SDA line and sends them to the DAT register through the internal shift register. Once the first byte is received, the hardware will set the Nations Technologies Inc. 258 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 259: Figure 14-6 Master Receiver Transfer Sequence Diagram

    4. EV7: I2C_STS1.RXDATNE=1, read the DAT register to clear this event. 5. EV7_1: I2C_STS1.RXDATNE =1, read the DAT register to clear this event. Set I2C_CTRL1.ACKEN=0 and Nations Technologies Inc. 259 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 260: Error Conditions Description

    In this situation, the last received Nations Technologies Inc. 260 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 261: Packet Error Check

    (slave) I2C event interrupt EVTINTEN 10-bit header sent (master) ADDR10F Received stop (slave) STOPF Data byte transfer finish Nations Technologies Inc. 261 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 262: I2C Registers

    Reset Value I2C_OADDR2 ADDR2[7:1] 00Ch Reserved Reset Value I2C_DAT DATA[7:0] 010h Reserved Reset Value I2C_STS1 014h Reserved Reset Value Nations Technologies Inc. 262 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 263: I2C Control Register 1 (I2C_Ctrl1)

    0: I2C_CTRL1.ACKEN bit determines whether to send an ACK to the byte currently being received; I2C_CTRL1.PEC bit indicates that the byte in the current shift register is PEC. Nations Technologies Inc. 263 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 264 1: Enable General call. acknowledge(ACK) the address 00h. PEC enable PECEN 0: Disable PEC module; 1: Enable PEC module. Nations Technologies Inc. 264 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 265: I2C Control Register 2 (I2C_Ctrl2)

    This interrupt is generated when: I2C_STS1.BUSERR = 1; I2C_STS1.ARLOST = 1; I2C_STS1.ACKFAIL = 1; I2C_STS1.OVERRUN = 1; I2C_STS1.PECERR = 1; Nations Technologies Inc. 265 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 266: I2C Own Address Register 1 (I2C_Oaddr1)

    Note: don't care these bits in 7-bit address mode I2C Own address register 2 (I2C_OADDR2) Address offset: 0x0C Reset value: 0x0000 Nations Technologies Inc. 266 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 267: I2C Data Register (I2C_Dat)

    1: PEC error: receiver will returns NACK (It doesn't matter if I2C_CTRL1.ACKEN is enabled or not) OVERRUN Overrun/Underrun Nations Technologies Inc. 267 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 268 This bit is cleared by software reading and writing to the data register, or cleared by hardware when I2C_CTRL1.EN=0. 0: Data register is empty; 1: Data register is not empty. Nations Technologies Inc. 268 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 269 0: Address mismatch or no address received(slave mode) or Address sending did not end(master mode); 1: Received addresses matched(slave mode) or Address sending ends(master mode) Nations Technologies Inc. 269 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 270: I2C Status Register 2 (I2C_Sts2)

    (I2C_STS1.ARLOST=1), or when I2C_CTRL1.EN=0, the hardware clears it. 0: Data receiving mode 1: Data transmission mode; Nations Technologies Inc. 270 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 271: I2C Clock Control Register (I2C_Clkctrl)

    If duty cycle = Tlow/Thigh = 2/1: CLKCTRL = f (Hz)/100000/3 PCLK Tlow = 2 × CLKCTRL× T PCLK Nations Technologies Inc. 271 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 272: I2C Rise Time Register (I2C_Tmrise)

    Address offset: 0x24 Reset value: 0x0000 Bit field Name Description 15:14 Reserved Reserved SCLAFENN SCL analog filter enable. 0:Enable 1:Disable Nations Technologies Inc. 272 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 273: I2C Master Receive Byte Register (I2C_Bytenum)

    Note: If you need to reconfigure BYTENUM after receiving all bytes, you need to wait for I2C_STS2.BUSY is 0 and re-enabled I2C_CTRL1.ACKEN Nations Technologies Inc. 273 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 274: Universal Asynchronous Receiver Transmitter (Uart)

    Receive data register full  Idle line detected  Data overflow detected  Frame error  Noise error  Parity error Nations Technologies Inc. 274 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 275: Functional Block Diagram

    TX pin is pulled high. When the transmitter is inactive, the TX pin reverts to the I/O Nations Technologies Inc. 275 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 276: Uart Frame Format

    Stat Stop bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 bit8 Start Idle frame Start Stop Break frame Nations Technologies Inc. 276 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 277: Transmitter

    9-bit data, the break frame consists of 11 bits of low level, followed by a stop bit. Nations Technologies Inc. 277 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 278: Single Byte Communication

    An interrupt is generated if UART_CTRL1.TXCIEN is '1'.UART_STS.TXC bit is cleared by a software sequence (read UART_STS register first, then write UART_DAT register). Nations Technologies Inc. 278 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 279: Receiver

    Nations Technologies Inc. 279 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 280: Figure 15-6 Start Bit Detection

    If UART_CTRL1.RXEN is reset during data transmission, the data being received will be lost; Nations Technologies Inc. 280 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 281: Table 15-2 Data Sampling For Noise Detection

    Received bits Data validity Effective be invalid be invalid be invalid be invalid be invalid be invalid Effective Nations Technologies Inc. 281 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 282: Generation Of Fractional Baud Rate

    Set baud rate serial number Kbps reality Error% The value in the register 1250 312.5 19.2 19.2 156.25 Nations Technologies Inc. 282 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 283: Even Parity

    | Start bit | 9-bit data | Stop bit | | start bit | 8-bit data | Parity bit | Stop bit | Even parity Nations Technologies Inc. 283 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 284: Multiprocessor Communication

    As shown in the Figure 15-7 below, when an idle frame is detected, UART is woken up, and then UART_CTRL1.RCVWU is cleared by hardware. At this time, UART_STS.IDLEF is not set. Nations Technologies Inc. 284 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 285: Figure 15-7 Mute Mode Using Idle Line Detection

    UART_CTRL1.RCVWU is cleared. The UART_STS.RXDNE bit will be set when this matching address is received. Data can then be transmitted normally. Nations Technologies Inc. 285 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 286: Single-Line Half-Duplex Communication

    UART mode configuration Table 15-8 UART mode setting Communication mode UART1 UART2 Asynchronous mode Hardware flow control mode Nations Technologies Inc. 286 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 287: Uart Registers

    Reset Value UART_CTRL3 014h Reserved Reserved Reset Value UART status register (UART_STS) Address offset: 0x00 Reset value: 0x0000 00C0 Nations Technologies Inc. 287 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 288 The software can clear this bit by reading UART_STS first and then reading UART_DAT. 0: No overrun error was detected. 1: Overflow error detected. Nations Technologies Inc. 288 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 289: Uart Data Register (Uart_Dat)

    DATV[8:0] Data value Contains the data sent or received; Software can change the transmitted data by writing Nations Technologies Inc. 289 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 290: Uart Baud Rate Configuration Register (Uart_Brcf)

    Software can set or clear this bit. 0:UART is disabled. 1:UART is enabled. Word length. Nations Technologies Inc. 290 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 291 Software can set this bit to 1 to make UART enter mute mode, and clear this bit to 0 to wake up UART. Nations Technologies Inc. 291 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 292: Uart Control Register 2(Uart_Ctrl2)

    If the lower four bits of the received data frame are equal to the ADDR[3:0] value, UART will be awakened. UART control register 3(UART_CTRL3) Address offset: 0x14 Nations Technologies Inc. 292 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 293 0: Half-duplex mode is disabled. 1: Half-duplex mode is enabled. Reserved Reserved, the reset value must be maintained. Nations Technologies Inc. 293 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 294: Serial Peripheral Interface (Spi)

     Data bit sequence programmable.  NSS management by hardware or software.  Clock polarity and phase programmable. Nations Technologies Inc. 294 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 295: Spi Function Description

    SPI works in the master mode. Conversely, SPI works in the slave mode. Users can use a standard I/O pin of the master device to control the NSS pin of the slave device. Nations Technologies Inc. 295 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 296: Figure 16-2 Slave Selects Management Of Hardware/Software

    Figure 16-2 Slave selects management of hardware/software The following figure is an example of the interconnection of single master and single slave devices Nations Technologies Inc. 296 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 297: Figure 16-3 Master And Slave Applications

    Regardless of the timing mode used, the master and slave configuration must be the same. Nations Technologies Inc. 297 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 298: Spi Work Mode

    8-bit; When SPI_CTRL1.DATFF = 1, SPI data frame length is 16-bit SPI work mode Master full duplex mode Master full duplex mode (SPI_CTRL1.MSEL=1 (master), SPI_CTRL1.BIDIRMODE=0 (two-wire one-way), Nations Technologies Inc. 298 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 299: Figure 16-5 Schematic Diagram Of The Change Of Te/Rne/Busy When The Host Is Continuously Transmitting In Full Duplex Mode

    The difference is that this mode will not read the received data, so the Nations Technologies Inc. 299 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 300: Figure 16-6 Schematic Diagram Of Te/Busy Change When The Host Transmits Continuously In One-Way Only Mode

    In slave mode, serial data is continuously received when the SPI master device pulls low the NSS signal Nations Technologies Inc. 300 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 301: Figure 16-7 Schematic Diagram Of Rne Change When Continuous Transmission Occurs In Receive-Only Mode

    The software operation flow of the master one-wire bidirectional receive mode is the same as that of the receive-only mode. Slave full duplex mode Slave full duplex mode (SPI_CTRL1.MSEL = 0(slave), SPI_CTRL1.BIDIRMODE = 0(two-wire one-way) and Nations Technologies Inc. 301 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 302: Figure 16-8 Schematic Diagram Of The Change Of Te/Rne/Busy When The Slave Is Continuously Transmitting In Full Duplex Mode

    SPI_CTRL1.RONLY = 0(sending mode and receiving mode)). Figure 16-9 Schematic diagram of TE/BUSY change during continuous transmission in slave unidirectional transmit-only Nations Technologies Inc. 302 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 303 Select SPI_CTRL1.CLKPOL bit and SPI_CTRL1.CLKPHA bit to define the phase relationship between data transmission and serial clock. Nations Technologies Inc. 303 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 304 SPI_STS.BUSY flag will be low for at least one SPI clock cycle between each data item (see Figure 16-9). Nations Technologies Inc. 304 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 305: Status Flag

    In slave mode, the SPI_STS.BUSY flag will be low for 1 SPI clock cycle between each data item transfer. So do not use the SPI_STS.BUSY flag to handle the sending and receiving of each data item. Nations Technologies Inc. 305 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 306: Turn Off The Spi

    Normally, the SPI_STS.MODERR bit of the slave cannot be set to 1. However, in a multi-master configuration, the Nations Technologies Inc. 306 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 307: Spi Interrupt

    Reset Value SPI_DAT DAT[15:0] 00Ch Reserved Reset Value SPI control register 1 (SPI_CTRL1) Address: 0x00 Reset value: 0x0000 Nations Technologies Inc. 307 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 308 Note: When turning off the SPI device, please follow 16.3.4 Section's procedure operation. BR[2:0] Baud rate control 000: fPCLK/2 Nations Technologies Inc. 308 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 309: Spi Control Register 2 (Spi_Ctrl2)

    When an error (SPI_STS.OVER, SPI_STS.MODERR) is generated, this bit controls whether an interrupt is generated 0: Disable error interrupt. 1: Enable error interrupt. Nations Technologies Inc. 309 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 310: Spi Status Register (Spi_Sts)

    Receive buffer is not empty 0: The receive buffer is empty. 1: The receive buffer is not empty. Nations Technologies Inc. 310 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 311: Spi Data Register (Spi_Dat)

    For 16-bit data frame format: the buffer is 16-bit, and the entire data register is used when sending and receiving, that is, SPI_DAT[15:0]. Nations Technologies Inc. 311 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 312: Beeper

    Bit Field Name Description 31:8 Reserved Reserved, the reset value must be maintained. BEEPER_FREQ_SEL[5:0] Beeper output frequency selection: Nations Technologies Inc. 312 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 313 0: Beeper disable(Note: After BEEPER_EN=0, the Beeper output can be turned off immediately by disabling the RCC_APBPCLKEN.BEEPEREN) 1: Beeper enable Nations Technologies Inc. 313 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 314: Debug Support (Dbg)

    ARM Cortex®-M0 core hardware debugging module can provide the following debugging functions:  SW-DP: Serial wire debugging port  AHB-AP: AHB access port  BPU: Break point unit Nations Technologies Inc. 314 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 315: Swd Function

    The pin assignment of SWD debug interface is shown in the following table: Table 25-1 Debug port pin Debug port Pin assignment SWDIO SWCLK Nations Technologies Inc. 315 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 316: Unique Device Serial Number (Uid)

    UCID is 128 bits and complies with the definition of the Nations Technologies chip serial number. It contains information about chip production and version.
  • Page 317 SRAM capacity 4bit 1KB as unit, SRAM siz e = N * 1KB Reserved 4bit Keep it all 1. Nations Technologies Inc. 317 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 318: Version History

    FLASH_USER register read-only bit Table 2-5: modify SWD access rights for L1 level Flash capacity note Table 19-1: modify Nations Technologies Inc. 318 / 319 Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 319: Notice

    It is the responsibility of the user of this document to properly design, program, and test the functionality and safety of any application made of this information and any resulting product. In no event shall NATIONS be liable for any direct, indirect, incidental, special, exemplary, or consequential damages arising in any way out of the use of this document or the Product.

Table of Contents