Nations N32G43 Series User Manual

32-bit arm cortex-m4f microcontroller
Table of Contents

Advertisement

Quick Links

N32G43x series
®
®
32-bit ARM
Cortex
-M4F microcontroller
User manual V2.0

Advertisement

Table of Contents
loading

Summary of Contents for Nations N32G43 Series

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

    Clock security system (CLKSS) ........................57 LSE Clock security system (LSECSS) ......................57 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 ..........................122 SysTick calibration value register........................122 Interrupt and exception vectors ........................122 External interrupt/event controller (EXTI) ......................125 Introduction ..............................125 Nations Technologies Inc. Tel:+86-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) ............... 155 LRC result register (CRC_LRC) ........................156 Cryptographic algorithm hardware acceleration engine (SAC) ................157 Nations Technologies Inc. Tel:+86-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 ......................... 227 General-purpose timers description ......................... 228 Time-base unit ..............................228 Counter mode ..............................229 Clock selection ..............................235 Nations Technologies Inc. Tel:+86-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 Low Power Timer (LPTIM) ............................292 Introduction ................................292 Main Features ............................... 292 Block diagram ..............................293 Function description ............................. 293 Nations Technologies Inc. Tel:+86-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 Wakeup Timer Register (RTC_WKUPT) ....................333 RTC Alarm A Register (RTC_ALARMA)..................... 333 RTC Alarm B Register (RTC_ ALARMB) ....................334 Nations Technologies Inc. Tel:+86-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 .......................... 363 Timing diagram ............................... 363 Analog watchdog ............................. 364 Scanning mode ..............................365 Injection channel management ........................365 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 ......................399 COMP features ..............................400 COMP configuration process ..........................400 COMP working mode ............................401 Window mode ..............................401 Nations Technologies Inc. Tel:+86-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 I2C Own address register 2 (I2C_OADDR2) ....................446 I2C Data register (I2C_DAT) ........................446 I2C Status register 1 (I2C_STS1) ........................447 I2C Status register 2 (I2C_STS2) ........................450 Nations Technologies Inc. Tel:+86-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 LPUART data register (LPUART_DAT) ....................... 509 LPUART baud rate configuration register 2 (LPUART_BRCFG2) .............. 509 LPUART wake up data register (LPUART_WUDAT) .................. 510 Nations Technologies Inc. Tel:+86-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 Bit time characteristic ............................ 565 CAN interrupt ............................... 568 Error management ............................569 Bus-Off recovery ............................569 CAN Configuration Flow ............................. 570 Nations Technologies Inc. Tel:+86-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 Unique device serial number (UID) .......................... 629 Introduction ................................629 UID register ................................629 UCID register ............................... 629 Version history ................................630 Notice ..................................631 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 Table 5-22 I2C2 alternate function remapping ......................103 Table 5-23 SPI1 alternate function remapping ......................103 Table 5-24 SPI2/I2S2 alternate function remapping ....................104 Nations Technologies Inc. Tel:+86-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 11-4 Output control bits of standard OCx channel ..................275 Table 12-1 TIMx register overview .......................... 287 Table 13-1 Pre-scaler division ratios ........................294 Nations Technologies Inc. Tel:+86-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 23-2 Parity frame format ..........................500 Table 23-3 LPUART interrupt requests ........................504 Table 23-4 LPUART register overview ........................505 Nations Technologies Inc. Tel:+86-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 26-8 Endpoint packet receive buffer size definition ..................621 Table 27-1 Debug port pin ............................625 Table 27-2 DBG register overview .......................... 626 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 Figure 10-16 Capture/compare channel (example: channel 1 input stage) .............. 174 Figure 10-17 Capture/compare channel 1 main circuit .................... 175 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 11-18 Center-aligned PWM waveform (AR=8) ................... 247 Figure 11-19 Edge-aligned PWM waveform (APR=8) ................... 248 Figure 11-20 Example of One-pulse mode ......................249 Nations Technologies Inc. Tel:+86-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 18-2 Data register of single DAC channel mode ..................389 Figure 18-3 Tine diagram of transitions with trigger disable .................. 391 Figure 18-4 LFSR algorithm for DAC ........................392 Nations Technologies Inc. Tel:+86-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 22-20 Break detection in LIN mode (11-bit break length-the LINBDL bit is set) ........477 Figure 22-21 Break detection and framing error detection in LIN mode ..............478 Figure 22-22 ISO7816-3 Asynchronous Protocol....................479 Nations Technologies Inc. Tel:+86-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 24-23 PCM standard waveform (16 bits) ..................... 534 Figure 24-24 PCM standard waveform (16-bit extended to 32-bit packet frame) ........... 534 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 Figure 26-4 Double buffered bulk endpoint example ....................602 Figure 26-5 Control transfer ............................ 606 Figure 27-1 N32G43x level and Cortex -M4F level debugging block diagram ........... 623 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: Abbreviations In The Text

    For all models of N32G43x microcontroller series, the existence and number of a peripheral, please refer to the data sheet of the corresponding model. 1 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 27: Table 2-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 / 631 Nations Technologies Inc. Tel:+86-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 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 / 631 Nations Technologies Inc. Tel:+86-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: Boot Management

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

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

    Flash memory module organization Bus address space is allocated to the main storage area and the information area. 8 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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  Select the page to be erased with the FLASH_ADD register;  Set the FLASH_CTRL.START bit to' 1'; 10 / 631 Nations Technologies Inc. Tel:+86-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 Check the FLASH_ STS.BUSY bit to confirm that there are no other flash operations in progress;  Unlock the FLASH_CTRL.OPTWE bit; 11 / 631 Nations Technologies Inc. Tel:+86-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 After each system reset, the option byte data is read out from the option byte block of Flash and stored in the option byte register (FLASH_OB/FLASH_WRP) with read-only property. At the same time, the option byte complement 12 / 631 Nations Technologies Inc. Tel:+86-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: Table 2-4 Option Byte List

     WRP0: write protection of pages 0-15, bit [0] corresponds to Page0 / 1, bit [7] corresponds to page14 / 15; 13 / 631 Nations Technologies Inc. Tel:+86-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 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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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-6 Flash Read-Write-Erase (1) Permission Control Table

    Erase Erase is automatically erased. Allow Allow Allow Allow Flash main memory 16 / 631 Nations Technologies Inc. Tel:+86-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 Flash main memory Allow Allow Allow Allow area mass erase 17 / 631 Nations Technologies Inc. Tel:+86-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 L2 protection level, cannot boot from SRAM level Flash option byte area JTAG/SWD is banned. Flash system memory area SRAM (All) 18 / 631 Nations Technologies Inc. Tel:+86-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 Prohibit Read-write-erase Prohibit area Read and Read and Read and SRAM (All) Read and write write write write 19 / 631 Nations Technologies Inc. Tel:+86-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: Icache

    First, turn off FLASH_AC.ICAHEN, then write 1 to FLASH_AC.ICAHRST, and then turn on FLASH_AC.ICAHEN.  Lock 20 / 631 Nations Technologies Inc. Tel:+86-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 Execute function 2 that needs to be locked in channel 1 (the code amount of function 2 should be less than the size of a single channel); 21 / 631 Nations Technologies Inc. Tel:+86-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: Sram

    Reserved Reset Value FLASH_KEY FKEY 004h Reset Value FLASH_OPTKEY OPTKEY 008h Reset Value FLASH_STS 00Ch Reserved Reset Value 22 / 631 Nations Technologies Inc. Tel:+86-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 FLASH Sleep Mode Enable 0:Turn off FLASH sleep mode; 1:Enable FLASH sleep mode. SLMF FLASH sleep mode flag 23 / 631 Nations Technologies Inc. Tel:+86-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 011: Three cycle delay, when 96MHz < SYSCLK <= 108MHz Other values: reserved 2.2.4.2.2 The FLASH key register (FLASH_KEY) Address offset: 0x04 Reset value: 0xXXXX XXXX 24 / 631 Nations Technologies Inc. Tel:+86-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 When the flash operation (programming/erasing) is completed, the hardware sets this bit to '1', and writing '1' can clear this bit status. 25 / 631 Nations Technologies Inc. Tel:+86-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: Interrupt generation is allowed. FERRITE Erase/Program Verify Error Interrupt This bit allows an interrupt to be generated when the 26 / 631 Nations Technologies Inc. Tel:+86-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 Reserved, the reset value must be maintained. Mass erase. 0: Disable mass erase mode; 1: Enable mass erase mode. 27 / 631 Nations Technologies Inc. Tel:+86-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 Note: This bit is read-only. nSWBOOT0 nSWBOOT0 Note: This bit is read-only. 25:24 Reserved Reserved, the reset value must be maintained. 28 / 631 Nations Technologies Inc. Tel:+86-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. nRST_STOP2 Enter STOP2 mode reset configuration. 0: Reset occurs immediately after entering STOP2 mode; 29 / 631 Nations Technologies Inc. Tel:+86-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 1: Write protection is invalid. Note: These bits are read-only. 2.2.4.2.10 ECC register(FLASH_ECC) Address offset: 0x24 Reset value: 0x0000 0000 30 / 631 Nations Technologies Inc. Tel:+86-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 (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 / 631 Nations Technologies Inc. Tel:+86-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: Power Control (Pwr)

    LPR is used in LOW-POWER RUN mode, LOW-POWER SLEEP mode, STOP2 mode and STANDBY mode. In STOP2 mode, it powers the retention power domain (RET) and the low-power power domain. 32 / 631 Nations Technologies Inc. Tel:+86-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 Supply Supervisor

    For more information on switching power supply reset thresholds, see the Electrical Characteristics section of the relevant data sheet. 33 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: Power Modes

    WFI/WFE: Continue to execute the STOP2 System reset and all EXTI 1)SCB_SCR.SLEEPDEEP = 1 code, peripherals that the 35 / 631 Nations Technologies Inc. Tel:+86-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: 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 36 / 631 Nations Technologies Inc. Tel:+86-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: Run Mode

    To further reduce dynamic power consumption, MR output voltage can also be adjusted via PWR_CTRL1.MRSEL. In addition, if the FLASH is not used, the software can write the FLASH_AC.SLMEN 37 / 631 Nations Technologies Inc. Tel:+86-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: Sleep Mode

    Enter SLEEP mode by executing WFI (wait for interrupt) or WFE (wait for event) instruction with SCB_SCR.SLEEPDEEP = 0. Depending on the SCB_SCR.SLEEPONEXIT, there are two options for SLEEP mode entry: 38 / 631 Nations Technologies Inc. Tel:+86-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: Low Power Run Mode

    PWR_CTRL1.LPREN bit is set to 1, use while to wait for PWR_STS2.LPRUNF to be 1. The use of while is to 39 / 631 Nations Technologies Inc. Tel:+86-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: Low Power Sleep Mode

    -M4F deep sleep mode, all core digital logic areas are powered off. Main voltage regulator (MR) off, HSE/HSI/PLL off, MSI/LSE/LSI optional operation. CPU registers, 80-byte backup registers, 40 / 631 Nations Technologies Inc. Tel:+86-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: Standby Mode

    Note: The GPIO pin state will change to the system default state upon exit. Enter STANDBY mode Enter STANDBY mode by executing WFI/WFE setting SCB_SCR.SLEEPDEEP = 1 and PWR_CTRL1.LPMSEL = "011". 41 / 631 Nations Technologies Inc. Tel:+86-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: Low-Power Auto-Wakeup (Awu) 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 / 631 Nations Technologies Inc. Tel:+86-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: Pwr Registers

    Power control register 1 (PWR_CTRL1) Address offset: 0x00 Reset value: 0x0000 0700 (reset by wakeup from STANDBY mode) 43 / 631 Nations Technologies Inc. Tel:+86-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: 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 44 / 631 Nations Technologies Inc. Tel:+86-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 3 (Pwr_Ctrl3)

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

    Note: A system reset will not clear this bit. Reserved Reserved, the reset value must be maintained. WKUPF2 WKUP2 pin wakeup flag. 47 / 631 Nations Technologies Inc. Tel:+86-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)

    This bit must be polled before increasing the frequency. 0: MCU is in LOW POWER RUN mode 48 / 631 Nations Technologies Inc. Tel:+86-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 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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: Low Power Domain Reset

    Software reset: The low power domain reset can be generated by setting the RCC_LDCTRL.LDSFTRST bit.  VDD power up/down will cause a low power domain reset. 51 / 631 Nations Technologies Inc. Tel:+86-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: Clock Control Unit

    FCLK is the free-running clock of Cortex™-M4F. For more details, refer to the ARM Cortex™-M4 technical reference manual. 52 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: Hsi Clock

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

    1 or 2 as the final PLL input clock, see Figure 4-4 Figure 4-4 PLL clock source selection PLLHSIPRE PLLSRC PLLMULFCT x2,x3,...x16, x17...x32 PLLCLK PLLDIVCLKEN PLLHSEPRES 55 / 631 Nations Technologies Inc. Tel:+86-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: Lse Clock

    2. Set the TIM9_CTRL1.C3SEL bit to 1, and connect the LSI to channel 3 of TIM9 internally; 3. Measure LSI clock frequency through TIM9 capture/compare 3 events or interrupts; 56 / 631 Nations Technologies Inc. Tel:+86-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: System Clock (Sysclk) Selection

    RCC_LDCTRL.LSECLKSSEN bit and turn off the LSE, and change the RTC clock source and other measures to ensure the safety of the application. 57 / 631 Nations Technologies Inc. Tel:+86-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: Rtc Clock

    The MCO output clock frequency division selection is realized by configuring the RCC_CFG.MCOPRES[3:0] bits. RCC Registers The RCC registers are accessible through AHB bus. The register description is as follows. 58 / 631 Nations Technologies Inc. Tel:+86-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: Rcc Register Overview

    MSICAL[7:0] 024h Reset Value RCC_AHBPRST 028h Reserved Reserved Reset Value ADCHPRES 02Ch RCC_CFG2 RNGCPRES[4:0] Reserved ADC1MPRES[4:0] ADCPLLPRES[4:0] [3:0] 59 / 631 Nations Technologies Inc. Tel:+86-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: Clock Control Register (Rcc_Ctrl)

    This bit cannot be cleared when PLL is used as the system clock. When the HSI/HSE is used as the clock source for the PLL, the PLL will not be 60 / 631 Nations Technologies Inc. Tel:+86-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 HSI oscillator. This bit cannot be reset if the HSI is used directly or indirectly as system clock. 61 / 631 Nations Technologies Inc. Tel:+86-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: Clock Configuration Register (Rcc_Cfg)

    001: Select internal low-speed clock (LSI) output 010: Select external low-speed clock (LSE) output 011: Select internal multi-speed clock (MSI) output 62 / 631 Nations Technologies Inc. Tel:+86-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 10010: PLL input clock × 19 10011: PLL input clock × 20 10100: PLL input clock × 21 63 / 631 Nations Technologies Inc. Tel:+86-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 AHBPRES[3:0] AHB prescaler Set and cleared by software to configure the division factor of the AHB clock (HCLK). 64 / 631 Nations Technologies Inc. Tel:+86-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: Clock Interrupt Register (Rcc_Clkint)

    This bit is set by software to clear the LSESSIF flag. 0: No effect 1: Clear LSESSIF flag 65 / 631 Nations Technologies Inc. Tel:+86-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 1: Clear the LSIRDIF flag MSIRDICLR MSI ready interrupt clear bit. Set by software to clear the MSIRDIF flag. 66 / 631 Nations Technologies Inc. Tel:+86-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 0: No clock ready interrupt from MSI oscillator 1: MSI oscillator has generated a clock ready interrupt BORIF BOR interrupt flag 67 / 631 Nations Technologies Inc. Tel:+86-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: Apb2 Peripheral Reset Register (Rcc_Apb2Prst)

    1: Clock ready interrupt caused by LSI oscillator APB2 Peripheral Reset Register (RCC_APB2PRST) Address offset: 0x0C Reset value: 0x0000 0000 68 / 631 Nations Technologies Inc. Tel:+86-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 0: Clear the reset 1: Reset GPIO port C IOPBRST GPIO port B reset. Set or cleared by software. 69 / 631 Nations Technologies Inc. Tel:+86-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: Apb1 Peripheral Reset Register (Rcc_Apb1Prst)

    Reserved, the reset value must be maintained. CANRST CAN reset Set or cleared by software. 0: Clear the reset 70 / 631 Nations Technologies Inc. Tel:+86-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 Reserved, the reset value must be maintained. COMPRST COMP reset Set and cleared by software. 0: Clear the reset 1: Reset COMP 71 / 631 Nations Technologies Inc. Tel:+86-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: Ahb Peripheral Clock Enable Register (Rcc_Ahbpclken)

    31:13 Reserved Reserved, the reset value must be maintained. ADCEN ADC clock enable Set and cleared by software. 72 / 631 Nations Technologies Inc. Tel:+86-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: Apb2 Peripheral Clock Enable Register (Rcc_Apb2Pclken)

    0: DMA clock disabled 1: DMA clock enabled APB2 Peripheral Clock Enable Register (RCC_APB2PCLKEN) Address offset: 0x18 Reset value: 0x0000 0000 73 / 631 Nations Technologies Inc. Tel:+86-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 IO Port D clock enable Set and cleared by software. 0: IO Port D clock disabled 1: IO Port D clock enabled 74 / 631 Nations Technologies Inc. Tel:+86-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: Apb1 Peripheral Clock Enable Register (Rcc_Apb1Pclken)

    0: DAC interface clock disabled 1: DAC interface clock enable PWREN Power interface clock enable Set and cleared by software. 75 / 631 Nations Technologies Inc. Tel:+86-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 Set and cleared by software. 0: TIM9 clock disabled 1: TIM9 clock enabled Reserved Reserved, the reset value must be maintained. 76 / 631 Nations Technologies Inc. Tel:+86-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: Low Power Domain Control Register (Rcc_Ldctrl)

    0: TIM2 clock disabled 1: TIM2 clock enabled LOW POWER Domain Control Register (RCC_LDCTRL) Address offset: 0x20 Reset value: 0x0000 0000 77 / 631 Nations Technologies Inc. Tel:+86-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 LSE clock security system status. 0: No LSE failure detected 1: LSE failure detected LSECLKSSEN LSE clock security system enable bit. 78 / 631 Nations Technologies Inc. Tel:+86-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: Clock Control/Status Register (Rcc_Ctrlsts)

    1: A low-power management reset occurred WWDGRSTF Window watchdog reset flag Set by hardware when a window watchdog reset occurs. 79 / 631 Nations Technologies Inc. Tel:+86-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 Written by software. The value of these bits will be added to MSICAL[7:0] to form the final calibration value used to calibrate the frequency of the internal MSI RC oscillator. 80 / 631 Nations Technologies Inc. Tel:+86-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: Ahb Peripheral Reset Register (Rcc_Ahbprst)

    1: Enable the internal RC 40 kHz oscillator AHB Peripheral Reset Register (RCC_AHBPRST) Address offset: 0x28 Reset value: 0x0000 0000 81 / 631 Nations Technologies Inc. Tel:+86-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: Clock Configuration Register 2 (Rcc_Cfg2)

    PCLK2 × 2 is selected. 1: SYSCLK input clock is selected as TIM1/8 clock source. 28:24 RNGCPRES[4:0] RNGC prescaler. 82 / 631 Nations Technologies Inc. Tel:+86-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 11010: PLL clock divided by 128 11011: PLL clock divided by 256 Others: PLL clock divided by 256 83 / 631 Nations Technologies Inc. Tel:+86-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: Clock Configuration Register 3 (Rcc_Cfg3)

    00000: Reserved 00001: TRNG 1M clock source divided by 2, HSE must be selected as TRNG 1M input clock 84 / 631 Nations Technologies Inc. Tel:+86-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: Retention Domain Control Register (Rcc_Rdctrl)

    0: Clear reset 1: Reset LPTIM Reserved Reserved, the reset value must be maintained. LPUARTEN LPUART clock enable. 85 / 631 Nations Technologies Inc. Tel:+86-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: Pll And Hsi Configuration Register (Rcc_Pllhsipre)

    Name Description 31:2 Reserved Reserved, the reset value must be maintained. PLLSRCDIV PLL clock source frequency division selection 86 / 631 Nations Technologies Inc. Tel:+86-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: Sram Control/Status Register (Rcc_Sram_Ctrlsts)

    0: Trigger an interrupt when a parity error is detected 1: Not trigger an interrupt when a parity error is detected 87 / 631 Nations Technologies Inc. Tel:+86-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: Gpio And Afio

    8-bit byte access is not allowed). The figure below shows the basic structure of an I/O port. 88 / 631 Nations Technologies Inc. Tel:+86-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: 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 89 / 631 Nations Technologies Inc. Tel:+86-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: 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 90 / 631 Nations Technologies Inc. Tel:+86-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: Figure 5-2 Input Floating/Pull-Up/Pull-Down Configuration

    The '1' port on the output data register is placed in a high impedance state (P-MOS is never activated) 91 / 631 Nations Technologies Inc. Tel:+86-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: 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 92 / 631 Nations Technologies Inc. Tel:+86-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-4 Alternate Function Configuration

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

    (GPIOx_POD) can be realized, and one or more bits can be set. The bit 94 / 631 Nations Technologies Inc. Tel:+86-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: 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. 95 / 631 Nations Technologies Inc. Tel:+86-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: Table 5-3 Debug Port Image

    ADC external trigger injection conversion is ADC external trigger injection conversion and injection conversion connected to EXTI (0 - 15). TIM8_CH4 connection. 96 / 631 Nations Technologies Inc. Tel:+86-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: 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 97 / 631 Nations Technologies Inc. Tel:+86-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-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 98 / 631 Nations Technologies Inc. Tel:+86-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-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 99 / 631 Nations Technologies Inc. Tel:+86-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-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 PB11 USART3_RX PC11 100 / 631 Nations Technologies Inc. Tel:+86-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-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 PB10 101 / 631 Nations Technologies Inc. Tel:+86-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-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 PA14 I2C1_SDA I2C1_SMBA 102 / 631 Nations Technologies Inc. Tel:+86-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-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 SPI1_I2S1_SCK_CK PA10 SPI1_I2S1_MISO_MCK SPI1_I2S1_MOSI_SD 103 / 631 Nations Technologies Inc. Tel:+86-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-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 104 / 631 Nations Technologies Inc. Tel:+86-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: Io Configuration Of Peripherals

    Table 5-32 LPTIM LPTIM pin PAD configuration mode LPTIM_INx Input floating LPTIM_OUT Push-pull alternate output LPTIM_ETR Input floating 105 / 631 Nations Technologies Inc. Tel:+86-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-33 Can

    Input floating or input pull-up or push-pull Slave mode alternate output Input floating or input pull-up or push-pull SPIx_I2Sx_MISO_MCK Master mode alternate output 106 / 631 Nations Technologies Inc. Tel:+86-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: Gpio Locking Mechanism

    When GPIOx_PLOCK.PLOCKK=1 but GPIOx_PLOCK.PLOCK[x]=0, the corresponding configuration and alternate function bits corresponding to GPIOx_PLOCK.PLOCK[x]=0 can be 107 / 631 Nations Technologies Inc. Tel:+86-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: Gpio Registers

    008h Reserved Reset Value GPIOx_PUPD 00Ch Reset Value GPIOx_PID 010h Reserved Reset Value GPIOx_POD 014h Reserved Reset Value 108 / 631 Nations Technologies Inc. Tel:+86-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: Gpio Mode Description Register (Gpiox_Pmode)

    01: General output mode 25:24 10: Alternate function mode 23:22 11: Analog function mode (state after reset) 21:20 19:18 109 / 631 Nations Technologies Inc. Tel:+86-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: Gpio Type Definition (Gpiox_Potype)

    Reserved, the reset value must be maintained. Toggle rate configuration bits y for port GPIOx (y = 0…15) 15:0 110 / 631 Nations Technologies Inc. Tel:+86-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 Pull-Up/Pull-Down Description Register (Gpiox_Pupd)

    11: Reserved 21:20 19:18 17:16 15:14 13:12 11:10 GPIO input data register (GPIOx_PID) Address: 0x10 Reset value: 0x0000 0000(x=A,B,C,D) 111 / 631 Nations Technologies Inc. Tel:+86-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: Gpio Output Data Register (Gpiox_Pod)

    Reset value: 0x0000 0000(x=A,B,C,D) Bit field Name Description Clear bit y of port GPIOx (y = 0…15) 31:16 PBCy 112 / 631 Nations Technologies Inc. Tel:+86-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 Configuration Lock Register (Gpiox_Plock)

    These bits are readable and writable but can only be written when the PLOCKK bit is 0: Do not lock the configuration of the port 1: Lock the configuration of the port 113 / 631 Nations Technologies Inc. Tel:+86-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 Alternate Function Low Register (Gpiox_Afl)

    1100:AF12 1101:AF13 1110:AF14 1111:AF15 GPIO alternate function High register (GPIOx_AFH) Address: 0x24 Reset value: 0x000F FFFF(x=A) ;0xFFFF FFFF(x=B,C,D) 114 / 631 Nations Technologies Inc. Tel:+86-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 Bit Clear Register (Gpiox_Pbc)

    1: Clear the corresponding PODy bit to 0 GPIO driver strength configuration register (GPIOx_DS) Address: 0x2C Reset value: 0x5555 5555(x=A,B,C,D) 115 / 631 Nations Technologies Inc. Tel:+86-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: Afio Registers

    AFIO base address: 0x40010000 Table 5-43 AFIO register overview Offset Register AFIO_RMP_CFG 000h Reserved Reset Value AFIO_EXTI_CFG1 004h Reserved Reset Value 116 / 631 Nations Technologies Inc. Tel:+86-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: Afio Mapping Configuration Control Register (Afio_Rmp_Cfg)

    ADC regular conversion external trigger. 0: ADC regular conversion external trigger is connected to EXTI (0-15) 117 / 631 Nations Technologies Inc. Tel:+86-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: Afio External Interrupt Configuration Register 1(Afio_Exti_Cfg1)

    01:PB0 pin 10:PC0 pin 11:PD0 pin AFIO external interrupt configuration register 2(AFIO_EXTI_CFG2) Address: 0x08 Reset value: 0x0000 0000 118 / 631 Nations Technologies Inc. Tel:+86-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: Afio External Interrupt Configuration Register 3(Afio_Exti_Cfg3)

    Reset value: 0x0000 0000 Bit field Name Description 31:14 Reserved Reserved, the reset value must be maintained. 13:12 EXTI11[1:0] 00:PA11 pin 119 / 631 Nations Technologies Inc. Tel:+86-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 External Interrupt Configuration Register 4(Afio_Exti_Cfg4)

    11:10 Reserved Reserved, the reset value must be maintained. EXTI14[1:0] 00:PA14 pin 01:PB14 pin 10:PC14 pin 11:PD14 pin 120 / 631 Nations Technologies Inc. Tel:+86-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 10:PC13 pin 11:Reserved Reserved Reserved, the reset value must be maintained. EXTI12[1:0] 00:PA12 pin 01:PB12 pin 10:PC12 pin 11:Reserved 121 / 631 Nations Technologies Inc. Tel:+86-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: 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 122 / 631 Nations Technologies Inc. Tel:+86-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 TIM1_CC TIM1 capture comparison interrupt 0x0000_00AC Settable TIM2 TIM2 global interrupt 0x0000_00B0 Settable TIM3 TIM3 global interrupt 0x0000_00B4 123 / 631 Nations Technologies Inc. Tel:+86-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 SAC global interrupt 0x0000_013C Settable MMU global interrupt 0x0000_0140 Settable Reserved Reserved 0x0000_0144 Settable RAMC_PERR RAM verification error interrupt 0x0000_0148 124 / 631 Nations Technologies Inc. Tel:+86-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: 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. 125 / 631 Nations Technologies Inc. Tel:+86-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: Functional Description

    In addition, interrupt/event requests can also be generated by software by writing a '1' in the software interrupt/event register. 126 / 631 Nations Technologies Inc. Tel:+86-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  Configure 25 interrupt/event line mask bits (EXTI_IMASK and EXTI_EMASK).  Configure the request bit of the software interrupt event register (EXTI_SWIE). 127 / 631 Nations Technologies Inc. Tel:+86-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: Exti Line Mapping

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

    EXTI_TS_SEL TSSEL[3:0] 018h Reserved Reset Value EXTI interrupt mask register (EXTI_IMASK) Address offset: 0x00 Reset value: 0x0000 0000 129 / 631 Nations Technologies Inc. Tel:+86-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 Event Mask Register (Exti_Emask)

    The rising edge on line x triggers the configuration bit 0: Disable rising edge triggering (interrupts and events) on input line x 130 / 631 Nations Technologies Inc. Tel:+86-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 Falling Edge Trigger Configuration Register (Exti_Ft_Cfg)

    Note: This bit can be cleared to '0' by writing '1' to clear the corresponding bit of EXTI_PEND. EXTI pending register (EXTI_PEND) Address offset: 0x00 Reset value: 0x0000 0000 131 / 631 Nations Technologies Inc. Tel:+86-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 Timestamp Trigger Source Selection Register (Exti_Ts_Sel)

    0001: Select EXTI1 as the trigger source of the timestamp event. 1111: Select EXTI15 as the trigger source for the timestamp event. 132 / 631 Nations Technologies Inc. Tel:+86-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: Dma Controller

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

    After one operation, the controller calculates the number of remaining transfers and updates the source address and the destination address 134 / 631 Nations Technologies Inc. Tel:+86-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: 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. 135 / 631 Nations Technologies Inc. Tel:+86-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: 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 136 / 631 Nations Technologies Inc. Tel:+86-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: Peripheral/Memory Address Incrementation

    Configure interrupt mask bits, 1: enable interrupts, 0 disable interrupts. Configure channel peripheral address and memory address and transfer direction. 137 / 631 Nations Technologies Inc. Tel:+86-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: Flow Control

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

    Event flag bit Enable control bit Half transfer HTXF HTXIE Transfer complete TXCF TXCIE Transfer error ERRF ERRIE 139 / 631 Nations Technologies Inc. Tel:+86-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: Dma Request Mapping

    Sel = 27 TIM1_UP Sel = 28 TIM1_TRIG Sel = 29 TIM2_CH1 Sel = 30 TIM2_CH2 Sel = 31 TIM2_CH3 140 / 631 Nations Technologies Inc. Tel:+86-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: Dma Registers

    Sel = 62 TIM9_UP DMA registers DMA register overview Table 7-5 DMA register overview Offset Register DMA_INTSTS 000h Reset Value 141 / 631 Nations Technologies Inc. Tel:+86-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 068h Reserved Reset Value DMA_CHCFG6 06Ch Reserved Reset Value DMA_TXNUM6 NDTX[15:0] 070h Reserved Reset Value 074h DMA_PADDR6 ADDR[31:0] 142 / 631 Nations Technologies Inc. Tel:+86-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: Dma Interrupt Status Register (Dma_Intsts)

    29/25/21/17/13/9/5/1 TXCFx Hardware sets this bit when transfer is done. This bit is cleared by software by writing 143 / 631 Nations Technologies Inc. Tel:+86-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: Dma Interrupt Flag Clear Register (Dma_Intclr)

    1: Reset DMA_INTSTS.GLBF bit of corresponding channel. DMA channel x configuration register (DMA_CHCFGx) Note:The x is channel number, x = 1…8 144 / 631 Nations Technologies Inc. Tel:+86-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 Software can enable/disable peripheral address increment mode. 0: Peripheral address won't increase with each transfer. 1: Peripheral address increase with each transfer. 145 / 631 Nations Technologies Inc. Tel:+86-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: Dma Channel X Transfer Number Register (Dma_Txnumx)

    Number of data to transfer. Number of data to be transferred (0~65535). Software can read/write the number of 146 / 631 Nations Technologies Inc. Tel:+86-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 Channel X Peripheral Address Register (Dma_Paddrx)

    This register can only be written if the channel is disabled (DMA_CHCFGx.CHEN = 0). Bit field Name Description 31:0 ADDR ADDR Memory address. 147 / 631 Nations Technologies Inc. Tel:+86-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 Channel X Channel Request Select Register (Dma_Chselx)

    0x03:USART2_TX 0x04:USART2_RX 0x05:USART3_TX 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 148 / 631 Nations Technologies Inc. Tel:+86-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 0x2C:TIM5_CH2 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 149 / 631 Nations Technologies Inc. Tel:+86-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 Bit field Name Description 0x3E:TIM9_UP 150 / 631 Nations Technologies Inc. Tel:+86-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: 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. 151 / 631 Nations Technologies Inc. Tel:+86-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: Crc Function Description

    If the initial value needs to be set, the LRC register should be configured first. 152 / 631 Nations Technologies Inc. Tel:+86-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: 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 153 / 631 Nations Technologies Inc. Tel:+86-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: 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 154 / 631 Nations Technologies Inc. Tel:+86-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: 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 155 / 631 Nations Technologies Inc. Tel:+86-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: 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. 156 / 631 Nations Technologies Inc. Tel:+86-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: 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 157 / 631 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com...
  • Page 181: 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; 158 / 631 Nations Technologies Inc. Tel:+86-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: 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 159 / 631 Nations Technologies Inc. Tel:+86-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: Counter Mode

    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 160 / 631 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 184 The figure below shows some examples of the counter behavior and the update flags for different division factors in the up-counting mode. 161 / 631 Nations Technologies Inc. Tel:+86-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: 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) 162 / 631 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 186: Figure 10-4 Timing Diagram Of The Up-Counting, Update Event When Arpen=0/1

    Figure 10-4 Timing diagram of the up-counting, update event when ARPEN=0/1 163 / 631 Nations Technologies Inc. Tel:+86-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 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 / 631 Nations Technologies Inc. Tel:+86-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-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". 165 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: Repetition Counter

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

    Counter clock = CK_CNT=CK_PSC Counter register 63 64 65 66 00 01 02 03 04 05 06 07 170 / 631 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 194: Figure 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 / 631 Nations Technologies Inc. Tel:+86-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-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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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-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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: Forced Output Mode

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

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

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

     If the value written into the counter is 0 or is the value of TIMx_AR, the direction will be updated but the update event will not be generated. 181 / 631 Nations Technologies Inc. Tel:+86-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-23 Edge-Aligned Pwm Waveform (Apr=8)

     Down-counting User can set TIMx_CTRL1.DIR=1 to make counter counts down. Here is an example for PWM mode1. 182 / 631 Nations Technologies Inc. Tel:+86-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: One-Pulse Mode

    TIMx_CCEN.CC2P= ‘0’; 3. TI2FP2 acts as the trigger (TRGI) of the slave mode controller and starts the counter, TIMx_SMCTRL.TSEL= 183 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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 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 / 631 Nations Technologies Inc. Tel:+86-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: Debug Mode

    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); 189 / 631 Nations Technologies Inc. Tel:+86-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-27 Control Circuit In Reset 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 / 631 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 214: Figure 10-28 Control Circuit In Trigger 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 / 631 Nations Technologies Inc. Tel:+86-755-86309900 Email:info@nationstech.com Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North. Nanshan District, Shenzhen, 518057, P.R.China...
  • Page 215: Figure 10-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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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: Figure 10-34 Example Of Hall Sensor Interface

    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 / 631 Nations Technologies Inc. Tel:+86-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: Timx Registers(X=1, 8)

    014h Reset Value TIMx_CCMOD1 Reset Value 018h TIMx_CCMOD1 Reset Value TIMx_CCMOD2 01Ch Reset Value TIMx_CCMOD2 01Ch Reset Value 198 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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 11: Center-aligned mode 3. The counter counts in center-aligned mode, and the output compare interrupt flag bit is set to 1 when up-counting or down-counting. 200 / 631 Nations Technologies Inc. Tel:+86-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: 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 / 631 Nations Technologies Inc. Tel:+86-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 When the counter enable signal is controlled by the trigger input, there is a delay on TRGO except if the master/slave mode is selected (see the description of the TIMx_SMCTRL.MSMD bit). 202 / 631 Nations Technologies Inc. Tel:+86-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: Slave Mode Control Register (Timx_Smctrl)

    This bit is used to enable external clock mode 2, and the counter is driven by any active edge on the ETRF signal in this mode. 203 / 631 Nations Technologies Inc. Tel:+86-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 0: No action 1: Events on the trigger input (TRGI) are delayed to allow a perfect synchronization between 204 / 631 Nations Technologies Inc. Tel:+86-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: Table 10-3 Timx Internal Trigger Connection

    ITR2 (TSEL = 010) ITR3 (TSEL = 011) TIM1 TIM5 TIM2 TIM3 TIM4 TIM8 TIM1 TIM2 TIM4 TIM5 205 / 631 Nations Technologies Inc. Tel:+86-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)

    0: Disable trigger interrupt 1: Enable trigger interrupt COMIEN COM interrupt enable 0: Disable COM interrupt 1: Enable COM interrupt 206 / 631 Nations Technologies Inc. Tel:+86-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: Status Registers (Timx_Sts)

    See TIMx_STS.CC1OCF description. CC3OCF Capture/Compare 3 overcapture flag See TIMx_STS.CC1OCF description. CC2OCF Capture/Compare 2 overcapture flags See TIMx_STS.CC1OCF description. 207 / 631 Nations Technologies Inc. Tel:+86-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 TIMx_STS.CC1ITF bit will go high if the counter overflows (in up-counting and up/down- counting modes) and underflows in down-counting mode. When the corresponding channel of CC1 is in input mode: 208 / 631 Nations Technologies Inc. Tel:+86-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: Event Generation Registers (Timx_Evtgen)

    DMA will be generated. This bit is automatically cleared by hardware. 0: No action 1: Generated a trigger event CCUDGN Capture/Compare control update generation 209 / 631 Nations Technologies Inc. Tel:+86-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: Capture/Compare Mode Register 1 (Timx_Ccmod1)

    ICx describes the function of a channel in input mode. Hence, please note that the same bit can have different meanings for output mode and for input mode. 210 / 631 Nations Technologies Inc. Tel:+86-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 Note 1: In PWM mode 1 or PWM mode 2, the OC1REF level changes only when the comparison result changes or when the output compare mode is switched from frozen mode 211 / 631 Nations Technologies Inc. Tel:+86-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 10: CC2 channel is configured as input, IC2 is mapped on TI1 11: CC2 channel is configured as input, IC2 is mapped on TRC. This mode is only active 212 / 631 Nations Technologies Inc. Tel:+86-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: Capture/Compare Mode Register 2 (Timx_Ccmod2)

    Note: CC1SEL is writable only when the channel is off (TIMx_CCEN.CC1EN = 0). Capture/compare mode register 2 (TIMx_CCMOD2) Offset address: 0x1C 213 / 631 Nations Technologies Inc. Tel:+86-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 Input capture mode: Bit field Name Description 15:12 IC4F[3:0] Input Capture 4 filter 11:10 IC4PSC[1:0] Input Capture 4 Prescaler 214 / 631 Nations Technologies Inc. Tel:+86-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: Capture/Compare Enable Registers (Timx_Ccen)

    Reserved, the reset value must be maintained CC5P Capture/Compare 5 output polarity See TIMx_CCEN.CC1P description. CC5EN Capture/Compare 5 output enable See TIMx_CCEN.CC1EN description. 215 / 631 Nations Technologies Inc. Tel:+86-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 IC1 is non-inverted. 1: inverted: Capture action occurs when IC1 generates a falling edge. When used as external 216 / 631 Nations Technologies Inc. Tel:+86-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: Table 10-4 Output Control Bits Of Complementary Ocx And Ocxn Channels With Break Function

    Then if the clock is present:OCx=OIx and OCxN=OIxN after a dead-time, when (CCxP ^ OIx) ^ (CCxNP^OIxN)! = 0. Off-state (Output enabled with inactive state) Asynchronously: OCx=CCxP, OCx_EN=1, OCxN=CCxNP,OCxN_EN=1; 217 / 631 Nations Technologies Inc. Tel:+86-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: Counters (Timx_Cnt)

    Each time an update event occurs, the PSC value is loaded into the active prescaler register. Auto-reload register (TIMx_AR) Offset address: 0x2C Reset values: 0xFFFF 218 / 631 Nations Technologies Inc. Tel:+86-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: Repeat Count Registers (Timx_Repcnt)

    Otherwise, this preloaded value is transferred to the active register only when an update event occurs.  CC1 channel is configured as input: 219 / 631 Nations Technologies Inc. Tel:+86-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 2 (Timx_Ccdat2)

    CC3 channel is configured as output: CCDAT3 contains the value to be compared to the counter TIMx_CNT, signaling on the OC3 output. 220 / 631 Nations Technologies Inc. Tel:+86-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 4 (Timx_Ccdat4)

    TIMx_BKDT register. 221 / 631 Nations Technologies Inc. Tel:+86-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 Lock Configuration These bits offer a write protection against software errors. – No write protected. – LOCK Level 1 222 / 631 Nations Technologies Inc. Tel:+86-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: Dma Control Register (Timx_Dctrl)

    This bit field defines the number DMA will accesses (write/read) TIMx_DADDR register. 00000:1 time transfer 00001: 2 times transfers 223 / 631 Nations Technologies Inc. Tel:+86-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 Transfer Buffer Register (Timx_Daddr)

    … … For the fourth time, DMA access to the TIMx_ DADDR register will be mapped to access 224 / 631 Nations Technologies Inc. Tel:+86-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)

    TIM1_CC5 and TIM8_CC5 is used for comparator blanking. 225 / 631 Nations Technologies Inc. Tel:+86-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 6 (Timx_Ccdat6)

    TIM1_CC6 is used to switch the input channel of OPAMP1 and OPAMP2; TIM8_CC6 can switch the input channel of OPAMP2 226 / 631 Nations Technologies Inc. Tel:+86-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 227 / 631 Nations Technologies Inc. Tel:+86-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

    (TIMx_PSC, TIMx_CNT and TIMx_AR) at any time. Depending on the setting of the auto-reload preload enable bit (TIMx_CTRL1.ARPEN), the value of the preload 228 / 631 Nations Technologies Inc. Tel:+86-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

    DMA requests are generated. This setting is used in scenarios where you want to clear the counter but do not want to generate an update interrupt. 229 / 631 Nations Technologies Inc. Tel:+86-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. 230 / 631 Nations Technologies Inc. Tel:+86-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) 231 / 631 Nations Technologies Inc. Tel:+86-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 232 / 631 Nations Technologies Inc. Tel:+86-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". 233 / 631 Nations Technologies Inc. Tel:+86-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) 234 / 631 Nations Technologies Inc. Tel:+86-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 : 235 / 631 Nations Technologies Inc. Tel:+86-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 236 / 631 Nations Technologies Inc. Tel:+86-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. 237 / 631 Nations Technologies Inc. Tel:+86-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 238 / 631 Nations Technologies Inc. Tel:+86-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. 239 / 631 Nations Technologies Inc. Tel:+86-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. 240 / 631 Nations Technologies Inc. Tel:+86-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 241 / 631 Nations Technologies Inc. Tel:+86-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: 242 / 631 Nations Technologies Inc. Tel:+86-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. 243 / 631 Nations Technologies Inc. Tel:+86-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: 244 / 631 Nations Technologies Inc. Tel:+86-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. 245 / 631 Nations Technologies Inc. Tel:+86-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. 246 / 631 Nations Technologies Inc. Tel:+86-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)

     If the value written into the counter is greater than the value of auto-reload, the direction will not be updated. 247 / 631 Nations Technologies Inc. Tel:+86-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. 248 / 631 Nations Technologies Inc. Tel:+86-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 249 / 631 Nations Technologies Inc. Tel:+86-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. 250 / 631 Nations Technologies Inc. Tel:+86-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. 251 / 631 Nations Technologies Inc. Tel:+86-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

    Setting TIM1_CTRL2.MMSEL=’100’ to use the OC1REF of TIM1 as trigger output.  Configure TIM1_CCMOD1 register to configure the OC1REF output waveform. 252 / 631 Nations Technologies Inc. Tel:+86-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. 253 / 631 Nations Technologies Inc. Tel:+86-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. 254 / 631 Nations Technologies Inc. Tel:+86-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. 255 / 631 Nations Technologies Inc. Tel:+86-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 256 / 631 Nations Technologies Inc. Tel:+86-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) 257 / 631 Nations Technologies Inc. Tel:+86-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 TIMx register overview Offset Register TIMx_CTRL1 000h Reset Value TIMx_CTRL2 004h Reset Value TIMx_SMCTRL 008h Reset Value 258 / 631 Nations Technologies Inc. Tel:+86-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] 259 / 631 Nations Technologies Inc. Tel:+86-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 260 / 631 Nations Technologies Inc. Tel:+86-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. 261 / 631 Nations Technologies Inc. Tel:+86-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. 262 / 631 Nations Technologies Inc. Tel:+86-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. 263 / 631 Nations Technologies Inc. Tel:+86-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 264 / 631 Nations Technologies Inc. Tel:+86-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 265 / 631 Nations Technologies Inc. Tel:+86-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 266 / 631 Nations Technologies Inc. Tel:+86-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. 267 / 631 Nations Technologies Inc. Tel:+86-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)

    1: Generated a trigger event Reserved Reserved, the reset value must be maintained CC4GN Capture/Compare 4 generation See TIMx_EVTGEN.CC1GN description. 268 / 631 Nations Technologies Inc. Tel:+86-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)

    Output compare mode: Bit field Name Description OC2CEN Output Compare 2 clear enable 269 / 631 Nations Technologies Inc. Tel:+86-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 Note 1: In PWM mode 1 or PWM mode 2, the OC1REF level changes only when the comparison result changes or when the output compare mode is switched from frozen mode to PWM mode. 270 / 631 Nations Technologies Inc. Tel:+86-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 TIMx_SMCTRL.TSEL. Note: CC2SEL is writable only when the channel is off (TIMx_CCEN.CC2EN = 0). 271 / 631 Nations Technologies Inc. Tel:+86-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)

    Capture/compare mode register 2 (TIMx_CCMOD2) Offset address: 0x1C Reset value: 0x0000 See the description of the CCMOD1 register above 272 / 631 Nations Technologies Inc. Tel:+86-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 Input capture mode: Bit field Name Description 15:12 IC4F[3:0] Input Capture 4 filter 11:10 IC4PSC[1:0] Input Capture 4 Prescaler 273 / 631 Nations Technologies Inc. Tel:+86-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)

    See TIMx_CCEN.CC1EN description. Reserved Reserved, the reset value must be maintained CC2P Capture/Compare 2 output polarity See TIMx_CCEN.CC1P description. 274 / 631 Nations Technologies Inc. Tel:+86-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)

    GPIO and AFIO registers. Counters (TIMx_CNT) Offset address: 0x24 Reset value: 0x0000 Bit field Name Description 15:0 CNT[15:0] Counter value 275 / 631 Nations Technologies Inc. Tel:+86-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: Prescaler (Timx_Psc)

    CC1 channel is configured as output: CCDAT1 contains the value to be compared to the counter TIMx_CNT, signaling on the OC1 output. 276 / 631 Nations Technologies Inc. Tel:+86-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 2 (Timx_Ccdat2)

    Reset value: 0x0000 Bit field Name Description 15:0 CCDAT3[15:0] Capture/Compare 3 value  CC3 channel is configured as output: 277 / 631 Nations Technologies Inc. Tel:+86-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: Capture/Compare Register 4 (Timx_Ccdat4)

    Offset address: 0x48 Reset value: 0x0000 Bit field Name Description 15:13 Reserved Reserved, the reset value must be maintained 278 / 631 Nations Technologies Inc. Tel:+86-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)

    DMA base address = The address of TIM_CTRL1 + TIMx_DCTRL. DBADDR * 4; DMA burst len = TIMx_DCTRL.DBLEN + 1. Example: If TIMx_DCTRL.DBLEN = 0x3(4 transfers), TIMx_DCTRL.DBADDR = 0xD 279 / 631 Nations Technologies Inc. Tel:+86-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 For the fourth time, DMA access to the TIMx_ DADDR register will be mapped to access TIMx_CCDAT4 register; 280 / 631 Nations Technologies Inc. Tel:+86-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 (Tim6 And Tim7)

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

    89 8A 8B 8C Update event(UEV) Prescaler controller register Write a new value in TIMx_PSC Prescaler counter Prescaler buffer 282 / 631 Nations Technologies Inc. Tel:+86-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: 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. 283 / 631 Nations Technologies Inc. Tel:+86-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-3 Timing Diagram Of Up-Counting. The Internal Clock Divider Factor = 2/N

    Internal clock divided by N CK_PSC Timer clock = CK_CNT Counter register Counter overflow Update interrupt flag(UDITF) Update event(UEV) 284 / 631 Nations Technologies Inc. Tel:+86-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: 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 285 / 631 Nations Technologies Inc. Tel:+86-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: 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). 286 / 631 Nations Technologies Inc. Tel:+86-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: Timx Register Overview

    Reserved, the reset value must be maintained ARPEN ARPEN: Auto-reload preload enable 0: Shadow register disable for TIMx_AR register 287 / 631 Nations Technologies Inc. Tel:+86-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: 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: 288 / 631 Nations Technologies Inc. Tel:+86-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: 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 289 / 631 Nations Technologies Inc. Tel:+86-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: 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 290 / 631 Nations Technologies Inc. Tel:+86-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: 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. 291 / 631 Nations Technologies Inc. Tel:+86-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: Low Power Timer (Lptim)

     Encoder mode, Encoder mode Pulse counting mode, support single pulse counting, double pulse counting (orthogonal and non-orthogonal) 292 / 631 Nations Technologies Inc. Tel:+86-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: 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 293 / 631 Nations Technologies Inc. Tel:+86-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: Prescaler

    Figure 13-2 shows an example of glitch filter behavior when detected a 2 consecutive samples. 294 / 631 Nations Technologies Inc. Tel:+86-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: Timer Enable

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

    It is possible to switch from one-shot mode to continuous mode. Setting LPTIM_CTRL.SNGMST bit will switch the LPTIM to one-shot counting mode if continuous counting mode was previously selected. The counter stops as soon 296 / 631 Nations Technologies Inc. Tel:+86-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: Figure 13-4 Ptim Output Waveform, Single Counting Mode Configuration

    Figure 13-5. 297 / 631 Nations Technologies Inc. Tel:+86-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: 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 298 / 631 Nations Technologies Inc. Tel:+86-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: 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. 299 / 631 Nations Technologies Inc. Tel:+86-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: Counter Mode

    For this configuration, the LPTIM counter can be updated either on rising edges or falling edges of the input1 clock signal but not on both rising and falling edges. 300 / 631 Nations Technologies Inc. Tel:+86-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: Encoder Mode

    Caution: In this mode the LPTIM must be clocked by an internal clock source, so the LPTIM_CFG.CLKSEL bit must 301 / 631 Nations Technologies Inc. Tel:+86-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: 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 302 / 631 Nations Technologies Inc. Tel:+86-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: Timeout Function

    When timeout function is used, the LPTIM counter will be reset and re-start by a selected trigger input event. If no trigger occurs within the configured time, the compare match event will happen. The waiting time is configured 303 / 631 Nations Technologies Inc. Tel:+86-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 Interrupts

    LPTIM register overview Table 13-5 LPTIM register overview Offset Register LPTIM_INTSTS 000h Reserved Reset Value 004h LPTIM_INTCLR Reserved 304 / 631 Nations Technologies Inc. Tel:+86-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 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. 305 / 631 Nations Technologies Inc. Tel:+86-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 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 306 / 631 Nations Technologies Inc. Tel:+86-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 Interrupt Enable Register (Lptim_Inten)

    0: ARRM interrupt disabled 1: ARRM interrupt enabled CMPMIE Compare match interrupt enable bit. 0: CMPM interrupt disabled 307 / 631 Nations Technologies Inc. Tel:+86-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: Lptim Configuration Register (Lptim_Cfg)

    LPTIM_COMP registers 1: The LPTIM output reflects the inverse of the compare results between LPTIM_ARR and LPTIM_COMP registers 308 / 631 Nations Technologies Inc. Tel:+86-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 111: / 128 Reserved Reserved, the reset value must be maintained. TRIGFLT[1:0] Configure the data filter trigger bit. 309 / 631 Nations Technologies Inc. Tel:+86-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 The CKSEL bit selects which clock source the LPTIM will use: 0: LPTIM is clocked by internal clock source (APB1 clock or any of the embedded oscillators) 310 / 631 Nations Technologies Inc. Tel:+86-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 Control Register (Lptim_Ctrl)

    The LPTIMEN bit is set and cleared by software. 0: LPTIM is disabled 1: LPTIM is enabled LPTIM compare register (LPTIM_COMP) Address offset: 0x14 311 / 631 Nations Technologies Inc. Tel:+86-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: Lptim Auto-Reload Register (Lptim_Arr)

    ARRVAL - 1. LPTIM counter register (LPTIM_CNT) Address offset: 0x1C Reset value: 0x0000 0000 312 / 631 Nations Technologies Inc. Tel:+86-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 If identical, the reading is reliable. 313 / 631 Nations Technologies Inc. Tel:+86-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: Real Time Clock (Rtc)

    APB will be reset Reset The following registers will be cleared when the system is reset  RTC_SUBS 314 / 631 Nations Technologies Inc. Tel:+86-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 Alternatively a tamper event could be a source of Time-stamp event. Alarm A/Alarm B interrupt/event Interrupts/events Wakeup interrupt/event Timestamp interrupt/event 315 / 631 Nations Technologies Inc. Tel:+86-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: Function Description

     Alarm A and Alarm B event/interrupts  Timestamp event/interrupt  Tamper event/interrupt  20 32-bit backup registers 316 / 631 Nations Technologies Inc. Tel:+86-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: Gpio Controlled By Rtc

    RTC clock and prescaler RTC clock source:  LSE clock 317 / 631 Nations Technologies Inc. Tel:+86-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: Rtc Calendar

    The value of prescaler and calendar can be initialized by the following steps:  Enter initialization mode by setting “1” to RTC_INITSTS.INITM bit, then wait for RTC_INITSTS.INITF flag 318 / 631 Nations Technologies Inc. Tel:+86-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: Calendar Reading

    319 / 631 Nations Technologies Inc. Tel:+86-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: Calibration Clock Output

    RTC_CTRL.OPOL bit control the polarity of the Alarm A, Alarm B or Wakeup output. RTC_OPT.TYPE bit control the RTC_ALARM pin to output open drain or output pull-up. 320 / 631 Nations Technologies Inc. Tel:+86-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: Periodic Automatic Wakeup

    RTC_INITSTS.TISF is set to 1. Timestamp event can generate an interrupt if RTC_CTRL.TSIEN is set to 1. If a new timestamp event is detected when RTC_INITSTS.TISF has been set to 1 already, the hardware sets 321 / 631 Nations Technologies Inc. Tel:+86-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: Tamper Detection

    Filtered level detection of RTC_TAMPx input When RTC_TMPCFG.TPFLT[1:0] bits set to 1/2/3, tamper detection is set to level detection. The value of 322 / 631 Nations Technologies Inc. Tel:+86-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: Daylight Saving Time Configuration

    Digital precision calibration is achieved by adjusting the number of RTC clock pulses in the calibration period. Digital precision calibration resolution is 0.954 PPM with the range from -487.1 PPM to +488.5 PPM. 323 / 631 Nations Technologies Inc. Tel:+86-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 Using an accurate 16-second period to measure the 1Hz calibration output can ensure that the measurement error is within 0.954ppm (0.5 RTCCLK cycles within 16 seconds). 324 / 631 Nations Technologies Inc. Tel:+86-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: Rtc Low Power Mode

    WDU[2:0] MOU[3:0] DAT[1:0] DAU[3:0] 004h Reserved Reset Value RTC_CTRL 008h Reserved Reset Value RTC_INITSTS 00Ch Reserved Reset Value 325 / 631 Nations Technologies Inc. Tel:+86-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)

    050h RTC_BKPx BF[31:0] 09Ch Reset Value RTC Calendar Time Register (RTC_TSH) Address offset: 0x00 Reset value: 0x0000 0000 326 / 631 Nations Technologies Inc. Tel:+86-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 Calendar Date Register (Rtc_Date)

    Describes which Week day 000: Forbidden 001: Monday 111: Sunday Describes the month tens value in BCD format 327 / 631 Nations Technologies Inc. Tel:+86-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: Rtc Control Register (Rtc_Ctrl)

    This bit is written by the user 0: Not record daylight saving time 1: Record daylight saving time 328 / 631 Nations Technologies Inc. Tel:+86-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 0: Calendar values are copied from the shadow registers, which are refreshed every two RTCCLK cycles. 1: Calendar values are copied directly from the calendar counters. 329 / 631 Nations Technologies Inc. Tel:+86-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: Rtc Initial Status Register (Rtc_Initsts)

    This flag is set to ‘1’ by hardware when a tamper event is detected on the RTC_TAMP3 input pin. This flag can be cleared by software writing 0 330 / 631 Nations Technologies Inc. Tel:+86-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 Register synchronization flag This flag is set to ‘1’ by hardware when the calendar value are copied into the shadow 331 / 631 Nations Technologies Inc. Tel:+86-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 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 332 / 631 Nations Technologies Inc. Tel:+86-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 Wakeup Timer Register (Rtc_Wkupt)

    RTC Alarm A Register (RTC_ALARMA) Address offset: 0x1C Reset value: 0x0000 0000 333 / 631 Nations Technologies Inc. Tel:+86-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 Alarm B Register (Rtc_ Alarmb)

    Address offset: 0x20 Reset value: 0x0000 0000 Bit field Name Description MASK4 Alarm date mask 0: Date/day match 334 / 631 Nations Technologies Inc. Tel:+86-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 Write Protection Register (Rtc_Wrp)

    Reading this byte always returns 0x00. For detail on how to unlock RTC register write protection, see chapter RTC register 335 / 631 Nations Technologies Inc. Tel:+86-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 Sub-Second Register (Rtc_Subs)

    This bit can only be written and read as zero. Writing to this bit does not have an impact when RTC_INITSTS.SHOPF=1. 30:15 Reserved Reserved, the reset value must be maintained 336 / 631 Nations Technologies Inc. Tel:+86-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 Time Register (Rtc_Tst)

    Describes the second units value in BCD format RTC Timestamp Date Register (RTC_TSD) Address offset: 0x34 Reset value: 0x0000 0000 337 / 631 Nations Technologies Inc. Tel:+86-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 Timestamp Sub-Second Register (Rtc_Tsss)

    Note: SSE[15:0] can be larger than RTC_PRE.DIVS[14:0] only after a shift operation. In that case, the correct time/date is one second less than as indicated by RTC_TSH/RTC_DATE. 338 / 631 Nations Technologies Inc. Tel:+86-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 Calibration Register (Rtc_Calib)

    0.9537 ppm. RTC Tamper Configuration Register(RTC_ TMPCFG) Address offset: 0x40 Reset value: 0x0000 0000 339 / 631 Nations Technologies Inc. Tel:+86-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 0: Enable precharge RTC_TAMPx pins before each sampling. 1: Disable precharge RTC_TAMPx pins 14:13 TPPRCH[1:0] RTC_TAMPx Precharge duration. 340 / 631 Nations Technologies Inc. Tel:+86-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 TPFLT = 00, tamper detection is in edge mode: 0: Rising edge trigger a tamper detection event. 341 / 631 Nations Technologies Inc. Tel:+86-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 A Sub-Second Register (Rtc_ Alrmass)

    0x2: Only SSV[1:0] are compared and other bits are not compared. 0x3: Only SSV[2:0] are compared and other bits are not compared. 342 / 631 Nations Technologies Inc. Tel:+86-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 Alarm B Sub-Second Register (Rtc_ Alrmbss)

    This value is compared with the synchronous prescaler counter RTC_SUBS.SS[14:0], and bit number of compared is controlled by MASKSSB[3:0]. 343 / 631 Nations Technologies Inc. Tel:+86-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: Rtc Option Register (Rtc_ Opt)

    If RTC_TMPCFG.TPxNOE=0, these registers are reset when tamper x event detection happens. 344 / 631 Nations Technologies Inc. Tel:+86-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). 345 / 631 Nations Technologies Inc. Tel:+86-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

    IWDG_STS.PVU bit and/or IWDG_STS.CRVU bit. The reload operation (IWDG_KEY.KEYV[15:0] configured with value of 0xAAAA) will also cause the registers to 346 / 631 Nations Technologies Inc. Tel:+86-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 347 / 631 Nations Technologies Inc. Tel:+86-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 348 / 631 Nations Technologies Inc. Tel:+86-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. 349 / 631 Nations Technologies Inc. Tel:+86-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 350 / 631 Nations Technologies Inc. Tel:+86-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. 351 / 631 Nations Technologies Inc. Tel:+86-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 352 / 631 Nations Technologies Inc. Tel:+86-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 353 / 631 Nations Technologies Inc. Tel:+86-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. 354 / 631 Nations Technologies Inc. Tel:+86-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 355 / 631 Nations Technologies Inc. Tel:+86-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. 356 / 631 Nations Technologies Inc. Tel:+86-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 357 / 631 Nations Technologies Inc. Tel:+86-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. 358 / 631 Nations Technologies Inc. Tel:+86-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

    They should be separately connected to V and V SSA. ADC clock An ADC requires three clocks, HCLK, ADC_CLK and ADC_1MCLK. 359 / 631 Nations Technologies Inc. Tel:+86-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

    ADC from the power-off state. After a power-on delay of ADC (t ), and the conversion begins when STAB the ADC_CTRL2.ON bit is set again. 360 / 631 Nations Technologies Inc. Tel:+86-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. 361 / 631 Nations Technologies Inc. Tel:+86-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] [16] Slow Channel ADC_IN16 [16] VREF- [17] Slow Channel [17] VREF- Slow Channel [18] VREFBUFF [18] VREF- 362 / 631 Nations Technologies Inc. Tel:+86-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 363 / 631 Nations Technologies Inc. Tel:+86-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 AWDGEJCH There is none Any value All injection channels All regular channels All injection and regular channels 364 / 631 Nations Technologies Inc. Tel:+86-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. 365 / 631 Nations Technologies Inc. Tel:+86-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 366 / 631 Nations Technologies Inc. Tel:+86-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. 367 / 631 Nations Technologies Inc. Tel:+86-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 368 / 631 Nations Technologies Inc. Tel:+86-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

    Temperature sensor Set the ADC_CTRL2.TEMPEN bit to 1, enable the temperature sensor and VREFINT, and use the temperature sensor 369 / 631 Nations Technologies Inc. Tel:+86-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

    Read the temperature data in the ADC data register, and calculate the temperature value by the following formula: Temperature (° C) = {(V ) / Avg_Slope} + 30- T SENSE offset In which: 370 / 631 Nations Technologies Inc. Tel:+86-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

    Register ADC_STS 000h Reserved Reset Value ADC_CTRL1 DCTU[2:0] AWDGCH[4:0] 004h Reserved Reset Value ADC_CTRL2 008h Reserved Reset Value 371 / 631 Nations Technologies Inc. Tel:+86-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 372 / 631 Nations Technologies Inc. Tel:+86-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. 373 / 631 Nations Technologies Inc. Tel:+86-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 374 / 631 Nations Technologies Inc. Tel:+86-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 375 / 631 Nations Technologies Inc. Tel:+86-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 376 / 631 Nations Technologies Inc. Tel:+86-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 377 / 631 Nations Technologies Inc. Tel:+86-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 378 / 631 Nations Technologies Inc. Tel:+86-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 379 / 631 Nations Technologies Inc. Tel:+86-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 380 / 631 Nations Technologies Inc. Tel:+86-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 381 / 631 Nations Technologies Inc. Tel:+86-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 382 / 631 Nations Technologies Inc. Tel:+86-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 383 / 631 Nations Technologies Inc. Tel:+86-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 384 / 631 Nations Technologies Inc. Tel:+86-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 0: Writing ADC_CTRL2.ENCAL bits will start calibration in single-ended input mode 1: Writing ADC_CTRL2.ENCAL bits will start calibration in differential input mode 385 / 631 Nations Technologies Inc. Tel:+86-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)

    1, with independent converter.V is used as the DAC reference voltage through the pin input to make the DAC REF+ 386 / 631 Nations Technologies Inc. Tel:+86-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: Main Features

    External event triggers the conversion DAC block diagram is shown below. Table 18-1 shows the description of pins.Table 18-1 DAC pins 387 / 631 Nations Technologies Inc. Tel:+86-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 to the output of the DAC. 388 / 631 Nations Technologies Inc. Tel:+86-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

    Figure 18-2 Data register of single DAC channel mode 8-bit right aligned 12-bit left aligned 12-bit right aligned 389 / 631 Nations Technologies Inc. Tel:+86-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

    After the DAC transfers data to the DAC_DATO register from its data hold register, the output is valid for the time tSETTTLING, which is related to the supply voltage and the analog output load. 390 / 631 Nations Technologies Inc. Tel:+86-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 Output Voltage

    (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. 391 / 631 Nations Technologies Inc. Tel:+86-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: Triangular Wave Generation

    Triangular wave generation The DAC can generate a triangle wave. The triangle wave function can be turned on by configuring 392 / 631 Nations Technologies Inc. Tel:+86-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: Figure 18-6 Triangle Wave Generation Of Dac

    Note: 1. Only when the DAC is configured to trigger can the triangle wave be generated 2. DAC_CTRL.MASEL[3:0] cannot be set after DAC is enabled. 393 / 631 Nations Technologies Inc. Tel:+86-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

    0001: unmasked LFSR bit [1:0] / triangular amplitude is equal to 3 0010: unmasked LFSR bit [2:0] / triangular amplitude equals 7 394 / 631 Nations Technologies Inc. Tel:+86-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 This bit is set to 1 and cleared by the software to enable/disable the DAC. 0: disables the DAC 1: Enable the DAC 395 / 631 Nations Technologies Inc. Tel:+86-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)

    The bits are configured by the software and the DAC converts the data. 12 bit left aligned data hold register for DAC (DAC_DL12CH) Offset address: 0x0C Reset value: 0x0000 0000 396 / 631 Nations Technologies Inc. Tel:+86-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: 8-Bit Right-Aligned Data Hold Register For Dac (Dac_Dr8Ch)

    Bit field Name Description 31:12 Reserved Reserved, the reset value must be maintained. 11:0 DACCHDO[11:0] DAC data output. 397 / 631 Nations Technologies Inc. Tel:+86-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 Bit field Name Description These bits are read-only and represent the output data of the DAC channel 398 / 631 Nations Technologies Inc. Tel:+86-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" 399 / 631 Nations Technologies Inc. Tel:+86-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) 400 / 631 Nations Technologies Inc. Tel:+86-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. 401 / 631 Nations Technologies Inc. Tel:+86-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. 402 / 631 Nations Technologies Inc. Tel:+86-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 403 / 631 Nations Technologies Inc. Tel:+86-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 404 / 631 Nations Technologies Inc. Tel:+86-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 405 / 631 Nations Technologies Inc. Tel:+86-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 406 / 631 Nations Technologies Inc. Tel:+86-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; 407 / 631 Nations Technologies Inc. Tel:+86-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 408 / 631 Nations Technologies Inc. Tel:+86-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; 409 / 631 Nations Technologies Inc. Tel:+86-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 410 / 631 Nations Technologies Inc. Tel:+86-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 411 / 631 Nations Technologies Inc. Tel:+86-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 412 / 631 Nations Technologies Inc. Tel:+86-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. 413 / 631 Nations Technologies Inc. Tel:+86-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 414 / 631 Nations Technologies Inc. Tel:+86-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. 415 / 631 Nations Technologies Inc. Tel:+86-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. 416 / 631 Nations Technologies Inc. Tel:+86-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. 417 / 631 Nations Technologies Inc. Tel:+86-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 filter 418 / 631 Nations Technologies Inc. Tel:+86-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 419 / 631 Nations Technologies Inc. Tel:+86-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. 420 / 631 Nations Technologies Inc. Tel:+86-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 421 / 631 Nations Technologies Inc. Tel:+86-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); 422 / 631 Nations Technologies Inc. Tel:+86-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. 423 / 631 Nations Technologies Inc. Tel:+86-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: I 2 C Interface

    It support interrupt mode, users can enable or disable interrupt according to their needs. 424 / 631 Nations Technologies Inc. Tel:+86-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: Sda And Scl Line Control

    The block diagram of I C interface is shown in the figure below. 425 / 631 Nations Technologies Inc. Tel:+86-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: Figure 21-1 I 2 C Functional Block Diagram

    SDA line when SCL is high. as shown in the figure below. Figure 21-2 I2C bus protocol Start Stop condition condition 426 / 631 Nations Technologies Inc. Tel:+86-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 SDA line is low, it considers that it has lost arbitration and shuts down its SDA output driver, while the other host continues to complete its own transmission. 427 / 631 Nations Technologies Inc. Tel:+86-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 4、 During the sending of the first byte, the software writes the second byte to I2C_DAT, neither the I2C_DAT register nor the shift register is empty. The I2C_STS1.TXDATE bit is cleared to 0. 428 / 631 Nations Technologies Inc. Tel:+86-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: Figure 21-3 Slave Transmitter Transfer Sequence Diagram

    I2C timing. After these two steps are completed, I2C runs in slave mode, waiting for receiving start bit and address. 429 / 631 Nations Technologies Inc. Tel:+86-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 Slave Receiver Transfer Sequence Diagram

    Note: a)EV1 event prolongs the time when SCL is low until the end of the corresponding software sequence. b) The software sequence of EV2 must be completed before the end of the current byte transmission. 430 / 631 Nations Technologies Inc. Tel:+86-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 I2C_STS1.TXDATE is cleared at this time. At any time, as long as there is data waiting to be sent and the I2C_STS1.TXDATE bit is set to 1, the software can write a byte to the I2C_DAT register. 431 / 631 Nations Technologies Inc. Tel:+86-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-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. 432 / 631 Nations Technologies Inc. Tel:+86-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 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 433 / 631 Nations Technologies Inc. Tel:+86-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: Figure 21-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. 434 / 631 Nations Technologies Inc. Tel:+86-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: Error Conditions Description

    And User make sure that in the event of an underrun error, the receiver discard repeatedly byte, 435 / 631 Nations Technologies Inc. Tel:+86-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: 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: 436 / 631 Nations Technologies Inc. Tel:+86-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: 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. 437 / 631 Nations Technologies Inc. Tel:+86-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: Smbus

    In order to distribute addres for each devices, it must have a unique device identifier(UDID) to distinguish devices. 438 / 631 Nations Technologies Inc. Tel:+86-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 When more than one device’s SMBALERT is low, the highest priority(The smaller the address, the higher the priority) 439 / 631 Nations Technologies Inc. Tel:+86-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: Debug Mode

    Send buffer is empty. TXDATE Bus error BUSERR Lost arbitration (master) ARLOST I2C error interrupt ERRINTEN Acknowledge fail ACKFAIL Overrun/underrun OVERRUN 440 / 631 Nations Technologies Inc. Tel:+86-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: I2C Registers

    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] 441 / 631 Nations Technologies Inc. Tel:+86-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: 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 442 / 631 Nations Technologies Inc. Tel:+86-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 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. 443 / 631 Nations Technologies Inc. Tel:+86-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: 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 444 / 631 Nations Technologies Inc. Tel:+86-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: 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 445 / 631 Nations Technologies Inc. Tel:+86-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: 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. 446 / 631 Nations Technologies Inc. Tel:+86-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: I2C Status Register 1 (I2C_Sts1)

    DAT register, under-run occurs which leads that the same byte will be send twice. 447 / 631 Nations Technologies Inc. Tel:+86-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 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. 448 / 631 Nations Technologies Inc. Tel:+86-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 1' after receiving the ACK of the second byte of the address. In slave mode: 449 / 631 Nations Technologies Inc. Tel:+86-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: 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. 450 / 631 Nations Technologies Inc. Tel:+86-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: I2C Clock Control Register (I2C_Clkctrl)

    0: I2C in standard mode(duty cycle defaults to 1/1); 1: I2C in fast mode(duty cycle can be configured). DUTY Duty cycle in fast mode 451 / 631 Nations Technologies Inc. Tel:+86-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: I2C Rise Time Register (I2C_Tmrise)

    I2C_CTRL2.CLKFREQ [5:0] is equal to 0x08 and TPCLK1=125ns ,09h(1000ns/125 ns + 1) must be written in TMRISE[5:0] ,. 452 / 631 Nations Technologies Inc. Tel:+86-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 If the result is not an integer, write the integer part to TMRISE[5:0] to ensure the t parameter. HIGH 453 / 631 Nations Technologies Inc. Tel:+86-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: Universal Synchronous Asynchronous Receiver Transmitter (Usart)

    LIN break frame detection, noise flag/overflow error/frame error in multi-buffer communication 454 / 631 Nations Technologies Inc. Tel:+86-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: Functional Block Diagram

    The data packets of serial communication are transmitted from the sending device to the RX interface of the receiving 455 / 631 Nations Technologies Inc. Tel:+86-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: Usart Frame Format

    Start Stat Stop bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 Start Idle frame Start Stop Break frame 456 / 631 Nations Technologies Inc. Tel:+86-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: Transmitter

    Receiving in Smartcard mode General USART mode, single-wire mode and modem mode. Transmitting and receiving in Smartcard mode 457 / 631 Nations Technologies Inc. Tel:+86-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-4 Configuration Stop Bit

    Send each data to be sent to the USART_DAT register through the CPU or DMA, and the write operation to the USART_DAT register will clear USART_STS.TXDE; 458 / 631 Nations Technologies Inc. Tel:+86-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: Receiver

    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 459 / 631 Nations Technologies Inc. Tel:+86-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 Start Bit Detection

    1 stop bit: the sampling of one stop bit is carried out through three points, and the 8th, 9th and 10th sampling bits are selected. 460 / 631 Nations Technologies Inc. Tel:+86-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 USART_STS.FEF will be set by hardware, and the invalid data will be transferred from the shift register 461 / 631 Nations Technologies Inc. Tel:+86-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: Generation Of Fractional Baud Rate

    PCLK  PCLK1 is used for USART2, USART3, up to 27MHz; 462 / 631 Nations Technologies Inc. Tel:+86-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: Table 22-3 Error Calculation When Setting Baud Rate

    0.16% 230.769 14.625 460.8 461.538 3.6875 0.69% 461.538 7.3125 921.6 923.076 1.8125 923.076 4.875 0.8% 1687.5 1687.7 2250 463 / 631 Nations Technologies Inc. Tel:+86-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: Receiver's Tolerance Clock Deviation

    1s in the data again. If it is an even number, the check is passed, indicating that no 464 / 631 Nations Technologies Inc. Tel:+86-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: Dma Application

    5. Start the channel. 6. After the data transfer is completed, the transfer complete flag (DMA_INTSTS.TXCFx) is set to 1. 465 / 631 Nations Technologies Inc. Tel:+86-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: Figure 22-7 Transmission Using Dma

    5. Start the channel. 466 / 631 Nations Technologies Inc. Tel:+86-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: Hardware Flow Control

    Figure 22-9 Hardware flow control between two USART DEVICE 1 DEVICE 2 TX control RX control RX control TX control 467 / 631 Nations Technologies Inc. Tel:+86-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: Figure 22-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. 468 / 631 Nations Technologies Inc. Tel:+86-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: Multiprocessor Communication

    As shown in the Figure 22-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. 469 / 631 Nations Technologies Inc. Tel:+86-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: Figure 22-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. 470 / 631 Nations Technologies Inc. Tel:+86-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: 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. 471 / 631 Nations Technologies Inc. Tel:+86-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: Figure 22-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) 472 / 631 Nations Technologies Inc. Tel:+86-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: 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 473 / 631 Nations Technologies Inc. Tel:+86-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: 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. 474 / 631 Nations Technologies Inc. Tel:+86-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: 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. 475 / 631 Nations Technologies Inc. Tel:+86-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 If a '1' is sampled before the 10th or 11th sample point, the current detection is canceled and the start bit is searched again. 476 / 631 Nations Technologies Inc. Tel:+86-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: Figure 22-20 Break Detection In Lin Mode (11-Bit Break Length-The Linbdl Bit Is Set)

    Idle Bit0 Bit1 Bit2 Bit6 Bit7 Bit8 Bit9 Bit10 Bit3 Bit4 Bit5 wait delimiter Sample Sample data LINBDF 477 / 631 Nations Technologies Inc. Tel:+86-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: Smartcard Mode (Iso7816)

    (according to the ISO protocol, the duration of the received NACK can be 1 or 2 baud clock cycles). 478 / 631 Nations Technologies Inc. Tel:+86-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: Figure 22-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. 479 / 631 Nations Technologies Inc. Tel:+86-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: Interrupt Request

    RXDNEIEN Data overrun error detected. ORERR Idle line detected IDLEF IDLEIEN Parity error PEIEN Disconnect flag LINBDF LINBDIEN 480 / 631 Nations Technologies Inc. Tel:+86-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: Mode Support

    000h Reserved Reset Value USART_DAT DATV[8:0] 004h Reserved Reset Value DIV_Decimal USART_BRCF DIV_Integer[11:0] [3:0] 008h Reserved Reset Value 481 / 631 Nations Technologies Inc. Tel:+86-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 Status Register (Usart_Sts)

    This bit is cleared by software. 0: LIN break character not detected. 1: LIN break character detected. TXDE The Transmit data register empty. 482 / 631 Nations Technologies Inc. Tel:+86-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 Note: this bit will not generate an interrupt because it appears with USART_STS.RXDNE, and the hardware will generate an interrupt when setting the 483 / 631 Nations Technologies Inc. Tel:+86-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: Usart Data Register (Usart_Dat)

    Contains the data sent or received; Software can change the transmitted data by writing these bits, or read the values of these bits to obtain the received data. 484 / 631 Nations Technologies Inc. Tel:+86-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: Usart Baud Rate Register (Usart_Brcf)

    Software can set or clear this bit. 0:USART is disabled. 485 / 631 Nations Technologies Inc. Tel:+86-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 1: the transmitter is enabled. RXEN Receiver enable 0: The receiver is disabled. 1: the receiver is enabled. 486 / 631 Nations Technologies Inc. Tel:+86-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: Usart Control Register 2 Register (Usart_Ctrl2)

    Note: For UART4/5, only one stop bit and two stop bits are valid. CLKEN Clock enable 0:CK pin is disabled 1:CK pin enabled 487 / 631 Nations Technologies Inc. Tel:+86-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: Usart Control Register 3 Register (Usart_Ctrl3)

    If the lower four bits of the received data frame are equal to the ADDR[3:0] value, USART will be awakened. USART control register 3 register (USART_CTRL3) Address offset : 0x14 488 / 631 Nations Technologies Inc. Tel:+86-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 0: Do not send NACK when there is a parity error. 1: send NACK when there is a parity error. Note: This bit cannot be used for UART4/5 489 / 631 Nations Technologies Inc. Tel:+86-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: Usart Guard Time And Prescaler Register (Usart_Gtp)

    (PCLK1/PCLK2) to generate low power consumption frequency. 490 / 631 Nations Technologies Inc. Tel:+86-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 1111: Divide the source clock by 62. In Smartcard mode, PSCV[7:5] is reserved. Note: This bit is invalid for UART4/5. 491 / 631 Nations Technologies Inc. Tel:+86-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: Low Power Universal Asynchronous Receiver Transmitter (Lpuart)

     Start bit detection  Receive buffer non-empty detection  A configurable receive byte  A programmable 4-byte frame 492 / 631 Nations Technologies Inc. Tel:+86-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: 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: 493 / 631 Nations Technologies Inc. Tel:+86-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: 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. 494 / 631 Nations Technologies Inc. Tel:+86-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 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. 495 / 631 Nations Technologies Inc. Tel:+86-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: Receiver

    Check the interrupt flags of the LPUART_STS register: buffer is not empty, buffer is half full, buffer is full, buffer overrun; 496 / 631 Nations Technologies Inc. Tel:+86-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 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. 497 / 631 Nations Technologies Inc. Tel:+86-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: 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 498 / 631 Nations Technologies Inc. Tel:+86-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: 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 499 / 631 Nations Technologies Inc. Tel:+86-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: 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. 500 / 631 Nations Technologies Inc. Tel:+86-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: Figure 23-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. 501 / 631 Nations Technologies Inc. Tel:+86-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: Hardware Flow Control

    RX control TX control RTS and CTS flow control can be independently enabled by setting LPUART_CTRL.RTSEN and LPUART_CTRL.CTSEN. 502 / 631 Nations Technologies Inc. Tel:+86-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-8 Rts Flow Control

    If CTS flow control is enabled (LPUART_CTRL.CTSEN=1), the signal of CTS pin will be changed. See Figure 23-9 for enabling CTS flow control. 503 / 631 Nations Technologies Inc. Tel:+86-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: Low Power Wake Up

    Receive buffer half full FIFO_HF FIFO_HFIE Receive buffer not empty FIFO_NE FIFO_NEIE Wake up in STOP2 mode WUFIE 504 / 631 Nations Technologies Inc. Tel:+86-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: Lpuart Registers

    Noise detected flag. When noise is detected in the received frame, this bit is set by hardware.This bit is 505 / 631 Nations Technologies Inc. Tel:+86-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: Lpuart Interrupt Enable Register (Lpuart_Inten)

    Address offset: 0x04 Reset value: 0x0000 0000 Bit field Name Description 31:7 Reserved Reserved, the reset value must be maintained. 506 / 631 Nations Technologies Inc. Tel:+86-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: Lpuart Control Register (Lpuart_Ctrl)

    10) 1: 1 sample bits, closed noise detection 13:12 WUSEL[1:0] Wake up event selection. 00: Start bit detection 507 / 631 Nations Technologies Inc. Tel:+86-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: Lpuart Baud Rate Configuration Register 1 (Lpuart_Brcfg1)

    0: Even parity 1: Odd parity LPUART baud rate configuration register 1 (LPUART_BRCFG1) Address offset: 0x0C Reset value: 0x0000 0174 508 / 631 Nations Technologies Inc. Tel:+86-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: Lpuart Data Register (Lpuart_Dat)

    Read the data register when receiving LPUART baud rate configuration register 2 (LPUART_BRCFG2) Address offset: 0x14 Reset value: 0x0000 0000 509 / 631 Nations Technologies Inc. Tel:+86-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: Lpuart Wake Up Data Register (Lpuart_Wudat)

    LPUART_CTRL.WUSEL[1:0] = 11 is used to wake up frame matching. In this case, all 4 bytes are valid 510 / 631 Nations Technologies Inc. Tel:+86-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: Serial Peripheral Interface/Inter-Ic Sound (Spi/I 2 S)

    Supports 16-bit, 24-bit or 32-bit data length and data frame format (configured according to requirements).  Steady state clock polarity programmable.  The data direction is always MSB first. 511 / 631 Nations Technologies Inc. Tel:+86-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: Spi Function Description

    SPI works in the master mode. Conversely, SPI works in the slave mode. Users can use a standard 512 / 631 Nations Technologies Inc. Tel:+86-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: Figure 24-2 Selective Management Of Hardware/Software

    Figure 24-2 Selective management of hardware/software The following figure is an example of the interconnection of single master and single slave devices 513 / 631 Nations Technologies Inc. Tel:+86-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: Figure 24-3 Master And Slave Applications

    Figure 24-4 is the combination timing of four CLKPHA and CLKPOL bits transmitted by SPI when the SPI_CTRL1.LSBFF = 0. 514 / 631 Nations Technologies Inc. Tel:+86-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: Spi Work Mode

    SPI_CTRL1.LSBFF bit, the data bits follow the MSB or LSB order is serially shifted to the 515 / 631 Nations Technologies Inc. Tel:+86-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: Figure 24-5 Schematic Diagram Of The Change Of Te/Rne/Busy When The Host Is Continuously Transmitting In Full

    SPI_STS.OVER bit will be set to '1', and the software will ignore it. The software operation process is as follows: 516 / 631 Nations Technologies Inc. Tel:+86-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: Figure 24-6 Schematic Diagram Of Te/Busy Change When Host Transmits Continuously In One-Way Only Mode

    Wait for SPI_STS.RNE bit to be set to '1', read the SPI_DAT register to get the received data, and the SPI_STS.RNE bit will be cleared by hardware while reading SPI_DAT register. Repeat this operation to receive 517 / 631 Nations Technologies Inc. Tel:+86-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: Figure 24-7 Schematic Diagram Of Rne Change When Continuous Transmission Occurs In Receive-Only Mode (Bidirmode=0 And Ronly=1)

    SPI_DAT register. Figure 24-8 Schematic diagram of the change of TE/RNE/BUSY when the slave is continuously transmitting in full 518 / 631 Nations Technologies Inc. Tel:+86-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: Figure 24-9 Schematic Diagram Of Te/Busy Change During Continuous Transmission In Slave Unidirectional Transmit

    The data receiving process begins when the slave device receives the clock signal and the first data bit from the 519 / 631 Nations Technologies Inc. Tel:+86-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 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 520 / 631 Nations Technologies Inc. Tel:+86-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: Status Flag

    SPI_DAT register. When the send buffer is not empty, the hardware will clear this flag to 0. 521 / 631 Nations Technologies Inc. Tel:+86-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: 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 522 / 631 Nations Technologies Inc. Tel:+86-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: 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. 523 / 631 Nations Technologies Inc. Tel:+86-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: Crc Calculation

    8-bit data frame format adopts CRC8, and the 16-bit data frame format adopts CRC16. The polynomial used in 524 / 631 Nations Technologies Inc. Tel:+86-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: Error Flag

    (SPI_CTRL2.ERRINTEN = 1). All received data is lost, and the SPI_DAT register retains only previously unread data. 525 / 631 Nations Technologies Inc. Tel:+86-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: Spi Interrupt

    Receive buffer non empty flag RNEINTEN Master mode failure event MODERR Overflow error OVER ERRINTEN CRC error flag CRCERR 526 / 631 Nations Technologies Inc. Tel:+86-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: 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; 527 / 631 Nations Technologies Inc. Tel:+86-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: Supported Audio Protocols

    (MSB) is sent and will change on the falling edge of the clock signal. 528 / 631 Nations Technologies Inc. Tel:+86-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-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). 529 / 631 Nations Technologies Inc. Tel:+86-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: Figure 24-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. 530 / 631 Nations Technologies Inc. Tel:+86-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: Figure 24-17 The Msb Is Aligned With 16-Bit Or 32-Bit Full Precision, Clkpol = 0

    Figure 24-18 MSB aligns 24-bit data, CLKPOL = 0 Send Receive 8-bit remaining 0 forced 24-bit data Right channel Left channel 32-bit 531 / 631 Nations Technologies Inc. Tel:+86-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: Figure 24-19 Msb-Aligned 16-Bit Data Is Extended To 32-Bit Packet Frame, Clkpol = 0

    Figure 24-20 LSB alignment 16-bit or 32-bit full precision, CLKPOL = 0 Send Receive Left channel (16-bit or 32-bit) Right channel 532 / 631 Nations Technologies Inc. Tel:+86-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: Figure 24-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. 533 / 631 Nations Technologies Inc. Tel:+86-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: Figure 24-23 Pcm Standard Waveform (16 Bits)

    Figure 24-24 PCM standard waveform (16-bit extended to 32-bit packet frame) WS short frame WS long frame 13-bit 16-bit 534 / 631 Nations Technologies Inc. Tel:+86-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: Clock Generator

    ���� ������ [ ( 32 × 2 ) × ( ( 2 × �������� ) + ������_��������) × 4] When MCLKOEN = 1 and CHBITS = 1, �� = �� ⁄ �� 535 / 631 Nations Technologies Inc. Tel:+86-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: 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; 536 / 631 Nations Technologies Inc. Tel:+86-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 SPI_STS.OVER flag is set to 1. If the SPI_CTRL2.ERRINTEN bit is set to 1, an interrupt is generated to indicate that an error has occurred. 537 / 631 Nations Technologies Inc. Tel:+86-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: Status Flag

    When the send buffer is not empty, this flag is cleared to 0. RX buffer not empty flag (RNE) 538 / 631 Nations Technologies Inc. Tel:+86-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: Error Flag

    Reading the SPI_STS register to clears the SPI_STS.UNDER bit. S interrupt The following table lists all I S interrupts. 539 / 631 Nations Technologies Inc. Tel:+86-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: 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 540 / 631 Nations Technologies Inc. Tel:+86-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: Spi Control Register 1 (Spi_Ctrl1) (Not Used In I2S Mode)

    Note: This bit can only be written when SPI is disabled (SPI_CTRL1.SPIEN=0), otherwise an error will occur. Note: Not used in I S mode. 541 / 631 Nations Technologies Inc. Tel:+86-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 Note: This bit cannot be changed during communication. Note: Not used in I S mode. MSEL Master device selection 542 / 631 Nations Technologies Inc. Tel:+86-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: Spi Control Register 2 (Spi_Ctrl2)

    0: Disable error interrupt. 1: Enable error interrupt. Reserved Reserved, the reset value must be maintained. 543 / 631 Nations Technologies Inc. Tel:+86-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: Spi Status Register (Spi_Sts)

    For more information about software sequences, refer to 24.3.7 for details. Note: Not used in I S mode. 544 / 631 Nations Technologies Inc. Tel:+86-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: Spi Data Register (Spi_Dat)

    For 8-bit data, the buffer is 8-bit, and only SPI_DAT[7:0] is used when sending and receiving. When receiving, SPI_DAT[15:8] is forced to 0. 545 / 631 Nations Technologies Inc. Tel:+86-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: Spi Crc Polynomial Register (Spi_Crcpoly) (Not Used In I 2 S Mode)

    Note: reading this register when the BUSY flag (SPI_STS.BUSY) is '1' may read incorrect values. Note: not used in I s mode. SPI TX CRC register (SPI_ CRCTDAT) Address offset: 0x18 546 / 631 Nations Technologies Inc. Tel:+86-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: Spi_I 2 S Configuration Register (Spi_I2Scfg)

    Note: This bit can only be set when I S is turned off. Note: not used in SPI mode. 547 / 631 Nations Technologies Inc. Tel:+86-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: Spi_I2S Prescaler Register (Spi_I2Sprediv)

    S is turned off. Note: not used in SPI mode. SPI_I2S prescaler register (SPI_I2SPREDIV) Address: 0x20 Reset value: 0x0002 548 / 631 Nations Technologies Inc. Tel:+86-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 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. 549 / 631 Nations Technologies Inc. Tel:+86-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: Controller Area Network (Can)

    With the wide application of CAN, the nodes of CAN network are growing rapidly. Multiple CAN nodes are connected through CAN network. With increase number of CAN nodes, messages in CAN network also increase 550 / 631 Nations Technologies Inc. Tel:+86-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: Can Module

    CANTX pin is disabled. 551 / 631 Nations Technologies Inc. Tel:+86-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 CAN_MCTRL.SLPRQ bit to exit the sleep state. If the wake-up interrupt (set the CAN_INTE.WKUITE bit) is enabled, the wake-up interrupt will be generated once 552 / 631 Nations Technologies Inc. Tel:+86-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: 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. 553 / 631 Nations Technologies Inc. Tel:+86-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: Can Test Mode

    To enter loopback mode, the CAN_BTIM.SLM bit should be cleared and the CAN_BTIM.LBM bit should be set. 554 / 631 Nations Technologies Inc. Tel:+86-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-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. 555 / 631 Nations Technologies Inc. Tel:+86-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-5 Silent Mode

    CAN system connected by CANTX and CANRX. To enter loopback silence mode, both the CAN_BTIM.SLM bit and the CAN_BTIM.LBM bit should be set. 556 / 631 Nations Technologies Inc. Tel:+86-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: Can Debugging Mode

    The messages in the Ready state mailbox is sent as soon as the CAN bus enters the idle state, then enter the 557 / 631 Nations Technologies Inc. Tel:+86-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: Time Triggered Communication Mode

    If the sending operation fails, whether due to arbitration loss or error, 558 / 631 Nations Technologies Inc. Tel:+86-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: Receiving Management

    Please refer to 25.4.5 Section: identifier filtering. 559 / 631 Nations Technologies Inc. Tel:+86-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-8 Receive Fifo Status

    (the CAN_INTE.FFITE bit is set), a FIFO full interrupt request will be generated. 560 / 631 Nations Technologies Inc. Tel:+86-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: Identifier Filtering

    And the filter group should be set to work in identifier list mode in order to filter out an identifier. 561 / 631 Nations Technologies Inc. Tel:+86-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: Figure 25-9 Filter Bit Width Setting-Register Organization

    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. 562 / 631 Nations Technologies Inc. Tel:+86-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: Table 25-1 Examples Of Filter Numbers

    16-bit-wide filters. For filters with the same bit width, then the 563 / 631 Nations Technologies Inc. Tel:+86-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: 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 564 / 631 Nations Technologies Inc. Tel:+86-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: Bit Time Characteristic

    2. In order to improve the CAN bit time accuracy, it is not recommended to use HSI as the clock source. 565 / 631 Nations Technologies Inc. Tel:+86-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: Figure 25-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 566 / 631 Nations Technologies Inc. Tel:+86-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: Figure 25-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 567 / 631 Nations Technologies Inc. Tel:+86-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: Can Interrupt

    When FIFO1 becomes full, and the CAN_RFF1.FFULL1 bit is set. When FIFO1 overruns, and the CAN_ RFF1.FFOVR1 bit is set. 568 / 631 Nations Technologies Inc. Tel:+86-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: Error Management

    In initialization mode, CAN will not monitor the status of CAN RX pin, so the recovery process cannot be completed. 569 / 631 Nations Technologies Inc. Tel:+86-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: Can Configuration Flow

    2. Check status bits of each mailbox in CAN_TSTS. If any mailbox with TMEMx (x = 0~2) is ‘1’, user can write the message, which is waiting for transmission, to the corresponding mailbox address. CAN_TMIx.TXRQ(x = 570 / 631 Nations Technologies Inc. Tel:+86-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: Can Registers

    The value of the filter can only be modified when the corresponding filter group is closed or the CAN_FMC.FINITM 571 / 631 Nations Technologies Inc. Tel:+86-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: Can Register Overview

    EXTID[17:0] 180h Reset Value CAN_TMDT0 MTIM[15:0] DLC[3:0] 184h Reset Value CAN_TMDL0 DATA3[7:0] DATA2[7:0] DATA1[7:0] DATA0[7:0] 188h Reset Value 572 / 631 Nations Technologies Inc. Tel:+86-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 DATA1[7:0] DATA0[7:0] Reset Value CAN_RMDH0 DATA7[7:0] DATA6[7:0] DATA5[7:0] DATA4[7:0] 1BCh Reset Value CAN_RMI1 STDID[10:0]/EXTID[28:18] EXTID[17:0] 1C0h Reset Value 573 / 631 Nations Technologies Inc. Tel:+86-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 CAN_FA1 FAC[13:0] 21Ch Reset Value 220h 224h 23Fh CAN_F0B1 FBC[31:0] 240h Reset Value CAN_F0B2 FBC[31:0] 244h Reset Value 574 / 631 Nations Technologies Inc. Tel:+86-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: Can Control And Status Register

    CAN_MCTRL register are initialized to their reset values. After that, the hardware automatically clears this bit. 575 / 631 Nations Technologies Inc. Tel:+86-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 0: Priority is determined by the identifier of the message; 1: Priority is determined by the order in which requests are sent. SLPRQ Sleep mode request 576 / 631 Nations Technologies Inc. Tel:+86-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 Reserved, the reset value must be maintained. SLAKINT Sleep acknowledge interrupt When CAN_INTE.SLKITE=1, once CAN enters sleep mode, hardware will set 577 / 631 Nations Technologies Inc. Tel:+86-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 11 consecutive recessive bits on the RX pin of CAN. CAN transmit status register (CAN_TSTS) Address offset: 0x08 Reset value: 0x1C00 0000 578 / 631 Nations Technologies Inc. Tel:+86-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 1: The last sending attempt was successful. When the sending request of mailbox 2 is successfully completed, hardware sets 579 / 631 Nations Technologies Inc. Tel:+86-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 Arbitration lost for mailbox 0 When the mailbox 0 fails to send due to the loss of arbitration, set this bit 580 / 631 Nations Technologies Inc. Tel:+86-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 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. 581 / 631 Nations Technologies Inc. Tel:+86-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 Every time the software releases the output mailbox by writing '1' to CAN_RFF1.RFFOM1 bit, CAN_RFF1.FFMP1 is decremented by 1 until it is 0. 582 / 631 Nations Technologies Inc. Tel:+86-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 Reserved, the reset value must be maintained. FOVITE1 FIFO 1 overflow interrupt enable 0: When CAN_RFF1.FFOVR bit is set, no interrupt is generated; 583 / 631 Nations Technologies Inc. Tel:+86-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 Least significant byte of the 9-bit transmit error counter Similar to the above, this counter is implemented according to the sending part of 584 / 631 Nations Technologies Inc. Tel:+86-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 Reset value: 0x0123 0000 Notes: This register CAN only be accessed by software when CAN is in initialization mode. 585 / 631 Nations Technologies Inc. Tel:+86-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: Can Mailbox Register

    Reset value: 0xXXXX XXXX,X= undefined bit (except bit 0, TXRQ=0 at reset) Notes: 1.This register is write-protected when the mailbox to which it belongs is waiting to be sent; 586 / 631 Nations Technologies Inc. Tel:+86-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 This field contains the value of the 16-bit timer at the time of sending the message SOF. 15:9 Reserved Reserved, the reset value must be maintained. 587 / 631 Nations Technologies Inc. Tel:+86-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 When the mailbox is not empty, all bits in this register are write protected. Address offset: 0x18c, 0x19c, 0x1ac 588 / 631 Nations Technologies Inc. Tel:+86-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 This bit determines the type of identifier used for sending messages in the mailbox. 0: Use standard identifier; 1: Use extended identifiers. 589 / 631 Nations Technologies Inc. Tel:+86-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 Receive FIFO mailbox low byte data register(CAN_RMDLx)( x=0..1) Address offset: 0x1B8, 0x1C8 Reset value: undefined Notes: All receiving mailbox registers are read-only. 590 / 631 Nations Technologies Inc. Tel:+86-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: Can Filter Register

    Address offset: 0x200 Reset value: 0x2A1C 0E01 Notes: The unreserved bits of this register are completely controlled by software. 591 / 631 Nations Technologies Inc. Tel:+86-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 Notes: You can only write to this register when you set CAN_FMC.FINITM bit and put the filter in initialization mode. 592 / 631 Nations Technologies Inc. Tel:+86-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 1: the filter is associated to FIFO1. CAN filter activation register (CAN_FA1) Address offset: 0x21C Reset value: 0x0000 0000 593 / 631 Nations Technologies Inc. Tel:+86-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 1: Must match, and the incoming identifier bit must be consistent with the identifier register bit corresponding to the filter. 594 / 631 Nations Technologies Inc. Tel:+86-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 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 25-4. 595 / 631 Nations Technologies Inc. Tel:+86-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: Universal Serial Bus Full-Speed Device Interface (Usb_Fs_Device)

     Support USB suspend/resume operation  Frame lock clock pulse generation Figure 26-1 is a functional block diagram of a USB peripheral. 596 / 631 Nations Technologies Inc. Tel:+86-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: Clock Configuration

    SRAM, so the maximum endpoint packet buffer that can be used by each endpoint is less than 512 bytes. Note: 597 / 631 Nations Technologies Inc. Tel:+86-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: Access Packet Buffer Memory

    USB module accesses the Packet Buffer Memory. 598 / 631 Nations Technologies Inc. Tel:+86-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: 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. 599 / 631 Nations Technologies Inc. Tel:+86-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: Double-Buffered Endpoints

    DATTOG and SW_BUF. DATTOG indicates the buffer currently being used by the USB module, 600 / 631 Nations Technologies Inc. Tel:+86-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: Table 26-1 Dattog And Sw_Buf Definitions

    DATTOG = 0. If the application has not finished processing the data in buffer0 601 / 631 Nations Technologies Inc. Tel:+86-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: Figure 26-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 602 / 631 Nations Technologies Inc. Tel:+86-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: Usb Transfer

    ADDR register is used as a pointer to the endpoint data packet receiving buffer corresponding to the endpoint, and 603 / 631 Nations Technologies Inc. Tel:+86-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 IN transmission or OUT transmission. As shown in Figure 26-5, take control write transfer as an example. Before enabling subsequent data 604 / 631 Nations Technologies Inc. Tel:+86-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 SETUP token packet, and will not reply any handshake packet to the host, forcing the host to send the SETUP token packet again. 605 / 631 Nations Technologies Inc. Tel:+86-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: Figure 26-5 Control Transfer

    Transmissions that require a fixed and precise data rate are defined as isochronous transfer. If an endpoint is defined 606 / 631 Nations Technologies Inc. Tel:+86-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: Usb Events And Interrupts

    USB module, and finally open the analog part connected to the USB transceiver. The software operation process is as follows: 607 / 631 Nations Technologies Inc. Tel:+86-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 Table 26-4 lists the USB_FN.RXDP_STS bit and the USB_FN.RXDM_STS bit to identify what triggers the resume event and the corresponding software action. 608 / 631 Nations Technologies Inc. Tel:+86-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: Endpoint Initialization

    USB registers The peripheral registers can be accessed by half-words (16-bit) or words (32-bit). USB base address: 0x4000 5C00 609 / 631 Nations Technologies Inc. Tel:+86-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: 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 610 / 631 Nations Technologies Inc. Tel:+86-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: Usb Endpoint N Register (Usb_Epn), N=[0

    STS_RX[1:0] Receive status This bit indicates the current state of the endpoint, Table 26-6 lists the available states 611 / 631 Nations Technologies Inc. Tel:+86-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 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: 612 / 631 Nations Technologies Inc. Tel:+86-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: Table 26-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 613 / 631 Nations Technologies Inc. Tel:+86-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: 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 614 / 631 Nations Technologies Inc. Tel:+86-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 、 When USB_CTRL.FRST = 1, the USB module will remain in reset state until software clears this bit. 615 / 631 Nations Technologies Inc. Tel:+86-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: Usb Interrupt Status Register (Usb_Sts)

    This bit is set by hardware when there is no activity on the USB bus for more than 3ms, indicating a suspend request. 616 / 631 Nations Technologies Inc. Tel:+86-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 After the USB module completes the data transmission and generates an interrupt, it is written by the hardware according to the endpoint number of the interrupt request. Note: 617 / 631 Nations Technologies Inc. Tel:+86-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: Usb Frame Number Register (Usb_Fn)

    Number of frames Hardware increments this bit every time the USB module receives a PID SOF token packet. 618 / 631 Nations Technologies Inc. Tel:+86-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: Usb Device Address Register (Usb_Addr)

    The buffer description table is located in the packet buffer memory and is used to configure the address and size of 619 / 631 Nations Technologies Inc. Tel:+86-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: Send Buffer Address Register N (Usb_Addrn_Tx)

    USB_CNTn_TX registers: USB_CNTn_TX_0 and USB_CNTn_TX_1. Receive buffer address register n (USB_ADDRn_RX) Address offset: [USB_ BUFTAB] + n× 16 + 8 620 / 631 Nations Technologies Inc. Tel:+86-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: Receive Data Byte Number Register N (Usb_Cntn_Rx)

    Table 26-8 Endpoint packet receive buffer size definition NUM_BLK[4:0] BLSIZE = 0 BLSIZE = 1 00000 Not allowed 32 bytes 621 / 631 Nations Technologies Inc. Tel:+86-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 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. 622 / 631 Nations Technologies Inc. Tel:+86-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: 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 623 / 631 Nations Technologies Inc. Tel:+86-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: 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): 624 / 631 Nations Technologies Inc. Tel:+86-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: 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. 625 / 631 Nations Technologies Inc. Tel:+86-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: Peripherals Debug Support

    Reset Value ID register (DBG_ID) Address offset: 0x00 Only 32-bit access is supported, fixed values cannot be modified. 626 / 631 Nations Technologies Inc. Tel:+86-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: 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. 627 / 631 Nations Technologies Inc. Tel:+86-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 1: (FCLK on, HCLK on) In DBG_SLEEP mode, both FCLK and HCLK clocks are provided by the previously configured system clock. 628 / 631 Nations Technologies Inc. Tel:+86-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: 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 653: Version History

    Version history Date Version Modify 2022.07.08 V1.2 Initial version. 630 / 631 Nations Technologies Inc. Tel:+86-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: 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