Nations N32L40 Series User Manual

32-bit arm cortex-m4f microcontroller
Table of Contents

Advertisement

Quick Links

N32L40x series
32-bit ARM® Cortex®-M4F microcontroller
User manual V2.2

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

Summary of Contents for Nations N32L40 Series

  • Page 1 N32L40x series 32-bit ARM® Cortex®-M4F microcontroller User manual V2.2...
  • Page 2: Table Of Contents

    Clock security system (CLKSS) ........................57 LSE Clock security system (LSECSS) ......................58 RTC clock ................................ 58 Watchdog clock ............................... 58 Nations Technologies Inc. Tel:+86-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 Nested vector interrupt register ..........................124 SysTick calibration value register........................124 Interrupt and exception vectors ........................124 External interrupt/event controller (EXTI) ......................127 Introduction ..............................127 Nations Technologies Inc. Tel:+86-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 CRC cyclic redundancy check code register (CRC_CRC16D) ............... 157 LRC result register (CRC_LRC) ........................158 9 Cryptographic algorithm hardware acceleration engine (SAC) ................159 Nations Technologies Inc. Tel:+86-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 Main features of General-purpose timers ......................... 226 General-purpose timers description ......................... 227 Time-base unit ..............................227 Counter mode ..............................228 Clock selection ..............................234 Nations Technologies Inc. Tel:+86-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 13 Low Power Timer (LPTIM) ............................290 Introduction ................................290 Main Features ............................... 290 Block diagram ..............................291 Function description ............................. 291 Nations Technologies Inc. Tel:+86-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 RTC Prescaler Register (RTC_PRE) ......................330 RTC Wakeup Timer Register (RTC_WKUPT) ....................331 RTC Alarm A Register (RTC_ALARMA)..................... 331 RTC Alarm B Register (RTC_ALARMB)..................... 332 Nations Technologies Inc. Tel:+86-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 Continuous conversion mode .......................... 362 Timing diagram ............................... 362 Analog watchdog ............................. 363 Scanning mode ..............................364 Injection channel management ........................364 VIII Nations Technologies Inc. Tel:+86-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 COMP system connection block diagram ......................398 COMP features ..............................399 COMP configuration process ..........................399 COMP working mode ............................400 Window mode ..............................400 Nations Technologies Inc. Tel:+86-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 LCD status register (LCD_STS) ........................445 LCD clear register (LCD_CLR) ........................446 LCD display memory register (LCD_RAM1_COMx x = 0...7) ..............447 Nations Technologies Inc. Tel:+86-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 USART control register 2 register (USART_CTRL2) ................... 512 USART control register 3 register (USART_CTRL3) ................... 513 USART guard time and prescaler register (USART_GTP) ................515 Nations Technologies Inc. Tel:+86-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 S mode) ..............571 SPI TX CRC register(SPI_ CRCTDAT) ....................571 SPI_I S configuration register(SPI_I2SCFG) ..................572 SPI_I2S prescaler register (SPI_I2SPREDIV) .................... 573 Nations Technologies Inc. Tel:+86-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 Receive buffer address register n (USB_ADDRn_RX) ................. 644 Receive data byte number register n (USB_CNTn_RX) ................645 28 Debug support (DBG) ..............................647 Overview ................................647 XIII Nations Technologies Inc. Tel:+86-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 29 Unique device serial number (UID) .......................... 653 Introduction ................................653 UID register ................................653 UCID register ............................... 653 30 Version history ................................654 31 Notice ..................................655 Nations Technologies Inc. Tel:+86-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 Table 5-22 I2C2 alternate function remapping ......................104 Table 5-23 SPI1 alternate function remapping ......................104 Table 5-24 SPI2/I2S2 alternate function remapping ....................105 Nations Technologies Inc. Tel:+86-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 Table 11-2 Register overview ..........................257 Table 11-3 TIMx internal trigger connection ......................264 Table 11-4 Output control bits of standard OCx channel ..................274 Nations Technologies Inc. Tel:+86-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 Table 23-5 when DIV_Decimal != 0. Tolerance of USART receiver ..............489 Table 23-6 Frame format ............................489 Table 23-7 USART interrupt request ........................505 XVII Nations Technologies Inc. Tel:+86-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 Table 27-8 Endpoint packet receive buffer size definition ..................645 Table 28-1 Debug port pin ............................649 Table 28-2 DBG register overview .......................... 650 XVIII Nations Technologies Inc. Tel:+86-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 Figure 10-15 Control circuit in external clock mode 2 .................... 173 Figure 10-16 Capture/compare channel (example: channel 1 input stage) .............. 174 Figure 10-17 Capture/compare channel 1 main circuit .................... 175 Nations Technologies Inc. Tel:+86-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 Figure 11-18 Center-aligned PWM waveform (AR=8) ................... 246 Figure 11-19 Edge-aligned PWM waveform (APR=8) ................... 247 Figure 11-20 Example of One-pulse mode ......................248 Nations Technologies Inc. Tel:+86-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 Figure 18-2 Data register of single DAC channel mode ..................389 Figure 18-3 Time diagram of transitions with trigger disable ................. 390 Figure 18-4 LFSR algorithm for DAC ........................391 Nations Technologies Inc. Tel:+86-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 Figure 23-12 Mute mode using idle line detection ....................495 Figure 23-13 Mute mode detected using address mark ................... 496 XXII Nations Technologies Inc. Tel:+86-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 S Philips protocol waveform (16/32-bit full precision, CLKPOL = 0) ........... 554 Figure 25-15 I S Philips protocol standard waveform (24-bit frame, CLKPOL = 0) ..........554 XXIII Nations Technologies Inc. Tel:+86-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 Figure 27-4 Double buffered bulk endpoint example ....................626 Figure 27-5 Control transfer ............................ 630 Figure 28-1 N32L40x level and Cortex -M4F level debugging block diagram ........... 647 XXIV Nations Technologies Inc. Tel:+86-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: Abbreviations In The Text

    For all models of N32L40x microcontroller series, the existence and number of a peripheral, please refer to the data sheet of the corresponding model. 1 / 655 Nations Technologies Inc. Tel:+86-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: Memory And Bus Architecture

    ICode bus: Connect the ICode bus of Cortex™-M4FP core with the flash instruction interface. Instruction prefetching is completed on this bus. 2 / 655 Nations Technologies Inc. Tel:+86-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: Bus Address Mapping

    Atomic accesses can be made through the bit-band Alias to performed read-modify-write operations on the target bits of the bit-band region. The specific mapping is as follows: 3 / 655 Nations Technologies Inc. Tel:+86-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-1 List Of Peripheral Register Addresses

    0x4002_2000 – 0x4002_23FF FLASH 0x4002_1400 – 0x4002_1FFF Reserved 0x4002_1000 – 0x4002_13FF 0x4002_0C00 – 0x4002_0FFF Reserved 0x4002_0800 – 0x4002_0BFF 4 / 655 Nations Technologies Inc. Tel:+86-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 0x4000_3400 – 0x4000_37FF Reserved 0x4000_3000 – 0x4000_33FF IWDG 0x4000_2C00 – 0x4000_2FFF WWDG 0x4000_2800 – 0x4000_2BFF 0x4000_2400 – 0x4000_27FF COMP 5 / 655 Nations Technologies Inc. Tel:+86-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: Bit Banding

    During system startup, you can select the BOOT mode after the reset through the BOOT0 pin and the user option 6 / 655 Nations Technologies Inc. Tel:+86-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: Boot Configuration

    0x2000 0000 Main Flash start 0x1FFF_0000 0x0800_0000 0x1000 0000 System Memory 0x0000_0000 0x2000 0000 0x08000000 Start 0x1FFF_0000 0x1000 0000 7 / 655 Nations Technologies Inc. Tel:+86-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: Embedded Boot Loader

    Flash memory module organization Bus address space is allocated to the main storage area and the information area. 8 / 655 Nations Technologies Inc. Tel:+86-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: Table 2-3 Flash Bus Address List

    The internal RC oscillator (HSI) must be turned on when the flash memory is programmed (written or erased). 9 / 655 Nations Technologies Inc. Tel:+86-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  Set the FLASH_CTRL.START bit to' 1';  Wait for the FLASH_ STS.BUSY bit to change to' 0'; 10 / 655 Nations Technologies Inc. Tel:+86-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 Unlock the FLASH_CTRL.OPTWE bit;  Set the FLASH_CTRL.OPTER bit to '1';  Set the FLASH_CTRL.START bit to '1'; 11 / 655 Nations Technologies Inc. Tel:+86-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: Option Byte

    0xFF. When the option byte and its complement are both 0xFF (the state after erasing), the above 12 / 655 Nations Technologies Inc. Tel:+86-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: Table 2-4 Option Byte List

     WRP1: write protection on pages 16-31, bit [0] corresponds to Page16 / 17,., bit [7] corresponds to Page30 / 31; 13 / 655 Nations Technologies Inc. Tel:+86-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: Write Protect

    Read protection is set by configuring RDP bytes in the option byte block. Three different read protection levels can be configured, as shown in the following Table 14 / 655 Nations Technologies Inc. Tel:+86-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: Table 2-5 Read Protection Configuration List

     When the system is reset (such as software reset, etc.), the option byte block (including the new 15 / 655 Nations Technologies Inc. Tel:+86-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: Table 2-6 Flash Read-Write-Erase (1) Permission Control Table

    Erase the main memory area is automatically erased. Flash main memory Allow Allow Allow Allow area mass erase 16 / 655 Nations Technologies Inc. Tel:+86-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 Allow Allow Allow Allow area mass erase Read-write- Read-write- Read-write- Flash option byte area Read-write-erase erase erase erase 17 / 655 Nations Technologies Inc. Tel:+86-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 L2 protection level, cannot boot from SRAM level Flash option byte area JTAG/SWD is banned. Flash system memory area SRAM (All) 18 / 655 Nations Technologies Inc. Tel:+86-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 Before 4KB of flash JTAG/SWD No modification Read-only Read-only Read-only level main memory area allowed interface is 19 / 655 Nations Technologies Inc. Tel:+86-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: Icache

    When all the ways are locked, the new data will not be written into the cache. After the software resets 20 / 655 Nations Technologies Inc. Tel:+86-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 After the function 2 is executed, set FLASH_CAHR.LOCKSTOP[1] to 1; Attention: 1. when the channel is latched, the register operation must follow a fixed process -First set 21 / 655 Nations Technologies Inc. Tel:+86-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: Sram

    004h Reset Value FLASH_OPTKEY OPTKEY 008h Reset Value FLASH_STS 00Ch Reserved Reset Value FLASH_CTRL 010h Reserved Reset Value 22 / 655 Nations Technologies Inc. Tel:+86-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 1:Enable FLASH sleep mode. SLMF FLASH sleep mode flag 0:FLASH not working in sleep mode; 1:FLASH working in sleep mode. 23 / 655 Nations Technologies Inc. Tel:+86-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 001: one cycle delay, when 32MHz < SYSCLK <=64MHz Other values: reserved 2.2.4.2.2 The FLASH key register (FLASH_KEY) Address offset: 0x04 Reset value: 0xXXXX XXXX 24 / 655 Nations Technologies Inc. Tel:+86-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 '1', and writing '1' can clear this bit. PVERR programming verification error When an error is reported during verification after programming, the hardware 25 / 655 Nations Technologies Inc. Tel:+86-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 This bit allows an interrupt to be generated when a Flash error occurs (when FLASH_STS.PGERR/ FLASH_STS.WRPERR is set to '1'). 26 / 655 Nations Technologies Inc. Tel:+86-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 0: disable page erase mode; 1: enable page erase mode Program. 0: disable program mode; 1: enable program mode. 27 / 655 Nations Technologies Inc. Tel:+86-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 Note: This bit is read-only. 22:11 Reserved Reserved, the reset value must be maintained. 10:8 BOR_LEV[2:0] BOR reset level 000:1.64V 001:2.10V 010:2.30V 28 / 655 Nations Technologies Inc. Tel:+86-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 Set watchdog 0: hardware watchdog; 1: Software watchdog. Note: This bit is read-only. RDPRT1 Read protection L1 level protection 29 / 655 Nations Technologies Inc. Tel:+86-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 Reserved, the reset value must be maintained. ECCLW After writing a word to a 32-bit Flash address, the corresponding lower 6-bit ECC value. 30 / 655 Nations Technologies Inc. Tel:+86-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 (see for detailed operation instructions 2.2.2.3.3 iCache locking Chapter). 0: disable 1: enable LOCKSTRT[3:0] iCache lock start. 0: disable 1: enable 31 / 655 Nations Technologies Inc. Tel:+86-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: Power Control (Pwr)

    The PWR module consists of a main regulator (MR) and a low power regulator (LPR). Two embedded linear regulators power all digital circuits. The regulator is always enabled after reset. 32 / 655 Nations Technologies Inc. Tel:+86-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: Power Supply Supervisor

    Power-on reset (POR) and brown-out reset (BOR) circuits are integrated inside the chip. BOR is active in all power 33 / 655 Nations Technologies Inc. Tel:+86-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: Figure 3-2 Brown-Out Reset (Bor) Waveform

    PVD can also be configured to monitor the external analog voltage PVD_IN (PB7) (compared to the internal VREFINT (about 1.2V)). 34 / 655 Nations Technologies Inc. Tel:+86-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: Power Modes

    1)SCB_SCR.SLEEPDEEP = 1 System reset and all EXTI code, peripherals that the 2)PWR_CTRL1.LPMSEL = user chooses to keep do 35 / 655 Nations Technologies Inc. Tel:+86-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: Table 3-2 Blocks Running State

    Table 3-2 Blocks running state Stop2 Standby Main Blocks FLASH SRAM1 SRAM2 CSS for HSE CSS for LSE Tamper IWDG 36 / 655 Nations Technologies Inc. Tel:+86-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: Run Mode

    FLASH into sleep mode to reduce power consumption, and the FLASH_AC.SLMEN bit can also restore 37 / 655 Nations Technologies Inc. Tel:+86-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: Sleep Mode

    SLEEP-NOW: If SCB_SCR.SLEEPONEXIT = 0, then WFI or WFE instruction is executed immediately, and the system enters sleep mode immediately. 38 / 655 Nations Technologies Inc. Tel:+86-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: Exit Sleep Mode

    CPU access to SRAM and prevent SRAM timing problems. Additional steps can be taken to further reduce power consumption: 39 / 655 Nations Technologies Inc. Tel:+86-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: Low Power Sleep Mode

    SRAM1/2 can be configured to be retained in STOP2 mode via PWR_CTRL3.RAM1RET and 40 / 655 Nations Technologies Inc. Tel:+86-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: Standby Mode

    If the access to the APB area is in progress, the time to enter the STANDBY mode will be delayed until the APB access is completed. 41 / 655 Nations Technologies Inc. Tel:+86-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: Exit Standby Mode

    To wake up from STANDBY mode using RTC alarm event, EXTI 18 does not need to be configured. PWR_CTRL3.IWKUPLEN needs to be configured. 42 / 655 Nations Technologies Inc. Tel:+86-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: Pwr Registers

    Reset value: 0x0000 0700 (reset by wakeup from STANDBY mode) Bit field Name Description 31:15 Reserved Reserved, the reset value must be maintained. 43 / 655 Nations Technologies Inc. Tel:+86-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: Power Control Register 2 (Pwr_Ctrl2)

    PVD filter enable bit. 0: Disable PVD filtering 1: Enable PVD filtering PLS[2:0] PVD threshold. PLS[2:0] Voltage 2.1v 2.25v 44 / 655 Nations Technologies Inc. Tel:+86-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: Power Control Register 3 (Pwr_Ctrl3)

    1: Duty on mode PBDTLPR PVDBOR state bit in LP RUN mode. 0: Normal mode 1: Duty on mode 45 / 655 Nations Technologies Inc. Tel:+86-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 Reserved, the reset value must be maintained. WKUP2EN Enable WKUP2 pin. Software can set and clear this bit. 46 / 655 Nations Technologies Inc. Tel:+86-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: Power Status Register 1 (Pwr_Sts1)

    Reserved, the reset value must be maintained. WKUPF2 WKUP2 pin wakeup flag. This bit is set by hardware. Can be cleared by software setting 47 / 655 Nations Technologies Inc. Tel:+86-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: Power Status Register 1 (Pwr_Sts1)

    This bit must be polled before increasing the frequency. 0: MCU is in LOW POWER RUN mode 1: MCU is in RUN mode 48 / 655 Nations Technologies Inc. Tel:+86-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: Power Status Clear Register (Pwr_Stsclr)

    Clear WKUP0 wakeup flag. This bit always reads as 0. 0: No effect. 1: Clear wakeup flag PWR_STS1.WKUPF0. 49 / 655 Nations Technologies Inc. Tel:+86-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: Reset And Clock Control (Rcc)

    The reset source can be identified by checking the reset flags in the Control/Status Register (RCC_CTRLSTS) and Low Power Domain Control Register(RCC_LDCTRL). 50 / 655 Nations Technologies Inc. Tel:+86-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: Software Reset

    VDD power up/down will cause a low power domain reset. Clock control unit Four different clock sources can be used to drive the system clock (SYSCLK): 51 / 655 Nations Technologies Inc. Tel:+86-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 FCLK is the free-running clock of Cortex™-M4F. For more details, refer to the ARM Cortex™-M4 technical reference manual. 52 / 655 Nations Technologies Inc. Tel:+86-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: Clock Tree Diagram

    The high-speed external clock signal (HSE) can be generated from the following two clock sources:  HSE external crystal/ceramic resonator 53 / 655 Nations Technologies Inc. Tel:+86-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: External Crystal/Ceramic Resonator (Hse Crystal)

    The HSI clock frequency of each chip has been calibrated to 1% (25° C) before leaving the factory. After the system 54 / 655 Nations Technologies Inc. Tel:+86-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: Msi Clock

    After selecting HSI or HSE (both can be divided by 1 or 2) as the clock source, you can continue to select the frequency divided by 1 or 2 as the final PLL input clock, see Figure 4-4 55 / 655 Nations Technologies Inc. Tel:+86-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: Lse Clock

    The RCC_CTRLSTS.LSIRD bit flag indicates if the LSI clock is stable. At startup, the clock is not released until this 56 / 655 Nations Technologies Inc. Tel:+86-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: System Clock (Sysclk) Selection

    If the HSE oscillator is directly or indirectly used as the system clock (indirectly means: it is used as the PLL input 57 / 655 Nations Technologies Inc. Tel:+86-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: Lse Clock Security System (Lsecss)

    The corresponding GPIO port register must be configured for the corresponding function.The following 7 clock signals can be selected as the MCO clock:  SYSCLK 58 / 655 Nations Technologies Inc. Tel:+86-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: Rcc Registers

    Reserved Reset Value RCC_APB2PRST 00Ch Reserved Reserved Reset Value RCC_APB1PRST 010h Reset Value RCC_AHBPCLKEN 014h Reserved Reset Value 59 / 655 Nations Technologies Inc. Tel:+86-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: Clock Control Register (Rcc_Ctrl)

    RCC_PLLHSIPRE 040h Reserved Reset Value SRAM_PARITY _CTRLSTS 044h Reserved Reset Value Clock Control Register (RCC_CTRL) Address offset: 0x00 60 / 655 Nations Technologies Inc. Tel:+86-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 This bit cannot be cleared when HSE is used directly or indirectly as the system clock. 0: Disable HSE oscillator 1: Enable HSE oscillator 15:7 HSICAL[8:0] Internal high-speed clock calibration value 61 / 655 Nations Technologies Inc. Tel:+86-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: Clock Configuration Register (Rcc_Cfg)

    0110: MCO clock divided by 7, duty cycle 1/(frequency division factor * 2) 0111: MCO clock divided by 8, duty cycle 1/(frequency division factor * 2) 62 / 655 Nations Technologies Inc. Tel:+86-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 00010: PLL input clock × 4 00011: PLL input clock × 5 00100: PLL input clock × 6 63 / 655 Nations Technologies Inc. Tel:+86-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 Set and cleared by software to configure the division factor of APB2 clock (PCLK2). Make sure that PCLK2 does not exceed 32MHz. 64 / 655 Nations Technologies Inc. Tel:+86-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 01: Select HSI as system clock 10: Select HSE as system clock 11: Select PLL output as system clock 65 / 655 Nations Technologies Inc. Tel:+86-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: Clock Interrupt Register (Rcc_Clkint)

    1: Clear the PLLRDIF flag HSERDICLR HSE ready interrupt clear Set by the software to clear the HSERDIF flag. 66 / 655 Nations Technologies Inc. Tel:+86-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 1: Enable HSI ready interrupt LSERDIEN LSE ready interrupt enable Set and cleared by software to enable and disable LSE ready interrupt. 67 / 655 Nations Technologies Inc. Tel:+86-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 This bit is cleared by the software by setting the LSERDICLR bit. 0: No clock ready interrupt caused by LSE oscillator 1: Clock ready interrupt caused by LSE oscillator 68 / 655 Nations Technologies Inc. Tel:+86-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: Apb2 Peripheral Reset Register (Rcc_Apb2Prst)

    1: Reset USART1 TIM8RST TIM8 timer reset Set and cleared by software. 0: Clear the reset 1: Reset TIM8 timer 69 / 655 Nations Technologies Inc. Tel:+86-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: Apb1 Peripheral Reset Register (Rcc_Apb1Prst)

    UCDRRST USBRST I2C2RST I2C1RST Reserved Reserved WWDG Reserved Reserved TIM9RST Reserved COMPRST TIM7RST TIM6RST TIM5RST TIM4RST TIM3RST TIM2RST 70 / 655 Nations Technologies Inc. Tel:+86-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 Set or cleared by software. 0: clear the reset 1: Reset USART3 USART2RST USART2 reset Set and cleared by software. 71 / 655 Nations Technologies Inc. Tel:+86-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 1: Reset TIM3 timer TIM2RST TIM2 timer reset Set and cleared by software. 0: Clear the reset 1: Reset TIM2 timer 72 / 655 Nations Technologies Inc. Tel:+86-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: Ahb Peripheral Clock Enable Register (Rcc_Ahbpclken)

    Set and cleared by software to disable/enable SRAM interface clock during Sleep mode. 0: SRAM interface clock disabled during Sleep mode. 1: SRAM interface clock enabled during Sleep mode 73 / 655 Nations Technologies Inc. Tel:+86-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: Apb2 Peripheral Clock Enable Register (Rcc_Apb2Pclken)

    TIM8 Timer clock enable Set and cleared by software. 0: TIM8 timer clock disabled 1: TIM8 timer clock enabled 74 / 655 Nations Technologies Inc. Tel:+86-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: Apb1 Peripheral Clock Enable Register (Rcc_Apb1Pclken)

    I2C2EN I2C1EN Reserved Reserved WWDG COMP Reserved Reserved TIM9EN Reserved COMPEN TIM7EN TIM6EN TIM5EN TIM4EN TIM3EN TIM2EN FILTEN 75 / 655 Nations Technologies Inc. Tel:+86-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 Set and cleared by software. 0: USART2 clock disabled 1: USART2 clock enabled 16:12 Reserved Reserved, the reset value must be maintained. 76 / 655 Nations Technologies Inc. Tel:+86-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 0: TIM3 clock disabled 1: TIM3 clock enabled TIM2EN TIM2 timer clock enable Set and cleared by software. 77 / 655 Nations Technologies Inc. Tel:+86-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: Low Power Domain Control Register (Rcc_Ldctrl)

    These bits can be reset by setting the LDSFTRST bit. 78 / 655 Nations Technologies Inc. Tel:+86-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: Clock Control/Status Register (Rcc_Ctrlsts)

    PWR_CTRL1.DRBP bit is set. These bits can only be cleared by a low-power domain reset. Any internal or external reset will not affect these bits. Clock Control/Status Register (RCC_CTRLSTS) Address offset: 0x24 Reset value: 0x0C00246C 79 / 655 Nations Technologies Inc. Tel:+86-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 RAM reset flag. Set by hardware when a RAM reset occurs and cleared by software by writing to 80 / 655 Nations Technologies Inc. Tel:+86-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 Set and cleared by software. 0: Disable the internal RC 40 kHz oscillator 1: Enable the internal RC 40 kHz oscillator 81 / 655 Nations Technologies Inc. Tel:+86-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: Ahb Peripheral Reset Register (Rcc_Ahbprst)

    Bit Field Name Description 31:30 Reserved Reserved, the reset value must be maintained. TIMCLKSEL TIM1/8 clock source selection 82 / 655 Nations Technologies Inc. Tel:+86-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 10101: PLL clock divided by 10 10110: PLL clock divided by 12 10111: PLL clock divided by 16 83 / 655 Nations Technologies Inc. Tel:+86-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: Clock Configuration Register 3 (Rcc_Cfg3)

    0: Select HSI oscillator as TRNG 1M input clock 1: Select HSE oscillator as TRNG 1M input clock Reserved Reserved, the reset value must be maintained. 84 / 655 Nations Technologies Inc. Tel:+86-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: Retention Domain Control Register (Rcc_Rdctrl)

    Reserved, the reset value must be maintained. LCDRST LCDreset. Set or cleared by software. 0: clear reset 1: Reset LCD LPUARTRST LPUART reset. 85 / 655 Nations Technologies Inc. Tel:+86-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 When switching the clock source from COMP1/2 to other clock sources, it is recommended to turn off COMP1/2 before switching. 86 / 655 Nations Technologies Inc. Tel:+86-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: Pll And Hsi Configuration Register (Rcc_Pllhsipre)

    SRAM2 parity error reset enable bit. 0: System reset when parity error detected 1: No system reset when parity error is detected 87 / 655 Nations Technologies Inc. Tel:+86-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 0: Trigger an interrupt when a parity error is detected 1: Not trigger an interrupt when a parity error is detected 88 / 655 Nations Technologies Inc. Tel:+86-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: Gpio And Afio

    8-bit byte access is not allowed). The figure below shows the basic structure of an I/O port. 89 / 655 Nations Technologies Inc. Tel:+86-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: I/O Function Description

    Reserved Alternate function push-pull Alternate function push-pull pull-up Alternate function push-pull pull-down Reserved Alternate function open-drain 90 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-2 Input And Output Characteristics Of Different Configurations

    Input data register (I/O status) Readable Readable Reads out 0 Readable Output data register(Output value) Invalid Readable and writable Invalid Readable 91 / 655 Nations Technologies Inc. Tel:+86-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 5-2 Input Floating/Pull-Up/Pull-Down Configuration

    ◆ Push-pull mode: '0' on the output datar egister activates N-MOS, and the pin outputs low level. 92 / 655 Nations Technologies Inc. Tel:+86-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: Figure 5-3 Output Mode Configuration

    The data appearing on the I/O pin is sampled into the input data register  Read access to input data register for I/O status 93 / 655 Nations Technologies Inc. Tel:+86-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: Analog Mode

    Pull-up and pull-down resistors are disabled  When reading the input data register, the value is '0'  Output buffer is disabled 94 / 655 Nations Technologies Inc. Tel:+86-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: Status After Reset

    By writing '1' to the bit to be changed in the set register (GPIOx_PBSC) and reset register (GPIOx_PBC), the 95 / 655 Nations Technologies Inc. Tel:+86-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: External Interrupt/Wake-Up Line

    The SWD-JTAG debug interface is enabled by default when the chip is powered on, and the debug interface is mapped to the GPIO port, as shown in the following table. 96 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-3 Debug Port Image

    ADC external trigger injection conversion is connected to ADC external trigger injection conversion and injection conversion EXTI (0 - 15). TIM8_CH4 connection. 97 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-5 Adc External Trigger Regular Conversion Alternate Function Remapping

    Table 5-7 TIM2 alternate function remapping Alternate function Remap TIM2_ETR PA15 TIM2_CH1 PA15 TIM2_CH2 TIM2_CH3 PB10 TIM2_CH4 PB11 98 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-8 Tim3 Alternate Function Remapping

    5.2.5.6.6 TIM8 alternate function remapping Table 5-11 TIM8 alternate function remapping Alternate function Remap TIM8_ETR TIM8_CH1 TIM8_CH2 TIM8_CH3 TIM8_CH4 TIM8_BKIN 99 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-12 Tim9 Alternate Function Remapping

    CAN signals can be mapped to port A and port B as shown in the table below. Table 5-14 CAN alternate function remapping Alternate function Remap PA11 CAN_RX PA12 CAN_TX 100 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-15 Usart1 Alternate Function Remapping

    Table 5-17 USART3 alternate function remapping Alternate function Remap USART3_CTS PB13 USART3_RTS PB14 PB10 USART3_TX PC10 USART3_RX PB11 101 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-18 Uart4 Alternate Function Remapping

    LPUART alternate function remapping Table 5-20 LPUART alternate function remapping Alternate function Remap LPUART_CTS PB13 PB12 LPUART_RTS PB14 LPUART_TX 102 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-21 I2C1 Alternate Function Remapping

    5.2.5.12.1 I2C1 alternate function remapping Table 5-21 I2C1 alternate function remapping Alternate function Remap PA15 I2C1_SCL PD13 PA14 I2C1_SDA PD12 I2C1_SMBA 103 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-22 I2C2 Alternate Function Remapping

    5.2.5.13.1 SPI1 alternate function remapping Table 5-23 SPI1 alternate function remapping Alternate function Remap SPI1_I2S1_NSS_WS PA10 SPI1_I2S1_SCLK_CK SPI1_I2S1_MISO_MCK SPI1_I2S1_MOSI_SD 104 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-24 Spi2/I2S2 Alternate Function Remapping

    COMP1_OUT 5.2.5.14.2 COMP2 alternate function remapping Table 5-26 COMP2 alternate function remapping Alternate function Remap COMP2_OUT PA12 PA14 105 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-27 Eventout Alternate Function Remapping

    AF10 SEG5~SEG6 PB0~PB1 AF10 SEG7~SEG9 PB3~PB5 AF10 SEG10~SEG15 PB10~PB15 AF10 SEG16 AF10 SEG17 PA15 AF10 SEG18~SEG27 PC0~PC9 AF10 106 / 655 Nations Technologies Inc. Tel:+86-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: I/O Configuration Of Peripherals

    SEG42 PC12 SEG43 I/O configuration of peripherals Table 5-31 ADC/DAC ADC/DAC pin GPIO configuration Analog mode Analog mode 107 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-32 Tim1/Tim8

    Input floating or input pull-up UARTx_RX Half duplex synchronous mode Unused, can be used as general I/O. 108 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-38 Lpuart

    Push-pull alternate output + pull-up Table 5-43 Other Alternate function GPIO configuration EVENT_OUT EVENT OUT Push-pull alternate output 109 / 655 Nations Technologies Inc. Tel:+86-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: Gpio Locking Mechanism

    GPIO register overview GPIOA base address: 0x40010800 GPIOB base address: 0x40010C00 GPIOC base address: 0x40011000 GPIOD base address: 0x40011400 110 / 655 Nations Technologies Inc. Tel:+86-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: Table 5-44 Gpio Register Overview

    AFSEL14[3:0] AFSEL13[3:0] AFSEL12[3:0] AFSEL11[3:0] AFSEL10[3:0] AFSEL9[3:0] AFSEL8[3:0] 024h Reset Value x= B,C,D 1 GPIOx_PBC 028h Reserved Reset Value 111 / 655 Nations Technologies Inc. Tel:+86-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: Gpio Mode Description Register (Gpiox_Pmode)

    11: Analog function mode (state after reset) 21:20 19:18 17:16 15:14 13:12 11:10 GPIO type definition (GPIOx_POTYPE) Address: 0x04 Reset value: 0x0000 0000(x= A,B,C,D) 112 / 655 Nations Technologies Inc. Tel:+86-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: Gpio Port Slew Rate Configuration Register (Gpiox_Sr)

    1:Slow slew rate GPIO pull-up/pull-down description register (GPIOx_PUPD) Address: 0x0C Reset value: 0x6400 0000(x=A) ;0x0000 0100(x=B) ;0x0000 0000(x=C) ;0x0000 0002(x=D) 113 / 655 Nations Technologies Inc. Tel:+86-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: Gpio Input Data Register (Gpiox_Pid)

    I/O port. GPIO output data register (GPIOx_POD) Address: 0x14 Reset value: 0x0000 0000(x=A,B,C,D) 114 / 655 Nations Technologies Inc. Tel:+86-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: Gpio Bit Set/Clear Register (Gpiox_Pbsc)

    1: Set the corresponding PODy bit to 1 GPIO configuration lock register (GPIOx_PLOCK) Address: 0x1C Reset value: 0x0000 0000(x=A,B,C,D) 115 / 655 Nations Technologies Inc. Tel:+86-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: Gpio Alternate Function Low Register (Gpiox_Afl)

    Alternate function configuration bits y for port GPIOx (y = 0…7) 31:28 AFSELy[3:0] 27:24 0000:AF0 23:20 0001:AF1 19:16 0010:AF2 15:12 0011:AF3 116 / 655 Nations Technologies Inc. Tel:+86-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: Gpio Alternate Function High Register (Gpiox_Afh)

    15:12 0011:AF3 11:8 0100:AF4 0101:AF5 0110:AF6 0111:AF7 1000:AF8 1001:AF9 1010:AF10 1011:AF11 1100:AF12 1101:AF13 1110:AF14 1111:AF15 (No alternate function) 117 / 655 Nations Technologies Inc. Tel:+86-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: Gpio Bit Clear Register (Gpiox_Pbc)

    Port GPIOx drive capability configuration bits y (y = 0…15) 31:30 DSy[1:0] 29:28 00:2mA 27:26 01:8mA 25:24 10:4mA 23:22 11:12mA 21:20 19:18 17:16 15:14 13:12 11:10 118 / 655 Nations Technologies Inc. Tel:+86-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: Afio Register

    Reset Value AFIO_EXTI_CFG4 010h Reserved Reset Value AFIO mapping configuration control register (AFIO_RMP_CFG) Address: 0x00 Reset value: 0x0000 0000 119 / 655 Nations Technologies Inc. Tel:+86-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: Afio External Interrupt Configuration Register 1(Afio_Exti_Cfg1)

    Bit field Name Description 31:14 Reserved Reserved, the reset value must be maintained 13:12 EXTI3[1:0] 00:PA3 pin 01:PB3 pin 120 / 655 Nations Technologies Inc. Tel:+86-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: Afio External Interrupt Configuration Register 2(Afio_Exti_Cfg2)

    Reserved, the reset value must be maintained EXTI6[1:0] 00:PA6 pin 01:PB6 pin 10:PC6 pin 11:PD6 pin Reserved Reserved, the reset value must be maintained 121 / 655 Nations Technologies Inc. Tel:+86-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: Afio External Interrupt Configuration Register 3(Afio_Exti_Cfg3)

    10:PC9 pin 11:PD9 pin Reserved Reserved, the reset value must be maintained EXTI8[1:0] 00:PA8 pin 01:PB8 pin 10:PC8 pin 122 / 655 Nations Technologies Inc. Tel:+86-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: Afio External Interrupt Configuration Register 4(Afio_Exti_Cfg4)

    11:PD13 pin Reserved Reserved, the reset value must be maintained EXTI12[1:0] 00:PA12 pin 01:PB12 pin 10:PC12 pin 11:PD12 pin 123 / 655 Nations Technologies Inc. Tel:+86-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: Interrupts And Events

    0x0000_0018 0x0000_001C Reserved ~0x0000_002B System services invoked by SWI Settable SVCall 0x0000_002C directives Settable DebugMonitor Debug monitor 0x0000_0030 124 / 655 Nations Technologies Inc. Tel:+86-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 TIM1 update interrupt 0x0000_00A4 TIM1 triggers and communication Settable TIM1_TRG_COM 0x0000_00A8 interrupt Settable TIM1_CC TIM1 capture comparison interrupt 0x0000_00AC 125 / 655 Nations Technologies Inc. Tel:+86-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 EXTI line 24 LCD global interrupt connected to Settable 0x0000_0138 EXTI line 26 Settable SAC global interrupt 0x0000_013C 126 / 655 Nations Technologies Inc. Tel:+86-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: 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. 127 / 655 Nations Technologies Inc. Tel:+86-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: Functional Description

    In addition, interrupt/event requests can also be generated by software by writing a '1' in the software interrupt/event register. 128 / 655 Nations Technologies Inc. Tel:+86-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: Exti Line Image

    EXTI line 16 is connected to the PVD output  EXTI line 17 is connected to the USB wake up event 129 / 655 Nations Technologies Inc. Tel:+86-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: Exti Registers

    EXTI line 25 is Reserved  EXTI line 26 is connected to the LCD global interrupt EXTI registers EXTI base address: 0x40010400 130 / 655 Nations Technologies Inc. Tel:+86-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: Exti Registers Overview

    Address offset: 0x00 Reset value: 0x0000 0000 Bit Field Name Description 31:27 Reserved Reserved, the reset value must be maintained 131 / 655 Nations Technologies Inc. Tel:+86-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: Exti Event Mask Register (Exti_Emask)

    Reserved Reserved,the reset value must be maintained. RT_CFG26 The rising edge on line 26 triggers the configuration bit 132 / 655 Nations Technologies Inc. Tel:+86-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: Exti Falling Edge Trigger Configuration Register (Exti_Ft_Cfg)

    Software interrupt on line 26 When the bit is' 0 ', writing '1' sets the corresponding pending bit in EXTI_PEND. If 133 / 655 Nations Technologies Inc. Tel:+86-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: Exti Pending Register (Exti_Pend)

    It can be cleared by writing '1' to the bit, or by changing the polarity of the edge detection. EXTI timestamp trigger source selection register (EXTI_TS_SEL) Address offset: 0x00 134 / 655 Nations Technologies Inc. Tel:+86-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 0001: Select EXTI1 as the trigger source of the timestamp event. 1111: Select EXTI15 as the trigger source for the timestamp event. 135 / 655 Nations Technologies Inc. Tel:+86-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: Dma Controller

     Access totally 5 AHB slaves: Flash, SRAM, ADC, APB1 and APB2.  Configurable data transmit number (0~65535). 136 / 655 Nations Technologies Inc. Tel:+86-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: Block Diagram

    After one operation, the controller calculates the number of remaining transfers and updates the source address and the destination address 137 / 655 Nations Technologies Inc. Tel:+86-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: Channel Priority And Arbitration

    When DMA_CHCFGx.PSIZE and DMA_CHCFGx.MSIZE are different, the DMA module aligns the data according to the Table 7-1 below. 138 / 655 Nations Technologies Inc. Tel:+86-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: Table 7-1 Programmable Data Width And Endian Operation (When Pinc = Minc = 1)

    0x8 / BBBAB9B8 0xC / BFBEBDBC 4: R BFBEBDBC [31:0] @0xC, W BFBEBDBC [31:0] @0xC 0xC / BFBEBDBC Notice: 139 / 655 Nations Technologies Inc. Tel:+86-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: Peripheral/Memory Address Incrementation

    Configure channel peripheral address and memory address and transfer direction. Configure channel priority, 0: lowest, 3: highest. Configure peripheral and memory address increment. 140 / 655 Nations Technologies Inc. Tel:+86-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: Flow Control

    Peripheral AHB read to AHB write, single transfer Peripheral Memory APB read to AHB write, single transfer Peripheral 141 / 655 Nations Technologies Inc. Tel:+86-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: Circular Mode

    Totally there are 63 DMA requests from all the peripherals. To have better support with full flexibility, register bits 142 / 655 Nations Technologies Inc. Tel:+86-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: Table 7-4 Dma Request Mapping

    Sel = 31 TIM2_CH3 Sel = 32 TIM2_CH4 Sel = 33 TIM2_UP Sel = 34 TIM3_CH1 Sel = 35 TIM3_CH3 143 / 655 Nations Technologies Inc. Tel:+86-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: Dma Registers

    Table 7-5 DMA register overview Offset Register DMA_INTSTS 000h Reset Value DMA_INTCLR 004h Reset Value 008h DMA_CHCFG1 Reserved 144 / 655 Nations Technologies Inc. Tel:+86-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 ADDR[31:0] 074h Reset Value DMA_MADDR6 ADDR[31:0] 078h Reset Value DMA_CHSEL6 CH_SEL[5:0] 07Ch Reserved Reset Value 080h DMA_CHCFG7 Reserved 145 / 655 Nations Technologies Inc. Tel:+86-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: Dma Interrupt Status Register (Dma_Intsts)

    Global flag for channel x (x=1…8). 28/24/20/16/12/8/4/0 GLBFx Hardware sets this bit when any interrupt events happen in this channel. This bit is 146 / 655 Nations Technologies Inc. Tel:+86-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: Dma Interrupt Flag Clear Register (Dma_Intclr)

    DMA channel x configuration register (DMA_CHCFGx) Note:The x is channel number, x = 1…8 Address offset: 0x08+20 * (x–1) Reset value: 0x0000 0000 147 / 655 Nations Technologies Inc. Tel:+86-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 1: Peripheral address increase with each transfer. CIRC Circular mode. Software can set/clear this bit. 0: Channel will stop after one round of transfer. 148 / 655 Nations Technologies Inc. Tel:+86-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: Dma Channel X Transfer Number Register (Dma_Txnumx)

    DMA channel will decrease this register by 1. If circular mode is enable, it will automatically reload pre-set value when it reach zero. 149 / 655 Nations Technologies Inc. Tel:+86-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: Dma Channel X Peripheral Address Register (Dma_Paddrx)

    Increment of address will be decided by DMA_CHCFGx.MSIZE. With DMA_CHCFGx.MSIZE equal to 01, DMA ignores bit 0 of MADDR and if 150 / 655 Nations Technologies Inc. Tel:+86-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: Dma Channel X Channel Request Select Register (Dma_Chselx)

    0x06:USART3_RX 0x07:UART4_TX 0x08:UART4_RX 0x09:UART5_TX 0x0A:UART5_RX 0x0B:LPUART_TX 0x0C:LPUART_RX 0x0D:SPI1_TX 0x0E:SPI1_RX 0x0F:SPI2_TX 0x10:SPI2_RX 0x11:I2C1_TX 0x12:I2C1_RX 0x13:I2C2_TX 0x14:I2C2_RX 0x15:DAC 0x16:TIM1_CH1 0x17:TIM1_CH2 151 / 655 Nations Technologies Inc. Tel:+86-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 0x2D:TIM5_CH3 0x2E:TIM5_CH4 0x2F:TIM5_UP 0x30:TIM5_TRIG 0x31:TIM6 0x32:TIM7 0x33:TIM8_CH1 0x34:TIM8_CH2 0x35:TIM8_CH3 0x36:TIM8_CH4 0x37:TIM8_COM 0x38:TIM8_UP 0x39:TIM8_TRIG 0x3A:TIM9_CH1 0x3B:TIM9_TRIG 0x3C:TIM9_CH3 0x3D:TIM9_CH4 0x3E:TIM9_UP 152 / 655 Nations Technologies Inc. Tel:+86-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: Crc Calculation Unit

     The verification initial value can be configured, and the size end of the data to be verified can be configured.  Support 8bit LRC check value generation The following figure is the block diagram of CRC unit. 153 / 655 Nations Technologies Inc. Tel:+86-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: Crc Function Description

    If the initial value needs to be set, the LRC register should be configured first. 154 / 655 Nations Technologies Inc. Tel:+86-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: Crc Registers

    The written data is the CRC value to be checked. The read data is the CRC calculation result. Only 32-bit operations are supported. CRC32 independent data register (CRC_CRC32IDAT) Address offset: 0x04 155 / 655 Nations Technologies Inc. Tel:+86-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: Crc32 Control Register (Crc_Crc32Ctrl)

    It can reset CRC32 module and set data register to be 0xFFFF_FFFF. This reset can only write 1, and hardware will clear to 0 automatically. CRC16 control register (CRC_CRC16CTRL) Address offset: 0x0C Reset value: 0x0000 0000 156 / 655 Nations Technologies Inc. Tel:+86-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: Crc16 Input Data Register (Crc_Crc16Dat)

    Note: 8-bits, 16-bits and 32-bits operations are supported. CRC cyclic redundancy check code register (CRC_CRC16D) Address offset: 0x14 Reset value: 0x0000 0000 157 / 655 Nations Technologies Inc. Tel:+86-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: Lrc Result Register (Crc_Lrc)

    CRC_CRC16DAT will be XOR with CRC_LCR register value. The result will be stored in CRC_LRC. Software read the result. It should be cleared before next use. 158 / 655 Nations Technologies Inc. Tel:+86-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: Cryptographic Algorithm Hardware Acceleration Engine (Sac)

    Support MD5 digest algorithm  Support symmetric national cryptographic SM1, SM4, SM7 algorithm and SM3 hash algorithm Note: For the performance and use of the cryptographic algorithm, please contact Nations Technologies sales staff 159 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com...
  • Page 184: Advanced-Control Timers (Tim1 And Tim8)

    Incremental (quadrature) encoder interface: used for tracking motion and resolving rotation direction and position;  Hall sensor interface: used to do three-phase motor control; 160 / 655 Nations Technologies Inc. Tel:+86-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: Tim1 And Tim8 Function Description

    TIMx_CTRL1.UPDIS=0. The counter CK_CNT is valid only when the TIMx_CTRL1.CNTEN bit is set. The counter 161 / 655 Nations Technologies Inc. Tel:+86-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: Prescaler Description

    Depending on the update request source is configured in the TIMx_CTRL1.UPRS, When an update event occurs, the TIMx_STS.UDITF is set, all registers are updated:  The repetition counter reloads the contents of the TIMx_REPCNT 162 / 655 Nations Technologies Inc. Tel:+86-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: 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) 163 / 655 Nations Technologies Inc. Tel:+86-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 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 164 / 655 Nations Technologies Inc. Tel:+86-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: Down-Counting Mode

    In this mode, the TIMx_CTRL1.DIR direction bits have no effect and the count direction is updated and specified by hardware. Center-aligned mode is valid when the TIMx_CTRL1. CAMSEL bit is not equal to "00". 165 / 655 Nations Technologies Inc. Tel:+86-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 10-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) 166 / 655 Nations Technologies Inc. Tel:+86-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: Figure 10-7 A Center-Aligned Sequence Diagram That Includes Counter Overflows And Underflows (Arpen = 1)

    (UEV) is actually only generated when the repeat counter reaches zero, which is valuable for generating PWM signals. 167 / 655 Nations Technologies Inc. Tel:+86-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: Figure 10-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 168 / 655 Nations Technologies Inc. Tel:+86-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 10-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 169 / 655 Nations Technologies Inc. Tel:+86-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: Clock Selection

    Counter clock = CK_CNT=CK_PSC Counter register 63 64 65 66 00 01 02 03 04 05 06 07 170 / 655 Nations Technologies Inc. Tel:+86-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 10-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. 171 / 655 Nations Technologies Inc. Tel:+86-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: Figure 10-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 172 / 655 Nations Technologies Inc. Tel:+86-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: 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. 173 / 655 Nations Technologies Inc. Tel:+86-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: Figure 10-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. 174 / 655 Nations Technologies Inc. Tel:+86-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: Figure 10-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 175 / 655 Nations Technologies Inc. Tel:+86-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: Input Capture Mode

    In capture mode, the TIMx_CCDATx registers are used to latch the counter value after the ICx signal detects. There is a capture interrupt flag TIMx_STS.CCxITF, which can issue an interrupt or DMA request if the 176 / 655 Nations Technologies Inc. Tel:+86-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: Pwm Input Mode

    Configure TIMx_CCEN.CC1P equal to ‘0’ to select the active polarity of filtered timer input 1(TI1FP1), valid on the rising edge. 177 / 655 Nations Technologies Inc. Tel:+86-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: Forced Output Mode

    OCxREF. And the flag still can be set. Therefore, the interrupt and DMA requests still can be sent. 178 / 655 Nations Technologies Inc. Tel:+86-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: Output Compare Mode

    Otherwise the TIMx_CCDATx shadow register will be updated at the next update event. Here is an example. 179 / 655 Nations Technologies Inc. Tel:+86-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: Pwm Mode

    180 / 655 Nations Technologies Inc. Tel:+86-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: Figure 10-22 Center-Aligned Pwm Waveform (Ar=8)

     If the value written into the counter is greater than the value of auto-reload, the direction will not be updated. 181 / 655 Nations Technologies Inc. Tel:+86-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: Figure 10-23 Edge-Aligned Pwm Waveform (Apr=8)

    When TIMx_CNT > TIMx_CCDATx, the reference PWM signal OCxREF is low. Otherwise it will be high. If the compare value in TIMx_CCDATx is greater than the auto-reload value, the OCxREF will remains 1. 182 / 655 Nations Technologies Inc. Tel:+86-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: One-Pulse Mode

    4. TIMx_CCDAT1 writes the count value to be delayed (t ), TIMx_AR - TIMx_CCDAT1 is the count value of DELAY 183 / 655 Nations Technologies Inc. Tel:+86-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: 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. 184 / 655 Nations Technologies Inc. Tel:+86-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: 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. 185 / 655 Nations Technologies Inc. Tel:+86-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: Figure 10-25 Complementary Output With Dead-Time Insertion

    If user set TIMx_CCEN.CCxEN=0 and TIMx_CCEN.CCxNEN=1, it will not complemented, and OCxN will become active when OCxREF is high. On the other hand, if user set TIMx_CCEN.CCxEN=1 and 186 / 655 Nations Technologies Inc. Tel:+86-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: Break Function

     The dead-time generator will reactivated if the timer clock is still provided, and drive the outputs according to the value of TIMx_CTRL2.OIx and TIMx_CTRL2.OIxN after the dead-time when (CCxP ^ OIx) ^ 187 / 655 Nations Technologies Inc. Tel:+86-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 TIMx_BKDT.LCKCFG. However, the TIMx_BKDT.LCKCFG can only be written once after an MCU reset. An example for output behavior in response to a break is as follow 188 / 655 Nations Technologies Inc. Tel:+86-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: Figure 10-26 Output Behavior In Response To A Break

    2. The slave mode is selected as reset mode (TIMx_SMCTRL.SMSEL=100), and the trigger input is selected as TI1 (TIMx_SMCTRL.TSEL=101); 3. Start counter (TIMx_CTRL1.CNTEN = 1) 189 / 655 Nations Technologies Inc. Tel:+86-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: Slave Mode: Trigger Mode

    The delay between the rising edge on TI2 and the actual start of the counter is due to the resynchronization circuit on TI2 input. 190 / 655 Nations Technologies Inc. Tel:+86-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: 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. 191 / 655 Nations Technologies Inc. Tel:+86-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: Figure 10-29 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); 192 / 655 Nations Technologies Inc. Tel:+86-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: Timer Synchronization

    The following figure shows the output timing diagram of OCx and OCxN when a COM commutation event occurs in three different configurations: 193 / 655 Nations Technologies Inc. Tel:+86-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: Encoder Interface Mode

    The relationship between the counting direction and the encoder signal is shown in Table 10-1 Counting direction versus encoder signals: 194 / 655 Nations Technologies Inc. Tel:+86-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: Table 10-1 Counting Direction Versus Encoder Signals

    The following figure shows the example of counter behavior when IC1FP1 polarity is inverted (CC1P= '1', other configurations are the same as above) 195 / 655 Nations Technologies Inc. Tel:+86-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: Interfacing With Hall Sensor

    (TIMx_CTRL2.CCPCTL=1) and support the rising edge of TRGI Trigger an update (TIMx_CTRL2.CCUSEL=1). This example is shown in the following figure. 196 / 655 Nations Technologies Inc. Tel:+86-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: Advanced-Control

    Interfacing timer Counter(CNT) (CCDAT2) CCDAT1 TRGO=OC2REF Advanced-control timers(TIM1&TIM8) OC1N OC2N OC3N Write CCxEN、CCxNEN and OCxMD for next step 197 / 655 Nations Technologies Inc. Tel:+86-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: Timx Register Description(X=1, 8)

    Reset Value TIMx_CCMOD1 Reset Value 018h TIMx_CCMOD1 Reset Value TIMx_CCMOD2 01Ch Reset Value TIMx_CCMOD2 01Ch Reset Value 020h TIMx_CCEN 198 / 655 Nations Technologies Inc. Tel:+86-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: Control Register 1 (Timx_Ctrl1)

    Reset Value TIMx_CCDAT6 CCDAT6[15:0] 058h Reserved Reset Value Control register 1 (TIMx_CTRL1) Offset address: 0x00 Reset value: 0x0000 0000 199 / 655 Nations Technologies Inc. Tel:+86-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 Note: Switching from edge-aligned mode to center-aligned mode is not allowed when the counter is still enabled (TIMx_CTRL1.CNTEN = 1). Direction 0: Up-counting 1: Down-counting 200 / 655 Nations Technologies Inc. Tel:+86-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: Control Register 2 (Timx_Ctrl2)

    TIMx_CTRL1.CNTEN bit is set in the software. Trigger mode can automatically set TIMx_CTRL1.CNTEN bit by hardware. Control register 2 (TIMx_CTRL2) Offset address: 0x04 Reset value: 0x0000 0000 201 / 655 Nations Technologies Inc. Tel:+86-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 010: Update - The update event is selected as the trigger output (TRGO). For example, a master timer clock can be used as a slave timer prescaler. 202 / 655 Nations Technologies Inc. Tel:+86-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: Slave Mode Control Register (Timx_Smctrl)

    ETRF signal in this mode. 0: External clock mode 2 disable. 1: External clock mode 2 enable. 203 / 655 Nations Technologies Inc. Tel:+86-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 (via TRGO) and its slaves. This is useful when several timers are required to be synchronized to a single external event. TSEL[2:0] Trigger selection 204 / 655 Nations Technologies Inc. Tel:+86-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: Dma/Interrupt Enable Registers (Timx_Dinten)

    TIM2 TIM3 TIM4 TIM8 TIM1 TIM2 TIM4 TIM5 DMA/Interrupt enable registers (TIMx_DINTEN) Offset address: 0x0C Reset value: 0x0000 205 / 655 Nations Technologies Inc. Tel:+86-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 Capture/Compare 3 interrupt enable 0: Disable capture/compare 3 interrupt 1: Enable capture/compare 3 interrupts CC2IEN Capture/Compare 2 interrupt enable 206 / 655 Nations Technologies Inc. Tel:+86-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: Status Registers (Timx_Sts)

    1: TIMx_STS.CC1ITF was already set when the value of the counter has been captured in the TIMx_CCDAT1 register. Reserved Reserved, the reset value must be maintained BITF Break interrupt flag 207 / 655 Nations Technologies Inc. Tel:+86-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 Update interrupt flag This bit is set by hardware when an update event occurs under the following conditions: 208 / 655 Nations Technologies Inc. Tel:+86-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: Event Generation Registers (Timx_Evtgen)

    1: Generated a COM event Note: This bit is only valid for channels with complementary outputs. CC4GN Capture/Compare 4 generation 209 / 655 Nations Technologies Inc. Tel:+86-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: Capture/Compare Mode Register 1 (Timx_Ccmod1)

    Output compare mode: Bit field Name Description OC2CEN Output Compare 2 clear enable 210 / 655 Nations Technologies Inc. Tel:+86-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 1: Enable preload function of TIMx_CCDAT1 register. Only read and write operations to preload registers. When an update event occurs, the value of TIMx_CCDAT1 is loaded into 211 / 655 Nations Technologies Inc. Tel:+86-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 N events are recorded. 0000: No filter, sampling at f frequency 0001: f , N = 2 SAMPLING CK_INT 212 / 655 Nations Technologies Inc. Tel:+86-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: Capture/Compare Mode Register 2 (Timx_Ccmod2)

    Capture/compare mode register 2 (TIMx_CCMOD2) Offset address: 0x1C Reset value: 0x0000 See the description of the CCMOD1 register above Output comparison mode: 213 / 655 Nations Technologies Inc. Tel:+86-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 Note: CC4SEL is writable only when the channel is off (TIMx_CCEN.CC4EN = 0). IC3F[3:0] Input Capture 3 filter 214 / 655 Nations Technologies Inc. Tel:+86-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: Capture/Compare Enable Registers (Timx_Ccen)

    CC3NP Capture/Compare 3 Complementary output polarity See TIMx_CCEN.CC1NP description. CC3NEN Capture/Compare 3 complementary output enable See TIMx_CCEN.CC1NEN description. 215 / 655 Nations Technologies Inc. Tel:+86-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 1: Enable - Enable output OC1 signal. The level of OC1N depends on the value of these bits TIMx_BKDT.MOEN, TIMx_BKDT.OSSI, TIMx_BKDT.OSSR, TIMx_CTRL2.OI1, TIMx_CTRL2.OI1N and TIMx_CCEN.CC1NEN. 216 / 655 Nations Technologies Inc. Tel:+86-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: Table 10-4 Output Control Bits Of Complementary Ocx And Ocxn Channels With Break Function

    Note: The status of external I/O pins connected to complementary OCx and OCxN channels depends on the OCx and OCxN channel states and GPIO and AFIO registers. 217 / 655 Nations Technologies Inc. Tel:+86-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: Counters (Timx_Cnt)

    When the TIMx_AR.AR [15:0] value is null, the counter does not work. Repeat count registers (TIMx_REPCNT) Offset address: 0x30 Reset value: 0x0000 218 / 655 Nations Technologies Inc. Tel:+86-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: Capture/Compare Register 1 (Timx_Ccdat1)

    When configured as output mode, register CCDAT1 and CCDDAT1 are readable and writable. Capture/compare register 2 (TIMx_CCDAT2) Offset address: 0x38 Reset value: 0x0000 219 / 655 Nations Technologies Inc. Tel:+86-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: Capture/Compare Register 3 (Timx_Ccdat3)

    When configured as output mode, register CCDAT3 and CCDDAT3 are readable and writable. Capture/compare register 4 (TIMx_CCDAT4) Offset address: 0x40 Reset value: 0x0000 Bit field Name Description 220 / 655 Nations Technologies Inc. Tel:+86-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: Break And Dead-Time Registers (Timx_Bkdt)

    1: Enable brake input (BRK and CCS clock failure events) Note: Any write to this bit requires an APB clock delay to take effect. 221 / 655 Nations Technologies Inc. Tel:+86-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 DTGN[7:5] = 0xx: dead time = DTGN[7:0] × (t DTGN[7:5] = 10x: dead time =(64+DTGN[5:0]) × (2 × t DTGN[7:5]=110: 222 / 655 Nations Technologies Inc. Tel:+86-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: Dma Control Register (Timx_Dctrl)

    00010: TIMx_SMCTRL, … 10001: TIMx_BKDT, 10010: TIMx_DCTRL DMA transfer buffer register (TIMx_DADDR) Offset address: 0x4C Reset value: 0x0000 223 / 655 Nations Technologies Inc. Tel:+86-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: Capture/Compare Mode Registers 3(Timx_Ccmod3)

    Output compare 5 Preload enable OC5FEN Output compare 5 fast enable 1:0 Reserved Reserved, the reset value must be maintained 224 / 655 Nations Technologies Inc. Tel:+86-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: Capture/Compare Register 5 (Timx_Ccdat5)

    TIM1_CC6 is used to switch the input channel of OPAMP1 and OPAMP2; TIM8_CC6 can switch the input channel of OPAMP2 225 / 655 Nations Technologies Inc. Tel:+86-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: General-Purpose Timers (Tim2, Tim3, Tim4, Tim5 And Tim9)

     Supports capture of internal comparator output signal. TIM9 supports capture of internal HSE, LSI, and LSE signal 226 / 655 Nations Technologies Inc. Tel:+86-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: General-Purpose Timers Description

    UEV. An update event is generated 227 / 655 Nations Technologies Inc. Tel:+86-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: Counter Mode

    Depending on the update request source is configured in the TIMx_CTRL1.UPRS. When an update event occurs, 228 / 655 Nations Technologies Inc. Tel:+86-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 The figure below shows some examples of the counter behavior and the update flags for different division factors in the up-counting mode. 229 / 655 Nations Technologies Inc. Tel:+86-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 11-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) 230 / 655 Nations Technologies Inc. Tel:+86-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 11-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 231 / 655 Nations Technologies Inc. Tel:+86-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: Figure 11-5 Timing Diagram Of The Down-Counting, Internal Clock Divided Factor = 2/N

    In this mode, the TIMx_CTRL1.DIR direction bits have no effect and the count direction is updated and specified by hardware. Center-aligned mode is valid when the TIMx_CTRL1. CAMSEL bit is not equal to "00". 232 / 655 Nations Technologies Inc. Tel:+86-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 11-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) 233 / 655 Nations Technologies Inc. Tel:+86-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: Clock Selection

    Auto-reload active register Clock selection  The internal clock of timers :CK_INT  Two kinds of external clock mode : 234 / 655 Nations Technologies Inc. Tel:+86-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 11-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 235 / 655 Nations Technologies Inc. Tel:+86-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: Figure 11-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. 236 / 655 Nations Technologies Inc. Tel:+86-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: Figure 11-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’ 237 / 655 Nations Technologies Inc. Tel:+86-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: 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. 238 / 655 Nations Technologies Inc. Tel:+86-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: Figure 11-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. 239 / 655 Nations Technologies Inc. Tel:+86-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: Figure 11-14 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 240 / 655 Nations Technologies Inc. Tel:+86-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: Input Capture Mode

    Configure TIMx_CCMOD1.CC1SEL to ‘01’. At this time, the input is the CC1 channel, and IC1 is mapped to TI1.  Program the desired input filter duration: 241 / 655 Nations Technologies Inc. Tel:+86-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: 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. 242 / 655 Nations Technologies Inc. Tel:+86-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: 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 243 / 655 Nations Technologies Inc. Tel:+86-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 Otherwise the TIMx_CCDATx shadow register will be updated at the next update event. Here is an example. 244 / 655 Nations Technologies Inc. Tel:+86-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: Pwm Mode

    User should not modified TIMx_CTRL1.DIR by software, it is updated by hardware. 245 / 655 Nations Technologies Inc. Tel:+86-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: Figure 11-18 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 246 / 655 Nations Technologies Inc. Tel:+86-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: Figure 11-19 Edge-Aligned Pwm Waveform (Apr=8)

    When TIMx_CNT > TIMx_CCDATx, the reference PWM signal OCxREF is low. Otherwise it will be high. If the compare value in TIMx_CCDATx is greater than the auto-reload value, the OCxREF will remains 1. 247 / 655 Nations Technologies Inc. Tel:+86-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: One-Pulse Mode

    4. TIMx_CCDAT1 writes the count value to be delayed (t ), TIMx_AR - TIMx_CCDAT1 is the count value of DELAY 248 / 655 Nations Technologies Inc. Tel:+86-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: 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. 249 / 655 Nations Technologies Inc. Tel:+86-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: Debug Mode

    The synchronization function does not support dynamic change of the connection. User should configure and enable the slave timer before enable the master timer’s trigger or clock. 250 / 655 Nations Technologies Inc. Tel:+86-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: Figure 11-22 Block Diagram Of Timer Interconnection

    Configure TIM1_CCMOD1 register to configure the OC1REF output waveform.  Setting TIM2_SMCTRL.TSEL = ‘000’ to connect TIM1 trigger output to TIM2. 251 / 655 Nations Technologies Inc. Tel:+86-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: Figure 11-23 Tim2 Gated By Oc1Ref Of Tim1

    Setting TIM2_CTRL1.CNTEN= ‘1’ to start TIM2.  Setting TIM1_CTRL1.CNTEN= ‘1’ to start TIM1.  Setting TIM1_CTRL1.CNTEN= ‘0’ to stop TIM1. 252 / 655 Nations Technologies Inc. Tel:+86-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: Figure 11-24 Tim2 Gated By Enable Signal Of Tim1

     Setting TIM2_SMCTRL. SMSEL = ‘110’ to set TIM2 to trigger mode.  Setting TIM1_CTRL1.CNTEN=1 to start TIM1. 253 / 655 Nations Technologies Inc. Tel:+86-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: Figure 11-25 Trigger Tim2 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. 254 / 655 Nations Technologies Inc. Tel:+86-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: Encoder Interface Mode

    Note: Encoder mode and external clock mode 2 are not compatible and must not be selected together. The relationship between the counting direction and the encoder signal is shown in Table 11-1: 255 / 655 Nations Technologies Inc. Tel:+86-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: Table 11-1 Counting Direction Versus Encoder Signals

    The following figure shows the example of counter behavior when IC1FP1 polarity is inverted (CC1P= '1', other configurations are the same as above) 256 / 655 Nations Technologies Inc. Tel:+86-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: Interfacing With Hall Sensor

    Table 11-2 Register overview Offset Register TIMx_CTRL1 000h Reset Value TIMx_CTRL2 004h Reset Value TIMx_SMCTRL 008h Reset Value 257 / 655 Nations Technologies Inc. Tel:+86-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 TIMx_CCDAT4 CCDAT4[15:0] 040h Reserved Reset Value 044h Reserved TIMx_DCTRL DBLEN[4:0] DBADDR[4:0] 048h Reset Value 04Ch TIMx_DADDR Reserved BURST[15:0] 258 / 655 Nations Technologies Inc. Tel:+86-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: Control Register 1 (Timx_Ctrl1)

    = 2 × t CK_INT 10: t = 4 × t CK_INT 11: Reserved, do not use this configuration 259 / 655 Nations Technologies Inc. Tel:+86-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 CCDATx) keep their values. If the TIMx_EVTGEN.UDGN bit is set or a hardware reset is issued by the slave mode controller, the counter and prescaler are reinitialized. 260 / 655 Nations Technologies Inc. Tel:+86-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: Control Register 2 (Timx_Ctrl2)

    010: Update - The update event is selected as the trigger output (TRGO). For example, a master timer clock can be used as a slave timer prescaler. 261 / 655 Nations Technologies Inc. Tel:+86-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: Slave Mode Control Register (Timx_Smctrl)

    When a faster external clock is input, a prescaler can be used to reduce the frequency of ETRP. 262 / 655 Nations Technologies Inc. Tel:+86-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 Reserved Reserved, the reset value must be maintained SMSEL[2:0] Slave mode selection 263 / 655 Nations Technologies Inc. Tel:+86-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: Dma/Interrupt Enable Registers (Timx_Dinten)

    Offset address: 0x0C Reset value: 0x0000 Bit field Name Description Reserved Reserved, the reset value must be maintained 264 / 655 Nations Technologies Inc. Tel:+86-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 0: Disable capture/compare 1 interrupt 1: Enables capture/comparing 1 interrupt UIEN Update interrupt enable 0: Disable update interrupt 1: Enables update interrupt 265 / 655 Nations Technologies Inc. Tel:+86-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: Status Registers (Timx_Sts)

    Except in center-aligned mode, this bit is set by hardware when the counter value is the same as the compare value (see TIMx_CTRL1.CAMSEL bit description). This bit is cleared by software. 0: No match occurred. 266 / 655 Nations Technologies Inc. Tel:+86-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: Event Generation Registers (Timx_Evtgen)

    Reserved, the reset value must be maintained CC4GN Capture/Compare 4 generation See TIMx_EVTGEN.CC1GN description. CC3GN Capture/Compare 3 generation 267 / 655 Nations Technologies Inc. Tel:+86-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: Capture/Compare Mode Register 1 (Timx_Ccmod1)

    OC2CEN Output Compare 2 clear enable 14:12 OC2MD[2:0] Output Compare 2 mode OC2PEN Output Compare 2 preload enable 268 / 655 Nations Technologies Inc. Tel:+86-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 When an update event occurs, the value of TIMx_CCDAT1 is loaded into the active register. Note 1: Only when TIMx_CTRL1.ONEPM = 1(In one-pulse mode), PWM mode can be used 269 / 655 Nations Technologies Inc. Tel:+86-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 SAMPLING CK_INT 0010: f , N = 4 SAMPLING CK_INT 0011: f , N = 8 SAMPLING CK_INT 270 / 655 Nations Technologies Inc. Tel:+86-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: Capture/Compare Mode Register 2 (Timx_Ccmod2)

    Output comparison mode: Bit field Name Description OC4CEN Output compare 4 clear enable 14:12 OC4MD[2:0] Output compare 4 mode 271 / 655 Nations Technologies Inc. Tel:+86-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 Note: CC4SEL is writable only when the channel is off (TIMx_CCEN.CC4EN = 0). IC3F[3:0] Input Capture 3 filter IC3PSC[1:0] Input Capture 3 Prescaler CC3SEL[1:0] Capture/compare 3 selection 272 / 655 Nations Technologies Inc. Tel:+86-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: Capture/Compare Enable Registers (Timx_Ccen)

    0: non-inverted: Capture action occurs when IC1 generates a rising edge. When used as external 273 / 655 Nations Technologies Inc. Tel:+86-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: Counters (Timx_Cnt)

    Counter value Prescaler (TIMx_PSC) Offset address: 0x28 Reset value: 0x0000 Bit field Name Description 15:0 PSC[15:0] Prescaler value 274 / 655 Nations Technologies Inc. Tel:+86-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: Auto-Reload Register (Timx_Ar)

    When configured as output mode, register CCDAT1 is readable and writable. Capture/compare register 2 (TIMx_CCDAT2) Offset address: 0x38 275 / 655 Nations Technologies Inc. Tel:+86-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: Capture/Compare Register 3 (Timx_Ccdat3)

    When configured as output mode, register CCDAT3 is readable and writable. Capture/compare register 4 (TIMx_CCDAT4) Offset address: 0x40 Reset value: 0x0000 276 / 655 Nations Technologies Inc. Tel:+86-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: Dma Control Register (Timx_Dctrl)

    And then the second access to the TIMx_DADDR, you will access the address of “DMA Base Address + 4” 00000: TIMx_CTRL1, 00001: TIMx_CTRL2, 00010: TIMx_SMCTRL, 277 / 655 Nations Technologies Inc. Tel:+86-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: Dma Transfer Buffer Register (Timx_Daddr)

    For the fourth time, DMA access to the TIMx_ DADDR register will be mapped to access TIMx_CCDAT4 register; 278 / 655 Nations Technologies Inc. Tel:+86-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: Basic Timers (Tim6 And Tim7)

    CK_CNT Controller Stop, clear or up Update event Update event auto-reload register The event Interrupt and DMA 279 / 655 Nations Technologies Inc. Tel:+86-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: Basic Timers Description

    89 8A 8B 8C Update event(UEV) Prescaler controller register Write a new value in TIMx_PSC Prescaler counter Prescaler buffer 280 / 655 Nations Technologies Inc. Tel:+86-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: Counter Mode

    The figure below shows some examples of the counter behavior and the update flags for different division factors in the up-counting mode. 281 / 655 Nations Technologies Inc. Tel:+86-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: Figure 12-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) 282 / 655 Nations Technologies Inc. Tel:+86-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: Figure 12-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 283 / 655 Nations Technologies Inc. Tel:+86-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: Clock Selection

    For abbreviations used in registers, see section 1.1. These peripheral registers can be operated as half word (16-bits) or one word (32-bits). 284 / 655 Nations Technologies Inc. Tel:+86-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: Register Overview

    Reserved, the reset value must be maintained ARPEN ARPEN: Auto-reload preload enable 0: Shadow register disable for TIMx_AR register 285 / 655 Nations Technologies Inc. Tel:+86-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: Control Register 2 (Timx_Ctrl2)

    These 3 bits (TIMx_CTRL2. MMSEL [2:0]) are used to select the synchronization information (TRGO) sent to the slave timer in the master mode. Possible combinations are as follows: 286 / 655 Nations Technologies Inc. Tel:+86-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: Dma/Interrupt Enable Registers (Timx_Dinten)

    Update interrupt enable 0: Disable update interrupt 1: Enables update interrupt Status Registers (TIMx_STS) Offset address: 0x10 Reset value: 0x0000 287 / 655 Nations Technologies Inc. Tel:+86-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: Event Generation Registers (Timx_Evtgen)

    Offset address: 0x24 Reset value: 0x0000 Bit field Name Description 15:0 CNT[15:0] Counter value Prescaler (TIMx_PSC) Offset address: 0x28 288 / 655 Nations Technologies Inc. Tel:+86-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: Automatic Reload Register (Timx_Ar)

    These bits define the value that will be loaded into the actual auto-reload register. See 12.3.1 for more details. When the TIMx_AR.AR [15:0] value is null, the counter does not work. 289 / 655 Nations Technologies Inc. Tel:+86-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: Low Power Timer (Lptim)

     Configurable I/O polarity  Encoder mode Pulse counting mode, support single pulse counting, double pulse counting (orthogonal and non- orthogonal) 290 / 655 Nations Technologies Inc. Tel:+86-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: Block Diagram

    The LPTIM can use an internal clock source or an external clock source. The internal clock source can be selected between APB, LSI, LSE, HSI or Comparator 1, 2 by configuring the RCC_RDCTRL.LPTIMSEL[2:0] bits. The 291 / 655 Nations Technologies Inc. Tel:+86-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: Prescaler

    Figure 13-2 shows an example of glitch filter behavior when detected a 2 consecutive samples. 292 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 317: Timer Enable

    Table 13-2 9 trigger inputs corresponding to LPTIM_CFG.TRGSEL[2:0] bits Corresponding trigger input Control bits PB6 or PC3 RTC alarm A 293 / 655 Nations Technologies Inc. Tel:+86-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: Operating Mode

    LPTIM_ARR register value if timer enable. If the one-shot counting mode was previously selected, 294 / 655 Nations Technologies Inc. Tel:+86-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: One-Shot Mode

    Figure 13-5. 295 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 320: Waveform Generation

    The LPTIM output waveform can be configured through the LPTIM_CFG.WAVE bit as follow:  Clearing the LPTIM_CFG.WAVE bit will force the LPTIM to generate a PWM waveform or a single-pulse 296 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 321: Register Update

    The LPTIM_ARR register and LPTIM_COMP register can be updated immediately after a software write operation. If the LPTIM is started, the LPTIM_ARR register and LPTIM_COMP register can be updated when counter overflow. 297 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 322: Counter Mode

    Since the signal injected on the LPTIM external Input1 is also used to clock the LPTIM kernel logic, there 298 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 323: Encoder Mode

    ‘0’. Also, the prescaler division ratio must be equal to its reset 299 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 324: Non-Orthogonal Encoder Mode

    To activate the Non-Encoder mode the LPTIM_CFG.NENC bit has to be set to ‘1’. The LPTIM must first be configured in Continuous mode. 300 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 325: Timeout Function

    The waiting time is configured through the timeout value. 301 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 326: Lptim Interrupts

    LPTIM register overview Table 13-5 LPTIM register overview Offset Register LPTIM_INTSTS 000h Reserved Reset Value LPTIM_INTCLR 004h Reserved Reset Value 302 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 327: Lptim Interrupt And Status Register (Lptim_Intsts)

    Change counter direction to down. In Encoder mode, hardware will set DOWN bit to inform the application the counter direction. 303 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 328: Lptim Interrupt Clear Register (Lptim_Intclr)

    Writing 1 to this bit clears the ARRUPD flag in the LPTIM_INTSTS register CMPUPDCF Compare register update OK Clear Flag 304 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 329: Lptim Interrupt Enable Register (Lptim_Inten)

    Auto reload match interrupt enable bit. 0: ARRM interrupt disabled 1: ARRM interrupt enabled CMPMIE Compare match interrupt enable bit. 305 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 330: Lptim Configuration Register (Lptim_Cfg)

    The WAVEPOL bit controls the output polarity 0: The LPTIM output reflects the compare results between LPTIM_ARR and LPTIM_COMP registers 306 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 331 010: / 4 011: / 8 100: / 16 101: / 32 110: / 64 111: / 128 307 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 332 10: The encoder both edges counting mode. CLKSEL Clock selector The CLKSEL bit selects which clock source the LPTIM will use: 308 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 333: Lptim Control Register (Lptim_Ctrl)

    LPTIM enable The LPTIMEN bit is set and cleared by software. 0: LPTIM is disabled 1: LPTIM is enabled 309 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 334: Lptim Compare Register (Lptim_Comp)

    ARRVAL - 1. LPTIM counter register (LPTIM_CNT) Address offset: 0x1C Reset value: 0x0000 0000 310 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 335 If identical, the reading is reliable. 311 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 336: Real Time Clock (Rtc)

    APB will be reset Reset The following registers will be cleared when the system is reset  RTC_SUBS 312 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 337 Time-stamp function for GPIO event saving. It is a source to Wakeup system from Timestamp low power modes. Alternatively a tamper event could be a source of Time-stamp event. 313 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 338: Function Description

    TAM3F Erase RTC_BKP(1~20) RTC includes the following modules:  Alarm A and Alarm B event/interrupts  Timestamp event/interrupt 314 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 339: Gpio Controlled By Rtc

    RTC_WRP register. During or before and after the unlocking process, the write operation to other registers does not affect the unlocking result. 315 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 340: Rtc Clock And Prescaler

    ), and APB1 clock frequency lower than RTC clock frequency is not allowed in any RTCCLK case. System reset will reset shadow registers. 316 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 341: Calendar Initialization And Configuration

    RTC_INITSTS.RSYF bit is set again.  System reset.  Calendar complete initialization.  Calendar complete synchronization. 2. Reading calendar value when RTC_CTRL.BYPS=1 317 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 342: Calibration Clock Output

    Enable Alarm A/Alarm B interrupt by set RTC_CTRL.ALAIEN/RTC_CTRL.ALBIEN bit(this step can be selected as needed )  Enable Alarm A/Alarm B by setting RTC_CTRL.ALAEN/ RTC_CTRL.ALBEN bit. 318 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 343: Alarm Output

    Enable Wakeup interrupt by set RTC_CTRL.WTIEN bit(this step can be selected as needed )  Enable wakeup timer by setting RTC_CTRL.WTEN bit. 319 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 344: Timestamp Function

    RTC_TMPCFG.TPxTRG bit. The RTC_TAMPx pin will generate a tamper detection event when corresponding edge is detected. 320 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 345: Daylight Saving Time Configuration

    Note: Before starting a shift operation, user must check RTC_SUBS.SS[15] bit is 0. Whenever write RTC_SCTRL register, the RTC_INITSTS.SHOPF flag will be set by hardware, which indicate a 321 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 346: Rtc Digital Clock Precision Calibration

    If the measurement period is the same as calibration period, the error can be eliminated.  The calibration period is 32 seconds (default). 322 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 347: Rtc Low Power Mode

    MIU[3:0] SCT[2:0] SCU[3:0] 000h Reserved Reset Value RTC_DATE YRT[3:0] YRU[3:0] WDU[2:0] MOU[3:0] DAT[1:0] DAU[3:0] 004h Reserved Reset Value 323 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 348 044h Reserved Reserved Reset Value RTC_ALRMBSS MASKSSB[3:0] SSV[14:0] 048h Reserved Reserved Reset Value RTC_OPT 04Ch Reserved Reset Value 324 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 349: Rtc Calendar Time Register (Rtc_Tsh)

    Reserved Reserved, the reset value must be maintained 23:20 YRT[3:0] Describes the year tens value in BCD format 325 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 350: Rtc Control Register (Rtc_Ctrl)

    1: Outputs low level when the selected output triggers(see OUTSEL[1:0]) CALOSEL Calibration output selection When RTC_CTRL.COEN=1, RTCCLK = 32.768KHz and prescale at their default value 326 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 351 Alarm A enable 0: Disable Alarm A 1: Enable Alarm A Reserved Reserved, the reset value must be maintained 327 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 352: Rtc Initial Status Register (Rtc_Initsts)

    The RECPF status flag is automatically set to ‘1’ when software writes to the RTC_CALIB register, indicating that the RTC_CALIB register is blocked. After the 328 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 353 Initialization flag RTC is in initialization state when this bit is ‘1’, and calendar time, date and prescale 329 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 354: Rtc Prescaler Register (Rtc_Pre)

    0: Alarm A update is not allowed 1: Alarm A update is allowed RTC Prescaler Register (RTC_PRE) Address offset: 0x10 Reset value: 0x007F 00FF 330 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 355: Rtc Wakeup Timer Register (Rtc_Wkupt)

    RTC Alarm A Register (RTC_ALARMA) Address offset: 0x1C Reset value: 0x0000 0000 331 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 356: Rtc Alarm B Register (Rtc_Alarmb)

    Describes the second units value in BCD format RTC Alarm B Register (RTC_ALARMB) Address offset: 0x20 Reset value: 0x0000 0000 332 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 357: Rtc Write Protection Register (Rtc_Wrp)

    Describes the second units value in BCD format RTC Write Protection register (RTC_WRP) Address offset: 0x24 Reset value: 0x0000 0000 333 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 358: Rtc Sub-Second Register (Rtc_Subs)

    In this case, the correct time/date is one second slower than the time/date indicated by RTC_TSH/RTC_DATE. RTC Shift Control Register (RTC_SCTRL) Address offset: 0x2C Reset value: 0x0000 0000 334 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 359: Rtc Timestamp Time Register (Rtc_Tst)

    19:16 HOU[3:0] Describes the hour units value in BCD format Reserved Reserved, the reset value must be maintained 335 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 360: Rtc Timestamp Date Register (Rtc_Tsd)

    Describes the date units value in BCD format RTC Timestamp Sub-second Register (RTC_TSSS) Address offset: 0x38 Reset value: 0x0000 0000 336 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 361: Rtc Calibration Register (Rtc_Calib)

    Note: when CW8 = 1, CM[1:0] will always be' 00' CW16 To select a 16-second calibration cycle period 0: Not effect. 337 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 362: Rtc Tamper Configuration Register(Rtc_Tmpcfg

    0: Disable tamper 2 interrupt when TPINTEN = 0. 1: Enabled tamper 2 interrupt TP1MF Tamper 1 mask flag 338 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 363 TPFLT[1:0] != 00, tamper detection is in level mode: 0: low level trigger a tamper detection event. 339 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 364: Rtc Alarm A Sub-Second Register (Rtc_Alrmass)

    0: Disable tamper detection 1: Enable tamper detection RTC Alarm A sub-second register (RTC_ALRMASS) Address offset: 0x44 Reset value: 0x0000 0000 340 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 365: Rtc Alarm B Sub-Second Register (Rtc_Alrmbss)

    (assuming that the rest of the fields match). 0x1: Only SSV[0] is compared and other bits are not compared. 341 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 366: Rtc Option Register (Rtc_Opt)

    0: Open-drain output 1: Push-pull output RTC Backup registers (RTC_BKP(1~20)) Address offset: 0x50 to 0x9C Reset value: 0x0000 0000 342 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 367 If RTC_TMPCFG.TPxNOE=0, these registers are reset when tamper x event detection happens. 343 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 368: Independent Watchdog (Iwdg)

    Reset and low-power wake-up can be matched.  A system reset occurs when the down counter reaches 0x0000 (if watchdog activated). 344 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 369: Function Description

    The reload operation (IWDG_KEY.KEYV[15:0] configured with value of 0xAAAA) will also cause the registers to become write protected again. 345 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 370: Debugging Mode

    Table 15-1 IWDG counting maximum and minimum reset time Minimum(ms) Maximum(ms) Pre-scale factor PD[2:0] RL[11:0]=0 RL[11:0]=0xFFF 409.6 819.2 1638.4 346 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 371: Iwdg Configuration Flow

    Reset value IWDG_PREDIV PD[2:0] 0x04 Reserved Reset value IWDG_RELV REL[11:0] 0x08 Reserved Reset value IWDG_STS 0x0C Reserved Reset value 347 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 372: Iwdg Key Register (Iwdg_Key)

    Address offset: 0x04 Reset value: 0x00000000 Bit field Name Description 31:3 Reserved Reserved, the reset value must be maintained. 348 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 373: Iwdg Reload Register (Iwdg_Relv)

    Therefore, the read value is valid only when the IWDG_STS.CRVU bit is ‘0’. IWDG status register (IWDG_STS) Address offset: 0x0C 349 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 374 Software can only try to change IWDG_PREDIV.PD[2:0] value when IWDG_KEY.KEYV[15:0] bits’ value is 0x5555 and this bit is 0. 350 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 375: Window Watchdog (Wwdg)

    Therefore, before enabling the watchdog, you need to set WWDG_CTRL.T [6] bit to 1, preventing reset right 351 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 376: Timing For Refresh Watchdog And Interrupt Generation

    MCU. Counter count down from 0x7F to 0x3F using scaled APB1 352 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 377: Debug Mode

    Setting WWDG_CTRL.ACTB[7] bit to enable WWDG; Software operates WWDG_STS.EWINTF[0] bit to clear wake-up interrupt flag; Configure WWDG_CFG.EWINT[9] bit to enable early wake-up interrupt. 353 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 378: Wwdg Registers

    A reset is produced when it rolls over from 0x40 to 0x3F (T6 becomes cleared). WWDG config register (WWDG_CFG) Address offset: 0x04 Reset value : 0x0000007F 354 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 379: Wwdg Status Register (Wwdg_Sts)

    ‘0’. A write of ‘1’ has no effect. This bit is also set if the interrupt is not enabled. 355 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 380: Analog To Digital Conversion (Adc)

    Support single conversion mode  Support continuous conversion mode  Support discontinuous mode  Support self-calibration  Support DMA 356 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 381: Function Description

    Supports internal reference voltage (2.048V), please refer to the data sheet for specific parameters Function Description Figure 17-1 is a functional block diagram of an ADC. 357 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 382: Adc Clock

    ADC clock An ADC requires three clocks, HCLK, ADC_CLK and ADC_1MCLK.  HCLK is used for the register access. 358 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 383: Adc Switch Control

    The conversion can be stopped by clearing the ADC_CTRL2.ONbit and placing the ADC in power-off mode. In this 359 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 384: Channel Selection

    Note: During conversion, changes to the ADC_RSEQx or ADC_JSEQ registers are prohibited; the ADC_RSEQx or ADC_JSEQ registers can only be changed when the ADC is idle. 360 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 385: Figure 17-3 Adc Channels And Pin Connections

    [15] Slow Channel [16] ADC_IN16 [16] VREF- Slow Channel [17] [17] VREF- Slow Channel [18] VREFBUFF [18] VREF- 361 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 386: Internal Channel

    ) to ensure its stability. After the ADC is stable, write 1 to ADC_CTRL2.ON again, the STAB 362 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 387: Analog Watchdog

    AWDGERCH AWDGSGLEN There is none Any value All injection channels All regular channels All injection and regular channels 363 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 388: Scanning Mode

    When using this function, the time interval between the injection channel triggers needs to be greater than the time required for the injection sequence to complete the conversion. 364 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 389: Discontinuous Mode

    1. When the conversion of all channels in the conversion sequence is completed, when the next trigger 365 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 390: Calibration

    ADC_JOFFSETx register, so the result can be a negative value; for regular sequence , there is no need to subtract offset value. 366 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 391: Programmable Channel Sampling Time

    SWSTRRCH as the external trigger source, you can start the regular channel conversion by setting ADC_CTRL2.SWSTRRCH to 1. 367 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 392: Dma Requests

    ADC_IN17 channel. When the temperature sensor is working, the ideal 368 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 393: Temperature Sensor Using Flow

    30 degrees celsius SENSE curve (mV/° C or μV/°C) Avg_Slope = temperature and Average slope of a V SENSE 369 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 394: Adc Interrupt

    Reset Value ADC_CTRL1 DCTU[2:0] AWDGCH[4:0] 004h Reserved Reset Value ADC_CTRL2 008h Reserved Reset Value ADC_SAMPT1 00Ch Reserved Reset Value 370 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 395: Adc Status Register (Adc_Sts)

    Reset Value ADC_SAMPT3 05Ch Reserved Reset Value ADC status register (ADC_STS) Address offset: 0x00 Reset value: 0x0000 0000 371 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 396 ADC_LTR and ADC_HTR registers 0: Analog watchdog event not occurs; 1: Analog watchdog event occurs. 372 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 397: Adc Control Register 1 (Adc_Ctrl1)

    This bit is set and cleared by the software to enable or disable automatic injection sequence channel conversion after regular sequence channel conversion is complete 373 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 398 10000: ADC analog input channel 16 10001: ADC analog input channel 17 10010: ADC analog input channel 18 374 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 399: Adc Control Register 2 (Adc_Ctrl2)

    These bits select external events to start the regular sequence conversion The triggering configuration of ADC is as follows 375 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 400 STAB 376 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 401: Adc Sampling Time Register 1 (Adc_Sampt1)

    011: 7.5 cycles 111: 601.5 cycles ADC sampling time register 2 (ADC_ SAMPT2) Address offset: 0x10 Reset value: 0x0000 0000 377 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 402: Adc Injected Channel Data Offset Register X (Adc_Joffsetx)(X=1

    The result of the conversion can be read in the ADC_JDATx register. ADC watchdog high threshold register (ADC_WDGHIGH) Address offset: 0x24 Reset value: 0x0000 0FFF 378 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 403: Adc Watchdog Low Threshold Register (Adc_Wdglow)

    These bits are software-defined as the number (0 to 18) of the 16th conversion channel in the conversion sequence. 14:10 SEQ15[4:0] 15th conversion in regular sequence 379 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 404: Adc Regular Sequence Register 2 (Adc_Rseq2)

    These bits are software-defined as the number (0 to 18) of the 6th transition channel in the conversion sequence. 24:20 SEQ5[4:0] 5th conversion in regular sequence 19:15 SEQ4[4:0] 4th conversion in regular sequence 380 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 405: Adc Injection Sequence Register (Adc_Jseq)

    1st conversion in injected sequence ADC injection data register x (ADC_JDATx) (x= 1…4) Address offset: 0x3C - 0x48 Reset value: 0x0000 0000 381 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 406: Adc Regulars Data Register (Adc_Dat)

    31:19 Reserved Reserved, the reset value must be maintained 18:1 DIFSEL[17:0] Differential mode for channels 18 to 1 382 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 407: Adc Calibration Factor (Adc_Calfact)

    ADC_STS.JSTR =0 (ADC does not process conversion or start conversion) ADC control register 3 (ADC_CTRL3) Address offset: 0x58 Reset value: 0x0000 0043 383 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 408 This bit is set and cleared by software to configure the calibrated single-ended or differential input mode 0: Writing ADC_CTRL2.ENCAL bits will start calibration in single-ended input mode 384 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 409: Adc Sampling Time Register 3 (Adc_Sampt3)

    011: 7.5 cycles 111: 601.5 cycles SAMP18[2:0] Channel Sample Time The channel sampling time definition is consistent with ADC_SAMPT2 385 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 410: Digital To Analog Conversion (Dac)

    Input reference voltage VREF+  External event triggers the conversion DAC block diagram and pins are shown below. 386 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 411: Table 18-1 Dac Pins

    Note: When the DAC is enabled, PA4 needs to be configured as analog input mode. PA4 will automatically connect 387 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 412: Dac Function Description And Operation Description

    8-bit data is right-aligned. (Actually stored in the register DACCHD[11:4] bits, DACCHD is the internal data storage register) 388 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 413: Dac Trigger

    DAC_DATO register. Note: 1. Do not change the DAC_CTRL.TSEL[2:0] bit when the DAC is enabled. 389 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 414: Dac Conversion

    Note: DMA requests for DAC have no accumulative function, and when the second external trigger occurs before the 390 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 415: The Noise

    (overflow bits are discarded). The initial value of LFSR is 0xAAA, and the value of LFSR is updated after 3 APB1 cycles after the trigger event occurs. Figure 18-4 LFSR algorithm for DAC 391 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 416: Triangular Wave Generation

    3 APB1 cycles after the trigger event occurs, the triangular wave counter will accumulate to the maximum amplitude value set, and then decrement to 0, and so on. 392 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 417: Dac Register

    DAC registers overview Table 18-3 DAC registers overview Offset Register DAC_CTRL 000h Reserved Reset Value 004h DAC_SOTTR Reserved 393 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 418: Dac Control Register (Dac_Ctrl)

    ≥1011: unmasked LFSR bit [11:0] / triangular amplitude is equal to 4095 WEN[1:0] DAC noise/triangle wave function selection. The bits are set to 1 and cleared by the software. 394 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 419: Dac Software Trigger Register (Dac_Sottr)

    Reset value: 0x0000 0000 Bit field Name Description 31:1 Reserved Reserved, the reset value must be maintained. TREN DAC software trigger 395 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 420: Bit Right Aligned Data Hold Register For Dac (Dac_Dr12Ch)

    Reserved, the reset value must be maintained. 8-bit right-aligned data hold register for DAC (DAC_DR8CH) Offset address: 0x10 396 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 421: Dac Data Output Register (Dac_Dato)

    11:0 DACCHDO[11:0] DAC data output. These bits are read-only and represent the output data of the DAC channel 397 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 422: Comparator (Comp)

    4. The second character in the 8-bit code of the last line of the chip printed in the factory setting is "B" 398 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 423: Comp Features

    COMPx_FILC.SAMPW[4:0]/2) Configure the filter sampling frequency (for timer applications, sampling frequency should be greater than 5MHz) 399 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 424: Comp Working Mode

    Note 2: The selection of the comparator's PA1/DAC1 is done by configuring COMP1_CTRL.INPDAC The comparator INM pins have the following configuration. INMSEL COMP1 COMP2 400 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 425: Interrupt

    The polarity of COMPx_CTRL.POL is reversed, and the interrupt is enabled. When INPSEL < INMSEL, the comparator interrupt is generated when COMPx_CTRL.OUT is set to 1 by hardware. 401 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 426: Comp Register

    01Ch Reserved COMP2_CTRL 020h Reserved Reset Value COMP2_FILC 024h Reserved Reset Value COMP2_FILP CLKPSC[15:0] 028h Reserved Reset Value 402 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 427: Comp Interrupt Enable Register (Comp_Inten)

    Software controlled Interrupt enable of COMP1. 0: Disable 1: Enable COMP low power select register (COMP_LPCKSEL) Address offset : 0x04 403 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 428: Comp Window Mode Register (Comp_Winmode)

    1: Comparators 1 and 2 are in window mode. COMP lock register (COMP_LOCK) Address offset : 0x0C Reset value : 0x0000 0000 404 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 429: Comp Control Register (Comp1_Ctrl)

    010: TIM8 OC5 selected as blanking source Other configurations: reserved 15:14 HYST[1:0] These bits control the hysteresis level. 00: No hysteresis 405 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 430 These bits allows to select the source connected to the inverting input of the comparator 1. 000:floating; 001:DAC1; 406 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 431: Comp Filter Register (Comp1_Filc)

    0: Disable 1: Enable COMP filter frequency division register (COMP1_FILP) Address offset : 0x18 Reset value : 0x0000 0000 407 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 432: Comp Control Register (Comp2_Ctrl)

    OUTTRG[3:0] These bits select which Timer input must be connected with the comparator 2 output. 0000:Reserved.; 0001:TIM1_BKIN; 0010:TIM1_OCrefclear; 408 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 433: Comp Filter Register (Comp2_Filc)

    0: Comparator disabled 1: Comparator enabled COMP filter register (COMP2_FILC) Address offset : 0x24 Reset value : 0x0000 0000 409 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 434: Comp Filter Frequency Division Register (Comp2_Filp)

    2: Every 3 cycle … COMP output select register (COMP2_OSEL) Address offset : 0x2C Reset value : 0x0000 0000 410 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 435: Comp Reference Voltage Register (Comp_Vrefscl)

    VREF1(DAC1) voltage scaler: 0: disable; 1: enable. COMP test register(COMP_TEST) Address offset : 0x34 Reset value : 0x0000 0000 411 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 436: Comp Interrupt Status Register (Comp_Intsts)

    This bit indicate the interrupt status of COMP2,write 0 to clear. COMP1IS This bit indicate the interrupt status of COMP1,write 0 to clear. 412 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 437: Operational Amplifier (Opamp)

    The output of OPAMP1 is connected to the analog input channel 3 of the ADC The output of OPAMP2 is connected to the analog input channel 7 of the ADC 413 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 438: Opamp Working Mode

    OPAMP are connected to the external port. , the amplification factor is determined by the external RC network. 414 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 439: Opamp Follow Mode

    OPAMPx_CS. VMSSEL or OPAMPx_CS. VMSEL is connected to the output port from the chip interior. A VM pin that is not occupied can be used as another GPIO. 415 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 440: Opamp Internal Gain (Pga) Mode

    OPAMPx_CS. PGAGAN to gain selection.The output of an OPAMP can be input to another OPAMP or a resistive network. OPAMP's VM input pin can be used as a normal GPIO. 416 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 441: Opamp With Filtered Internal Gain Mode

    OPAMAPx_CS.VPSEL is set to be connected to the external pin, and the negative of OPAMP can be connected to components such as capacitors. Figure 20-5 Internal gain mode with filtering 417 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 442: Opamp Calibration

    OPAMP register overview Table 20-1 OPAMP register overview Offset Register OPAMP_CS1 000h Reserved Reset Value OPAMP_CS2 010h Reserved Reset Value 418 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 443: Opamp Control Status Register (Opamp1_Cs)

    When this signal switches, the offset during calibration mode is calibrated. TSTREF Reserved, the reset value must be maintained. 419 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 444: Opamp Control Status Register (Opamp2_Cs)

    Operational amplifier Enable 0: disable; 1: enable. OPAMP Control Status Register (OPAMP2_CS) Offset address: 0x10 Reset value: 0x0000 0000 420 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 445 010: VP2 (PB14); 011: VP3 (PD13); Others :(NC). VMSEL[1:0] OPAMP inverted input selection 00: VM0 (PC5); 01: VM1 (PB0); 421 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 446: Opamp Lock Register (Opamp_Lock)

    After the reset, this bit can be written only once 0: OPAMP2 register can read and write; 1: The OPAMP2 register is read-only. OPAMP1LK With OPAMP2LK. 422 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 447: Liquid Crystal Display Controller (Lcd)

    Support blink function: 1, 2, 3, 4, 8 or all pixels can blink at the specified frequency (0.5Hz, 1Hz, 2Hz or 4Hz)  Pins used for SEG and COM functions should be configured with the appropriate AFIO. 423 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 448: Functional Block Diagram

    DIV[3:0] ck_div SEG[43:0] VSEL LCDEN COM[7:4] Interrupt HDEN CONTRAST[2:0] SEG[43:40] BIAS[1:0] SEG[31:28] SEG[39:0] SEG[43:40] COM[3:0] Analog Switch Array 424 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 449: Functional Description

    Example of frame frequency calculation is shown in the following table: Table 21-1 Frame rate calculation example LCDCLK PRES[3:0] DIV[3:0] Ratio Duty frame 32.768kHz 30.12Hz 32.768kHz 30.12Hz 425 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 450: Common End Driver

    1/2 V at the end of each odd period. 426 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 451: Figure 21-2 Odd-Even Frames Example(1/4 Duty Cycle, 1/3 Bias)

    1 is inactive. When the LCD_CTRL.LCDEN bit is disabled, all COM is pulled to VSS and the LCD_STS.ENSTS flag becomes 427 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 452: Segment Driver

    When the LCD_CTRL.LCDEN bit is disabled, all SEG ports are pulled down to VSS. Below figure shows the waveform with different duty cycles and bias 428 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 453: Figure 21-4 1/2 Duty Cycle, 1/2 Bias

    0/2VLCD COM0 SEG2 SEG3 2/2VLCD 1/2VLCD COM0-SEG0 Activated pixel 0/2VLCD -1/2VLCD -2/2VLCD 1/2VLCD COM0-SEG1 0/2VLCD Inactivated pixel -1/2VLCD 429 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 454: Figure 21-5 1/3 Duty Cycle, 1/3 Bias

    SEG2 0/3VLCD 3/3VLCD 2/3VLCD 1/3VLCD COM0-SEG1 Activated pixel 0/3VLCD -1/3VLCD -2/3VLCD -3/3VLCD 1/3VLCD COM0-SEG0 0/3VLCD Inactivated pixel -1/3VLCD 430 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 455: Figure 21-6 1/4 Duty Cycle, 1/3 Bias

    SEG1 0/3VLCD 3/3VLCD 2/3VLCD 1/3VLCD COM0-SEG1 0/3VLCD Activated pixel -1/3VLCD -2/3VLCD -3/3VLCD 1/3VLCD COM0-SEG0 0/3VLCD Inactivated pixel -1/3VLCD 431 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 456: Blink Function

    LCD_FCTRL.BLINKF[2:0] bits and divide f . Table 21-2 lists configuration examples for ck_div different blink frequencies. 432 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 457: Voltage Generator And Contrast Control

    For LCD_FCTRL.PULSEON[2:0] bits: LCD_FCTRL.PULSEON[2:0] configures the time that R is enabled by the HDEN switch when the COM and SEG 433 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 458: Figure 21-8 Lcd Drive Voltage Control

    2/3 V BUFEN BUFEN LCDRail2 BUFEN 1/2 V 1/3 V BUFEN BUFEN LCDRail3 1/4 V BUFEN BIAS[1] Static 434 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 459: Double Buffer Display

    44 SEG pins and 1, 2, 3 and 4 COM pins are available.In 1/8 duty cycle mode, there are up to 40 SEG pins, and SEG[43:40] can be used as COM[7:4]. 435 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 460: Table 21-3 Com And Seg Pins Mapping Table

    SEG[43:40]/ COM[7:4] SEG[31:28] 30× 4 —— —— COM[3:0] COM[3:0] 34× 4 SEG[32], SEG[35] SEG[32], SEG[35] SEG[31:28] Not used 436 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 461 SEG[27:0] SEG[27:0] SEG[43:40]/ COM[7:4] Not available COM[3] Not used —— —— 20×3 COM[2:0] COM[2:0] SEG[32], SEG[35] SEG[32], SEG[35] 437 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 462 SEG[32], SEG[35] SEG[31:28] Not available SEG[17:0] SEG[17:0] SEG[43:40]/ COM[7:4] SEG[43:40] —— —— STATIC 44×1 COM[3:1] Not used COM[0] COM[0] 438 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 463 3. Not available: The pin is not lead out in the current package; Not used: The pin is lead out in the current package, but this function is not supported according to the current configuration. 439 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 464: Working Process

    LCD registers must be read and written by 32 bits Start address of the LCD controller register is 0x40004000 440 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 465: Lcd Controller Register Overview

    Reset Value LCD_RAM1_COM4 034h Reset Value LCD_RAM2_COM4 038h Reserved Reset Value LCD_RAM1_COM5 03Ch Reset Value 040h LCD_RAM2_COM5 Reserved 441 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 466: Lcd Control Register (Lcd_Ctrl)

    01:1/3 Bias; 10:1/4 Bias; 11: Reserved. DUTY[2:0] Duty selection 000: static LCD; 001:1/2 DUTY; 010:1/3 duty; 011:1/4 duty; 442 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 467: Lcd Frame Control Register (Lcd_Fctrl)

    = ck_pres/(16+n) 0000: ck_div = ck_pres/16; 0001: ck_div = ck_pres/17; 0010: ck_div = ck_pres/18; 1111: ck_div = ck_pres/31. 443 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 468 Pulse on duration This bit configures the pulse duration based on ck_pres. 000: 0; 001: 1 / ck_pres; 444 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 469: Lcd Status Register (Lcd_Sts)

    LCD frame control register synchronization flag Every time the LCD_FCTRL register is updated in the LCDCLK domain, the bit is 445 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 470: Lcd Clear Register (Lcd_Clr)

    0: LCD controller is disabled. 1: LCD controller is enabled. LCD clear register (LCD_CLR) Address offset: 0x0C Reset value: 0x0000 0000 446 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 471: Lcd Display Memory Register (Lcd_Ram1_Comx X = 0

    Display memory LCD_RAM2_COMx (x = 0...3) Pixel bit (y = 0...11), each bit corresponds to a pixel. The pixel value 1 represents activity, and 0 represents inactivity. 447 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 472: Lcd Display Memory Register (Lcd_Ram2_Comx X = 4

    Display memory LCD_RAM2_COMx (x = 4...7) Pixel bits (y = 0...7), each bit corresponds to a pixel. The pixel value 1 represents activity, and 0 represents inactivity. 448 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 473: C Interface

    It support interrupt mode, users can enable or disable interrupt according to their needs. 449 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 474: Sda And Scl Line Control

    The block diagram of I C interface is shown in the figure below. 450 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 475: Start And Stop Conditions

    Clock synchronization and Arbitration The I2C module supports multi-master arbitration, which means two masters can initiate an I2C START 451 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 476: Clock Synchronization

    Each I2C device is identified by a unique address. According to the device function, they can be either a transmitter 452 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 477 I2C_STS1.TXDATE bit is cleared.After that, as long as there is still data to be sent and I2C_STS1.TXDATE is set to 1, the software can write a byte to I2C_DAT register. 453 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 478: Figure 22-3 Slave Transmitter Transfer Sequence Diagram

    After it is found that it is set, the software clears the I2C_STS1.ADDRF bit by 454 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 479: Figure 22-4 Slave Receiver Transfer Sequence Diagram

    When the START condition is generated on the bus through the start bit, the device enters the master mode. 455 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 480 I2C_STS1.TXDATE flag bit. After that, there is no need to care about the status of the I2C_STS1.TXDATE bit. 456 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 481: Figure 22-5 Master Transmitter Transfer Sequence Diagram

    The software sequence of EV8 must be completed before the end of the current byte transfer. c) When I2C_STS1.TXDATE or I2C_STS1.BSF bit is set, stop condition should be arranged when EV8_2 occurs. 457 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 482 1, an acknowledge pulse will be sent. At this time, the software can read the first byte from the I2C_DAT register, and then the I2C_STS1.RXDATNE bit is cleared to 0. After that, as long as I2C_STS1.RXDATNE is 458 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 483: Figure 22-6 Master Receiver Transfer Sequence Diagram

    6. EV9: I2C_STS1.ADDR10F=1, reading STS1 and then writing to the DAT register will clear this event. Note: a) If a single byte is received, it is NA. 459 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 484: Error Conditions Description

    And User make sure that in the event of an underrun error, the receiver discard repeatedly byte, 460 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 485: Dma Application

    If use DMA mode need set I2C_CTRL2.DMAEN bit. When data byte is received,DMA will send I2C data to storage area, set DMA channel for I2C reception. The following steps must be opreate: 461 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 486: Packet Error Check

    DMA transfer. And if it does the last DMA request of the master receiver, NACK will be sent automatically after receiving the last byte. When arbitration is lost, PEC calculation is invalid. 462 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 487: Smbus

    In order to distribute addres for each devices, it must have a unique device identifier(UDID) to distinguish devices. 463 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 488: Bus Protocol

    When more than one device’s SMBALERT is low, the highest priority(The smaller the address, the higher the priority) 464 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 489: Debug Mode

    Send buffer is empty. TXDATE Bus error BUSERR Lost arbitration (master) ARLOST I2C error interrupt ERRINTEN Acknowledge fail ACKFAIL Overrun/underrun OVERRUN 465 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 490: I2C Register Description

    Reset Value I2C_STS2 PECVAL[7:0] 018h Reserved Reset Value I2C_CLKCTRL CLKCTRL[11:0] 01Ch Reserved Reset Value 020h I2C_TMRISE Reserved TMRISE[5:0] 466 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 491: I2C Control Register 1 (I2C_Ctrl1)

    To detect the PEC of the second byte, the I2C_CTRL1.PEC bit must be set after the ACKPOS bit is configured and when the ADDR event is extended. ACKEN Acknowledge enable 467 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 492 If I2C_CTRL1.SMBTYPE=1, the host address of SMBus is used. SMBTYPE SMBus type 0: Device 1: Host Reserved Reserved, the reset value must be maintained. 468 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 493: I2C Control Register 2 (I2C_Ctrl2)

    I2C_STS1.ADDR F = 1 (Master/Slave) I2C_STS1.ADD10F = 1 (Master) I2C_STS1.STOPF = 1 (Slave) I2C_STS1.BSF = 1 with no I2C_STS1.TXDATE or I2C_STS1.RXDATNE event 469 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 494: I2C Own Address Register 1 (I2C_Oaddr1)

    Reserved, the reset value must be maintained. ADDR[9:8] Interface address 9~8 bits of the address. Note: don't care these bits in 7-bit address mode 470 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 495: I2C Own Address Register 2 (I2C_Oaddr2)

    Note: If the ARLOST event occurs when processing the ACK pulse, the received byte will not be copied into the data register, so it cannot be read. 471 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 496: I2C Status Register 1 (I2C_Sts1)

    DAT register, under-run occurs which leads that the same byte will be send twice. 472 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 497 Note: When BSF is set, the RXDATNE bit cannot be cleared when reading data, because the data register is still full. Reserved Reserved, the reset value must be maintained. 473 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 498 1' after receiving the ACK of the second byte of the address. In slave mode: 474 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 499: I2C Status Register 2 (I2C_Sts2)

    Hardware clears this bit when a stop condition or a repeated start condition is generated, or when I2C_CTRL1.EN=0. 475 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 500: I2C Clock Control Register (I2C_Clkctrl)

    1: I2C in fast mode(duty cycle can be configured). DUTY Duty cycle in fast mode 0:Tlow/Thigh = 2; 476 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 501: I2C Rise Time Register (I2C_Tmrise)

    If the result is not an integer, write the integer part to TMRISE[5:0] to ensure the t parameter. HIGH 477 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 502 478 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 503: Universal Synchronous Asynchronous Receiver Transmitter (Usart)

    LIN break frame detection, noise flag/overflow error/frame error in multi-buffer communication 479 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 504: Functional Block Diagram

    The data packets of serial communication are transmitted from the sending device to the RX interface of the receiving 480 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 505: Usart Frame Format

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

    Receiving in Smartcard mode General USART mode, single-wire mode and modem mode. Transmitting and receiving in Smartcard mode 482 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 507: Figure 23-4 Configuration Stop Bit

    USART_DAT register will clear USART_STS.TXDE; After writing the last data word in the USART_DAT register, wait for USART_STS.TXC =1, which indicates 483 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 508: Single Byte Communication

    The samples at the 3rd, 5th, and 7th bits, and the samples at the 8th, 9th, and 10th bits are all '0' (that is, 6 '0'), then confirm the receipt of the start bit, the USART_STS.RXDNE flag bit is set, and if USART_CTRL1.RXDNEIEN=1, 484 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 509: Figure 23-6 Start Bit Detection

    1.5 stop bit (Smartcard mode): when sending in Smartcard mode, the device must check whether the data is sent correctly. So the receiver function block must be activated (USART_CTRL1.RXEN=1) and sample the signal 485 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 510: Framing Error

    USART_STS.RXDNE and the hardware will generate an interrupt when the USART_STS.RXDNE flag is set. In multi-buffer communication mode, an interrupt will be generated if the USART_CTRL3.ERRIEN bit 486 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 511: Overrun Error

    PCLK1 is used for USART2, USART3, up to 16MHz;  PCLK2 is used for USART1, UART4, UART5, up to 32MHz. USARTDIV is an unsigned fixed-point number. 487 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 512: Table 23-3 Error Calculation When Setting Baud Rate

    Notes: The lower the clock frequency of the CPU, the lower the error for a particular baud rate. 488 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 513: Receiver's Tolerance Clock Deviation

    If it is not even, it means that an error has occurred, the USART_STS.PEF flag is set to '1', and if USART_CTRL1.PEIEN is enabled, an interrupt is generated. Odd parity 489 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 514: Dma Application

    5. Start the channel. 6. After the data transfer is completed, the transfer complete flag (DMA_INTSTS.TXCFx) is set to 1. 490 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 515: Figure 23-7 Transmission Using Dma

    5. Start the channel. 491 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 516: Hardware Flow Control

    Figure 23-9 hardware flow control between two USART DEVICE 1 DEVICE 2 TX control RX control RX control TX control 492 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 517: Figure 23-10 Rts Flow Control

    If the USART_CTRL3.CTSEN bit is set, the USART_STS.CTSF bit will be set high by hardware when the nCTS input changes state. An interrupt will be generated if USART_CTRL3.CTSIEN is enabled. 493 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 518: Figure 23-11 Cts Flow Controls

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

    USART_CTRL1.RCVWU is cleared. The USART_STS.RXDNE bit will be set when this matching address is received. Data can then be transmitted normally. 495 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 520: Synchronous Mode

    The transmitter in synchronous mode works the same as in asynchronous mode. Data on the TX pin is sent out synchronously with CK. 496 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 521: Figure 23-14 Usart Synchronous Transmission Example

    Clock(CLKPOL=0,CLKPHA=0) Clock(CLKPOL=0,CLKPHA=1) Clock(CLKPOL=1,CLKPHA=0) Clock(CLKPOL=1,CLKPHA=1) Data on TX (from master) MSB Stop Start LSB Data on RX (from slave) 497 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 522: Single-Wire Half-Duplex Mode

    Single-wire half-duplex mode USART supports single-wire half-duplex communication, allowing data to be transmitted in both directions, but only 498 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 523: Irda Sir Endec Mode

    For the receiver, the requirement for a valid signal is that the duration of the low level signal must be greater than 2 cycles of the IrDA low power baud rate clock. 499 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 524: Lin Mode

    When LIN is sent, the length of the data bits sent can only be 8 bits. By setting USART_CTRL1.SDBRK, a 13-bit '0' will be sent as the break symbol, and insert a stop bit. 500 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 525 If a '1' is sampled before the 10th or 11th sample point, the current detection is canceled and the start bit is searched again. 501 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 526: Figure 23-20 Break Detection In Lin Mode (11-Bit Break Length-The Linbdl Bit Is Set)

    Idle Bit0 Bit1 Bit2 Bit3 Bit4 Bit5 Bit6 Bit7 Bit8 Bit9 Bit10 wait delimiter Sample Sample data LINBDF 502 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 527: Smartcard Mode (Iso7816)

    (according to the ISO protocol, the duration of the received NACK can be 1 or 2 baud clock cycles). 503 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 528: Figure 23-22 Iso7816-3 Asynchronous Protocol

    (USART_GTP.GTV[7:0]). The clearing of the USART_STS.TXC flag is not affected by the smart card mode. The following figure details how USART samples NACK signals. 504 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 529: Interrupt Request

    NEF/OREF/FEF ERRIEN buffer communication (1) This flag bit is used only when DMA is used to receive data(USART_CTRL3.DMARXEN=1). 505 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 530: Mode Support

    DATV[8:0] 004h Reserved Reset Value DIV_Decimal USART_BRCF DIV_Integer[11:0] [3:0] 008h Reserved Reset Value USART_CTRL1 00Ch Reserved Reset Value 506 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 531: Usart Status Register (Usart_Sts)

    This bit is cleared to 0 when the software writes the data to be sent into USART_DAT. 0: Send data buffer is not empty. 507 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 532 USART_STS.RXDNE flag. In the multi-buffer communication mode, if the USART_CTRL3.ERRIEN bit is set, an interrupt will be generated when the NEF flag is set. 508 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 533: Usart Data Register (Usart_Dat)

    (the 7th or 8th bit depends on USART_CTRL1.WL bit) will be replaced by the parity bit. 509 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 534: Usart Baud Rate Register (Usart_Brcf)

    0:USART is disabled. 1:USART is enabled. Word length. 0:8 data bits. 1:9 data bits. 510 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 535 Software can set this bit to 1 to make USART enter mute mode, and clear this bit to 0 to wake up USART. In idle frame wake-up mode (USART_CTRL1.WUM=0), this bit is cleared by 511 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 536: Usart Control Register 2 Register (Usart_Ctrl2)

    Note: This bit cannot be used for UART4/5. CLKPOL Clock polarity. This bit is used to set the polarity of CK pin in synchronous mode. 512 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 537: Usart Control Register 3 Register (Usart_Ctrl3)

    USART will be awakened. USART control register 3 register (USART_CTRL3) Address offset : 0x14 Reset value : 0x0000 0000 513 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 538 Note: This bit cannot be used for UART4/5 HDMEN Half-duplex mode enable. This bit is used to enable half-duplex mode. 514 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 539: Usart Guard Time And Prescaler Register (Usart_Gtp)

    (PCLK1/PCLK2) to generate low power consumption frequency. 00000000: reserved-do not write this value. 00000001: divide the source clock by 1. … 515 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 540 1111: Divide the source clock by 62. In Smartcard mode, PSCV[7:5] is reserved. Note: This bit is invalid for UART4/5. 516 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 541: Low Power Universal Asynchronous Receiver Transmitter (Lpuart)

     Start bit detection  Receive buffer non-empty detection  A configurable receive byte  A programmable 4-byte frame 517 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 542: Functional Block Diagram

    TX: Serial data output. When sending is enabled, the pin defaults to be high level. The following pins are required in hardware flow control mode: 518 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 543: Lpuart Frame Format

    When the Transmit Enable bit (LPUART_CTRL.TXEN) is set and there is data in the buffer, the transmitter sends 8- bit data words. The data in the shift register is output on the TX pin. 519 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 544 After the last data byte is written to the LPUART_DAT register, you must wait for LPUART_STS.TXC=1 before shutting down the LPUART module or setting the microcontroller into low-power mode. 520 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 545: Receiver

    Check the interrupt flags of the LPUART_STS register: buffer is not empty, buffer is half full, buffer is full, buffer overrun; 521 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 546 Noise errors use an over-sampling technique (if the LPUART_CTRL.SMPCNT bit is 0, that is, the number of samples is 3) to recover data by distinguishing valid input data from noise. 522 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 547: Fractional Baud Rate Generation

    LPUARTDIV is set in the baud rate configuration registers LPUART_BRCFG1 and LPUART_BRCFG2. Note: After writing LPART_BRCFG1 and LPUART_BRCFG2, the baud rate counter is replaced with the new value 523 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 548: Parity Control

    Reset the LPUART_CTRL.PCDIS bit, enable parity control (generate a parity bit when sending, parity check when receiving), set or reset the LPUART_CTRL.PSEL bit selection to use odd or even check. LPUART frame formats 524 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 549: Dma Application

    LPUART_STS.TXC flag bit is asserted by the hardware to indicate that the transfer is completed. The software needs wait for LPUART_STS.TXC=1. 525 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 550: Figure 24-5 Sending Using Dma

    When completing the transfer specified by the DMA controller, the DMA controller generates an interrupt on the DMA channel's interrupt vector. 526 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 551: Hardware Flow Control

    RTS flow control If RTS flow control is enabled (LPUART_CTRL.RTSEN=1), the RTS will be driven high (active) when the RTS 527 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 552: Figure 24-8 Rts Flow Control

    Transmit delay Transmit Data 3 Start Start Stop Stop Data 2 Idle TX line Data 1 Data 3 528 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 553: Low Power Wake Up

    Table 24-4 LPUART register overview Offset Register LPUART_STS 000h Reserved Reset Value LPUART_INTEN 004h Reserved Reset Value WUSEL 008h LPUART_CTRL Reserved [1:0] 529 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 554: Lpuart Status Register (Lpuart_Sts)

    1: Buffer is half full.RX data should be read before the buffer is full FIFO_FU FIFO full flag. 530 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 555: Lpuart Interrupt Enable Register (Lpuart_Inten)

    0: Disables buffer overrun interrupt 1: Enable buffer overrun interrupt TXCIE TX complete interrupt enable 0: Disable TX complete interrupt 531 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 556: Lpuart Control Register (Lpuart_Ctrl)

    0: Cannot wake up STOP2 mode 1: Can wake up the STOP2 mode DMA_RXEN DMA RX request enable 532 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 557: Lpuart Baud Rate Configuration Register 1 (Lpuart_Brcfg1)

    LPUARTDIV is not large enough at this time, so 1-bit sampling method should be adopted to avoid sampling error. LPUART data register (LPUART_DAT) Address offset: 0x10 533 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 558: Lpuart Baud Rate Configuration Register 2 (Lpuart_Brcfg2)

    "Fractional baud rate generation". LPUART wake up data register (LPUART_WUDAT) Address offset: 0x18 Reset value: 0x0000 0000 534 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 559 LPUART_CTRL.WUSEL[1:0] = 11 is used to wake up frame matching. In this case, all 4 bytes are valid 535 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 560: Serial Peripheral Interface/Inter-Ic Sound (Spi/I S)

     Steady state clock polarity programmable.  The data direction is always MSB first.  Supports DMA function. 536 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 561: 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. 537 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 562: Figure 25-2 Selective Management Of Hardware/Software

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

    Figure 25-4 is the combination timing of four CLKPHA and CLKPOL bits transmitted by SPI when the SPI_CTRL1.LSBFF=0. 539 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 564: Data Format

    SPI_CTRL1.LSBFF bit, the data bits follow the MSB or LSB order is serially shifted to the 540 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 565: Schematic Diagram Of The Change Of Te/Rne/Busy When The Host Is Continuously Transmitting In Full Duplex Mode

    SPI_STS.OVER bit will be set to '1', and the software will ignore it. The software operation process is as follows: Set SPI_CTRL1.SPIEN = 1, enable SPI module. 541 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 566: Figure 25-6 Schematic Diagram Of Te/Busy Change When Host Transmits Continuously In One-Way Only Mode

    The process of data receiving can also be implemented in the interrupt handler generated by the rising edge of the 542 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 567: Figure 25-7 Schematic Diagram Of Rne Change When Continuous Transmission Occurs In Receive-Only Mode (Bidirmode = 0 And Ronly = 1)

    SPI_DAT register. Figure 25-8 Schematic diagram of the change of TE/RNE/BUSY when the slave is continuously transmitting in full 543 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 568: Schematic Diagram Of Te/Busy Change During Continuous Transmission In Slave Unidirectional Transmit-Only Mode

    The data receiving process begins when the slave device receives the clock signal and the first data bit from the MOSI 544 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 569 In master mode, the sending process starts when data is written to the send buffer. If the next data has been written into the SPI_DAT register before the current data frame sending is completed, the continuous sending function can 545 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 570: Status Flag

    SPI_DAT register. When the send buffer is not empty, the hardware will clear this flag to 0. 546 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 571: Disabling The Spi

    3. Wait for the last RNE (SPI_STS.RNE) to be set before entering shutdown mode (or turning off the SPI module 547 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 572: Spi Communication Using Dma

    (SPI_STS.TE) bit to be set to 1, and wait for the BUSY flag (SPI_STS.BUSY) bit to be set to 0. 548 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 573: Crc Calculation

    8-bit data frame format adopts CRC8, and the 16-bit data frame format adopts CRC16. The polynomial used in 549 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 574: Error Flag

    (SPI_CTRL2.ERRINTEN = 1). All received data is lost, and the SPI_DAT register retains only previously unread data. 550 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 575: Spi Interrupt

    Receive buffer non empty flag RNEINTEN Master mode failure event MODERR Overflow error OVER ERRINTEN CRC error flag CRCERR 551 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 576: I 2 S Function Description

    WS: Channel selection (shared with NSS pin), used as data control signal output in master mode, and used as input in slave mode; 552 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 577: Supported Audio Protocols

    (MSB) is sent and will change on the falling edge of the clock signal. 553 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 578: Figure 25-14 I S Philips Protocol Waveform (16/32-Bit Full Precision, Clkpol = 0)

    CPU will first read the SPI_DAT register to get 0x95AA, and then read the SPI_DAT register to get 0x6600 (only the upper 8-bit data is valid, and the lower 8-bit data is always 0). 554 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 579: Figure 25-16 I 2 S Philips Protocol Standard Waveform (16-Bit Extended To 32-Bit Packet Frame, Clkpol = 0)

    (MSB) are generated simultaneously. The standard data receiving and sending processing mode is the same as I S Philips standard. 555 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 580: Figure 25-17 The Msb Is Aligned With 16-Bit Or 32-Bit Full Precision, Clkpol = 0

    Figure 25-18 MSB aligns 24-bit data, CLKPOL = 0 Send Receive 8-bit remaining 0 forced 24-bit data Right channel Left channel 32-bit 556 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 581: Figure 25-19 Msb-Aligned 16-Bit Data Is Extended To 32-Bit Packet Frame, Clkpol = 0

    Figure 25-20 LSB alignment 16-bit or 32-bit full precision, CLKPOL = 0 Send Receive Left channel (16-bit or 32-bit) Right channel 557 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 582: Figure 25-21 Lsb Aligns 24-Bit Data, Clkpol = 0

    RNE(SPI_STS.RNE) event will be generated. In this way, there is more time between 2 reads and writes, which can prevent underflow or overflow from happening. 558 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 583: Figure 25-23 Pcm Standard Waveform (16 Bits)

    Figure 25-24 PCM standard waveform (16-bit extended to 32-bit packet frame) WS short frame WS long frame 13-bit 16-bit 559 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 584: Clock Generator

    ���� ������ [ ( 32 × 2 ) × ( ( 2 × �������� ) + ������_��������) × 4] When MCLKOEN = 1 and CHBITS = 1, �� = �� ⁄ �� 560 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 585: I 2 S Transmission And Reception Sequence

    SPI_I2SCFG.CHBITS bit; 4. When user needs to enable interrupt or DMA, the configuration operation is the same as SPI; 561 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 586 SPI_CTRL2.ERRINTEN bit is set to 1, an interrupt is generated to indicate that an error has occurred. The channel corresponding to the currently transmitted data can be confirmed by the SPI_STS.CHSIDE bit. When 562 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 587: Status Flag

    When the receive buffer is not empty, this flag is set to 1, indicating that valid data has been received into the receive 563 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 588: Error Flag

    Reading the SPI_STS register to clears the SPI_STS.UNDER bit. S interrupt The following table lists all I S interrupts. 564 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 589: Dma Function

    Reset Value MODCFG STDSEL TDATLEN SPI_I2SCFG [1:0] [1:0] [1:0] 01Ch Reserved Reset Value SPI_I2SPREDIV LDIV[7:0] 020h Reserved Reset Value 565 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 590: Spi Control Register 1 (Spi_Ctrl1) (Not Used In I2S Mode)

    1 by the accessed slave device, and only the accessed slave device can output, so as to avoid data line conflicts. 566 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 591 Note: This bit cannot be changed during communication. Note: Not used in I S mode. CLKPOL Clock polarity 567 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 592: Spi Control Register 2 (Spi_Ctrl2)

    When this bit is set, a DMA request is issued as soon as the TE flag (SPI_STS.TE) is set 568 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 593: Spi Status Register (Spi_Sts)

    Note: this bit is set by hardware and cleared by software by writing 0. Note: Not used in I S mode. UNDER Underflow flag 0: No underflow occurred. 569 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 594: Spi Data Register (Spi_Dat)

    SPI_DAT[15:0]. SPI CRC polynomial register (SPI_CRCPOLY) (not used in I S mode) Address: 0x10 Reset value: 0x0007 570 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 595: Spi Rx Crc Register (Spi_Crcrdat) (Not Used In I S Mode)

    When the data frame format is set to 8 bits, only the lower 8 bits participate in the calculation 571 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 596: Spi_I 2 S Configuration Register(Spi_I2Scfg

    S Philips standard. 01: High byte alignment standard (left alignment). 10: Low byte alignment standard (right alignment). 11: PCM standard. 572 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 597: Spi_I2S Prescaler Register (Spi_I2Sprediv)

    0: actual frequency division coefficient = LDIV × 2. 1: actual frequency division coefficient = (LDIV × 2) + 1. 573 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 598 Note: For correct operation, this bit can only be set when I S is turned off. Use this bit only in S master mode. Not used in SPI mode. 574 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 599: Controller Area Network (Can)

    CAN network. With increase number of CAN nodes, messages in CAN network also increase dramatically which will occupides lots of CPU resource. In this CAN controller, receive FIFOs and filter mechanism 575 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 600: Can Module

    CANTX pin is disabled. CAN is in normal mode when CAN_MSTS.INIAK and CAN_MSTS.SLPAK bits are both '0', and it must 576 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 601: Normal Mode

    CAN bus activity is detected, regardless of whether the hardware is enabled to automatically wake up CAN. 577 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 602: Send Mailbox

    CAN has two receiving FIFOs, each of which can store three complete messages. No application program is needed to manage it, and it is managed by hardware. 578 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 603: Can Test Mode

    To enter loopback mode, the CAN_BTIM.SLM bit should be cleared and the CAN_BTIM.LBM bit should be set. 579 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 604: Figure 26-4 Loopback Mode

    CAN bus, without affecting the bus because dominant bits is not actually sent to the bus. To enter silent mode, the CAN_BTIM.SLM bit should be set and the CAN_BTIM.LBM bit should be cleared. 580 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 605: Figure 26-5 Silent Mode

    To enter loopback silence mode, both the CAN_BTIM.SLM bit and the CAN_BTIM.LBM bit should be set. Figure 26-6 loopback silent mode CAN-CTRL transceiver CAN_Bus 581 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 606: Can Debugging Mode

    When more than one sending mailbox is registered, the sending order is determined by the identifier of the message in the mailbox. 582 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 607: Cancel Sending

    CAN_TSTS.RQCPM bit. At the same time, the transmission result can query the CAN_TSTS.TXOKM, CAN_TSTS.ALSTM and CAN_TSTS.TERRM bits. 583 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 608: Receiving Management

    Please refer to 26.4.5 Section: identifier filtering. 584 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 609: Figure 26-8 Receive Fifo Status

    (the CAN_INTE.FFITE bit is set), a FIFO full interrupt request will be generated. 585 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 610: Identifier Filtering

    And the filter group should be set to work in identifier list mode in order to filter out an identifier. 586 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 611: Mask Mode

    The filter ID is used to store the identifier format, and the filter MASK is used to indicate which bits must be checked and which bits can be ignored. 587 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 612: Identifier List Mode

    16-bit-wide filters. For filters with the same bit width, then the 588 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 613: Message Storage

    CAN_TMDLx CAN_TMDHx Receiving mailbox (FIFO) CAN_RMDTx.FMI[7:0] field can store the filter matching serial number and CAN_RMDTx.MTIM[15:0] field can 589 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 614: Bit Time Characteristic

    2. In order to improve the CAN bit time accuracy, it is not recommended to use HSI as the clock source. 590 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 615: Figure 26-11 Bit Sequence

    (CAN_BTIM.TBS1[3:0] + 1), x (CAN_BTIM.TBS2[2:0] + 1), One-bit time = 1 x t BaudRate = One-bit time 591 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 616: Figure 26-12 Various Can Frames

    13. send pause: applies to error passive nodes only. End Of Frame or Inter-Frame Space Error Delimiter or Overload Frame or Overload Frame Overload Delimiter 592 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 617: Can Interrupt

    When FIFO1 becomes full, the CAN_RFF1.FFULL1 bit is set. When FIFO1 overruns, and the CAN_ RFF1.FFOVR1 bit is set. 593 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 618: Error Management

    In initialization mode, CAN will not monitor the status of CAN RX pin, so the recovery process cannot be completed. 594 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 619: Can Configuration Flow

    CAN_TMIx.TXRQ(x = 0~2) bit must be written to ‘1’ after this mailbox is programed. 595 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 620: Can Register File

    In addition, only when the whole filter is set to the initialization mode (that is, CAN_FMC.FINITM=1), the 596 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 621: Can Register Address Overview

    DLC[3:0] 184h Reset Value CAN_TMDL0 DATA3[7:0] DATA2[7:0] DATA1[7:0] DATA0[7:0] 188h Reset Value 18Ch CAN_TMDH0 DATA7[7:0] DATA6[7:0] DATA5[7:0] DATA4[7:0] 597 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 622 DATA5[7:0] DATA4[7:0] 1BCh Reset Value CAN_RMI1 STDID[10:0]/EXTID[28:18] EXTID[17:0] 1C0h Reset Value CAN_RMDT1 MTIM[15:0] FMI[7:0] DLC[3:0] 1C4h Reset Value 598 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 623 220h 224h 23Fh CAN_F0B1 FBC[31:0] 240h Reset Value CAN_F0B2 FBC[31:0] 244h Reset Value CAN_F1B1 FBC[31:0] 248h Reset Value 599 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 624: Can Control And Status Register

    Reserved, the reset value must be maintained. TTCM Time triggered communication mode 0: disable time triggered communication mode; 600 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 625 The software can request the CAN to enter the sleep mode by setting this bit, and once the current CAN activity (sending or receiving messages) ends, the CAN will enter the sleep mode. 601 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 626 When this bit is set, if the CAN_INTE.SLKITE bit is set, a state change interrupt will be generated. 602 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 627 11 consecutive recessive bits on the RX pin of CAN. CAN transmit status register (CAN_TSTS) Address offset: 0x08 Reset value: 0x1C00 0000 603 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 628 1: The last sending attempt was successful. When the sending request of mailbox 2 is successfully completed, hardware sets 604 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 629 Arbitration lost for mailbox 0 When the mailbox 0 fails to send due to the loss of arbitration, set this bit 605 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 630 When there are 3 messages in FIFO 0, the hardware sets this bit'. This bit is cleared by software. Reserved Reserved, the reset value must be maintained. 606 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 631 CAN_RFF1.RFFOM1 bit, CAN_RFF1.FFMP1 is decremented by 1 until it is 0. CAN interrupt enable register (CAN_INTE) Address offset: 0x14 607 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 632 1: When CAN_RFF1.FFOVR bit is set, an interrupt is generated. FFITE1 FIFO 1 full interrupt enable 0: When CAN_RFF1.FFULL bit is set, no interrupt is generated; 608 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 633 CAN protocol. 15:7 Reserved Reserved, the reset value must be maintained. LEC[2:0] The Last error code. 609 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 634 Reset value: 0x0123 0000 Notes: This register CAN only be accessed by software when CAN is in initialization mode. 610 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 635: Can Mailbox Register

    Notes: 1.This register is write-protected when the mailbox to which it belongs is waiting to be sent; 2.This register implements the send request control function (bit 0)-the reset value is 0. 611 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 636 CAN_TMDTx.MTIM[7:0] is the seventh byte and CAN_TMDTx.MTIM[15:8] is the eighth byte. They replace the data written in CAN_TMDHx[31:16] 612 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 637 When the mailbox is not empty, all bits in this register are write protected. Address offset: 0x18c, 0x19c, 0x1ac Reset value: undefined 613 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 638 Reserved, the reset value must be maintained. Receive FIFO mailbox data length and time stamp register(CAN_RMDTx)( x=0..1) Address offset: 0x1B4, 0x1C4 Reset value: undefined 614 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 639 Data byte 0 of the message. Notes: the message contains 0 to 8 bytes of data, starting from byte 0. 615 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 640: Can Filter Register

    Initialization mode settings for all filter groups. 0: The filter group works in normal mode; 1: The filter group works in initialization mode. 616 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 641 1: The filter bit width is a single 32-bit. CAN filter FIFO assignment register (CAN_FFA1) Address offset: 0x214 Reset value: 0x0000 0000 617 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 642 Only when the corresponding CAN_FA1.FACx bit is cleared or the CAN_FMC.FINIT bit is set, the corresponding filter register can be modified. 618 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 643 Mask/identifier register in mask mode has the same definition as register bit in identifier list mode. See for the address of the filter bank register Table 26-4. 619 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 644: Universal Serial Bus Full-Speed Device Interface (Usb_Fs_Device)

     Support USB suspend/resume operation  Frame lock clock pulse generation Figure 27-1 is a functional block diagram of a USB peripheral. 620 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 645: Clock Configuration

    SRAM, so the maximum endpoint packet buffer that can be used by each endpoint is less than 512 bytes. Note: 621 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 646: Access Packet Buffer Memory

    USB module accesses the Packet Buffer Memory. 622 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 647: Buffer Description Table

    0 only receives data up to the endpoint 0 packet receive buffer size, other redundant data is discarded and a buffer overflow exception occurs. 623 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 648: Double-Buffered Endpoints

    DATTOG and SW_BUF. DATTOG indicates the buffer currently being used by the USB module, 624 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 649: Table 27-1 Dattog And Sw_Buf Definitions

    DATTOG = 0. If the application has not finished processing the data in buffer0 corresponding to ADDR3_RX_0/CNT3_RX_0, the software will not toggle SW_BUF (SW_BUF = 0). If there is 625 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 650: Figure 27-4 Double Buffered Bulk Endpoint Example

    The Tx buffer of endpoint 3 (buffer0) DATTOG=0 SW_BUF=1 Usb bus The Rx buffer of endpoint 3 Application (buffer1) 512 bytes packet buffer 626 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 651: Usb Transfer

    ADDR register is used as a pointer to the endpoint data packet receiving buffer corresponding to the endpoint, and 627 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 652: Control Transfer

    IN transmission or OUT transmission. As shown in Figure 27-5, take control write transfer as an example. Before enabling subsequent data 628 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 653 SETUP token packet, and will not reply any handshake packet to the host, forcing the host to send the SETUP token packet again. 629 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 654: Figure 27-5 Control Transfer

    USB host will allocate the required bandwidth for the endpoint in 630 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 655: Usb Events And Interrupts

    USB transceiver. The software operation process is as follows:  Enable the clock signal of the USB module 631 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 656: Table 27-4 Resume Event Detection

    Table 27-4 Resume event detection [USB_FN.RXDP_STS, USB_FN.RXDM_STS] Wake-up event Software operation Root reset None 632 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 657: Usb Interrupt

    USB registers The peripheral registers can be accessed by half-words (16-bit) or words (32-bit). USB base address: 0x4000 5C00 633 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 658: Usb Register Overview

    Reset Value USB_CTRL 040h Reserved Reset Value USB_STS EP_ID[3:0] 044h Reserved Reset Value USB_FN FN[10:0] 048h Reserved Reset Value 634 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 659: Usb Endpoint N Register (Usb_Epn), N=[0

    STS_RX[1:0] Receive status This bit indicates the current state of the endpoint, Table 27-6 lists the available states 635 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 660 Double-buffered endpoint, this bit is used to implement the flow control mechanism for double-buffered endpoints. Isochronous endpoint, this bit is used for double buffer exchange. Note: 636 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 661: Table 27-6 Receive Status Code

    STALL: the status of the handshake packet is STALL NAK: the status of the handshake packet is NAK VALID: endpoints can be used to send 637 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 662: Usb Control Register (Usb_Ctrl)

    1: Enable start of frame interrupt, when USB_STS.SOF = 1, an interrupt will be generated. ESOFM Expected start of frame interrupt enable 0: Disable the expected start of frame interrupt 638 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 663: Usb Interrupt Status Register (Usb_Sts)

    When USB_CTRL.FRST = 1, the USB module will remain in reset state until software clears this bit. USB interrupt status register (USB_STS) Address offset: 0x44 639 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 664 Software can read and write this bit, but only writing 0 is valid, and writing 1 is invalid. 、 In suspend mode, the USB hardware will not detect the suspend signal until the 640 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 665 Isochronous endpoints and double-buffered bulk endpoints have high priority, other endpoints have low 641 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 666: Usb Frame Number Register (Usb_Fn)

    Hardware increments this bit every time the USB module receives a PID SOF token packet. USB device address register (USB_ADDR) Address offset: 0x4C Reset value: 0x0000 0000 642 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 667: Usb Packet Buffer Description Table Address Register (Usb_Buftab)

    32 bits, the data packet buffer memory addresses use 32-bit aligned addresses, not the addresses used by the USB_BUFTAB register and the buffer description table. 643 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 668: Send Buffer Address Register N (Usb_Addrn_Tx)

    Address offset: [USB_ BUFTAB] + n× 16 + 8 USB local address: [USB_ BUFTAB] + n× 8 + 4 644 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 669: Receive Data Byte Number Register N (Usb_Cntn_Rx)

    Table 27-8 Endpoint packet receive buffer size definition NUM_BLK[4:0] BLSIZE = 0 BLSIZE = 1 00000 Not allowed 32 bytes 00001 2 bytes 64 bytes 645 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 670 The size of the endpoint packet receive buffer is defined during the device enumeration process and is defined by the wMaxPacketSize field of the standard endpoint descriptor in the USB 2.0 protocol specification. 646 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 671: Debug Support (Dbg)

    -M4F core hardware debugging module can provide the following debugging functions:  SWJ-DP: serial /JTAG debug port  AHP-AP: AHB access port 647 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 672: Jtag/Swd Function

    See the following Table for the pin allocation of JTAG debugging interface and SWD debugging interface (SWDIO is alternated with JTMS, SWCLK is alternated with JTCK): 648 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 673: Mcu Debug Function

    The DBG_CTRL.STDBY bit needs to be configured to start the internal RC oscillator to provide the clock for HCLK and FCLK. 649 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 674: Peripherals Debug Support

    Reset Value ID register (DBG_ID) Address offset: 0x00 Only 32-bit access is supported, fixed values cannot be modified. 650 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 675: Debug Control Register (Dbg_Ctrl)

    TIMx debug pause bits (x = 4, 3, 2, 1). Set or cleared by software. 0: TIMx running state has no effect. 651 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 676 1: (FCLK on, HCLK on) In DBG_SLEEP mode, both FCLK and HCLK clocks are provided by the previously configured system clock. 652 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 677: Unique Device Serial Number (Uid)

    Secure Bootloader with security function. 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 678: 30 Version History

    Add Clock Tree Figure note: When PLL is selected as system clock source, PLL minimum clock output is 32MHz 654 / 655 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 679: 31 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