background image

 

 

 

 

 

 

 

N32G45x series 

32-bit ARM

®

 

Cortex

®

-M4 microcontroller 

User manual V3.0 

 

 

 

 

 

Содержание N32G45 Series

Страница 1: ...N32G45x series 32 bit ARM Cortex M4 microcontroller User manual V3 0...

Страница 2: ...1 EXTI register review 44 2 3 2 EXTI interrupt mask register EXTI_IMASK 44 2 3 3 EXTI event mask register EXTI_EMASK 45 2 3 4 Rising trigger selection register EXTI_RT_CFG 45 2 3 5 Falling trigger se...

Страница 3: ...registers 95 5 4 1 BKP register overview 95 5 4 2 Backup Data Register x BKP_DATx x 1 42 97 5 4 3 Backup Control Register BKP_CTRL 97 5 4 4 Backup Control Status Register BKP_CTRLSTS 98 Reset and clo...

Страница 4: ...registers 159 7 3 1 GPIO register overview 159 7 3 2 GPIO port low configuration register GPIOx_PL_CFG 160 7 3 3 GPIO port high configuration register GPIOx_PH_CFG 161 7 3 4 GPIO port input data regis...

Страница 5: ...gister DMA_INTSTS 195 8 5 3 DMA interrupt flag clear register DMA_INTCLR 195 8 5 4 DMA channel x configuration register DMA_CHCFGx 196 8 5 5 DMA channel x transfer number register DMA_TXNUMx 198 8 5 6...

Страница 6: ...229 9 12 3 ADC control register 1 ADC_CTRL1 230 9 12 4 ADC control register 2 ADC_CTRL2 233 9 12 5 ADC sampling time register 1 ADC_SAMPT1 235 9 12 6 ADC sampling time register 2 ADC_ SAMPT2 235 9 12...

Страница 7: ...wave 256 10 4 11 Synchronous trigger to generate different triangle waves 256 DAC register 257 10 5 1 DAC registers overview 257 10 5 2 DAC control register DAC_CTRL 257 10 5 3 DAC software trigger re...

Страница 8: ...mode control register TIMx_SMCTRL 309 11 4 5 DMA Interrupt enable registers TIMx_DINTEN 312 11 4 6 Status registers TIMx_STS 313 11 4 7 Event generation registers TIMx_EVTGEN 315 11 4 8 Capture compar...

Страница 9: ...n x 2 3 4 and 5 363 12 4 1 Register Overview 363 12 4 2 Control register 1 TIMx_CTRL1 365 12 4 3 Control register 2 TIMx_CTRL2 367 12 4 4 Slave mode control register TIMx_SMCTRL 368 12 4 5 DMA Interru...

Страница 10: ...block diagram 399 14 2 2 GPIOs of RTC 400 14 2 3 RTC register write protection 400 14 2 4 RTC clock and prescaler 400 14 2 5 RTC calendar 401 14 2 6 Calendar initialization and configuration 401 14 2...

Страница 11: ...egister RTC_ OPT 421 CRC calculation unit 423 Introduction 423 Main features 423 15 2 1 CRC32 423 15 2 2 CRC16 423 Function description 424 15 3 1 CRC32 424 15 3 2 CRC16 424 CRC registers 425 15 4 1 C...

Страница 12: ...terface SDIO 441 Main features of SDIO 441 SDIO bus topology 442 SDIO function description 444 18 3 1 SDIO adapter 444 18 3 2 SDIO AHB Interface 455 Card function description 456 18 4 1 Confirmation o...

Страница 13: ...gister SDIO_FIFOCOUNT 495 18 7 16 SDIO data FIFO register SDIO_DATFIFO 496 Universal serial bus full speed device interface USB_FS_Device 497 Introduction 497 Main features 497 Clock configuration 498...

Страница 14: ...5 20 4 6 Message storage 538 20 4 7 Bit time characteristic 539 CAN interrupt 542 20 5 1 Error management 543 20 5 2 Bus Off recovery 543 CAN Configuration Flow 543 CAN Register File 545 20 7 1 Regist...

Страница 15: ..._CRCTDAT 604 21 5 9 SPI_ I2 S configuration register SPI_I2SCFG 604 21 5 10 SPI_I2 S prescaler register SPI_I2SPREDIV 606 I2 C interface 607 Introduction 607 Main features 607 Function description 607...

Страница 16: ...rt 663 USART registers 663 23 7 1 USART register overview 663 23 7 2 USART Status register USART_STS 664 23 7 3 USART Data register USART_DAT 666 23 7 4 USART Baud rate register USART_BRCF 667 23 7 5...

Страница 17: ...SPI DMA Control Register QSPI_DMA_CTRL 695 24 6 22 QSPI DMA Transmit Data Level Register QSPI_DMATDL_CTRL 695 24 6 23 QSPI DMA Receive Data Level Register QSPI_DMARDL_CTRL 695 24 6 24 QSPI Data Regist...

Страница 18: ...s 2 high register ETH_MACADDR2HI 761 25 5 19 ETH MAC address 2 low register ETH_MACADDR2LO 762 25 5 20 ETH MAC address 3 high register ETH_MACADDR3HI 762 25 5 21 ETH MAC address 3 low register ETH_MAC...

Страница 19: ...rent receive descriptor address register ETH_DMACHRXDESC 788 25 5 53 ETH DMA current transmit buffer address register ETH_DMACHTXBADDR 789 25 5 54 ETH DMA current receive buffer address register ETH_D...

Страница 20: ...neral operation process 817 28 3 2 DMA application 818 28 3 3 Image size 818 28 3 4 Image area 818 28 3 5 Image scaling 818 28 3 6 Soft reset 819 28 3 7 Interrupts 819 28 3 8 Read FIFO data 819 28 3 9...

Страница 21: ...09 Baoshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China 29 4 1 DBG register overview 832 29 4 2 ID register DBG_ID 832 29 4 3 Debug control register DBG_CTRL 833 Unique device se...

Страница 22: ...s of different I O configurations 137 Table 7 3 Debug port image 145 Table 7 4 ADC1 external trigger injection conversion alternate function remapping 146 Table 7 5 ADC1 external trigger regular conve...

Страница 23: ...alternate function remapping 150 Table 7 25 UART5 alternate function remapping 150 Table 7 26 UART6 alternate function remapping 150 Table 7 27 UART7 alternate function remapping 151 Table 7 28 I2C1...

Страница 24: ...tchdog channel selection 212 Table 9 3 Right align data 216 Table 9 4 Left aligne data 216 Table 9 5 External trigger for regular channels of ADC1 and ADC2 217 Table 9 6 External trigger for regular c...

Страница 25: ...r overview 439 Table 18 1 MMC SD SD I O Card bus pin definition 446 Table 18 2 Command Channel Status Flags 450 Table 18 3 Data Token Format 453 Table 18 4 Transmit FIFO Status Flags 454 Table 18 5 Re...

Страница 26: ...W_BUF definitions 501 Table 19 2 How to use double buffering 501 Table 19 3 How to use isochronous double buffering 508 Table 19 4 Resume event detection 509 Table 19 5 USB register overview 511 Table...

Страница 27: ...USART register overview 663 Table 24 1 QSPI register overview 681 Table 25 1 ETH module pin configuration alternate 707 Table 25 2 SMI clock configuration range 709 Table 25 3 Transmit interface signa...

Страница 28: ...mode configuration 139 Figure 7 4 Alternate function configuration 140 Figure 7 5 High impedance analog mode configuration 141 Figure 8 1 DMA block diagram 184 Figure 8 2 DMA1 request mapping 190 Fig...

Страница 29: ...trigonometry generation enable software trigger 252 Figure 11 1 Block diagram of TIM1 and TIM8 267 Figure 11 2 Counter timing diagram with prescaler division change from 1 to 4 268 Figure 11 3 Timing...

Страница 30: ...ion in encoder interface mode 300 Figure 11 33 Encoder interface mode example with IC1FP1 polarity inverted 301 Figure 11 34 Example of Hall sensor interface 303 Figure 12 1 Block diagram of TIMx x 2...

Страница 31: ...n encoder interface mode 362 Figure 12 28 Encoder interface mode example with IC1FP1 polarity inverted 363 Figure 13 1 Block diagram of TIMx x 6 and 7 386 Figure 13 2 Counter timing diagram with presc...

Страница 32: ...dpoint example 503 Figure 19 5 Control transfer 507 Figure 20 1 Topology of CAN network 525 Figure 20 2 CAN working mode 527 Figure 20 3 Dual CAN block diagram 528 Figure 20 4 loopback mode 529 Figure...

Страница 33: ...sion CLKPOL 0 587 Figure 21 15 I2S Philips protocol standard waveform 24 bit frame CLKPOL 0 587 Figure 21 16 I2S Philips protocol standard waveform 16 bit extended to 32 bit packet frame CLKPOL 0 588...

Страница 34: ...mark 653 Figure 23 14 USART synchronous transmission example 654 Figure 23 15 USART data clock timing example WL 0 654 Figure 23 16 USART data clock timing example WL 1 655 Figure 23 17 RX data sampli...

Страница 35: ...gram 791 Figure 26 3 Comparator5 Comparator6 comparator7 connection diagram 792 Figure 27 1 Block diagram of OPAMP1 and OPAMP2 connection diagram 805 Figure 27 2 Block diagram of OPAMP3 and OPAMP4 con...

Страница 36: ...ct on this bit read clear rc_w0 Software can read this bit or clear it by writing 0 and writing 1 has no effect on this bit read clear by read rc_r Software can read this bit Reading this bit will aut...

Страница 37: ...egister The system tick calibration value is fixed at 18000 When the system tick clock is set to 18 MHz the maximum value of HCLK 8 a 1ms time reference is generated 2 1 2 Interrupt and exception vect...

Страница 38: ...obal interrupt 0x0000_0074 14 21 Settable DMA1 channel 4 DMA1 channel 4 global interrupt 0x0000_0078 15 22 Settable DMA1 channel 5 DMA1 channel 5 global interrupt 0x0000_007C 16 23 Settable DMA1 chann...

Страница 39: ...7 Settable TIM5 TIM5 global interrupt 0x0000_0108 51 58 Settable SPI3_I2S3 SPI3 I2S3 global interrupt 0x0000_010C 52 59 Settable UART4 UART4 global interrupt 0x0000_0110 53 60 Settable UART5 UART5 glo...

Страница 40: ...5 COMP6 global interrupt 0x0000_018C 84 91 Settable COMP7 COMP7 global interrupt 0x0000_0190 85 92 Settable R SRAM R SRAM error interrupt 0x0000_0194 External interrupt event controller EXTI 2 2 1 Int...

Страница 41: ...will be generated and the corresponding Pending bit will be set to 1 Writing 1 in the corresponding bit of the Pending register will clear the interrupt request To generate an event the corresponding...

Страница 42: ...that control the NVIC interrupt channel mapped to the External Interrupt Controller so that an interrupt coming from one of the 21 lines can be correctly acknowledged Hardware configuration select and...

Страница 43: ...l EXTI2_CFG 3 0 Control EXTI3_CFG 3 0 Control EXTI4_CFG 3 0 Control EXTI5_CFG 3 0 Control EXTI6_CFG 3 0 Control EXTI7_CFG 3 0 Control AFIO_EXTI_CFG1 Register AFIO_EXTI_CFG2 Register EXTI0 EXTI1 EXTI2...

Страница 44: ...FG Reserved RT_CFG 20 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00Ch EXTI_FT_CFG Reserved FT_CFG 20 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 010h EXTI_SWIE Reserved SWIE 2...

Страница 45: ...nt mask on line x 0 Event request from line x is masked 1 Event request from line x is not masked 2 3 4 Rising trigger selection register EXTI_RT_CFG Address offset 0x08 Reset value 0x0000 0000 Bit fi...

Страница 46: ...it field Name Description 31 21 Reserved Reserved the reset value must be maintained 20 0 SWIEx Software interrupt on line x When this bit is 0 writing 1 will set the corresponding Pending bit in EXTI...

Страница 47: ...etection to clear this bit 2 3 8 EXTI timestamp trigger source selection register EXTI_TS_SEL Address offset 0x18 Reset value 0x0000 0000 Bit field Name Description 31 4 Reserved Reserved the reset va...

Страница 48: ...ax 144MHz AHB Bus Matrix Max 144MHz DMA1 EFC Flash DCode DMA TPIU SW JTAG NVIC FPU DSP SBus ICode DMA2 DMA ETH iCache SRAM R SRAM SAC QSPI SDIO RCC CRC APB2 Max 72MHz AFIO APB1 Max 36MHz EXTI GPIOA GP...

Страница 49: ...HB2APB2 Among them APB1 contains 26 low speed APB peripherals and the maximum speed of PCLK1 is 36MHz APB2 contains 18 high speed APB peripherals and the maximum speed of PCLK2 is equal to 72MHz 3 1 2...

Страница 50: ...004_0000 0xE004_0FFF COMP OPAMP Reserved TIM7 TIM6 TIM5 TIM4 TIM3 TIM2 0x4000_2400 0x4000_27FF 0x4000_2000 0x4000_23FF 0x4000_1800 0x4000_1BFF 0x4000_1400 0x4000_17FF 0x4000_1000 0x4000_13FF 0x4000_0C...

Страница 51: ...ding 3 1 3 Boot management Boot address When the system starts the boot mode after reset can be selected through BOOT1 and BOOT0 pins After system reset or exit from standby mode the value of BOOT pin...

Страница 52: ...08000000 0x0000_0000 0x1FFF_0000 0x1000_0000 0x2000_0000 1 1 SRAM start 0x08000000 0x1FFF_0000 0x0000_0000 0x1000_0000 0x2000_0000 Embedded boot loader Embedded boot loader program is stored in the sy...

Страница 53: ...Page 2 0x0800_1000 0x0800_17FF 2KB Page 255 0x0807_F800 0x0807_FFFF 2KB Information area System memory area 0x1FFF_0000 0x1FFF_3FFF 16KB System configuration area 0x1FFF_F000 0x1FFF_F7FF 2KB Option b...

Страница 54: ...HCLK 32MHz the minimum number of waiting periods is 0 When 32MHz HCLK 64MHz the minimum number of waiting periods is 1 When 64MHz HCLK 96MHz the minimum number of waiting periods is 2 When 96MHz HCLK...

Страница 55: ...flash programming Main memory programming process Check the FLASH_ STS BUSY bit to confirm that there are no other flash operations in progress Set the FLASH_CTRL PG bit to 1 Write the word to be prog...

Страница 56: ...function can be configured to be enabled or disabled through the register and it is enabled by default Option byte Option byte block is mainly used to configure read write protection boot mode configu...

Страница 57: ...te 15 8 Corresponding complement code 7 0 Option byte 0x1FFF_F800 nUSER USER nRDP1 RDP1 0x1FFF_F804 nData1 Data1 nData0 Data0 0x1FFF_F808 nWRP1 WRP1 nWRP0 WRP0 0x1FFF_F80C nWRP3 WRP3 nWRP2 WRP2 0x1FFF...

Страница 58: ...uration A system reset is required for the configured value to be reloaded to take effect If an attempt is made to program or erase a protected page a protection error flag will be returned in the FLA...

Страница 59: ...protected option byte is rewritten to the unprotected L0 level all the main storage areas will be automatically erased and the process is as follows Erasing the option byte block will not result in au...

Страница 60: ...Erase Flash main memory area mass erase Allow Allow Allow Allow Flash option byte area Read Write Erase Read Write Erase Read Write Erase Read Write Erase Flash system memory area prohibit prohibit Re...

Страница 61: ...and write Read and write Read and write protect level Boot mode SRAM Changing a Protection Level Perform user Access to areas JTAG SWD Main Flash System Memory SRAM L0 level Before 4KB of flash main m...

Страница 62: ...e erase Read write erase Read write erase Flash system memory area Prohibit Prohibit Prohibit Prohibit SRAM All Read and write Read and write Read and write Read and write L2 level Before 4KB of flash...

Страница 63: ...h main memory area Prohibit Read only Read only Read only L0 or L2 is allowed When changed to L0 the main memory area is automatically erased After 4KB of flash main memory area Prohibit Read write er...

Страница 64: ...updated Accordingly it is equivalent to storing only the jump header of the program in the Cache The main features of the instruction buffer are as follows 8KB iCache Support connection mode 4WAY Soft...

Страница 65: ...peatedly used codes in iCache to improve the efficiency of code execution iCache module has four latch channels and the size of each channel is 1 4 of the whole cache When using a single channel you m...

Страница 66: ...0000 0x2002 3FFF R SRAM supports read and write access of bytes half words and words and supports access to SBus DMA1 DMA2 and ETH Because the bus address of R SRAM is continuously connected to SRAM...

Страница 67: ...R BUSY Reset Value 0 0 0 0 0 0 0 0 010h FLASH_CTRL Reserved ECCERRITE EOPITE FERRITE ERRITE OPTWE SMPSEL LOCK START OPTER OPTPG Reserved MER PER PG Reset Value 0 0 0 0 0 0 1 0 0 0 0 0 0 014h FLASH_ADD...

Страница 68: ...of the prefetch buffer 0 The prefetch buffer is closed 1 The prefetch buffer is open 4 PRFTBFE Prefetch buffer enable 0 Close the prefetch buffer 1 Enable prefetch buffer 3 Reserved Reserved the rese...

Страница 69: ...5 2 4 The FLASH status register FLASH_STS Address offset 0x0C Reset value 0x0000 0000 Bit field Name Description 31 8 Reserved Reserved the reset value must be maintained 7 ECCERR ECC error Read FLAS...

Страница 70: ...ved the reset value must be maintained 0 BUSY Busy This bit indicates that a flash operation is in progress At the beginning of flash operation this bit is set to 1 This bit is cleared to 0 when the o...

Страница 71: ...set 1 SMP2 mode Before programming it will not judge whether the content of the address where the programming is located has been erased and the Flash will directly start programming If the programmi...

Страница 72: ...lect the page to be erased when page erasing Note When the FLASH_STS BUSY bit is 1 this register cannot be written 3 2 5 2 7 Option byte register FLASH_OB Address offset 0x1C Reset value 0x03FF FFFC B...

Страница 73: ...only 2 WDG_SW Set watchdog 0 hardware watchdog 1 Software watchdog Note This bit is read only 1 RDPRT1 Read protection L1 level protection 0 Read protection L1 level is not enabled 1 read protection L...

Страница 74: ...it Flash address the corresponding lower 6 bit ECC value 3 2 5 2 10 RDN register FLASH_RDN Address offset 0x2C Reset value 0x0000 0000 Bit field Name Description 31 25 Reserved Reserved the reset valu...

Страница 75: ...6309900 Email info nationstech com Address Nations Tower 109 Baoshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Bit field Name Description Chapter 0 disable 1 enable 3 0 LOCKST...

Страница 76: ...range is 1 8V 3 6V mainly used for clock and reset system most analog peripherals powered BKR and MR are internal voltage regulators that can provide power for the digital module power supply system V...

Страница 77: ...diode between this supply and the VBAT pin If there is no external battery in the application It is recommended to connect the VBAT pin to VDD with a 100nF ceramic capacitor In RUN SLEEP STOP0 mode th...

Страница 78: ...ip Can work with a minimum voltage of 1 8V No external reset circuit is required When VDD or VDDA is lower than the specified threshold VPOR PDR the chip will remain in reset state For more informatio...

Страница 79: ...hold This event is internally connected to the interrupt line 16 of the external interrupt which will generate an interrupt if enabled in the external interrupt register Depending on the rising fallin...

Страница 80: ...ower modes Mode Condition Enter Exit RUN CPU boot Peripheral configuration Power on system reset low power wake up Enter sleep STOP0 STOP2 standby and VBAT modes SLEEP CPU goes to sleep mode and the k...

Страница 81: ...ed off LSE LSI configurable GPIO is maintained and peripheral IO multiplexing is not maintained 16KB R SRAM data retention other SRAM and register data are lost 84B BK register retention GPIOs and EXT...

Страница 82: ...e stopped position and the peripherals need to be re initialized at this time The running enable conditions of different modules in different power consumption modes are shown in the following table T...

Страница 83: ...a Peripheral Run Sleep Stop 0 Stop 2 Standby VBAT Wakeup capability Wakeup capability Wakeup capability LSI O O O O O O LSE O O O O O O CSS O O RTC Auto wakeup O O O O O O O O O Number of RTC Tamper p...

Страница 84: ...power mode 4 FLASH is in sleep Flash itself mode 4 2 1 SLEEP mode The CPU stops and all peripherals including peripherals around the Cortex M4F core such as NVIC SysTick etc can run and wake up the C...

Страница 85: ...combined with peripheral clock control mechanism The voltage regulator can be configured in normal or low power mode In STOP0 mode most of the clock sources in the core domain are disabled such as PLL...

Страница 86: ...igital logic areas are powered off The main voltage regulator MR is turned off and the HSE HSI PLL is turned off CPU register retention LSE LSI configurable GPIO retention peripheral IO multiplexing i...

Страница 87: ...32 768kHz crystal oscillator LSE OSC optional It can be turned on by RCC_BDCTRL LSEEN bit R SRAM data retention which can be turned on by register PWR_CTRL2 SR2STBRET Exit STANDBY mode MCU exits STAN...

Страница 88: ...and STANDBY modes To do this two of the three optional RTC clock sources can be selected by software programming RCC_BDCTRL RTCSEL 1 0 as follows 32 768kHz external crystal clock LSE OSC This clock s...

Страница 89: ...0 4 4 2 Power control register PWR_CTRL Address offset 0x00 Reset value 0x0000 0700 reset by wakeup from STANDBY mode Bit field Name Description 31 10 Reserved Reserved the reset value must be mainta...

Страница 90: ...age thresholds see the description of the MSB bit NOTE See the Electrical Characteristics section in the datasheet for detailed descriptions 4 PVDEN Power supply voltage monitor PVD enabled 0 Disable...

Страница 91: ...1 The device is already in VBAT mode 2 PVDO PVD output This bit is only valid when PVD is enabled by the PWR_CTRL PVDEN bit 0 VDD VDDA is higher than the PVD threshold selected by PWR_CTRL PRS 2 0 1 V...

Страница 92: ...ndent watchdog wakeup enable 0 Independent watchdog wakeup disable 1 Independent watchdog wake up enable 8 4 LSITRIM 4 0 LSI correction value 3 TMPWPEN TAMPER wake up enable 0 Disable 1 Enable 2 SR2ST...

Страница 93: ...86 755 86309900 Email info nationstech com Address Nations Tower 109 Baoshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Bit field Name Description 0 EXMODE Extended mode contro...

Страница 94: ...upt or event BKP_CTRLSTS Function description Power down backup Tamper detection An tamper detection event clears all backup data register contents The detection function of the TAMPER pin can be enab...

Страница 95: ...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 010h BKP_DAT4 Reserved DAT 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 014h BKP_DAT5 Reserved DAT 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 018h BKP_DAT6 Res...

Страница 96: ...P_DAT20 Reserved DAT 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 068h BKP_DAT21 Reserved DAT 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 06Ch BKP_DAT22 Reserved DAT 15 0 Reset Value 0 0 0 0...

Страница 97: ...0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0B4h BKP_DAT40 Reserved DAT 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0B8h BKP_DAT41 Reserved DAT 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

Страница 98: ...15 10 Reserved Reserved the reset value must be maintained 9 TINTF Tamper interrupt flag This bit is set by hardware when an tamper event is detected and the TPINT_EN bit is 1 This flag is cleared by...

Страница 99: ...s reset only after system reset or wake up from standby mode 1 CLRTINT Clear Tamper Detection Interrupt This bit can only be written and the read value is 0 0 invalid 1 Clear the tamper detection inte...

Страница 100: ...the figure will finally act on the NRST pin and remain low during the reset process The reset entry vector is fixed at address 0x0000_0004 For more details see Table 2 1 vector table 6 1 2 System res...

Страница 101: ...reset instead of entering STANDBY mode Generate low power management reset when entering STOP0 STOP2 mode This reset is enabled by setting the nRST_STOP bit in the user option byte At this time even i...

Страница 102: ...o drive RTC RTCCLK Each clock source can be turned on or off independently when it is not used to optimize power consumption Several prescalers can be used to configure the frequencies of the AHB the...

Страница 103: ...LASH_CLK to Flash programming USB_CLK to USB interface I2S3CLK I2S2CLK TRNG_CLK 1M ADC1 2 3 4_CLK 1M ADC1 2 3 4_CLK FCLK CPU AHB BUS HCLK SysTick SAC_CLK CRC_CLK APB1 Prescaler 1 2 4 8 16 36MHz MAX PC...

Страница 104: ...configuration is shown in See Figure 6 3 For more details please refer to the electrical characteristics section of the datasheet The RCC_CTRL HSERDF bit indicates whether the high speed external osc...

Страница 105: ...ks to provide the 48MHz USBCLK clock 6 2 5 LSE clock The LSE crystal is a 32 768KHz low speed external crystal or ceramic resonator It provides a low power and accurate clock source for the real time...

Страница 106: ...urce is ready either after a delay to start the stabilization phase or PLL stabilization When the selected clock source is not ready the switching of the system clock will not occur until the target c...

Страница 107: ...s divided by 128 as the RTC clock If the VDD power supply is cut off or the internal voltage regulator is turned off the power supply in the 1 8V domain is cut off the RTC state is indeterminate The P...

Страница 108: ...I2C1RST UART5RST UART4RST USART3RST USART2RST Reserved SPI3RST SPI2RST Reserved WWDGRST Reserved TIM7RST TIM6RST TIM5RST TIM4RST TIM3RST TIM2RST Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

Страница 109: ...red by software When entering the stop0 stop2 standby mode it is cleared by hardware This bit cannot be cleared when PLL is used as the system clock When the HSI HSE is used as the clock source for th...

Страница 110: ...nal value for calibrating the frequency of the internal HSI RC oscillator The trimming step is around 40 kHz between two consecutive HSICAL steps and the default value is 16 which can adjust the HSI t...

Страница 111: ...CT 3 0 26 24 MCO 2 0 Microcontroller clock output selection Set and cleared by software 0xx no clock output 100 Select system clock SYSCLK output 101 select internal high speed clock HSI output 110 se...

Страница 112: ...010 PLL input clock 19 10011 PLL input clock 20 10100 PLL input clock 21 10101 PLL input clock 22 10110 PLL input clock 23 10111 PLL input clock 24 11000 PLL input clock 25 11001 PLL input clock 26 11...

Страница 113: ...by 16 7 4 AHBPRES 3 0 AHB prescaler Set and cleared by software to configure the division factor of the AHB clock HCLK 0xxx SYSCLK not divided 1000 SYSCLK divided by 2 1001 SYSCLK divided by 4 1010 S...

Страница 114: ...interrupt clear Set by the software to clear the PLLRDIF flag 0 No effect 1 Clear the PLLRDIF flag 19 HSERDICLR HSE ready interrupt clear Set by the software to clear the HSERDIF flag 0 Not used 1 Cle...

Страница 115: ...0 No clock security system interrupt caused by HSE clock failure 1 Clock security system interrupt caused by HSE clock failure 6 5 Reserved Reserved the reset value must be maintained 4 PLLRDIF PLL re...

Страница 116: ...eripheral Reset Register RCC_APB2PRST Address offset 0x0c Reset value 0x0000 0000 Bit Field Name Description 31 21 Reserved Reserved the reset value must be maintained 20 I2C4RST I2C4 reset Set and cl...

Страница 117: ...M1 timer 10 9 Reserved Reserved the reset value must be maintained 8 IOPGRST GPIO port G reset Set or cleared by software 0 Clear the reset 1 Reset GPIO port G 7 IOPFRST GPIO port F reset Set or clear...

Страница 118: ...reset 1 Reset the DAC interface 28 PWRRST Power interface reset Set and cleared by software 0 Clear the reset 1 Reset the power interface 27 BKPRST Backup interface reset Set or cleared by software 0...

Страница 119: ...et UART5 19 UART4RST UART4 reset Set and cleared by software 0 Clear the reset 1 Reset UART4 18 USART3RST USART3 reset Set or cleared by software 0 clear the reset 1 Reset USART3 17 USART2RST USART2 r...

Страница 120: ...are 0 Clear the reset 1 Reset TIM4 timer 1 TIM3RST TIM3 timer reset Set and cleared by software 0 Clear the reset 1 Reset TIM3 timer 0 TIM2RST TIM2 timer reset Set and cleared by software 0 Clear the...

Страница 121: ...1 ADC2 clock enabled 12 ADC1EN ADC1 clock enable Set and cleared by software 0 ADC1 clock disabled 1 ADC1 clock enabled 11 SACEN SAC clock enable Set and cleared by software 0 SAC clock disabled 1 SA...

Страница 122: ...oftware 0 DMA2 clock disabled 1 DMA2 clock enabled 0 DMA1EN DMA1 clock enable Set and cleared by software 0 DMA1 clock disabled 1 DMA1 clock enabled 6 3 8 APB2 Peripheral Clock Enable Register RCC_APB...

Страница 123: ...timer clock enabled 12 SPI1EN SPI1 clock enable Set and cleared by software 0 SPI1 clock disabled 1 SPI1 clock enabled 11 TIM1EN TIM1 timer clock enable Set and cleared by software 0 TIM1 timer clock...

Страница 124: ...t value must be maintained 0 AFIOEN Alternate function IO clock enable Set and cleared by software 0 Alternate Function IO clock disabled 1 Alternate Function IO clock enabled 6 3 9 APB1 Peripheral Cl...

Страница 125: ...be maintained 23 USBEN USB clock enable Set and cleared by software 0 USB clock disabled 1 USB clock enabled 22 I2C2EN I2C2 clock enable Set and cleared by software 0 I2C2 clock disabled 1 I2C2 clock...

Страница 126: ...0 8 Reserved Reserved the reset value must be maintained 7 COMPFILTEN COMP Filter clock enable Set and cleared by software 0 COMP Filter clock disabled 1 COMP Filter clock enabled 6 COMPEN COMP clock...

Страница 127: ...d by software 0 Disable RTC clock 1 Enable RTC clock 14 10 Reserved Reserved the reset value must be maintained 9 8 RTCSEL 1 0 RTC clock source selection Set by software to select RTC clock source Onc...

Страница 128: ...the PWR_CTRL DBKP bit is set These bits can only be cleared by a backup domain reset Any internal or external reset will not affect these bits 6 3 11 Clock Control Status Register RCC_CTRLSTS Address...

Страница 129: ...by software by writing to the RMRSTF bit 0 No MMU reset occurred 1 MMU reset occurred 24 RMRSTF Clear the reset flag Set by the software to clear the reset flag 0 No effect 1 Clear the reset flag 23 R...

Страница 130: ...40 KHz oscillator clock cycles 0 Internal 40KHz RC oscillator clock not ready 1 Internal 40KHz RC oscillator clock ready 0 LSIEN Internal low speed oscillator enable Set and cleared by software 0 Dis...

Страница 131: ...cleared by software 0 Clear the reset 1 Reset SAC 10 Reserved Reserved the reset value must be maintained 9 RNGCRST RNGC reset Set and cleared by software 0 Clear the reset 1 Reset RNGC 8 0 Reserved...

Страница 132: ...DC 1M clock source divided by 31 11111 ADC 1M clock source divided by 32 Note ADC clock must be configured to 1M 10 ADC1MSEL ADC 1M clock source selection Set or cleared by software 0 Select HSI oscil...

Страница 133: ...Register 3 RCC_CFG3 Address offset 0x30 Reset value 0x0000 3800 Bit Field Name Description 31 19 Reserved Reserved the reset value must be maintained 18 TRNG1MEN TRNG analog interface clock enable Set...

Страница 134: ...rk North Nanshan District Shenzhen 518057 P R China Bit Field Name Description 1111x TRNG 1M clock source divided by 32 10 7 Reserved Reserved the reset value must be maintained 6 BORRSTEN BOR reset e...

Страница 135: ...re pins which can be configured by users according to requirements Each GPIO pin can be independently configured as an output input or alternate peripheral function port Except for the analog function...

Страница 136: ...PIOx_POD x A B C D E F G The I O configurations in different operation modes are shown in the following table Table 7 1 I O mode and configuration relationship Configuration mode PCFG1 PCFG0 PMODE1 PM...

Страница 137: ...According to peripheral function configuration Open drain mode Disable Configurable GPIO outputs 0 when the data is 0 and high impedance when he data is 1 Disable Configurable GPIO outputs 0 when the...

Страница 138: ...vel 1 port on the output register make the pin in a high impedance state P MOS is never activated Push pull mode 0 on the output register activates N MOS and the pin outputs low level 1 on the output...

Страница 139: ...nate function mode Schmidt trigger input is activated Weak pull up and pull down resistors are disabled In the open drain or push pull configuration the output buffer is turned on Signals of built in...

Страница 140: ...057 P R China Figure 7 4 Alternate function configuration Analog mode When the I O port is configured in analog mode Weak pull up and pull down resistors are disabled Read access to the input data reg...

Страница 141: ...OSC_OUT has no GPIO function by default BOOT0 pin default configuration is input pull down NRST pull up input and output After the reset the default state of the pin associated with the debug system i...

Страница 142: ...set The bit written with 1 is set or cleared accordingly and the bit not written with 1 will not be changed The software does not need to disable interrupts and is completed in a single APB2 write ope...

Страница 143: ...disconnected from its original pin and remapped to the new pin Functional remapping of backup domain pins PC13 PC15 7 2 5 3 1 Functional description of backup power domain pins PC13 PC15 PC13 PC15 pin...

Страница 144: ...ing RTC calibration clock RTC alarm clock pulse or second pulse When this pin is not used for intrusion detection it can be used to output RTC calibration clock RTC alarm clock pulse or second pulse s...

Страница 145: ...n and above packages PD0 and PD1 pins are available and OSC_IN and OSC_OUT are available so there is no need to remap PD0 PD1 to OSC_IN OSC_OUT JTAG SWD alternate function remapping The SWD JTAG debug...

Страница 146: ...ternate function remapping The external trigger source of injection conversion and regular conversion of ADC supports remapping See alternate remapping and debug I O configuration register AFIO_RMP_CF...

Страница 147: ...ADC4 external trigger injection conversion ADC4 external trigger injection conversion is connected to EXTI14 ADC4 external trigger injection conversion is connected to TIM5_CH4 Table 7 11 ADC4 extern...

Страница 148: ...PE13 TIM1_CH4 PA11 PA11 PE14 TEAM1_BKIN PB12 PA6 PB5 PE15 TIM1_CH1N PB13 PA7 PB13 PE8 TIM1_CH2N PB14 PB0 PB14 PE10 TIM1_CH3N PB15 PB1 PB15 PE12 Table 7 17 TIM8 alternate function remapping Alternate...

Страница 149: ...ship of DVP signals is shown in the following Table Table 7 20 DVP alternate function remapping Alternate function DVP_RMP 1 0 00 DVP_RMP 1 0 01 DVP_RMP 1 0 11 DVP_HSYNC PA1 PE2 PE2 DVP_VSYNC PA2 PE3...

Страница 150: ...RT3_RX PB11 PC11 PD9 USART3_CK PB12 PC12 PD10 USART3_CTS PB13 PD11 USART3_RTS PB14 PD12 UARTx alternate function remapping UART4 5 6 7 interfaces have remapping function See the alternate remapping co...

Страница 151: ...1 I2C1_SCL PB6 PB8 I2C1_SDA PB7 PB9 I2C1_SMBA PB5 7 2 5 12 2 I2C2 pin remapping See alternate remapping configuration register AFIO_RMP_CFG3 Table 7 29 I2C2 pin remapping Alternate function I2C2_RMP...

Страница 152: ...e 7 33 SPI2 I2S2 pin remapping Alternate function SPI2_RMP 1 0 00 SPI2_RMP 1 0 01 SPI2_RMP 1 0 11 SPI2_NSS I2S2_WS PB12 PC6 PE10 SPI2_SCK I2S2_CK PB13 PC7 PE11 SPI2_MISO PB14 PC8 PE12 SPI2_MOSI I2S2_S...

Страница 153: ...Alternate function QSPI_RMP 1 0 00 QSPI_RMP 1 0 01 QSPI_RMP 1 0 11 QSPI_NSS PA4 PF0 PC10 QSPI_CLK PA5 PF1 PC11 QSPI_IO0 PA6 PF2 PC12 QSPI_IO1 PA7 PF3 PD0 QSPI_ IO2 PC4 PF4 PD1 QSPI_ IO3 PC5 PF5 PD2 ET...

Страница 154: ...iguration of peripherals Table 7 38 ADC DAC ADC DAC pin GPIO configuration ADC Analog mode DAC Analog mode Table 7 39 TIM1 TIM8 TIM1 TIM8 pin Configuration PAD configuration mode TIM1 8_CHx Input capt...

Страница 155: ...DVP_D4 Input floating DVP_D5 Input floating DVP_D6 Input floating DVP_D7 Input floating Table 7 43 USART USART pin Configuration GPIO configuration USARTx_TX full duplex transmissions Push pull altern...

Страница 156: ...r mode Floating input or input pull up or push pull alternate output Full duplex mode slave mode Push pull alternate output Simple bidirectional data line Master mode Unused can be used as general I O...

Страница 157: ...utput QSPI_IO1 Push pull alternate output QSPI_IO0 Push pull alternate output QSPI_CLK Push pull alternate output QSPI_NSS Push pull alternate output Table 7 49 ETH MAC signal Pin configuration ETH_MD...

Страница 158: ...g reset state ETH_MII_RXD2 Input floating reset state ETH_MII_RXD3 Input floating reset state Table 7 50 USB USB pin GPIO configuration USB_DM USB_DP Once the USB module is enabled these pins are auto...

Страница 159: ...uence writing GPIOx_PH_CFG GPIOx_PL_CFG bits can be modified as long as PLOCK _ CFG 0 which is not affected by the configuration of GPIOx_PLOCK_CFG 15 0 PLOCKK_CFG 1 GPIOx_PH_CFG GPIOx_PL_CFG is contr...

Страница 160: ...0 0 0 0 0 0 0 0 0 0 x B 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 x C D E F G 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 010h GPIOx_PBSC PBC15 PBC14 PBC13 PBC12 PBC11 PBC10 PBC9 PBC8 PBC7 PBC6 PBC5 PBC4 PBC3 PBC2 PBC1 PBC...

Страница 161: ...GPIOx_POD register 11 reserved When PMODE 1 0 00 output mode 00 General push pull output mode 01 General open drain output mode 10 Alternate function push pull output mode 11 Open drain output mode of...

Страница 162: ...output mode 11 Open drain output mode of alternate function 29 28 25 24 21 20 17 16 13 12 9 8 5 4 1 0 PMODEy 1 0 Mode bit of port x y 8 15 00 input mode state after reset 01 output mode maximum speed...

Страница 163: ...t setting clearing register GPIOx_PBSC Address offset 0x10 Reset value 0x0000 0000 Bit field Name Description 31 16 PBCy Clear bit y of port GPIOx y 0 15 These bits can only be written and operated as...

Страница 164: ...OCKK_CFG Lock key This bit can be read at any time and it can only be modified by the key lock write sequence 0 Port configuration lock key is activated 1 The port configuration lock key is activated...

Страница 165: ...DS_CFGy The drive capability configuration bit y of port GPIOx y 0 15 These bits can only be read or written in the form of 16 bit words 0 2mA 1 Controlled by PMODEy of GPIOx_PH_CFG GPIOx_PL_CFG PMOD...

Страница 166: ...0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 014h AFIO_EXTI_CFG4 Reserved EXTI15_CFG 3 0 EXTI14_CFG 3 0 EXTI13_CFG 3 0 EXTI12_CFG 3 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 01Ch Reserved 020h A...

Страница 167: ...le 1 Output enable 6 4 PORT_SEL 2 0 Port selection bit Select the port used to output the event output signal of cortex 000 select port A 001 select port B 010 select port C 011 select port D 100 sele...

Страница 168: ...ceiver of the external RMII interface 22 21 Reserved Reserved the reset value must be maintained 20 ADC2_ETRR ADC2 regular conversion external trigger remapping This bit can be set to 1 or set to 0 by...

Страница 169: ...C_OUT 14 13 CAN1_RMP 1 0 CAN1 alternate function remapping These bits can be set to 1 or set to 0 by software to control the re mapping of the alternate functions CAN1_RX and CAN1_TX on products with...

Страница 170: ...KIN PE15 CH1N PE8 CH2N PE10 CH3N PE12 5 4 USART3_RMP 1 0 Remapping of USART3 These bits can be set to 1 or set to 0 by software to control the image of the CTS RTS CK TX and RX alternate functions of...

Страница 171: ...7 11 Remapping NSS PB2 SCK PE7 MISO PE8 MOSI PE9 7 4 4 AFIO external interrupt configuration register 1 AFIO_EXTI_CFG1 Address offset 0x08 Reset value 0x0000 0000 Bit field Name Description 31 16 Rese...

Страница 172: ...bits can be read and written by software and used to select the input source of the EXTIx external interrupt EXTI4 configuration 0000 PA4 pin 0001 PB4 pin 0010 PC4 pin 0011 PD4 pin 0100 PE4 pin 0101...

Страница 173: ...0101 Reserved 0110 Reserved EXTI9 configuration 0000 PA9 pin 0001 PB9 pin 0010 PC9 pin 0011 PD9 pin 0100 PE9 pin 0101 Reserved 0110 PG9 pin EXTI10 configuration 0000 PA10 pin 0001 PB10 pin 0010 PC10...

Страница 174: ...served EXTI15 configuration 0000 PA15 pin 0001 PB15 pin 0011 PC15 pin 0011 PD15 pin 0100 PE15 pin 0101 PF15 pin 0110 Reserved 7 4 8 AFIO alternate remapping configuration register 3 AFIO_RMP_CFG3 Addr...

Страница 175: ...01 Remapping TX PB13 RX PB14 10 Remapping TX PE8 RX PE9 11 Remapping TX PB8 RX PB9 21 20 UART4_RMP 1 0 Remapping of UART4 These bits can be set to 1 or set to 0 by software to control the image of th...

Страница 176: ...SO and MOSI alternate functions of SPI3 on the GPIO port 00 No remapping NSS WS PA15 SCK CK PB3 MISO PB4 MOSI PB5 01 Remapping NSS WS PD2 SCK CK PC10 MISO PC11 MOSI PC12 10 Remapping NSS WS PD8 SCK CK...

Страница 177: ...PF4 IO3 PF5 11 Remapping NSS PC10 SCK PC11 IO0 PC12 IO1 PD0 IO2 PD1 IO3 PD2 3 Reserved Reserved the reset value must be maintained 2 1 CAN2_RMP 1 0 CAN2 remapping This bit can be set to 1 or set to 0...

Страница 178: ...D5 PB11 D6 PF14 D7 PF15 19 QSPI_XIP_EN QSPI XIP memory mapping mode enable control 0 Disable 1 Enable 18 Reserved Reserved the reset value must be maintained 17 ADC4_ETRR ADC4 regular conversion exte...

Страница 179: ...ation 11 Remapping COMP6_OUT PB7 9 8 COMP5_RMP 1 0 Remapping of COMP5_OUT This bit can be set to 1 or 0 by software 00 No remapping COMP5_OUT PB0 01 Remapping COMP5_OUT PB11 10 Remapping COMP5_OUT PB6...

Страница 180: ...set value must be maintained 23 EGB4_DET_EN EMC GB4 detection enable bit ground bounce detection 0 Disable 1 Enable 22 EGB3_DET_EN EMC GB3 detection enable bit 0 Disable 1 Enable 21 EGB2_DET_EN EMC GB...

Страница 181: ...Enable 9 EGB2_RST_EN When EMC GB2 detects it the system resets the enable bit 0 Disable 1 Enable 8 EGB1_RST_EN When EMC GB1 detects it the system resets the enable bit 0 Disable 1 Enable 7 EGBN4_RST_E...

Страница 182: ...ail info nationstech com Address Nations Tower 109 Baoshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Bit field Name Description 1 Enable 0 ECLAMP1_RST_EN When EMC CLAMP1 detec...

Страница 183: ...dently configurable DMA channels 8 channels each for DMA1 and DMA2 Support three transfer types which are Memory to Memory Memory to Peripheral and Peripheral to Memory Each DMA channel supports hardw...

Страница 184: ...red by hardware peripherals or software and the DMA controller processes the request according to the priority level of the channel The data is read from the source address according to the configured...

Страница 185: ...es an arbitration strategy to handle multiple requests from different channels The priority of each channel is programmable in the channel control register DMA_CHCFGx 4 levels of priority Very high pr...

Страница 186: ...15 0 0x4 W B4 7 0 0x2 4 R B7B6 15 0 0x6 W B6 7 0 0x3 0x0 B0 0x1 B2 0x2 B4 0x3 B6 16 16 4 0x0 B1B0 0x2 B3B2 0x4 B5B4 0x6 B7B6 1 R B1B0 15 0 0x0 W B1B0 15 0 0x0 2 R B3B2 15 0 0x2 W B3B2 15 0 0x2 3 R B5...

Страница 187: ...o extra bits will be padded with 0 8 4 5 Peripheral Memory address incrementation DMA_CHCFGx PINC and DMA_CHCFGx MINC respectively control whether the peripheral address and memory address are enabled...

Страница 188: ...in each DMA channel configuration register Flow control is used to control source destination and direction of DMA channel Table 8 2 Flow control table DMA_CHCFGx MEM2MEM DMA_CHCFGx DIR Source Destina...

Страница 189: ...g clear bit is set Half transfer interrupt An interrupt is generated when half of the channel data is transferred Interrupt is a level signal Each channel has its dedicated interrupt interrupt mask co...

Страница 190: ...TIM3_CH3 Hardware request 3 SPI1_TX USART3_RX TIM1_CH2 TIM3_CH4 TIM3_UP Hardware request 4 SPI2 I2S2_RX USART1_TX I2C2_TX TIM1_CH4 TIM1_TRIG TIM1_COM TIM4_CH3 Hardware request 5 Hardware request 6 USA...

Страница 191: ...Channel 7 Channel 8 TIM2 TIM2_CH3 TIM2_UP TIM2_CH1 TIM2_CH2 TIM2_CH4 TIM3 TIM3_CH3 TIM3_CH4 TIM3_UP TIM3_CH1 TIM3_TRIG TIM4 TIM4_CH1 TIM4_CH2 TIM4_CH3 TIM4_UP DMA2 controller The DMA2 request mapping...

Страница 192: ...4 Hardware request 5 Hardware request 6 Hardware request 7 Hardware request 8 Hardware request 1 Peripheral request signal Channel 1 Software trigger MEM2MEM bit Channel 1 enable bit Channel 2 Softwar...

Страница 193: ...2 CTXCF2 CGLBF2 CERRF1 CHTXF1 CTXCF1 CGLBF1 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 008h DMA_CHCFG1 Reserved MEM2MEM PRIOLVL 1 0 MSIZE 1 0 PSIZE 1 0 MINC PINC CIRC...

Страница 194: ...lue 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 068h DMA_CHSEL5 Reserved CH_SEL 5 0 Reset Value 0 0 0 0 0 0 06Ch DMA_CHCFG6 Reserved MEM2MEM PRIOLVL 1 0 MSIZE 1 0 PSIZE 1 0 MINC PI...

Страница 195: ...alf transfer flag for channel x x 1 8 Hardware sets this bit when half transfer is done This bit is cleared by software by writing 1 to DMA_INTCLR CHTXFx bit 0 Half transfer not yet done on channel x...

Страница 196: ...hannel 29 25 21 17 13 9 5 1 CTXCFx Clear transfer complete flag for channel x x 1 8 Software can set this bit to clear TXCF of corresponding channel 0 No action 1 Reset DMA_INTSTS TXCF bit of correspo...

Страница 197: ...le memory address increment mode 0 Memory address won t increase with each transfer 1 Memory address increase with each transfer 6 PINC Peripheral increment mode Software can enable disable peripheral...

Страница 198: ...0c 20 x 1 Reset value 0x0000 0000 This register can only be written if the channel is disabled DMA_CHCFGx CHEN 0 Bit field Name Description 31 16 Reserved Reserved the reset value must be maintained 1...

Страница 199: ...000 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 Memory starting address for DMA to read write from to Increm...

Страница 200: ...to the DMA request of ADC1 Bit field Name Description 31 6 Reserved Reserved the reset value must be maintained 5 0 CH_SEL 5 0 DMA1 channel request selection 40 UART5_RX 39 ADC2 38 I2C1_RX 37 TIM4_UP...

Страница 201: ...is only valid when the channel MAP is enabled DMA_CHMAPEN MAP_EN 1 This register is used to manage the DMA2 channel mapped by the DMA2 peripheral request Note After the channel MAP is enabled DMA cha...

Страница 202: ...I2S3_RX 3 TIM8_UP 2 TIM8_CH3 1 TIM5_TRIG 0 TIM5_CH4 8 5 10 DMA channel MAP enable register DMA_CHMAPEN Address offset 0xA8 Reset value 0x0000 0000 Note After the MAP is enabled DMA will respond to the...

Страница 203: ...s Technologies Inc Tel 86 755 86309900 Email info nationstech com Address Nations Tower 109 Baoshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Bit field Name Description 1 Enab...

Страница 204: ...ADC3 supports 15 external channels and ADC4 supports 13 external channels Support 12 bit 10 bit 8 bit 6 bit resolution configurable The highest sampling rate 5 14MSPS under 12bit resolution The highe...

Страница 205: ...ADCx_IN15 Gpio Ports Analog channel multiplexing VTS VREFINT ADCCLK ADC prescaler Data bus Injected data registers 4 x 16 bits Regular data register 16 bits Data register Analog watchdog Interrupt ge...

Страница 206: ...same otherwise the ADC accuracy will be affected 4 External channel reference data sheet 9 3 1 ADC clock An ADC requires three clocks HCLK ADC_CLK and ADC_1MCLK HCLK is used for the register access AD...

Страница 207: ...checked by polling the ADC_CTRL3 PDRDY bit When the ADC is disabled the default mode is power down In this mode as long as the power is on there is no need to re calibrate and the calibration value is...

Страница 208: ...e conversions up to a maximum of 16 The ADC_RSEQx registers specify the regular channels and the conversion order of the regular channels The ADC_RSEQ1 LEN 3 0 bits specified regular channel sequence...

Страница 209: ...3 VINN 3 VINP 4 VINN 4 VINP 5 VINN 5 VINP 6 VINN 6 VINP 7 VINN 7 VINP 8 VINN 8 VINP 9 VINN 9 VINP 10 VINN 10 VINP 11 VINN 11 VINP 12 VINN 12 VINP 13 VINN 13 VINN 14 VINP 15 VINN 15 VINP 16 VINN 16 VI...

Страница 210: ...P 0 VINN 0 VINP 1 VINN 1 VINP 2 VINN 2 VINP 3 VINN 3 VINP 4 VINN 4 VINP 5 VINN 5 VINP 6 VINN 6 VINP 7 VINN 7 VINP 8 VINN 8 VINP 9 VINN 9 VINP 10 VINN 10 VINP 11 VINN 11 VINP 12 VINN 12 VINP 13 VINN 13...

Страница 211: ...end flag ADC_STS JENDC will be set to 1 If the injection channel conversion end interrupt enable ADC_CTRL1 JENDCIEN bit is set to 1 an interrupt will be generated at this time and the converted data w...

Страница 212: ...figuring ADC_WDGHIGH HTH and the low threshold of the analog watchdog can be set by configuring ADC_WDGLOW LTH The threshold of the analog watchdog has nothing to do with the way of data alignment bec...

Страница 213: ...ADC_CTRL1 AUTOJC bit is set then the Injected channels are automatically converted following the regular channels mentioned by ADC_RSEQ and ADC_JSEQx A single trigger can conver up to 16 4 channels S...

Страница 214: ...he regular sequence and then stop until the next trigger signal is generated Next trigger will continue to convert n channels from the point where the previous conversion stopped until all channels of...

Страница 215: ...rogram sets the ADC_CTRL2 ENCAL bit to 1 to start self calibration During the calibration the ADC_CTRL2 ENCAL bit remains 1 After the calibration the ADC_CTRL2 ENCAL bit is cleared by hardware and the...

Страница 216: ...t voltage in the specified sampling cycle For different channels you can select different sampling time The total conversion time is calculated as follows TCONV Sampling time 12 5 cycles Example ADCCL...

Страница 217: ...1 SWSTRRCH Software control bit For the injection sequence the software sets the ADC_CTRL2 EXTJTRIG bit to 1 then the injection channel can use the rising edge of the external event to trigger the sta...

Страница 218: ...st it will transfer the converted data from the ADC_DAT register to the destination address specified by the user Note In independent ADC mode ADC1 ADC2 ADC3 ADC4 have DMA function In dual ADC mode th...

Страница 219: ...ta will be stored in the ADC_DAT register The high half word of ADC_DAT is the conversion data of ADC2 The low half word of ADC_DAT is the conversion data of ADC1 and 32 bit DMA can be used to transfe...

Страница 220: ...ternal trigger comes from the multiplexer of ADC1 determined by ADC_CTRL2 EXTJSEL 2 0 ADC2 will be triggered synchronously If ADC1 or ADC2 sets ADC_CTRL1 JENDCIEN a JENDC interrupt will be generated w...

Страница 221: ...nce will be converted continuously The converted data will be stored in the ADC_DAT register The high halfword of ADC_DAT is the conversion data of ADC2 and the low halfword of ADC_DAT is the conversi...

Страница 222: ...y converts the regular sequence without the need to set ADC_CTRL2 CTU The converted data will be stored in the ADC_DAT register The high half word of ADC_DAT is the conversion data of ADC2 and the low...

Страница 223: ...nverted when the second trigger is generated all injection channels of ADC2 are converted and so on If ADC1 or ADC2 sets ADC_CTRL1 JENDCIEN a JENDC interrupt will be generated when the conversion of t...

Страница 224: ...on of the synchronous injection channel can interrupt the transition of the synchronous regular channel Note In this mode the sequence of synchronous conversion of ADC1 and ADC2 needs to be set to the...

Страница 225: ...er occurs during injection transition 9 9 9 Mixed synchronous injection mode alternate mode In this mode when the injection trigger occurs the alternate conversion will be interrupted the injection co...

Страница 226: ...digital value by the ADC_IN16 channel When the temperature sensor is working the ideal sampling time is 17 1us when the temperature sensor is not working the ADC_CTR2 TEMPEN bit can be cleared by soft...

Страница 227: ...re and Average slope of a VSENSE curve mV C or V C Toffset empirical value for temperature error compensation C Refer to the values of V30 and Avg_Slope in the electrical characteristics chapter of th...

Страница 228: ...DIEN AWDGCH Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 008h ADC_CTRL2 Reserved TEMPEN SWSTRRCH SWSTRJCH EXTRTRIG EXTRSEL 2 0 Reserved EXTJTRIG EXTJSEL ALIG Reserved EN...

Страница 229: ...048h ADC_JDAT4 Reserved JDAT4 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 04Ch ADC_DAT Reserved DAT 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 050h ADC_DIFSEL Reserved DIFSEL 18 0 Reserved...

Страница 230: ...version This bit is set by hardware at the end of all injection sequence channel conversions and cleared by software 0 Conversion is not complete 1 Conversion is complete 1 ENDC Conversion sequence ch...

Страница 231: ...erved in ADC2 and ADC4 Changing the channel configuration in dual ADC mode will cause a restart condition It is recommended to turn off the dual ADC mode before changing the configuration to avoid syn...

Страница 232: ...DCIEN Interrupt enable for injected channels This bit is set and cleared by the software to disallow or allow interrupts after all injection channel conversions have finished 0 Disable JENDC interrupt...

Страница 233: ...ion of a set of regular channels 0 Reset state 1 Starts converting the regular channel 21 SWSTRJCH Start conversion of injected channels This bit is set by the software to initiate the conversion and...

Страница 234: ...gger configuration for ADC1 and ADC2 000 TIM1_TRGO event 100 TIM3_CC4 event 001 TIM1_CC4 event 101 TIM4_TRGO event 010 TIM2_TRGO event 110 EXTI line 15 TIM8_CC4 event 011 TIM2_CC1 event 111 SWSTRRCH T...

Страница 235: ...the conversion will not be triggered This is to prevent the wrong conversion from being triggered 9 12 5 ADC sampling time register 1 ADC_SAMPT1 Address offset 0x0C Reset value 0x0000 0000 Bit field...

Страница 236: ...cycles 110 71 5 cycles 011 28 5 cycles 111 239 5 cycles ADC_SAMPT3 SAMPSEL 1 the sampling time is set as follows 000 1 5 cycles 100 19 5 cycles 001 2 5 cycles 101 61 5 cycles 010 4 5 cycles 110 181 5...

Страница 237: ...ter ADC_WDGLOW Address offset 0x28 Reset value 0x0000 0000 Bit field Name Description 31 12 Reserved Reserved the reset value must be maintained 11 0 LTH 11 0 Analog watchdog low threshold These bits...

Страница 238: ...version in regular sequence 9 12 11 ADC regular sequence register 2 ADC_RSEQ2 Address offset 0x30 Reset value 0x0000 0000 Bit field Name Description 31 30 Reserved Reserved the reset value must be mai...

Страница 239: ...value 0x0000 0000 Bit field Name Description 31 22 Reserved Reserved the reset value must be maintained 21 20 JLEN 1 0 Injected sequence length These bits are software defined as the number of channe...

Страница 240: ...ted channel The data is left aligned or right aligned 9 12 15 ADC regulars data register ADC_DAT Address offset 0x4C Reset value 0x0000 0000 Bit field Name Description 31 16 ADC2DAT 15 0 Data converte...

Страница 241: ...te the hardware will update it according to the calibration coefficient Software can write these bits with a new calibration factor If the new calibration coefficient is different from the current coe...

Страница 242: ...is disabled the ADC enters low power mode 1 When the ADC is disabled the ADC enters deep sleep mode 9 JENDCAIEN Interrupt enable for any injected channels This bit is set and cleared by the software...

Страница 243: ...Data resolution This bit is set and cleared by the software to select the resolution of the conversion 00 6 bits 01 8 bits 10 10 bits 11 12 bits 9 12 19 ADC sampling time register 3 ADC_SAMPT3 Address...

Страница 244: ...d The DAC output channel has 2 with independent converter Both channels can be configured to convert independently or to convert simultaneously and update the output simultaneously VREF is used as the...

Страница 245: ...ltage VDDA Analog power Input analog power VSSA Analog power ground Input analog power ground DACx_OUT DAC analog output Analog output signal Note When the DACx is enabled PA4 or PA5 needs to be confi...

Страница 246: ...the data alignment configuration the corresponding registers of the data configuration are as follows When the DAC outputs independently there are 3 cases When the configuration data is written to th...

Страница 247: ...ernal data storage register When the configuration data is written to the DAC_DR12DCH register the DAC1 data is written to DAC_DR12DCH 15 4 Actually stored in the register DACCH1D 11 0 bits DACCH1D is...

Страница 248: ...trigger Trigger source Type TSEL 2 0 Timer 6 TRGO events Internal signal from the on chip timer 000 Timer 8 TRGO events 001 Timer 7 TRGO events 010 Timer 5 TRGO events 011 Timer 2 TRGO events 100 Tim...

Страница 249: ...alignment data hold register will be transferred to the DAC_DATOx register after three APB1 cycles according to the selected trigger event when the hardware trigger occurs When the software trigger o...

Страница 250: ...ar when two DACs are turned on Note DMA requests for DAC have no accumulative function and when the second external trigger occurs before the response to the first external trigger the second DMA requ...

Страница 251: ...tude of the triangle wave can be selected by configuring DAC_CTRL MAxSEL 3 0 The value of the internal triangle wave counter is added to the value of the DAC alignment data holding register and writte...

Страница 252: ...er DAC can still operate independently For details please refer to the following chapter description 10 4 1 Independent trigger without waveform generator The configuration process is as follows Confi...

Страница 253: ...figure DAC_CTRL T1EN and DAC_CTRL T2EN to enable trigger enable of DAC1 and DAC2 Configure DAC_CTRL T1SEL 2 0 and DAC_CTRL T2SEL 2 0 as different values to select different trigger sources Configure D...

Страница 254: ...ure DAC_CTRL W1EN 1 0 and DAC_CTRL W2EN 1 0 as 1x to select the triangle wave generation enable Configure DAC_CTRL MA1SEL3 0 and DAC_CTRL MA2SEL3 0 as different values to get different triangle wave a...

Страница 255: ...DAC_CTRL W2EN 1 0 as 01 to select noise generation enable Configure DAC_CTRL MA1SEL3 0 and DAC_CTRL MA2SEL3 0 to the same value to get the same LFSR register mask bit Put the data to be converted int...

Страница 256: ...litude value of DAC1 is added to the value of the corresponding data holding register The added value is transferred to the register DAC_DATO1 after a delay of 3 APB1 clock cycles and the counter valu...

Страница 257: ...H1D 11 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 00Ch DAC_DL12CH1 Reserved DACCH1D 11 0 Reserved Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 010h DAC_DR8CH1 Reserved DACCH1D 7 0 Reset Value 0 0 0 0 0 0 0 0 014h D...

Страница 258: ...mplitude equals 63 0110 unmasked LFSR bit 6 0 triangular amplitude equals 127 0111 unmasked LFSR bit 7 0 triangular amplitude equals 255 1000 unmasked LFSR bit 8 0 triangular amplitude equals 511 1001...

Страница 259: ...ude equal 3 0010 unmasked LFSR bit 2 0 triangular amplitude equals 7 0011 unmasked LFSR bit 3 0 triangular amplitude equals 15 0100 unmasked LFSR bit 4 0 triangular amplitude equals 31 0101 unmasked L...

Страница 260: ...igger register DAC_SOTTR Offset address 0x04 Reset value 0x0000 0000 Bit field Name Description 31 2 Reserved Reserved the reset value must be maintained 1 TR2EN The DAC2 software trigger This bit is...

Страница 261: ...AC1 converts the data 10 5 5 12 bit left aligned data hold register for DAC1 DAC_DL12CH1 Offset address 0x0c Reset value 0x0000 0000 Bit field Name Description 31 16 Reserved Reserved the reset value...

Страница 262: ...1 12 Reserved Reserved the reset value must be maintained 11 0 DACCH2D 11 0 12 bit right aligned data for DAC2 The bits are configured by the software and the DAC2 converts the data 10 5 8 12 bit left...

Страница 263: ...DAC_DR12DCH Offset address 0x20 Reset value 0x0000 0000 Bit field Name Description 31 28 Reserved Retained the reset value must be maintained 27 16 DACCH2D 11 0 12 bit right aligned data for DAC2 The...

Страница 264: ...0 5 12 8 bit right aligned data hold register for dual DAC DAC_DR8DCH Offset address 0x28 Reset value 0x0000 0000 Bit field Name Description 31 16 Reserved Retained the reset value must be maintained...

Страница 265: ...Shenzhen 518057 P R China 10 5 14 DAC2 data output register DAC_DATO2 Offset address 0x30 Reset value 0x0000 0000 Bit field Name Description 31 12 Reserved Retained the reset value must be maintained...

Страница 266: ...ctor can be configured with any value between 1 and 65536 Programmable Repetition Counter TIM1 up to 6 channels TIM8 up to 6 channels 4 capture compare channels the working modes are PWM output ouput...

Страница 267: ...IMx_CTRL1 CNTEN bit is set The counter starts counting one clock cycle after the TIMx_CTRL1 CNTEN bit is set TI2FP1 TI2FP2 TI1FP2 TI3FP3 TI1FP1 TI4FP4 XOR TI2 TI3 TI1 TI4 Polarity selection BRK IC4 IC...

Страница 268: ...overflow event is generated If the TIMx_CTRL1 UPRS bit select update request and the TIMx_EVTGEN UDGN bit are set an update event UEV will generate And TIMx_STS UDITF will not be set by hardware there...

Страница 269: ...ll still be cleared and the prescaler counter will also be set to 0 but the prescaler value will remain unchanged The figure below shows some examples of the counter behavior and the update flags for...

Страница 270: ...ck CK_CNT Counter register Update event UEV Update interrupt flag UDITF Write a new value in TIMx_AR 32 31 33 34 35 36 00 01 02 03 FF 36 04 05 06 07 Counter overflow Auto reload preload register Auto...

Страница 271: ...2 N Center aligned mode In center aligned mode the counter increments from 0 to the value TIMx_AR 1 a counter overflow event is generated It then counts down from the auto reload value TIMx_AR to 1 an...

Страница 272: ...note if the update source is a counter overflow auto reload update before reloading the counter Figure 11 6 Timing diagram of the Center aligned internal clock divided factor 2 N Figure 11 7 A center...

Страница 273: ...s means that data is transferred from the preload registers to the shadow registers every N 1 counter overflow or CK_PSC CNTEN Timer clock CK_CNT Counter register Update event UEV 05 06 04 03 02 01 00...

Страница 274: ...occurs In center aligned mode each time the counter overflows or underflows Its repetition rate is defined by the value of the TIMx_REPCNT register Repetition counters feature automatic reloading The...

Страница 275: ...count sequence diagram in center aligned mode Software clear 34 35 36 00 01 35 36 00 01 35 36 00 01 35 36 00 01 35 36 00 01 35 36 00 01 33 CK_PSC CNTEN Timer clock CK_CNT Underflow Overflow UDITF UDI...

Страница 276: ...Internal clock source CK_INT When the TIMx_SMCTRL SMSEL is equal to 000 the slave mode controller is disabled The three control bits TIMx_CTRL1 CNTEN TIMx_CTRL1 DIR TIMx_EVTGEN UDGN can only be change...

Страница 277: ...g TIMx_CCMOD1 IC2F 3 0 if filter is not needed keep IC2F bit at 0000 Configure TIMx_SMCTRL SMSEL equal to 111 select timer external clock mode 1 Configure TIMx_SMCTRL TSEL equal to 110 select TI2 as t...

Страница 278: ...example use the following configuration steps to make the up counter count every 2 rising edges on ETR Since no filter is needed in this case make TIMx_SMCTRL EXTF 3 0 equal to 0000 Configure the pre...

Страница 279: ...nels Capture compare channels include capture compare registers and shadow registers The input section consists of digital filters multiplexers and prescalers The output section includes comparators a...

Страница 280: ...an intermediate waveform OCxRef active high as reference The polarity acts at the end of the chain fDTS Filter Down counter TIMx_CCMOD1 IC1F 3 0 TI1 Edge Detector TIMx_CCEN CC1P From channel 2 From s...

Страница 281: ...main circuit S R From time base unit Read CCDAT1H TIM1_EVTGEN CC1GN Read in progress Input mode S R Read CCDAT1L Output mode CC1SEL 1 CC1SEL 0 UEV Write in progress APB Bus MCU Peripheral interface Ca...

Страница 282: ...pt or DMA request if the corresponding interrupt enable is pulled high TIM1_CCMOD1 OC1CEN TIM1_CCMOD1 OC1M D 2 0 CNT CCR1 CNT CCR1 TIM1_CCMOD1 OC1CEN TIM1_CCMOD1 OC1MD 2 0 OC1ERF OCxERF Dead time gene...

Страница 283: ...w level are detected we can validate the transition on TI1 Then configure TIMx_CCMOD1 IC1F to 0011 By configuring TIMx_CCEN CC1P 0 select the rising edge as the valid transition polarity on the TI1 ch...

Страница 284: ...with the TIMx_CH1 TIMx_CH2 signals 11 3 8 Forced output mode Software can force output compare signals to active or inactive level directly in output mode TIMx_CCMODx CCxSEL 00 User can set TIMx_CCMOD...

Страница 285: ...user set TIMx_DINTEN CCxIEN a corresponding interrupt will be generated If user set TIMx_DINTEN CCxDEN and set TIMx_CTRL2 CCDSEL to select DMA request and DMA request will be sent User can set TIMx_C...

Страница 286: ...xP On the other hand to enable the output of OCx user need to set the combination of the value of CCxEN CCxNEN MOEN OSSI and OSSR in TIMx_CCEN and TIMx_BKDT The values of TIMx_CNT and TIMx_CCDATx are...

Страница 287: ...alue of TIMx_CTRL1 DIR that the counter counts up or down Cautions that the DIR and CAMSEL bits should not be changed at the same time User should not write the counter while running in center aligned...

Страница 288: ...Up counting User can set TIMx_CTRL1 DIR 0 to make counter counts up Here is an example for PWM mode1 When TIMx_CNT TIMx_CCDATx the reference PWM signal OCxREF is high Otherwise it will be low If the c...

Страница 289: ...ed and a pulse tPULSE with a controllable pulse width is generated after a controllable delay tDELAY The output mode needs to be configured as output compare mode or PWM mode After selecting one pulse...

Страница 290: ...be converted to the same level as the comparison match occurs immediately regardless of the comparison result OCxFEN fast enable only takes effect when the channel mode is configured for PWM1 and PWM...

Страница 291: ...Mx_BKDT OSSR When switching to the IDLE state the dead time will be activated If user set TIMx_CCEN CCxEN and TIMx_CCEN CCxNEN at the same time a dead time will be insert If there is a break circuit t...

Страница 292: ...inactive level user can use this function to send a specific waveform such as PWM or static active level User can also use this function to set both outputs in their inactive level or both outputs ac...

Страница 293: ...g edge of MOEN can be asynchronous so between the actual signal and the synchronous control bit there set a resynchronization circuit This circuit will cause a delay between the asynchronous and the s...

Страница 294: ...r other security components When the break input is active TIMx_BKDT MOEN cannot be set automatically or by software at the same time and the TIMx_STS BITF cannot be cleared Because the break inputs a...

Страница 295: ...prescaler updates the preload registers TIMx_AR TIMx_CCDATx and generates the update event UEV TIMx_CTRL1 UPRS 0 The following is an example of a reset mode 1 Channel 1 is configured as input to detec...

Страница 296: ...due to the resynchronization circuit on TI2 input Figure 11 28 Control circuit in Trigger mode Slave mode Gated mode In gate control mode the level polarity of the input port can control whether the...

Страница 297: ...his time the trigger selection needs to select non ETRF TIMx_SMCTRL TSEL 111 Here is an example 1 Channel 1 is configured as input to detect the rising edge of TI1 TIMx_CCMOD1 CC1SEL 01 TIMx_CCEN CC1P...

Страница 298: ...in advance the preloaded bits are OCxMD CCxEN and CCxNEN When a COM commutation event occurs the OCxMD CCxEN and CCxNEN preload bits are transferred to the shadow register bits COM commutation event...

Страница 299: ...TI2 at the same time TIMx_SMCTRL SMSEL 011 The encoder interface is equivalent to using an external clock with direction selection and the counter only counts continuously between 0 and the auto relo...

Страница 300: ...down Counting up Counting on TI1 and TI2 High Counting down Counting up Counting up Counting down Low Counting up Counting down Counting down Counting up Here is an example of an encoder with dual ed...

Страница 301: ...ail info nationstech com Address Nations Tower 109 Baoshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Figure 11 33 Encoder interface mode example with IC1FP1 polarity inverted...

Страница 302: ...EL 100 any change in the Hall 3 inputs will trigger the counter to recount so it is used as a time reference the capture compare channel 1 is configured to capture the TRC signal in capture mode TIMx_...

Страница 303: ...n Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Figure 11 34 Example of Hall sensor interface TI1 Counter CNT CCDAT2 OC1 OC1N Va OC2 OC2N OC3 OC3N Write CCxEN CCxNEN and OCxMD for...

Страница 304: ...0 0 0 0 0 0 0 0 0 0 00Ch TIMx_DINTEN Reserved TDEN COMDEN CC4DEN CC3DEN CC2DEN CC1DEN UDEN BIEN TIEN COMIEN CC4IEN CC3IEN CC2IEN CC1IEN UIEN Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 010h TIMx_STS Re...

Страница 305: ...0 0 0 0 0 0 0 0 0 0 0 0 03Ch TIMx_CCDAT3 Reserved CCDAT3 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 040h TIMx_CCDAT4 Reserved CCDAT4 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 044h TIMx_BK...

Страница 306: ...1 selection 0 Select external CH1 signal from IOM 1 Select internal CH1 signal from COMP Note Before operating this bit the extended mode of the chip must be turned on set PWR_CTRL3 EXMODE 10 IOMBKPEN...

Страница 307: ...is used to select the UEV event sources by software 0 If update interrupt or DMA request is enabled any of the following events will generate an update interrupt or DMA request Counter overflow underf...

Страница 308: ...t Idle state 1 OC1N Output 0 When TIMx_BKDT MOEN 0 after dead time OC1N 0 1 When TIMx_BKDT MOEN 0 after dead time OC1N 1 8 OI1 Output Idle state 1 0 When TIMx_BKDT MOEN 0 if OC1N is implemented after...

Страница 309: ...ompare DMA selection 0 When a CCx event occurs a DMA request for CCx is sent 1 When an update event occurs a DMA request for CCx is sent 2 CCUSEL Capture compare control update selection 0 If TIMx_CTR...

Страница 310: ...of the external trigger signal ETRP must be at most 1 4 of TIMxCLK frequency When a faster external clock is input a prescaler can be used to reduce the frequency of ETRP 00 Prescaler disable 01 ETRP...

Страница 311: ...en directly by the internal clock 001 Encoder mode 1 According to the level of TI2FP2 the counter up counting or down counting on the edge of TI1FP1 010 Encoder mode 2 According to the level of TI1FP1...

Страница 312: ...e capture compare 4 DMA request 11 CC3DEN Capture Compare 3 DMA request enable 0 Disable capture compare 3 DMA request 1 Enable capture compare 3 DMA request 10 CC2DEN Capture Compare 2 DMA request en...

Страница 313: ...compare 1 interrupt 1 Enables capture comparing 1 interrupt 0 UIEN Update interrupt enable 0 Disable update interrupt 1 Enables update interrupt 11 4 6 Status registers TIMx_STS Offset address 0x10 Re...

Страница 314: ...No trigger event occurred 1 Trigger interrupt occurred 5 COMITF COM interrupt flag This bit is set by hardware once a COM event is generated when TIMx_CCEN CCxEN TIMx_CCEN CCxNEN TIMx_CCMOD1 OCxMD ha...

Страница 315: ...o update event occurred 1 Update interrupt occurred 11 4 7 Event generation registers TIMx_EVTGEN Offset address 0x14 Reset values 0x0000 Bit field Name Description 15 8 Reserved Reserved the reset va...

Страница 316: ...lag will be pulled high if the corresponding interrupt and DMA are enabled the corresponding interrupt and DMA will be generated If The TIMx_STS CC1ITF is already pulled high pull TIMx_STS CC1OCF high...

Страница 317: ...he output reference signal OC1REF which determines the values of OC1 and OC1N and is valid at high levels while the active levels of OC1 and OC1N depend on the TIMx_CCEN CC1P and TIMx_CCEN CC1NP bits...

Страница 318: ...n match on CC1 output Therefore OC is set to the comparison level regardless of the comparison result The delay time for sampling the trigger input and activating the CC1 output is reduced to 3 clock...

Страница 319: ...S 16 N 5 1011 fSAMPLING fDTS 16 N 6 1100 fSAMPLING fDTS 16 N 8 1101 fSAMPLING fDTS 32 N 5 1110 fSAMPLING fDTS 32 N 6 1111 fSAMPLING fDTS 32 N 8 3 2 IC1PSC 1 0 Input Capture 1 prescaler These bits are...

Страница 320: ...10 CC4 channel is configured as input IC4 is mapped on TI3 11 CC4 channel is configured as input IC4 is mapped on TRC This mode is only active when the internal trigger input is selected by TIMx_SMCTR...

Страница 321: ...3 0 Input Capture 3 filter 3 2 IC3PSC 1 0 Input Capture 3 Prescaler 1 0 CC3SEL 1 0 Capture compare 3 selection These bits are used to select the input output and input mapping of the channel 00 CC3 c...

Страница 322: ...y See TIMx_CCEN CC1NP description 6 CC2NEN Capture Compare 2 complementary output enable See TIMx_CCEN CC1NEN description 5 CC2P Capture Compare 2 output polarity See TIMx_CCEN CC1P description 4 CC2E...

Страница 323: ...1 Enable capture Table 11 4 Output control bits of complementary OCx and OCxN channels with break function Control bits Output state1 MOENOSSI OSSR CCxEN CCxNENOCx Output state OCxN Output state 1 X 0...

Страница 324: ...If both outputs of a channel are not used CCxEN CCxNEN 0 OIx OIxN CCxP and CCxNP must all be cleared Note The status of external I O pins connected to complementary OCx and OCxN channels depends on t...

Страница 325: ...epetition counter value Repetition counter is used to generate the update event or update the timer registers only after a given number N 1 cycles of the counter where N is the value of TIMx_REPCNT RE...

Страница 326: ...dable and writable 11 4 16 Capture compare register 2 TIMx_CCDAT2 Offset address 0x38 Reset value 0x0000 Bit field Name Description 15 0 CCDAT2 15 0 Capture Compare 2 values CC2 channel is configured...

Страница 327: ...e register CCDAT3 and CCDDAT3 are readable and writable 11 4 18 Capture compare register 4 TIMx_CCDAT4 Offset address 0x40 Reset value 0x0000 Bit field Name Description 15 0 CCDAT4 15 0 Capture Compar...

Страница 328: ...ny write to this bit requires an APB clock delay to take effect 12 BKEN Break enable 0 Disable brake input BRK and CCS clock failure events 1 Enable brake input BRK and CCS clock failure events Note A...

Страница 329: ...d in output mode also enable write protection Note After the system reset the LCKCFG bit can only be written once Once written to the TIMx_BKDT register LCKCFG will be protected until the next reset 7...

Страница 330: ..._CTRL1 00001 TIMx_CTRL2 00010 TIMx_SMCTRL 10001 TIMx_BKDT 10010 TIMx_DCTRL 11 4 21 DMA transfer buffer register TIMx_DADDR Offset address 0x4C Reset value 0x0000 Bit field Name Description 15 0 BURST...

Страница 331: ...ompare mode registers 3 TIMx_CCMOD3 Offset address 0x54 Reset value 0x0000 Bit field Name Description 15 OC6CEN Output compare 6 clear enable 14 12 OC6MD 2 0 Output compare 6 mode 11 OC6PEN Output com...

Страница 332: ...ve register only when an update event occurs TIM1_CC5 and TIM8_CC5 is used for comparator blanking 11 4 24 Capture compare register 6 TIMx_CCDAT6 Offset address 0x5C Reset value 0x0000 Bit field Name...

Страница 333: ...ize up counting down counting up down counting 16 bit programmable prescaler The frequency division factor can be configured with any value between 1 and 65536 TIM2 TIM3 TIM4 and TIM5 up to 4 channels...

Страница 334: ...it can be generated by software when TIMx_CTRL1 UPDIS 0 The counter CK_CNT is valid only when the TIMx_CTRL1 CNTEN bit is set The counter starts counting one clock cycle after the TIMx_CTRL1 CNTEN bi...

Страница 335: ...te And TIMx_STS UDITF will not be set by hardware therefore no update interrupts or update DMA requests are generated This setting is used in scenarios where you want to clear the counter but do not w...

Страница 336: ...d The figure below shows some examples of the counter behavior and the update flags for different division factors in the up counting mode Figure 12 3 Timing diagram of up counting The internal clock...

Страница 337: ...ck CK_CNT Counter register Update event UEV Update interrupt flag UDITF Write a new value in TIMx_AR 32 31 33 34 35 36 00 01 02 03 FF 36 04 05 06 07 Counter overflow Auto reload preload register Auto...

Страница 338: ...2 N Center aligned mode In center aligned mode the counter increments from 0 to the value TIMx_AR 1 a counter overflow event is generated It then counts down from the auto reload value TIMx_AR to 1 an...

Страница 339: ...arts from 0 as does the prescaler s counter Please note if the update source is a counter overflow auto reload update before reloading the counter Figure 12 6 Timing diagram of the Center aligned inte...

Страница 340: ...inds of external clock mode CK_PSC CNTEN Timer clock CK_CNT Counter register Update event UEV 05 06 04 03 02 01 00 01 02 03 04 05 06 07 Counter underflow Update interrupt flag UDITF Auto reload preloa...

Страница 341: ...L is equal to 000 the slave mode controller is disabled The three control bits TIMx_CTRL1 CNTEN TIMx_CTRL1 DIR TIMx_EVTGEN UDGN can only be changed by software except TIMx_EVTGEN UDGN which remains cl...

Страница 342: ...TIMx_CCMOD1 IC2F 3 0 if filter is not needed keep IC2F bit at 0000 Configure TIMx_SMCTRL SMSEL equal to 111 select timer external clock mode 1 Configure TIMx_SMCTRL TSEL equal to 110 select TI2 as th...

Страница 343: ...ion steps to make the up counter count every 2 rising edges on ETR Since no filter is needed in this case make TIMx_SMCTRL EXTF 3 0 equal to 0000 Configure the prescaler by making TIMx_SMCTRL EXTPS 1...

Страница 344: ...capture compare registers and shadow registers The input section consists of digital filters multiplexers and prescalers The output section includes comparators and output controls The input signal T...

Страница 345: ...an intermediate waveform OCxRef active high as reference The polarity acts at the end of the chain fDTS Filter Down counter TIMx_CCMOD1 IC1F 3 0 TI1 Edge Detector TIMx_CCEN CC1P From channel 2 From s...

Страница 346: ...main circuit S R From time base unit Read CCDAT1H TIM1_EVTGEN CC1GN Read in progress Input mode S R Read CCDAT1L Output mode CC1SEL 1 CC1SEL 0 UEV Write in progress APB Bus MCU Peripheral interface Ca...

Страница 347: ...an interrupt or DMA request if the corresponding interrupt enable is pulled high The TIMx_STS CCxITF bit is set by hardware when a capture event occurs and is cleared by software or by reading the TIM...

Страница 348: ...6 PWM input mode There are some differences between PWM input mode and normal input capture mode including Two ICx signals are mapped to the same TIx input The two ICx signals are active on edges of...

Страница 349: ...the output compare signal to inactive level The values of the TIMx_CCDATx shadow register and the counter still comparing with each other in this mode And the flag still can be set Therefore the inter...

Страница 350: ...e sent User can set TIMx_CCMODx OCxPEN to choose capture compare shawdow regisete using capture compare preload registers TIMx_CCDATx or not The time resolution is one count of the counter In one puls...

Страница 351: ...output of OCx user need to set the combination of the value of CCxEN The values of TIMx_CNT and TIMx_CCDATx are always compared with each other when the TIM is under PWM mode Only if an update event o...

Страница 352: ...gned mode otherwise it will cause unexpected results Here are some example 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...

Страница 353: ...If the compare value in TIMx_CCDATx is greater than the auto reload value the OCxREF will remains 1 Conversely if the compare value is 0 the OCxREF will remains 0 When TIMx_AR 8 the PWM waveforms are...

Страница 354: ...configured as output compare mode or PWM mode After selecting one pulse mode the counter will stop counting after the update event UEV is generated Figure 12 20 Example of One pulse mode The followin...

Страница 355: ...less of the comparison result OCxFEN fast enable only takes effect when the channel mode is configured for PWM1 and PWM2 modes 12 3 11 Clearing the OCxREF signal on an external event If user set TIMx_...

Страница 356: ...x and external trigger synchronization Same as advanced timer See 11 3 16 12 3 14 Timer synchronization All TIMx timers are internally connected to each other This implementation allows any master tim...

Страница 357: ...setting TIM2_CTRL1 CNTEN 1 Start TIM1 by setting TIM1_CTRL1 CNTEN 1 Note If user select OCx as the trigger output of TIM1 by configuring MMSEL 1xx OCx rising edge will be used to drive timer2 Master...

Страница 358: ...TIM1 In the next example Gated TIM2 with enable signal of TIM1 Setting TIM1 CTRL1 CNTEN 0 to stop TIM1 TIM2 counts on the divided internal clock only when TIM1 is enable Both counters are clocked base...

Страница 359: ...le we can use update event as trigger source TIM1 is master TIM2 is slave The configuration steps are shown as below Setting TIM1_CTRL2 MMSEL 010 to use the update event of TIM1 as trigger output Conf...

Страница 360: ...as below Setting TIM1 MMSEL 001 to use the enable signal as trigger output Setting TIM1_SMCTRL TSEL 100 to configure the TIM1 to slave mode and receive the trigger input of TI1 Setting TIM1_SMCTRL SM...

Страница 361: ...on the edge of TI2 TIMx_SMCTRL SMSEL 010 3 The counter counts on the edges of TI1 and TI2 at the same time TIMx_SMCTRL SMSEL 011 The encoder interface is equivalent to using an external clock with dir...

Страница 362: ...ng down Counting up Counting up Counting down Low Counting up Counting down Counting down Counting up Here is an example of an encoder with dual edge triggering selected to suppress input jitter 1 IC1...

Страница 363: ...ed as half word 16 bits or one word 32 bits 12 4 1 Register Overview Table 12 2 Register map and reset value Offset Register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5...

Страница 364: ...0 01Ch TIMx_CCMOD2 Reserved OC4CEN OC4MD 2 0 OC4PEN OC4FEN CC4SEL 1 0 OC3CEN OC3MD 2 0 OC3PEN OC3FEN CC3SEL 1 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 01Ch TIMx_CCMOD2 Reserved IC4F 3 0 IC4PSC 1...

Страница 365: ...om IOM signal 1 Select internal CH4 from COMP signal Note For TIM5 setting to 1 is invalid Before operating this bit the extended mode of the chip must be turned on set PWR_CTRL3 EXMODE 13 C3SEL Chann...

Страница 366: ...interrupt flag bit is set to 1 when up counting 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 counti...

Страница 367: ...t or a hardware reset is issued by the slave mode controller the counter and prescaler are reinitialized 0 CNTEN Counter Enable 0 Disable counter 1 Enable counter Note external clock gating mode and e...

Страница 368: ...CTRL MSMD bit 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 011 Compare pulse Triggers the output to send a...

Страница 369: ...an be used to reduce the frequency of ETRP 00 Prescaler disable 01 ETRP frequency divided by 2 10 ETRP frequency divided by 4 11 ETRP frequency divided by 8 11 8 EXTF 3 0 External trigger filter These...

Страница 370: ...ounter up counting or down counting on the edge of TI1FP1 010 Encoder mode 2 According to the level of TI1FP1 the counter up counting or down counting on the edge of TI2FP2 011 Encoder mode 3 Accordin...

Страница 371: ...st enable 0 Disable capture compare 3 DMA request 1 Enable capture compare 3 DMA request 10 CC2DEN Capture Compare 2 DMA request enable 0 Disable capture compare 2 DMA request 1 Enable capture compare...

Страница 372: ...g See TIMx_STS CC1OCF description 11 CC3OCF Capture Compare 3 overcapture flag See TIMx_STS CC1OCF description 10 CC2OCF Capture Compare 2 overcapture flags See TIMx_STS CC1OCF description 9 CC1OCF Ca...

Страница 373: ...lows in up counting and up down counting modes and underflows in down counting mode When the corresponding channel of CC1 is in input mode This bit is set by hardware when the capture event occurs Thi...

Страница 374: ...nd DMA are enabled the corresponding interrupt and DMA will be generated When the corresponding channel of CC1 is in input mode TIMx_CCDAT1 will capture the current counter value and the TIMx_STS CC1I...

Страница 375: ...2 0 Output Compare 1 mode These bits are used to manage the output reference signal OC1REF which determines the values of OC1 and OC1N and is valid at high levels while the active levels of OC1 and OC...

Страница 376: ...n match on CC1 output Therefore OC is set to the comparison level regardless of the comparison result The delay time for sampling the trigger input and activating the CC1 output is reduced to 3 clock...

Страница 377: ...SAMPLING fDTS 32 N 5 1110 fSAMPLING fDTS 32 N 6 1111 fSAMPLING fDTS 32 N 8 3 2 IC1PSC 1 0 Input Capture 1 prescaler These bits are used to select the ratio of the prescaler for IC1 CC1 input When TIMx...

Страница 378: ...mode is only active when the internal trigger input is selected by TIMx_SMCTRL TSEL Note CC4SEL is writable only when the channel is off TIMx_CCEN CC4EN 0 7 OC3CEN Output compare 3 clear enable 6 4 OC...

Страница 379: ...bits are used to select the input output and input mapping of the channel 00 CC3 channel is configured as output 01 CC3 channel is configured as input IC3 is mapped to TI3 10 CC3 channel is configure...

Страница 380: ...ted Capture action occurs when IC1 generates a rising edge When used as external trigger IC1 is non inverted 1 inverted Capture action occurs when IC1 generates a falling edge When used as external tr...

Страница 381: ...ler value Counter clock fCK_CNT fCK_PSC PSC 15 0 1 Each time an update event occurs the PSC value is loaded into the active prescaler register 12 4 13 Auto reload register TIMx_AR Offset address 0x2C...

Страница 382: ...egister CCDAT1 is only readable When configured as output mode register CCDAT1 is readable and writable 12 4 15 Capture compare register 2 TIMx_CCDAT2 Offset address 0x38 Reset value 0x0000 Bit field...

Страница 383: ...de register CCDAT3 is only readable When configured as output mode register CCDAT3 is readable and writable 12 4 17 Capture compare register 4 TIMx_CCDAT4 Offset address 0x40 Reset value 0x0000 Bit fi...

Страница 384: ...0 DMA Base Address This bit field defines the first address where the DMA accesses the TIMx_DADDR register When access is done through the TIMx_DADDR first time this bit field specifies the address yo...

Страница 385: ...ers TIMx_DCTRL DBADDR 0xD TIMx_CCDAT1 DMA data length half word DMA memory address buffer address in SRAM DMA peripheral address TIMx_DADDR address When an event occurs TIMx will send requests to the...

Страница 386: ...onverter DAC The basic timer is directly connected to the DAC inside the chip and drives the DAC directly through the trigger output Main features 16 bit auto reload up counting counters 16 bit progra...

Страница 387: ...is generated when the counter reaches the overflow condition and it can be generated by software when TIMx_CTRL1 UPDIS 0 The counter CK_CNT is valid only when the TIMx_CTRL1 CNTEN bit is set The count...

Страница 388: ...where you want to clear the counter but do not want to generate an update interrupt Depending on the update request source is configured in TIMx_CTRL1 UPRS When an update event occurs TIMx_STS UDITF...

Страница 389: ...13 3 Timing diagram of up counting The internal clock divider factor 2 N CK_PSC CNTEN Timer clock CK_CNT Counter register Counter overflow Update interrupt flag UDITF 0034 0035 Update event UEV 0036 0...

Страница 390: ...ck CK_CNT Counter register Update event UEV Update interrupt flag UDITF Write a new value in TIMx_AR 32 31 33 34 35 36 00 01 02 03 FF 36 04 05 06 07 Counter overflow Auto reload preload register Auto...

Страница 391: ...T Figure 13 5 Control circuit in normal mode internal clock divided by 1 13 3 4 Debug mode When the microcontroller is in debug mode the Cortex M4 core halted depending on the DBG_CTRL TIMx_STOP confi...

Страница 392: ...Reserved MMSEL 2 0 Reserved Reset Value 0 0 0 008h Reserved 00Ch TIMx_DINTEN Reserved UDEN Reserved UIEN Reset Value 0 0 010h TIMx_STS Reserved UDITF Reset Value 0 014h TIMx_EVTGEN Reserved UDGN Reset...

Страница 393: ...event sources by software 0 If update interrupt or DMA request is enabled any of the following events will generate an update interrupt or DMA request Counter overflow The TIMx_EVTGEN UDGN bit is set...

Страница 394: ...as the trigger output TRGO Sometimes you need to start multiple timers at the same time or enable slave timer for a period of time The counter enable signal is set when TIMx_CTRL1 CNTEN bit is set or...

Страница 395: ...1 Reserved Reserved the reset value must be maintained 0 UDITF Update interrupt flag This bit is set by hardware when an update event occurs under the following conditions When TIMx_CTRL1 UPDIS 0 and...

Страница 396: ...mer counter will restart and all shadow register will be updated It will restart prescaler counter also 13 4 7 Counter TIMx_CNT Offset address 0x24 Reset value 0x0000 Bit field Name Description 15 0 C...

Страница 397: ...oshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Bit field Name Description 15 0 AR 15 0 Auto reload value These bits define the value that will be loaded into the actual auto...

Страница 398: ...sources of Interrupt Event These include Alarm A Alarm B Wakeup Timer Time Stamp After RTC is enabled by the RCC register and voltage remains in the operating range RTC will not stop timing in any mod...

Страница 399: ...g Interrupts events Alarm A Alarm B interrupt event Wakeup interrupt event Timestamp interrupt event RTC function description 14 2 1 RTC block diagram Figure 14 1 RTC Block Diagram RTC includes the fo...

Страница 400: ...on is cleared in default so the PWR_CTRL DBKP bit must set to 1 to enable write access to the RTC register Once the backup domain is reset all write protection RTC registers are write protected All wr...

Страница 401: ...gister instead User can access the calendar register directly by setting the RTC_CTRL BYPS bit When RTC_CTRL BYPS 0 calendar values are from shadow registers when reading RTC_SUBS RTC_TSH or RTC_DATE...

Страница 402: ...ait RTC_INITSTS RSYF bit is set again System reset Calendar complete initialization Calendar complete synchronization 2 Reading calendar value when RTC_CTRL BYPS 1 Reading the calendar value directly...

Страница 403: ...s RTC_ALRMxSS RTC_ALARMx Enable Alarm A Alarm B interrupt by set RTC_CTRL ALAIEN RTC_CTRL ALBIEN bit this step can be selected as needed Enable Alarm A Alarm B by setting RTC_CTRL ALAEN RTC_CTRL ALBEN...

Страница 404: ...n be enabled by setting RTC_CTRL TSEN bit to 1 When a timestamp event is detected on the RTC_TS pin the calendar values of the event will be stored in the timestamp register RTC_TSSS RTC_TST RTC_TSD a...

Страница 405: ...resolution is 0 954 PPM with the range from 487 1 PPM to 488 5 PPM When the input frequency is 32768 Hz calibration period can be configured as 220 RTCCLK cycles or 32 seconds The precision calibratio...

Страница 406: ...LK cycles within 16 seconds The calibration period is 8 seconds Using an accurate 8 second period to measure the 1Hz calibration output can ensure that the measurement error is within 1 907ppm 0 5 RTC...

Страница 407: ..._PRE Reserved DIVA 6 0 Reserved DIVS 14 0 Reset Value 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 014h RTC_WKUPT Reserved WKUPT 15 0 Reset Value 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 01Ch RTC_ALARMA MASK4 W...

Страница 408: ...Register RTC_TSH Address offset 0x00 Reset value 0x0000 0000 Bit field Name Description 31 23 Reserved Reserved the reset value must be maintained 22 APM AM PM format 0 AM format or 24 hour format 1 P...

Страница 409: ...0 Describes the date tens value in BCD format 3 0 DAU 3 0 Describes the date units value in BCD format 14 3 4 RTC Control Register RTC_CTRL Address offset 0x08 Reset value 0x0000 0000 Bit field Name...

Страница 410: ...tracts 1 hour to the current time 16 AD1H Add 1 hour summer time change When this bit is set 1 hour can be added to the calendar time This bit is always read as 0 No effect 1 Adds 1 hour to the curren...

Страница 411: ...when TSPOL is changed to avoid unwanted RTC_INITSTS TISF setting 2 0 WKUPSEL 2 0 Wakeup clock selection 000 RTC clock is divided by 16 001 RTC clock is divided by 8 010 RTC clock is divided by 4 011...

Страница 412: ...cleared by software writing 0 7 INITM Enter Initialization mode 0 Free running mode 1 Enter initialization mode and set calendar time value date value and prescale value 6 INITF Initialization flag R...

Страница 413: ...ardware when Alarm B values can be changed after the RTC_CTRL ALBEN bit has been set to 0 0 Alarm B update is not allowed 1 Alarm B update is allowed 0 ALAWF Alarm A write flag This flag is set to 1 b...

Страница 414: ...errupt otherwise the changed settings will not take effect immediately but will take effect after the next wakeup In particular when RTC_CTRL WKUPSEL 2 0 is set to 010 the modified setting does not ta...

Страница 415: ...seconds mask 0 Seconds match 1 Seconds not match 6 4 SET 2 0 Describes the second tens value in BCD format 3 0 SEU 3 0 Describes the second units value in BCD format 14 3 9 RTC Alarm B Register RTC_...

Страница 416: ...value in BCD format 7 MASK1 Alarm seconds mask 0 Seconds match 1 Seconds not match 6 4 SET 2 0 Describes the second tens value in BCD format 3 0 SEU 3 0 Describes the second units value in BCD format...

Страница 417: ...t 0x2C Reset value 0x0000 0000 Bit field Name Description 31 SUB1S Add one second 0 No impact 1 Subtract one second to the clock calendar This bit can only be written and read as zero Writing to this...

Страница 418: ...value in BCD format 11 8 MIU 3 0 Describes the minute units value in BCD format 7 Reserved Reserved the reset value must be maintained 6 4 SET 2 0 Describes the second tens value in BCD format 3 0 SEU...

Страница 419: ...d 15 0 SSE 15 0 Sub second value SSE 15 0 is the value in the synchronous prescaler counter The fraction of a second is provided by the formula below Second fraction RTC_PRE DIVS 14 0 SSE 15 0 RTC_PRE...

Страница 420: ...e number of mask pulse out of 220 RTCCLK pulses This effectively decreases the frequency of the calendar with a resolution of 0 9537 ppm 14 3 17 RTC Alarm A sub second register RTC_ ALRMASS Address of...

Страница 421: ...ison on sub seconds for Alarm The alarm is set when the seconds unit is incremented assuming that the rest of the fields match 0x1 Only SSV 0 is compared and other bits are not compared 0x2 Only SSV 1...

Страница 422: ...tech com Address Nations Tower 109 Baoshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Bit field Name Description 31 1 Reserved Reserved the reset value must be maintained 0 TYP...

Страница 423: ...ion unit can calculate the identifier of the software when the program is running then compare it with the reference identifier generated during connection and then store it in the specified memory sp...

Страница 424: ...orts back to back writes or sequential write read operations CRC_CRC32DAT can be re initialized to 0xFFFFFFFF by setting CRC_CRC32CTRL RESET This operation does not affect the data in register CRC_CRC...

Страница 425: ...AT 7 0 Reset Value 0 0 0 0 0 0 0 0 008h CRC32CTRL Reserved RESET Reset Value 0 00Ch CRC16CTRL Reserved CLR ENDHL Reserved Reset Value 0 0 0 010h CRC16DAT Reserved CRC16DAT 7 0 Reset Value 0 0 0 0 0 0...

Страница 426: ...te data CRC_CRC32CTRL RESET reset signal will not impact this register Note This register is not a part of CRC calculation and can be used to store any data 15 4 4 CRC32 control register CRC_CRC32CTRL...

Страница 427: ...late from MSB or LSB configured endian 0 From MSB to LSB 1 From LSB to MSB This bit is only for data to be verified 0 Reserved Reserved the reset value must be maintained Note 8 bits 16 bits and 32 bi...

Страница 428: ...bits 16 bits and 32 bits operations are supported 8 bit operations must be performed twice in a row to ensure that 16 bit initial values are configured properly 15 4 8 LRC result register CRC_LRC Add...

Страница 429: ...tions due to software failure The IWDG is best suited for applications that require the watchdog to run as a totally independent process outside the main application but have lower timing accuracy con...

Страница 430: ...atically start running after the system is powered on and will generate a system reset unless the software reloads the counter before it reaches 0 16 3 1 Register access protection IWDG_PREDIV and IWD...

Страница 431: ...0 this indicates program malfunction IWDG generates reset signal under this circumstance If user wants to configure IWDG pre scale and reload value register it needs to write 0x5555 to IWDG_KEY KEYV 1...

Страница 432: ...1x 6 4 26214 4 16 4 2 IWDG configuration flow Software flow 1 Write 0x5555 to IWDG_KEY KEYV 15 0 bits to enable write access of IWDG_PREDIV and IWDG_RELV registers 2 Check IWDG_STS PVU bit or IWDG_STS...

Страница 433: ...ed REL 11 0 Reset value 1 1 1 1 1 1 1 1 1 1 1 1 0x0C IWDG_STS Reserved CRVU PVU Reset value 0 0 16 5 2 IWDG key register IWDG_KEY Address offset 0x00 Reset value 0x00000000 Bit field Name Description...

Страница 434: ...0x5555 The IWDG_STS PVU bit must be 0 otherwise PD 2 0 value cannot be changed Divide number is as follow 000 divider 4 001 divider 8 010 divider 16 011 divider 32 100 divider 64 101 divider 128 Other...

Страница 435: ...eload value from the VDD voltage domain If a write operation is in progress the read back value may be invalid Therefore the read value is valid only when the IWDG_STS CRVU bit is 0 16 5 5 IWDG status...

Страница 436: ...wake up interrupt If the watchdog is started and the interrupt is enabled wake up interrupt WWDG_CFG EWINT will be generated when the count value reaches 0x40 Function description If the watchdog is a...

Страница 437: ...n analyze the cause of software failure or save important data in the corresponding interrupt service routine ISR and reload the counter to prevent WWDG from resetting Write 0 to the WWDG_STS EWINTF b...

Страница 438: ...L WWDG_STOP bit in debug module If this bit is set to 1 the counter stops The counter works normally when the bit is 0 See the chapter on debugging module for details 29 3 2 User interface 17 6 1 WWDG...

Страница 439: ...008h WWDG_STS Reserved EWINTF Reset Value 0 17 7 2 WWDG control register WWDG_CTRL Address offset 0x00 Reset value 0x0000007F Bit field Name Description 31 8 Reserved Reserved the reset value must be...

Страница 440: ...can be modified as follows 00 CK Counter Clock PCLK1 div 4096 div 1 01 CK Counter Clock PCLK1 div 4096 div 2 10 CK Counter Clock PCLK1 div 4096 div 4 11 CK Counter Clock PCLK1 div 4096 div 8 6 0 W 6...

Страница 441: ...with SD I O card specification version 2 0 there are two different data bus modes 1 bit default and 4 bit MMC Fully compatible with Multimedia Card System Specification Version 4 2 and earlier version...

Страница 442: ...l operation always consists of a command and response Additionally some operations have a data token There are other operations that include their information directly in the command or response struc...

Страница 443: ...esponse SDIO_CMD SDIO_DATA host to devise host to devise device to host command Data block CRC Data block CRC Data block CRC device to host The stop command stops data transfer Single block operation...

Страница 444: ...related functions of the MMC SD SD I O card AHB bus interface used to operate the FIFO unit of the register control data transmission in the SDIO adapter module and generate interrupt and DMA request...

Страница 445: ...ersions only supports 1 bit data line only SDIO_DAT0 can be used When an SD or SD I O card is connected to the bus SDIO_DAT0 or SDIO_DAT 3 0 can be used by the host to configure data transfers SDIO_CM...

Страница 446: ...CTRL PWRCFG bit to turn off SDIO_CLK when the bus is idle When SDIO_CLKCTRL CLKBYP bit is 0 SDIO_CLK is obtained by dividing the frequency of SDIOCLK when SDIO_CLKCTRL CLKBYP bit is 1 SDIO_CLK is dire...

Страница 447: ...the card through the SDIO_CMD line one bit of data per SDIO_CLK The 48 bit command contains 1 start bit 1 transmit bit 6 bit command index defined SDIO_CMDCTRL CMDIDX bits 32 bit parameters defined by...

Страница 448: ...n SDIO_CMD out Command Unit Idle Pend Wait Send CE ATA command received complete The signal or CPSM is turned off Or command CRC error Response received in CE ATA mode without interruption Wait to ena...

Страница 449: ...state the command timer starts to run if a response is received that is the start bit is detected the command state machine CPSM enters the Receive state and when the command state machine CPSM enters...

Страница 450: ...t SDIO_STS CMDRUN Command transfer in progress The CRC generator calculates the CRC checksum of all bits preceding the CRC code including start bits transmit bits command index and command parameters...

Страница 451: ...r begins after a write to the SDIO_DATCTRL register and setting the SDIO_DATCTRL DATEN bit to 1 When the SDIO_DATCTRL DATDIR bit is 0 the data is from the controller to the card and the DPSM enters th...

Страница 452: ...us flag Receive In this state the DPSM receives the card s data and writes it to the data FIFO Depending on the setting of the transfer mode bits in the data control register the data transfer mode ca...

Страница 453: ...the DPSM sends data to the card device and then enters the idle state If a FIFO underflow error occurs the DPSM sets the FIFO error flag and enters the idle state Busy In this state the DPSM waits for...

Страница 454: ...Table 18 4 Transmit FIFO Status Flags Flag Description SDIO_STS TFIFOF This flag is set high when all 32 transmit FIFO words have valid data SDIO_STS TFIFOE This flag is set high when all 32 transmit...

Страница 455: ...rease SDIO_CLK clock frequency 3 Send CMD7 command to select card and configure bus width 4 The configuration process of DMA1 is as follows a Enable DMA1 controller and clear all interrupt flags b Use...

Страница 456: ...is is because a card whose internal memory stores the Card Identification Number CID and Card Specific Data CSD can only transmit these information under the condition of data transfer VDD When the SD...

Страница 457: ...ard is not compatible it will be placed in an inactive state 4 The SDIO card host broadcasts a CMD2 command ALL_SEND_CID to all active cards All active cards simultaneously send their CID numbers seri...

Страница 458: ...ated data length is not aligned with the data block and block misalignment is not allowed parameter WRITE_BLK_MISALIGN for CSD is not set the card will detect block misalignment errors before the star...

Страница 459: ...ted in response to the stop transfer command If the host sends the stop transmission command the card has already transmitted the last data block in a certain number of multiple data block operations...

Страница 460: ...sfer is controlled by the READ_DAT_UNTIL_STOP CMD11 command This command requires the card to read data from the specified address until the SDIO card host sends a STOP_TRANSMISSION CMD12 command Due...

Страница 461: ...estart the erase operation waiting for the first step If a command other than SEND_STATUS and erase command is received the card should set ERASE_RESET in the status register reset the erase sequence...

Страница 462: ...s placed in the closed position of the small window the card is not write protected and the user can modify the content in the card There is also a switch on the corresponding part of the slot of the...

Страница 463: ...ck in which the command is sent must take into account the lengths of both the old and new passwords 3 On the data line send the CMD42 LOCK UNLOCK command with a suitable data block length and include...

Страница 464: ...simultaneously in the same sequence of operations In this case the card host module first sets the password according to the above steps It should be noted that the LOCK_UNLOCK bit should be set in t...

Страница 465: ...erform an erase operation on an already unlocked card will cause the operation to fail and set the LOCK_UNLOCK_FAILED error bit in the status register 18 4 11 Card status register Card status register...

Страница 466: ...ard unlocked 1 card locked When this bit is set it means the card has been locked A 24 LOCK_UNLOCK_FAILED EX 0 no error 1 error Wrong sequence of commands in lock unlock or wrong password detected C 2...

Страница 467: ...ommand results in a change of state this change will be reflected in the response of the next command These four bits are interpreted as decimal numbers 0 to 15 B 8 READY_FOR_DATA SR 0 no ready 1 read...

Страница 468: ...re applications The length of the SD state is a 512 bit data block After receiving the ACMD13 command CMD55 then CMD13 the content of the SD status register is transferred to the SDIO card host But it...

Страница 469: ...offset value to increase when erasing See below A 399 312 Reserved 311 0 Reserved for Manufacturer The abbreviations in the table for types and clearing condition fields are defined as follows Type E...

Страница 470: ...F_PROTECTED_AREA is in bytes SPEED_CLASS These 8 bits indicate the type of speed and a value that can be calculated by calculating PW 2 PW is the write performance Table 18 9 Speed Type Codes SPEED_CL...

Страница 471: ...be erased in one operation so that the host can display the progress of the erase operation If this field is 0 the timeout calculation for erasure is not supported Table 18 13 ERASE_SIZE Codes ERASE_...

Страница 472: ...interrupt request has been serviced by the MultiMediaCard SD module the interrupt status bits can be cleared by writing the appropriate bits to the SD I O card s internal registers through an I O wri...

Страница 473: ...dard interface which is suitable for a variety of application types while taking into account specific users and applications so two types of general commands are defined in the standard application r...

Страница 474: ...18 16 Write commands for block based transfers CMD Index Type Parameter Response Format Abbreviation Description CMD23 ac 31 16 0 15 0 Number of blocks R1 SET_BLOCK_COUNT Defines the number of blocks...

Страница 475: ...e write protect bit of the specified group CMD30 adtc 31 0 Write Protect Data Addresses R1 SEND_WRITE_PROT If the card is write protected this command requires the card to send the status of the write...

Страница 476: ...Index Type Parameter Response Format Abbreviation Description CMD42 adtc 31 0 Stuff bits R1b LOCK_UNLOCK Set clear password or lock unlock card The length of the data block is set by the SET_BLOCKLEN...

Страница 477: ...ards and SDIO Cards The CE ATA command is an extension of the MMC V4 2 command so it has the same format The command channel operates in half duplex mode so that commands and responses can be sent and...

Страница 478: ...protected except for the R3 response type Each command codeword has an end bit always 1 There are 5 response types and their formats are defined as follows R1 normal response command The code length...

Страница 479: ...finition of the level code is the limited voltage window is low and the card is busy Table 18 27 R3 response Bit Width Value Description 47 1 0 Start bit 46 1 0 Transmission bit 45 40 6 111111 Reserve...

Страница 480: ...ion Version 1 0 treats the detected CMD5 command as an illegal command and does not respond to it The host that can handle the I O card will send a CMD5 command and if the card returns a response R4 t...

Страница 481: ...ntrol function can avoid FIFO underflow transmit mode and overflow receive mode errors The operation process of hardware flow control is to stop SDIO_CLK and freeze the SDIO state machine When the FIF...

Страница 482: ...0 0 0 024h SDIO_DTIMER DATTIMEOUT 31 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 028h SDIO_DATLEN Reserved DATLEN 24 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

Страница 483: ...state the clock of the card is turned on Note This register cannot be written within 7 HCLK clock cycles after writing data 18 7 3 SDIO clock control register SDIO_CLKCTRL Address offset 0x04 Reset va...

Страница 484: ...he PWRCFG bit when the bus is idle 0 SDIO_CLK is always output 1 SDIO_CLK is only output when there is bus activity 8 CLOCKEN Clock enable bit 0 SDIO_CLK is off 1 SDIO_CLK is enabled 7 1 DIV Clock div...

Страница 485: ...Bit Field Name Description 31 15 Reserved Reserved the reset value must be maintained 14 CEATAEN CE ATA command If this bit is set CPSM will transmit CMD61 13 INTDIS Not interrupt enable If this bit i...

Страница 486: ...SD I O cards can only send short responses the parameters can be changed according to the type of response and the software will distinguish the type of response according to the command sent CE ATA...

Страница 487: ...d Card Status 31 1 The highest bit of the card status is always received first and the lowest bit of the SDIO_RESPONSE3 register is always 0 18 7 8 SDIO data timer register SDIO_DTIMER Address offset...

Страница 488: ...the value in the data length register must be a multiple of the data block length see SDIO_DATCTRL Before writing to the data control register for data transfer the data timer register and data length...

Страница 489: ...lock length 27 128 bytes 1000 block length 28 256 bytes 1001 block length 29 512 bytes 1010 block length 210 1024 bytes 1011 block length 211 2048 bytes 1100 block length 212 4096 bytes 1101 block len...

Страница 490: ...rved the reset value must be maintained 24 0 DATCOUNT Data count value When reading this register it returns the number of data bytes to be transmitted Writing this register has no effect Note This re...

Страница 491: ...ast 8 more words can be written to the FIFO 13 RXRUN Data receive in progress 12 TXRUN Data transmit in progress 11 CMDRUN Command transfer in progress 10 DATBLKEND Data block sent received CRC check...

Страница 492: ...lag 7 CMDSENDC CMDSEND flag clear bit Software sets this bit to clear the SDIO_STS CMDSEND flag 6 CMDRESPRECVC CMDRESPRECV flag clear bit Software sets this bit to clear the SDIO_STS CMDRESPRECV flag...

Страница 493: ...eiving FIFO is valid to generate an interrupt 20 TDATVALIDEN Data available in Rx FIFO interrupt enable Setting clearing this bit by software to enable disable the data valid interrupt in the transmit...

Страница 494: ...tting command without interrupt 1 Interrupt when command is being transmitted 10 DATBLKENDEN Data block end interrupt enable Setting clearing this bit by software enables disables the end of block tra...

Страница 495: ...REN Data CRC fail interrupt enable Setting clearing this bit by software to enable disable the interrupt for block CRC detection failure 0 Data block CRC detection failure does not generate an interru...

Страница 496: ...FO Address offset 0x80 Reset value 0x0000 0000 The receive and transmit FIFO is a 32 bit wide read or write set of registers it contains 32 registers on consecutive 32 addresses the CPU can use the FI...

Страница 497: ...features Comply with USB2 0 full speed device specification Supports up to 8 configurable USB endpoints Each endpoint supports four transfer types in the USB2 0 protocol Control transfer Bulk transfer...

Страница 498: ...used and the endpoint packet buffer size of each endpoint Each endpoint has a buffer description table entry which describes the buffer address size and the number of bytes that need to be transferred...

Страница 499: ...ich the user application program on the microcontroller and the USB module accesses the Packet Buffer Memory Figure 19 2 The user applications on the microcontrollers and the USB modules access Packet...

Страница 500: ...C host and the USB device the use of bulk transmission allows the PC host to transmit data with maximum efficiency within one frame However when the transmission speed is too fast the USB device will...

Страница 501: ...ster As shown in Figure 19 3 when an endpoint uses the double buffer mechanism all four buffer description table entries of the endpoint will be used DATTOG and SW_BUF are responsible for flow control...

Страница 502: ...bus is completed the hardware will toggle DATTOG 0 If the application has not finished processing the data in buffer0 corresponding to ADDR3_RX_0 CNT3_RX_0 the software will not toggle SW_BUF SW_BUF 0...

Страница 503: ...The process of one time receiving or sending data on the USB is called a transaction and there are three types of transactions Setup transaction Data IN transaction and Data OUT transaction Applicatio...

Страница 504: ...he endpoint s sending state to NAK state USB_EPn STS_TX 10 and the hardware sets USB_EPn CTRS_TX bit to generate a correct sending interrupt The software responds to the CTRS_TX interrupt identifies w...

Страница 505: ...ket is invalid the USB device sends a PID NAK or STALL handshake packet according to USB_EPn STS_RX Note 1 When the USB device receives data from the host if the size of the received data exceeds the...

Страница 506: ...ectly before enabling the Status stage in the OUT direction in addition to setting the Rx direction status of the USB device endpoint to VALID you also need to set STATUS_OUT USB_EPn EP_KIND to 1 indi...

Страница 507: ...point is defined as a isochronous endpoint during enumeration the USB host will allocate the required bandwidth for the endpoint in OUT 1 DATA1 SETUP 0 DATA0 Tx STALL Rx VALID USB bus Tx NAK Rx NAK Tx...

Страница 508: ...CNTn_RX_1 1 ADDRn_RX_1 CNTn_RX_1 ADDRn_RX_0 CNTn_RX_0 The application initializes the DATTOG bits based on the buffer to be used the first time Each time the transfer is completed USB_EPn CTRS_RX or...

Страница 509: ...ated endpoint packet buffer Suspend and resume events 19 4 5 2 1 Suspend events When full speed USB is communicating normally the host will send a PID SOF token packet every millisecond If the USB mod...

Страница 510: ...resume event from USB suspend mode 19 4 6 Endpoint initialization 1 Initialize the USB_ADDRn_TX or USB_ADDRn_RX register configure the endpoint Tx or Rx packet buffer start address 2 According to the...

Страница 511: ...S_TX 1 0 EPADDR 3 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 010h USB_EP4 Reserved CTRS_RX DATTOG_RX STS_RX 1 0 SETUP EP_TYPE 1 0 EP_KIND CTRS_TX DATTOG_TX STS_TX 1 0 EPADDR 3 0 Reset Value 0 0 0 0...

Страница 512: ...e generated Note 1 Software can read and write this bit but only writing 0 is valid and writing 1 is invalid 14 DATTOG_RX Receive data PID toggle bit If the endpoint is not isochronous this bit repres...

Страница 513: ...ULK bulk endpoint 01 CONTROL control endpoint 10 ISO isochronous endpoint 11 INTERRUPT interrupt endpoint 8 EP_KIND Endpoint special type EP_TYPE 1 0 EP_KIND meaning 00 BULK DBL_BUF double buffered en...

Страница 514: ...int after the transaction is successfully completed 3 0 EPADDR 3 0 Endpoint address This bit indicates the destination endpoint of the communication and must be written before enabling the correspondi...

Страница 515: ...B_STS ERROR 1 an interrupt will be generated 12 WKUPM Wake up interrupt enable 0 Disable wake up interrupt 1 Enable wake up interrupt when USB_STS WKUP 1 an interrupt will be generated 11 SUSPDM Suspe...

Страница 516: ...set USB_CTRL FSUSPD and then set USB_CTRL LP_MODE 2 LP_MODE Low power mode 0 No effect 1 Enter low power mode in suspend mode Activity on the USB bus wake event resets this bit software can also reset...

Страница 517: ...g errors occur 1 No response the host response timed out 2 CRC error CRC check error in data or token packet 3 Bit stuffing error bit stuffing error detected in PID data or CRC 4 Frame format error no...

Страница 518: ...s bit but only writing 0 is valid and writing 1 is invalid 2 When the USB module does not receive the PID SOF token packet for 3ms in a row that is 3 ESOF interrupts occur in a row and a SUSPD interru...

Страница 519: ...and can detect the occurrence of a resume condition in the suspend state 13 LOCK Lock USB This bit is set by hardware if at least 2 PID SOF token packets are detected continuously after the end of an...

Страница 520: ...0x50 Reset value 0x0000 0000 Bit Field Name Description 31 16 Reserved Reserved the reset value must be maintained 15 3 BUFTAB 12 0 Buffer table This bit holds the starting address of the buffer descr...

Страница 521: ...eived 0 Since packet buffer memory addresses are word 32 bit aligned this bit must be 0 19 6 2 Send data byte number register n USB_CNTn_TX Address offset USB_ BUFTAB n 16 4 USB local address USB_ BUF...

Страница 522: ...The memory block size is 2 bytes 1 The memory block size is 32 bytes 14 10 NUM_BLK 4 0 Number of memory blocks Records the number of memory blocks allocated to the endpoint packet receive buffer and...

Страница 523: ...0 BLSIZE 1 00011 6 bytes 128 bytes 01111 30 bytes 512 bytes 10000 32 bytes Reserved 10001 34 bytes Reserved 10010 36 bytes Reserved 11110 60 bytes Reserved 11111 62 bytes Reserved Note 1 The size of t...

Страница 524: ...upt control CAN Core Manages the communication between the CAN and the 512 bytes SRAM memory see Figure 20 3 Dual CAN CAN1 and CAN2 each with 512 bytes of SRAM Note USB and CAN1 share a single 512 byt...

Страница 525: ...n this CAN controller receive FIFOs and filter mechanism are added as hardware support for CPU message processing and reduce real time response requirement of CAN message Figure 20 1 Topology of CAN n...

Страница 526: ...initialization mode the register configuration will not be affected When CAN is in initialization mode message receiving and sending are prohibited and the CANTX pin outputs a recessive bit high leve...

Страница 527: ...CAN_MSTS SLPAK bit in response to a sleep or initialization request 20 3 3 Send mailbox Applications can send messages through three sending mailboxes The order of sending three mailbox messages is de...

Страница 528: ...tance Filter CAN1 Transmit Mailbox 0 CAN1 Transmit Mailbox 1 CAN1 Transmit Mailbox 2 CAN1 Receive FIFO0 Mailbox 1 Mailbox 2 Mailbox 0 CAN1 Receive FIFO1 Mailbox 1 Mailbox 2 Mailbox 0 CAN1 with 512 byt...

Страница 529: ...oid external influence the CAN kernel ignores the acknowledgement error at the moment of acknowledgement bit of data remote frame it does not detect whether there is an dominant bit To enter loopback...

Страница 530: ...CANRX pin is disconnected from the CAN bus while the CANTX pin is driven to the recessive bit state It can be used for Run time self diagnose just like CAN can be tested in loop back mode but not affe...

Страница 531: ...ority Changing to the Ready status once the mailbox becomes the highest priority mailbox The messages in the ready mailbox is sent as soon as the CAN bus enters the idle state then enter the sending s...

Страница 532: ...red communication mode The internal timer of CAN is activated in time triggered communication mode It is incremented at each CAN bit time see 20 4 7 Section CAN samples the value of the internal timer...

Страница 533: ...e in the FIFO FIFO is completely managed by hardware which can simplify the application program ensure the consistency of data and reduce the processing time of CPU Valid message According to CAN prot...

Страница 534: ...way the latest received message will not be discarded If the FIFO lock function is enabled set the CAN_MCTRL RFLM bit then the newly received messages will be discarded and the software can read the f...

Страница 535: ...s to meet this demand These filter banks are used to receive only those messages needed by software Each filter bank x contains two 32 bit registers namely CAN_FxR0 and CAN_FxR1 Setting of filter bit...

Страница 536: ...red Identifier list mode 32 bit Mask Mode CAN_FS1 FSCx 1 CAN_FM1 FBx 0 FBC 31 21 FBC 20 3 STDID 10 0 EXTID 28 18 EXTID 17 0 IDE RTR 0 filter ID filter Mask USER ID FBC2 FBC1 FBC0 FBC 31 21 FBC2 FBC2 F...

Страница 537: ...register This filter matching index can help to identify which types of message it is in this receive FIFO The filter matching sequence number can be used two ways The first one is comparing the filt...

Страница 538: ...ilter rules of CAN When receiving a message its identifier is first compared with the filter configured in identifier list mode If there is a match the message will be stored in the associated FIFO an...

Страница 539: ...ge To avoid programming errors in software setting the bit time characteristic register CAN_BTIM can only be done when CAN is initialized Its operation can be simply understood as dividing each nomina...

Страница 540: ...bit when CAN itself does not send the recessive bit Note 1 The time characteristics and resynchronization mechanism of CAN bits are detailed in the ISO11898 standard 2 In order to improve the CAN bit...

Страница 541: ...Data Field 8 Nbit CRC Field 16bit 2bit 7bit Inter Frame Space Inter Frame Space or Overload Frame ID 28 18 DLC CRC EOF ID 17 0 SOF RTR r1 r0 ACK SRR IDE Arbitration Field 32bit Ctrl Field 6bit Data N...

Страница 542: ..._RFF0 FFMP0 bit is not 00 When FIFO0 becomes full and the CAN_ RFF0 FFULL0 bit is set When FIFO0 overruns and the CAN_ RFF0 FFOVR0 bit is set FIFO1 interrupt CAN_RX1_IRQn FIFO1 receive a new message a...

Страница 543: ...tus What s more by setting the CAN_INTE register such as CAN_INTE LECITE bit the software can flexibly control the generation of interrupts when an error is detected 20 5 2 Bus Off recovery When TXEC...

Страница 544: ...fly but its advised not to do so Otherwise during few cycles CAN behavior will become unpredictable 8 Exit Initialization mode by clearing CAN_MCTRL INIRQ bit 9 Wait for CAN_MSTS INIAK bit become 0 ex...

Страница 545: ...trol and status registers By configuring these registers user can configure CAN parameters such as working mode and baud rate start message sending handling message reception interrupt setting read di...

Страница 546: ...Reserved RFFOM1 FFOVR1 FFULL1 Reserved FFMP1 1 0 Reset Value 0 0 0 0 0 014h CAN_INTE Reserved SLKITE WKUITE ERRITE Reserved LECITE BOFITE EPVITE EWGITE Reserved FOVITE1 FFITE1 FMPITE1 FOVITE0 FFITE0...

Страница 547: ...x 1A8h CAN_TMDL2 DATA3 7 0 DATA2 7 0 DATA1 7 0 DATA0 7 0 Reset Value x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 1ACh CAN_TMDH2 DATA7 7 0 DATA6 7 0 DATA5 7 0 DATA4 7 0 Reset Value...

Страница 548: ...0 0 0 0 0 0 0 0 0 0 0 0 0 208h Reserved 20Ch CAN_FS1 Reserved FSC 13 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 210h Reserved 214h CAN_FFA1 Reserved FAF 13 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 218...

Страница 549: ...shan District Shenzhen 518057 P R China Offset Register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 2A8h CAN_F13B1 FBC 31 0 Reset Value x x x x x x x x x x x...

Страница 550: ...eset CAN after which CAN enters sleep mode and CAN_RFFx FFMP bit and CAN_MCTRL register are initialized to their reset values After that the hardware automatically clears this bit 14 8 Reserved Reserv...

Страница 551: ...the next received message will be discarded 2 TXFP Transmit FIFO priority When there are multiple messages waiting to be sent at the same time this bit determines the sending order of these messages...

Страница 552: ...n CAN_INTE SLKITE 1 once CAN enters sleep mode hardware will set this bit and then the corresponding interrupt will be triggered When this bit is set if the CAN_INTE SLKITE bit is set a state change i...

Страница 553: ...is bit is the confirmation of the software request to enter the initialization mode the CAN_MCTRL INIRQ bit is set Hardware clears this bit when CAN exits initialization mode CAN leaves Initialization...

Страница 554: ...ls to send due to the loss of arbitration set this bit 17 TXOKM2 Transmission OK of mailbox 2 The hardware updates this bit after each sending attempt of mailbox 2 0 The last sending attempt is not ye...

Страница 555: ...s this bit when the sending message of mailbox 0 is idle If there is no message waiting to be sent in mailbox 0 it will have no effect to set this bit 6 4 Reserved Reserved the reset value must be mai...

Страница 556: ...en FIFO 0 is full a new message is received and the message meets the filtering conditions the hardware sets this bit This bit is cleared by software 3 FFULL0 FIFO 0 full When there are 3 messages in...

Страница 557: ...reset value must be maintained 1 0 FFMP1 1 0 FIFO 1 message pending Number of messages in FIFO 1 These two bits reflect the number of messages stored in the current receiving FIFO 1 Every time a new m...

Страница 558: ...1 overflow interrupt enable 0 When CAN_RFF1 FFOVR bit is set no interrupt is generated 1 When CAN_RFF1 FFOVR bit is set an interrupt is generated 5 FFITE1 FIFO 1 full interrupt enable 0 When CAN_RFF1...

Страница 559: ...Reserved Reserved the reset value must be maintained 6 4 LEC 2 0 The Last error code When an error is detected on the CAN bus the hardware is set according to the error situation When the message is...

Страница 560: ...de is prohibited 1 Loopback mode is allowed 29 26 Reserved Reserved the reset value must be maintained 25 24 RSJW 1 0 Resynchronization jump width For resynchronization this bit field defines the uppe...

Страница 561: ...it Field Name Description 31 21 STDID 10 0 EXTID 28 18 Standard identifier or extended identifier Depending on the content of CAN_TMIx IDE bits these bits are either standard identifiers or high bytes...

Страница 562: ...stamp CAN_TMDTx MTIM 15 0 is the last two bytes sent CAN_TMDTx MTIM 7 0 is the seventh byte and CAN_TMDTx MTIM 15 8 is the eighth byte They replace the data written in CAN_TMDHx 31 16 CAN_TMDLx DATA6...

Страница 563: ...he mailbox is not empty all bits in this register are write protected Address offset 0x18c 0x19c 0x1ac Reset value undefined Bit Field Name Description 31 24 DATA7 7 0 Data byte 7 Data byte 7 of the m...

Страница 564: ...eserved Reserved the reset value must be maintained Receive FIFO mailbox data length and time stamp register CAN_RMDTx x 0 1 Address offset 0x1B4 0x1C4 Reset value undefined Notes All receiving mailbo...

Страница 565: ...DATA1 7 0 Data byte 1 Data byte 1 of the message 7 0 DATA0 7 0 Data byte 0 Data byte 0 of the message Notes the message contains 0 to 8 bytes of data starting from byte 0 Receive FIFO mailbox high byt...

Страница 566: ...Filter init mode Initialization mode settings for all filter groups 0 The filter group works in normal mode 1 The filter group works in initialization mode CAN filter mode register CAN_FM1 Address off...

Страница 567: ...x 13 0 0 The filter bit width is 2 16 bits 1 The filter bit width is a single 32 bit CAN filter FIFO assignment register CAN_FFA1 Address offset 0x214 Reset value 0x0000 0000 Notes You can only write...

Страница 568: ...wo 32 bit registers CAN_FiR 2 1 Only when the corresponding CAN_FA1 FACx bit is cleared or the CAN_FMC FINIT bit is set the corresponding filter register can be modified Bit Field Name Description 31...

Страница 569: ...shan District Shenzhen 518057 P R China bank are different For the mapping of filters function description and association of mask registers see 20 4 5 Section identifier filtering Mask identifier reg...

Страница 570: ...nment standard and PCM standard Both of them are synchronous serial interface communication protocols Main features 21 2 1 SPI features Full duplex mode and simplex synchronous mode Support master mod...

Страница 571: ...ave input pin Data is send by the MOSI pin of master device and received from the MOSI pin of slave device NSS chip select pin There are two types of NSS pin internal pin and external pin If the inter...

Страница 572: ...el and the slave should connect NSS pin to the low level during the entire data frame transfer NSS output mode NSS output of the master device is enable SPI_CTRL1 MSEL 1 SPI_CTRL2 SSOEN 1 SPI as the m...

Страница 573: ...apture by setting SPI_CTRL1 CLKPOL bit and SPI_CTRL1 CLKPHA bit When CLKPOL 0 CLKPHA 0 the SCLK pin will keep low in idle state and the data will be sampled at the first edge which is rising edge When...

Страница 574: ...er the first data is written to the SPI_DAT register the transmission will start When the first bit of the data is sent the data bytes are loaded from the data register into the shift register in para...

Страница 575: ...PI_STS TE flag Figure 21 5 Schematic diagram of the change of TE RNE BUSY when the host is continuously transmitting in full duplex mode Master two wire one way send only mode SPI_CTRL1 MSEL 1 SPI_CTR...

Страница 576: ...as follows Enable the receive only mode SPI_CTRL1 RONLY 1 Enable SPI module set SPI_CTRL1 SPIEN 1 in master mode SCLK clock signal is generated immediately and serial data is continuously received be...

Страница 577: ...TRL1 BIDIRMODE 1 SPI_CTRL1 BIDIROEN 0 SPI_CTRL1 RONLY 0 When SPI_CTRL1 SPIEN 1 the receiving process starts There is no data output in this mode the received data bits are sequentially and serially sh...

Страница 578: ...llel b0 b2 b1 b3 b4 b6 b5 b0 b7 b1 b2 b3 b5 b4 b6 b7 b1 b0 b3 b2 b4 b5 b7 b6 DATA1 0x11 DATA2 0x22 DATA3 0x33 b0 b2 b1 b3 b4 b6 b5 b0 b7 b1 b2 b3 b5 b4 b6 b7 b1 b0 b3 b2 b4 b5 b7 b6 DATA1 0xAA DATA2 0...

Страница 579: ...LSBFF bit to define the frame format 5 Configure the NSS mode as described above for the NSS function 6 Run mode is configured by SPI_CTRL1 MSEL bit SPI_CTRL1 BIDIRMODE bit SPI_CTRL1 BIDIROEN bit and...

Страница 580: ...lag SPI_STS BUSY is always high In slave mode the continuity of communication is determined by the SPI master device However even if the communication is continuous the BUSY flag SPI_STS BUSY will be...

Страница 581: ...4 Disabling the SPI In order to turn off the SPI module different operation modes require different operation steps Master or slave full duplex mode 1 Wait for the RNE flag SPI_STS RNE to be set to 1...

Страница 582: ...the SPI needs to be enabled SPI_CTRL2 TDMAEN 1 When the SPI is only used for receiving data only the receive DMA channel of the SPI needs to be enabled SPI_CTRL2 RDMAEN 1 In send mode after DMA has s...

Страница 583: ...o 1 an interrupt will be generated In order to keep the synchronization of the next CRC calculation result of the master slave device the user should clear the CRC value of the master slave device Set...

Страница 584: ...SPI_STS MODERR bit may be set to 1 In this case the SPI_STS MODERR bit indicates that there is a multi master collision The interrupt routine can perform a reset or return to the default state to rec...

Страница 585: ...is sent SD Serial data shared with MOSI pin used for data send and receive WS Channel selection shared with NSS pin used as data control signal output in master mode and used as input in slave mode M...

Страница 586: ...be transmitted and set the data bit width of the channel by setting the SPI_I2SCFG CHBITS bits There are 4 data formats for sending data as follows 16 bit data is packed into 16 bit data frame 16 bit...

Страница 587: ...mission For example if the user sends 24 bit data 0x95AA66 the CPU will first write 0x95AA into the SPI_DAT register and then write 0x66XX into the SPI_DAT register only the upper 8 bit data is valid...

Страница 588: ...rresponding interrupt The sending is performed by hardware even if the last 16 bits 0x0000 are not sent the hardware will set the TE SPI_STS TE bit to 1 and the corresponding interrupt will be generat...

Страница 589: ...l precision CLKPOL 0 Figure 21 18 MSB aligns 24 bit data CLKPOL 0 Figure 21 19 MSB aligned 16 bit data is extended to 32 bit packet frame CLKPOL 0 CLK WS SD Left channel 16 bit or 32 bit Right Channel...

Страница 590: ...d or write the SPI_DAT register twice during each frame of data transmission For example if the user sends 24 bit data 0x95AA66 the CPU will first write 0xXX95 only the lower 8 bit data is valid the u...

Страница 591: ...SPI_DAT register first once the valid data starts to be send the next TE SPI_STS TE event will be generated In the process of receiving data once the device receives valid data the RNE SPI_STS RNE ev...

Страница 592: ...na Figure 21 23 PCM standard waveform 16 bits Figure 21 24 PCM standard waveform 16 bit extended to 32 bit packet frame 21 4 2 Clock generator In the master mode the linear divider needs to be set cor...

Страница 593: ...gure 21 26 Audio sampling frequency definition The sampling signal frequency of the audio can be set by setting the SPI_I2SPREDIV ODD_EVEN bit and the SPI_I2SPREDIV LDIV 7 0 bits Audio can be sampled...

Страница 594: ...71 0 45 0 45 21 4 3 I2 S Transmission and reception sequence I2S initialization sequence 1 The user can set the SPI_I2SPREDIV LDIV 7 0 bits and SPI_I2SPREDIV ODD_EVEN bit to configure the related pres...

Страница 595: ...vice is enabled and the data has been written to the I2S data register the external master device can start communication When the first clock edge representing the next data transfer arrives the new...

Страница 596: ...CFG I2SEN 0 Slave mode The receiving process of the slave mode is similar to that of the master mode with the following differences The CHSIDE flag SPI_STS CHSIDE indicates which channel corresponds t...

Страница 597: ...register has 2 error flag bits Overflow flag OVER When the RNE flag SPI_STS RNE is set to 1 but there is still data sent to the receive buffer an overflow error will occur At this time the OVER flag S...

Страница 598: ...USY OVER MODERR CRCERR UNDER CHSIDE TE RNE Reset Value 0 0 0 0 0 0 1 0 00Ch SPI_DAT Reserved DAT 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 010h SPI_CRCPOLY Reserved CRCPOLY 15 0 Reset Value 0 0...

Страница 599: ...s bit should be set immediately after the last data is written in SPI_DAT register Note Not used in I2 S mode 11 DATFF Data frame format 0 8 bit data frame format is used for sending receiving 1 16 bi...

Страница 600: ...e When turning off the SPI device please follow paragraph 21 3 4 Section s procedure operation 5 3 BR 2 0 Baud rate control 000 fPCLK 2 001 fPCLK 4 010 fPCLK 8 011 fPCLK 16 100 fPCLK 32 101 fPCLK 64 1...

Страница 601: ...error SPI_STS CRCERR SPI_STS OVER SPI_STS UNDER SPI_STS MODERR is generated this bit controls whether an interrupt is generated 0 Disable error interrupt 1 Enable error interrupt 4 3 Reserved Reserve...

Страница 602: ...and cleared according to the sequence of software operations For more information about software sequences refer to 21 3 7 for details Note Not used in I2 S mode 4 CRCERR CRC error flag 0 The received...

Страница 603: ...ta sending and receiving can be 8 bit or 16 bit To ensure correct operation the data frame format needs to be determined before enabling the SPI For 8 bit data the buffer is 8 bit and only SPI_DAT 7 0...

Страница 604: ...ing this register when the BUSY flag SPI_STS BUSY is 1 may read incorrect values Note not used in I2 s mode 21 5 8 SPI TX CRC register SPI_CRCTDAT Address offset 0x18 Reset value 0x0000 Bit field Name...

Страница 605: ...M frame synchronization 0 Short frame synchronization 1 Long frame synchronization Note This bit is only meaningful when SPI_I2SCFG STDSEL 11 used by the PCM standard Note not used in SPI mode 6 Reser...

Страница 606: ...ister SPI_I2SPREDIV Address 0x20 Reset value 0x0002 Bit field Name Description 15 10 Reserved Reserved the reset value must be maintained 9 MCLKOEN Master clock output enable 0 Disable master clock ou...

Страница 607: ...ter Supports 7 bit 10 bit address mode and broadcast addressing As I2C master it can generate clock start and stop signal As I2C slave it supports address detection stop bit detection function Support...

Страница 608: ...BSF 1 the I2C interface keeps the clock line low after receiving the data byte waiting for the software to read STS1 and then read the data register buffer and shift register are full If clock extend...

Страница 609: ...stop bit The start and stop conditions are generated by software in the master mode Start bit is a level conversion from high to low on SDA line when SCL is high Stop bit is a level transition from l...

Страница 610: ...clock is still in the low period the low to high switch of this clock will not change the state of the SCL line Therefore the SCL line is kept low by the device with the longest low level period A dev...

Страница 611: ...I2C_STS2 TRF indicates whether it is currently in receiver mode or transmission mode When sending data to I2C bus in transmission mode the software should follow the following steps 1 First enable I2C...

Страница 612: ...ster is empty write DAT 3 EV3 I2C_STS1 TXDATE 1 shift register is not empty data register is empty write DAT will clear the event 4 EV3 2 I2C_STS1 ACKFAIL 1 ACKFAIL bit of STS1 register write 0 to cle...

Страница 613: ...detects the STOP bit on I2C bus set I2C_STS1 STOPF to 1 and if the I2C_CTRL2 EVTINTEN bit is set an interrupt will be generated The software clears the I2C_STS1 STOPF bit by reading the I2C_STS1 regis...

Страница 614: ...header byte 11110xx0 and then sends the lower 8 bits of the slave address where xx represents the highest 2 bits of the 10 bit address In the 7 bit address mode only one address byte needs to be sent...

Страница 615: ...DAT register will clear the event 5 EV8_2 I2C_STS1 TXDATE 1 I2C_STS1 BSF 1 request to set stop bit These two events are cleared by the hardware when a stop condition is generated 6 EV9 I2C_STS1 ADDR1...

Страница 616: ...is set to 1 by hardware and if the I2C_CTRL2 EVTINTEN bit is set to 1 an interrupt will be generated Then the master device waits to read the STS1 register once and then reads the STS2 register Note I...

Страница 617: ...Instructions 1 EV5 I2C_STS1 STARTBF 1 reading STS1 and then writing the address into the DAT register will clear this event 2 EV6 I2C_STS1 ADDRF 1 reading STS1 and STS2 in sequence will clear this ev...

Страница 618: ...ned by software whether suspend I2C device as slave when data is discarded in transmission and the bus releases by hardware it will have two situation If an error start condition is detected the slave...

Страница 619: ...in the interrupt handler after the DMA transfer is completed if interrupt enable Note When I2C and other peripherals use the same DMA controller they cannot be turned on at the same time Transmit pro...

Страница 620: ...can improve the reliability of communication The CRC 8 polynomial uses by the PEC calculator is C x x8 x2 x 1 In transmit mode software sets I2C_CTRL1 PEC transfer bit in the last I2C_STS1 TXDATE even...

Страница 621: ...rities between SMBus and I2C Both bus protocols contain of 2 wires a clock wire SCL and a data wire SDA with an optional SMBus alert wire The data format is similar SMBus data format is similar to 7 b...

Страница 622: ...device This is the reason why SMBus has a minimum transmission rate limitation to prevent the bus from locking up for a long time after the timeout occurs I2C bus is essentially a DC bus that is to s...

Страница 623: ...RL1 SMBTYPE 1 use the SMB master header field 2 In order to support ARP I2C_CTRL1 ARPEN 1 in SMBus host mode I2C_CTRL1 SMBTYPE 1 software needs to respond to the I2C_STS2 SMBHADDR bit in SMBus slave m...

Страница 624: ...h I2C_CTRL1 Reserved SWRESET Reserved SMBALERT PEC ACKPOS ACKEN STOPGEN STARTGEN NOEXTEND GCEN PECEN ARPEN SMBTYPE Reserved SMBMODE EN Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 004h I2C_CTRL2 Reserved D...

Страница 625: ...software It will be cleared by hardware when PEC has been transferred or by start or stop condition or when I2C_CTRL1 EN 0 0 No PEC transfer 1 PEC transfer Note When arbitration is lost the calculati...

Страница 626: ...RL1 until this bit is cleared by hardware Otherwise the STOPGEN STARTGEN or PEC bits may be set twice 8 STARTGEN Start generation It can be set or cleared by software Or it will be cleared by hardware...

Страница 627: ...eset value must be maintained 12 DMALAST DMA last transfer 0 Next DMA EOT is not the last transfer 1 Next DMA EOT is the last transfer Note This bit is used in the master receiving mode so that a NACK...

Страница 628: ...ned 5 0 CLKFREQ 5 0 I2C Peripheral clock frequency CLKFREQ 5 0 should be the APB clock frequency to generate the correct timming 000000 Disable 000001 Disable 000010 2MHz 000011 3MHz 100100 36MHz 1001...

Страница 629: ...g mode enable 0 Disable dual address mode only OADDR1 is recognized 1 Enable dual address mode both OADDR1 and OADDR2 are recognized Note Valid only for 7 bit address mode 22 6 6 I2C Data register I2C...

Страница 630: ...ve mode slave device resets the communication and hardware frees the bus Timeout in master mode hardware sends the stop condition 13 Reserved Reserved the reset value must be maintained 12 PECERR PEC...

Страница 631: ...cleared by hardware when I2C_CTRL1 EN 0 0 Data register is not empty 1 Data register is empty When sending data this bit is set to 1 when the data register is empty and it is not set at the address se...

Страница 632: ...the data register has not been read I2C_STS1 RXDATNE 1 In sending mode when a new data is to be transmitted and the data register has not been written with the new data I2C_STS1 TXDATE 1 Note After re...

Страница 633: ...en I2C_CTRL1 EN 0 0 SMBus host address was not received 1 when I2C_CTRL1 SMBTYPE 1 and I2C_CTRL1 ARPEN 1 SMBus host address is received 5 SMBDADDR SMBus device default address Slave mode Hardware clea...

Страница 634: ...In slave mode 1 In master mode When the interface is in the master mode I2C_STS1 STARTBF 1 the hardware sets this bit 22 6 9 I2C Clock control register I2C_CLKCTRL Address offset 0x1c Reset value 0x00...

Страница 635: ...e the definitions of these parameters in the data sheet for details 4 These delays have no filters 22 6 10 I2C Rise time register I2C_TMRISE Address offset 0x20 Reset value 0x0002 Note The I2C_TMRISE...

Страница 636: ...on Baud rate generator the highest baud rate can reach 4 5Mbit s Support serial data frame structure with 8 or 9 data bits 1 or 2 stop bits Generation and checking of supported parity bits Support har...

Страница 637: ...ter is active and not sending data the TX pin is pulled high When the transmitter is inactive the TX pin reverts to the I O port configuration RX is an input pin for serial data reception data is reco...

Страница 638: ...quired The CK pin is used for clock output for synchronous transfers Clock phase and polarity are software programmable During the start and stop bits the CK pin does not output clock pulses The CK pi...

Страница 639: ...o the configuration of the data bit length with the least significant bit first If USART_CTRL1 TXEN is reset during a data transfer it will cause the baud rate counter to stop counting and the data be...

Страница 640: ...nsmitter process 1 Enable USART_CTRL1 UEN to activate USART 2 Configure the transmitter s baud rate data bit length parity bit optional the number of stop bits or DMA configuration 3 Activate the tran...

Страница 641: ...ift register is sending data the data is stored in the TDR register and after the current transmission is completed the data is put into the shift register When a frame containing data is sent and USA...

Страница 642: ...four requirements the USART receiver thinks that it has not received the correct start bit and will exit the start bit detection and Return to idle state and wait for falling edge Figure 23 6 Start b...

Страница 643: ...irst shifted from the RX pin into the receive shift register 5 When the data of the received shift register is moved to the RDR register USART_STS RXDNE is set and the data can be read out If USART_CT...

Страница 644: ...irst then write USART_DAT register During single byte communication no noise interrupt generated because it occurs with USART_STS RXDNE and the hardware will generate an interrupt when the USART_STS R...

Страница 645: ...8 then DIV_Decimal 16 0 98 15 68 Nearest integer DIV_Decimal 16 0x10 out of configurable range so a carry to integer is required So DIV_Integer 20 1 21 0x15 DIV_Decimal 0x0 So USART_BRCF 0x150 Example...

Страница 646: ...ansceiver and the high to low transition timing of the transceiver these factors will affect the overall clock system variation Only when the sum of the above four changes is less than the tolerance o...

Страница 647: ...e receiver calculates the number of 1s in the data again If it is an odd number the check is passed indicating that no errors occurred during the transmission process If it is not an odd number it mea...

Страница 648: ...dress will be the source address of the data transfer 2 Set the address of the data memory When a data transfer request occurs the transferred data will be written to this address 3 Set the amount of...

Страница 649: ...1 23 4 8 Hardware flow control USART supports hardware flow control The purpose is to coordinate the sending and receiving parties so that the data will not be lost The connection method is shown in t...

Страница 650: ...RT_CTRL3 CTSEN to enable CTS CTS is an input signal used to judge whether data can be sent to the other device The low level is valid and the low level indicates that the device can send data to the o...

Страница 651: ...to be communicated when needed so that the slave device is in an active state and transmits data with the master device The USART can wake up from mute mode by idle line detection or address mark det...

Страница 652: ...be written to 1 by software and USART enters mute mode Note When the receive buffer contains no data RXNE 0 in USART_SR the USART_CTRL1 RCVWU bit can be written to 0 or 1 Otherwise the write operation...

Страница 653: ...CLKPOL 1 the default level of CLK is high When the phase polarity is 0 USART_CTRL2 CLKPHA 0 the data is sampled on the first edge of the clock when the phase polarity is 1 USART_CTRL2 CLKPHA 1 the dat...

Страница 654: ...mode Data is sampled on CK without any oversampling But setup time and hold time depending on baud rate 1 16 bit time must be considered Figure 23 14 USART synchronous transmission example Figure 23...

Страница 655: ...Single wire half duplex mode USART supports single wire half duplex communication allowing data to be transmitted in both directions but only allows data to be transmitted in one direction at the sam...

Страница 656: ...infrared light pulse to represent a logic 0 and the pulse width is specified as 3 16 of a bit period in normal mode as shown in the Figure 23 19 USART only supports up to 115200bps for SIR ENDEC The...

Страница 657: ...LINMEN bit Note When using LIN mode USART_CTRL2 STPB 1 0 USART_CTRL2 CLKEN USART_CTRL3 SCMEN USART_CTRL3 HDMEN USART_CTRL3 IRDAMEN these bits should be kept clear LIN transmitting When LIN is sent th...

Страница 658: ...the start bit the circuit samples each subsequent bit at the 8th 9th and 10th oversampling clock points of each bit When 10 or 11 consecutive bits are detected as 0 and followed by a delimiter it mean...

Страница 659: ...just long enough break detected Case 3 break signal long enough break detected RX line Sample Break frame Sample data Break frame Idle Idle Bit0 Bit1 Bit2 Bit3 Bit4 Bit7 Bit5 Bit6 Bit8 Bit9 Bit10 0 0...

Страница 660: ...stop bits can be used when sending data So 1 5 stop bits are recommended as this avoids configuration transitions In smart card mode the data bits should be configured as 8 bits and the parity bit sh...

Страница 661: ...clock The smart card mode is delayed by a minimum of 1 2 baud clock than normal operation In normal operation USART_STS TXC is set when a frame containing data is sent and USART_STS TXDE 1 In smart ca...

Страница 662: ...one interrupt request can be generated at the same time Table 23 7 USART interrupt request Interrupt function Interrupt event Event flag Enable bit USART global interrupt Transmission data register is...

Страница 663: ...Y Y Y Y Y Y Y Synchronous mode Y Y Y N N N N Single wire half duplex mode Y Y Y Y Y Y Y Smartcard mode Y Y Y N N N N IrDA infrared mode Y Y Y Y Y Y Y DMA communication mode Y Y Y Y Y Y Y Hardware flo...

Страница 664: ...0 0 0 0 0 0 018h USART_GTP Reserved GTV 7 0 PSCV 7 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 23 7 2 USART Status register USART_STS Address offset 0x00 Reset value 0x0000 00C0 Bit field Name Descr...

Страница 665: ...er 0 The read data buffer is empty 1 The read data buffer is not empty 4 IDLEF IDLE line detected flag Within one frame time the idle state is detected at the RX pin and this bit is set to 1 When USAR...

Страница 666: ...mitted data has both framing errors and overload errors the hardware will continue to transmit the data and only set the USART_STS OREF flag bit In the multi buffer communication mode if the USART_CTR...

Страница 667: ...RXEN are disabled respectively Bit field Name Description 31 16 Reserved Reserved the reset value must be maintained 15 4 DIV_Integer 11 0 Integer part of baud rate divider 3 0 DIV_Decimal 3 0 Fracti...

Страница 668: ...erated when USART_STS TXDE bit is set 0 Send buffer empty interrupt is disabled 1 Send buffer empty interrupt is enabled 6 TXCIEN Transmit complete interrupt enable If this bit is set to 1 an interrup...

Страница 669: ...receiver is in mute mode 0 SDBRK Send Break Character The software transmits a break character by setting this bit to 1 This bit is cleared by hardware during stop bit of the break frame transmission...

Страница 670: ...7 Reserved Reserved the reset value must be maintained 6 LINBDIEN LIN break detection interrupt enable If this bit is set to 1 an interrupt will be generated when USART_STS LINBDF bit is set 0 Discon...

Страница 671: ...is bit is used to enable RTS hardware flow control function 0 RTS hardware flow control is disabled 1 RTS hardware flow control is enabled Note This bit cannot be used for UART4 5 6 7 7 DMATXEN DMA tr...

Страница 672: ...bled 1 Error interrupt enabled 23 7 8 USART guard time and prescaler register USART_GTP Address offset 0x18 Reset value 0x0000 0000 Bit field Name Description 31 16 Reserved Reserved the reset value m...

Страница 673: ...t to 00000001 In Smartcard mode PSCV 7 5 is reserved PSCV 4 0 is used to set the frequency division factor of the peripheral clock APB1 APB2 to generate the smart card clock The actual frequency divis...

Страница 674: ...PI mode In Single mode it supports standard SPI operation and can work in half duplex and full duplex modes Support indirect mode and memory mapped mode 8 bit 16 bit 32 bit data access mode support Su...

Страница 675: ...ates with peripherals through commands Each command includes five phase Instruction phase Address phase Mode bits phase Wait cycles phase and Data phase Any phase can be skipped but at least remains o...

Страница 676: ...in Single SPI mode QSPI_CTRL0 SPI_FRF 1 0 00 When QSPI_CTRL0 TMOD 1 0 01 the QSPI is in indirect transmission mode and the byte to be transmitted is sent to the flash memory during the data transmissi...

Страница 677: ...ress can occupy multiple FIFO locations Both instructions and addresses must be programmed in the QSPI_DATx registers The write operation can be divided into three phase the Instruction phase the Addr...

Страница 678: ...timing in CTRL0 SPI_FRF specified mode QSPI_ENH_CTRL0 TRANS_TYPE 1 0 shall be configured as 0x02 When QSPI_CTRL0 SPI_FRF 1 0 is configured as 0x02 Quad mode N 3 when QSPI_CTRL0 SPI_FRF 1 0 is configu...

Страница 679: ...ration Timing In quad mode N 3 each read command data will be transmitted in the format configured by QSPI_CTRL0 SPI_FRF 1 0 Configured as 0x2 for quad mode Both address and instruction receive timing...

Страница 680: ...SPI_CTRL0 SPI_FRF 1 0 is configured as 0x01 Dual mode N 1 Instruction and address are received timing in QSPI_CTRL0 SPI_FRF specified mode The QSPI_ENH_CTRL0 TRANS_TYPE 1 0 configuration should be 0x2...

Страница 681: ...22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 000h QSPI_CTRL0 Reserved SPI_FRF 1 0 Reserved CFS 3 0 Reserved SSTE SRL Reserved TMOD 1 0 SCPOL SCPH FRF 1 0 Reserved DFS 4 0 Reset Value 1...

Страница 682: ...set Value 0 0 0 0 0 0 0 034h QSPI_RISTS Reserved XRXORI S MMCRIS RXFFRIS RXFORIS RXFURIS TXFORIS TXFERIS Reset Value 0 0 0 0 0 0 0 038h QSPI_TXFOI_CL R Reserved TXFOIC Reset Value 0 03Ch QSPI_RXFOI_CL...

Страница 683: ...0 0 0 0 0 0 0 100h QSPI_XIP_INCR_ TOC Reserved ITOC 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 104h QSPI_XIP_WRAP _TOC Reserved WTOC 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 108h QSPI_X...

Страница 684: ...maintained 14 SSTE Slave Select Toggle Enable While operating in SPI mode with clock phase SCPH set to 0 this bit controls the behavior of the NSS between data frames 0 NSS will stay low and serial c...

Страница 685: ...data frame length When the data frame size is programmed to be less than 32 bits the data is automatically right aligned 0x0 0x01 0x02 Reserved 0x03 4bit 0x04 5bit 0x05 6bit 0x1D 30bit 0x1E 31bit 0x1F...

Страница 686: ...ion 31 3 Reserved Reserved the reset value must be maintained 2 MHS_EN Microwire Handshaking Enable 0 Handshaking diable 1 Handshaking enable When enabled the QSPI checks for a ready status from the t...

Страница 687: ...N 1 24 6 7 QSPI Baud Rate Select Register QSPI_BAUD Address offset 0x14 Reset value 0x0000 0000 Bit field Name Description 31 16 Reserved Reserved the reset value must be maintained 15 0 CLK_DIV 15 0...

Страница 688: ...ed 4 0 TXFT_TEI 4 0 Transmit FIFO Threshold to Trigger Empty Interrupt Tx transmission threshold when the number of transmit FIFOs is less than this value an empty interrupt is triggered 24 6 9 QSPI R...

Страница 689: ...Reserved the reset value must be maintained 5 0 RXFN 5 0 Number of Receive FIFO 24 6 12 QSPI Status Register QSPI_STS Address offset 0x28 Reset value 0x0000 0006 Bit field Name Description 31 7 Reserv...

Страница 690: ...d entries this bit is cleared 1 TXFNF Transmit FIFO Not Full 0 Tx FIFO is full 1 Tx FIFO is not Full Set when the transmit FIFO contains one or more empty locations and is cleared when the FIFO is ful...

Страница 691: ...ield Name Description 31 7 Reserved Reserved the reset value must be maintained 6 XRXOIS XIP Receive FIFO Overflow Interrupt Status 0 Invalid after masking 1 Validafter after masking 5 MMCIS Multi Mas...

Страница 692: ...Status 0 Invalid prior to masking 1 Valid prior to masking 5 MMCRIS Multi Master Contention Raw Interrupt Status 0 Invalid prior to masking 1 Valid prior to masking 4 RXFFRIS Receive FIFO Full Raw In...

Страница 693: ...maintained 0 TXFOIC Clear Transmit FIFO Overflow Interrupt After reading this register clear the Tx FIFO overflow interrupt status 24 6 17 QSPI Receive FIFO Overflow Interrupt Clear Register QSPI_RXF...

Страница 694: ...ister QSPI_MMCI_CLR Address offset 0x44 Reset value 0x0000 0000 Bit field Name Description 31 1 Reserved Reserved the reset value must be maintained 0 MMCIC Clear Multi Master Contention Interrupt Aft...

Страница 695: ...field Name Description 31 2 Reserved Reserved the reset value must be maintained 1 TX_DMA_EN Transmit DMA Enable 0 Disable 1 Enable 0 RX_DMA_EN Receive DMA Enable 0 Disable 1 Enable 24 6 22 QSPI DMA...

Страница 696: ...0 31 Reset value 0x0000 0000 Bit field Name Description 31 0 DATx 31 0 In the Rx state it is the receive buffer and the read data is automatically right aligned in the Tx state it is the send buffer a...

Страница 697: ...QSPI_CTRL0 SPI_FRF 00 This register cannot be written to after the QSPI_EN register is enabled Address offset 0xF4 Reset value 0x0000 0200 Bit field Name Description 31 Reserved Reserved the reset va...

Страница 698: ...ion transfer format 00 Instruction and Address will be sent in Standard SPI Mode 01 Instruction will be sent in Standard SPI Mode and Address will be sent in the mode specified by QSPI_CTRL0 SPI_FRF 1...

Страница 699: ...ansfer opcode Register QSPI_XIP_INCR_TOC Address offset 0x100 Reset value 0x0000 0000 Bit field Name Description 31 16 Reserved Reserved the reset value must be maintained 15 0 ITOC 15 0 XIP INCR tran...

Страница 700: ...h 00 Mode bits length equal to 2 01 Mode bits length equal to 4 10 Mode bits length equal to 8 11 Mode bits length equal to 16 25 24 Reserved Reserved the reset value must be maintained 23 XIP_CT_EN E...

Страница 701: ...gth in bits 00 No Instruction 01 4bit 10 8 bit 11 16 bit 8 Reserved Reserved the reset value must be maintained 7 4 ADDR_LEN 3 0 Length of Address to transmit 0x0 No Address 0x1 4bit 0x2 8bit 0x3 12bi...

Страница 702: ...nable 0 Not Selected 1 Selected 24 6 33 QSPI XIP Receive FIFO Overflow Interrupt Clear Register QSPI_XIP_RXFOI_CLR Address offset 0x110 Reset value 0x0000 0000 Bit field Name Description 31 1 Reserved...

Страница 703: ...t Shenzhen 518057 P R China Bit field Name Description 31 8 Reserved Reserved the reset value must be maintained 7 0 XTOUT 7 0 XIP time out value in terms of AHB XIP time out value in terms of APB Onc...

Страница 704: ...MII and RMII two standard interfaces for communication with the physical layer PHY and realizes the transmission and reception of Ethernet data frames Ethernet module complies with the IEEE 802 3 2008...

Страница 705: ...automatic discarding of frames when late collision excessive collision excessive deferral and underrun 2 2K byte FIFOs one is TxFIFO for sending the other is RxFIFO for receiving the threshold is conf...

Страница 706: ...default configuration is MII mode SMI interface for configuring and managing external PHY devices Ethernet DMA controller accesses the MAC controller through the AHB master interface to control data t...

Страница 707: ...ethod Table 25 1 ETH module pin configuration alternate MII Signal RMII Signal Default mapping Remap 1 Remap 2 Remap 3 Pin configuration MDC MDC PC1 Push pull alternate output high speed 50MHz TXD2 PC...

Страница 708: ...high speed 50MHz TxD3 PB8 PB7 Push pull alternate output high speed 50MHz 25 4 3 SMI interface SMI is used to access and set the configuration of the PHY It communicates with the external PHY through...

Страница 709: ...d mode 2 Set ETH_MACMIIADDR MB to 1 to start receiving data The ETH_MACMIIADDR MB bit can be used to judge whether the transmission is completed When receiving data the ETH_MACMIIADDR MB bit is always...

Страница 710: ...ransferred In order to ensure that the received data is normal the active level cannot appear after the SFD on the data line appears MII_Rx_ER Receive error signal keep the valid state for at least on...

Страница 711: ...000 to 1111 Normal frame interval 0 1 0000 Normal frame interval 0 1 0001 to 1101 Reserved 0 1 1110 Wrong carrier indication 0 1 1111 Reserved 1 0 0000 to 1111 Normal data receive 1 1 0000 to 1111 Err...

Страница 712: ...he clock output pin MCO of the MCU can provide a 50MHz clock signal Figure 25 7 RMII clock source 25 4 6 MAC function description The MAC module performs the encapsulation of transmitted data and rece...

Страница 713: ...MAC controller If the frame is not completely written into TxFIFO that is the size of TxFIFO is smaller than the length of the Ethernet frame to be transmitted the data will also be transmitted to MA...

Страница 714: ...descriptor with TDES1 FS of 1 is received The clear operation will cause MAC controller to generate a data underflow event and end the transmission of the current frame and return the transmission st...

Страница 715: ...f transmission Ethernet controller automatically calculates and inserts checksums when transmitting and detects checksum errors when receiving Only when ETH_DMAOPMOD TSF is configured to 1 that is the...

Страница 716: ...um values are not inserted into TCP UDP or ICMP headers The frame data has been transmitted but the data packet taken out by MAC from TxFIFO is smaller than the value indicated by the data length fiel...

Страница 717: ...methods of unicast destination address filtering 25 4 6 10 4 HASH or perfect address filter Set ETH_MACFFLT HPF to 1 and set ETH_MACFFLT HUC bit for unicast frames or ETH_MACFFLT HMC bit for multicast...

Страница 718: ...is forwarded to application Destination address source address filtering result Table 25 5 Destination address filter result list and Table 25 6 Source address filter result list show the filtering re...

Страница 719: ...frame length type field is less than 0x600 MAC will automatically strip the PAD and FCS After the number of bytes transmitted by MAC to RxFIFO reaches the value of the frame length type field all rema...

Страница 720: ...d return to the overflow state and the overflow counter will be incremented accordingly If RxFIFO works in store and forward mode MAC filter and discard all error frames but by setting ETH_DMAOPMOD FE...

Страница 721: ...If there is no frame underflow no carrier carrier loss excessive deferral late collision excessive collision or Jabber timeout error in the transmitted frame it is considered that the transmission pro...

Страница 722: ...3 command Reserved Filter 2 command Reserved Filter 1 command Reserved Filter 0 command Wakeup frame filter register 5 Filter 3 offset Filter 2 offset Filter 1 offset Filter 0 offset Wakeup frame filt...

Страница 723: ...nd recognized by the Ethernet module and triggers a wake up event The frame format of the Magic Packet wake up frame is as follows 6 bytes of all 1 0xFFFF FFFF FFFF at any position after the destinati...

Страница 724: ...to normal state 25 4 8 Ethernet DMA function description The dedicated DMA controller of Ethernet module can realize the frame data transmission between FIFO and system storage reducing the intervent...

Страница 725: ...lignment types supported by Ethernet DMA controller include byte alignment halfword alignment and word alignment So the application can configure the transmit data buffer address and receive data buff...

Страница 726: ...igured to be large enough to store a complete frame RDES0 FS and RDES0 LS will be set in the same descriptor The actual received frame length can be obtained through these bits of RDES0 FL 13 0 Applic...

Страница 727: ...unt TDES2 Buffer 1 address Timestamp low TDES3 Buffer 2 address Next descriptor address Timestamp high TDES0 Transmit descriptor word 0 Bit field Name Description 31 OWN Occupancy bit 0 Indicates that...

Страница 728: ...1 Data underflow error 14 JT Jabber timeout This bit is only set when ETH_MACCFG JD bit is reset 0 No Jabber timeout occurred 1 A Jabber timeout occurred at MAC sender 13 FF Frame clear When set to 1...

Страница 729: ...0 Collision count This 4 bit value records the number of collision that occurred before frame was transmitted These bits have no effect when TDES0 EC is 1 2 ED Excessive deferral This bit is valid wh...

Страница 730: ...fields but do not calculate checksums of pseudo headers 11 Enable calculation and insertion of checksum of hardware IP header and data field and also calculate checksum of pseudo header 26 DC Disable...

Страница 731: ...tor type is chain or ring After data is transmitted DMA can use them to store the upper 32 bits of the frame s timestamp When the value of TDES3 represents the physical address of buffer 2 TDES1 TCH 0...

Страница 732: ...ter completing a complete frame transmission ETH_DMASTS TI transmit status bit will be set only when TDES1 IC is 1 If DMA interrupt is enabled corresponding interrupt will be entered Then DMA controll...

Страница 733: ...ing in cut through threshold mode and the received frame length is greater than or equal to the preset receive threshold or working in store and forward mode and a complete frame is stored in the RxFI...

Страница 734: ...tamp low RDES3 Buffer 2 address Next descriptor address Timestamp high RDES0 Receive descriptor word 0 Bit field Name Description 31 OWN Occupancy bit 0 Indicates that CPU occupies descriptor 1 Indica...

Страница 735: ...as occurred 11 OE Overflow error This bit is set when RxFIFO has overflowed and part of the received frame has been transferred to input buffer 0 No overflow error occurred 1 RxFIFO overflow occurred...

Страница 736: ...1 A watchdog timeout occurred while receiving a frame and current received frame will be truncated 3 RE Receive error This bit indicates that the valid interface signal Rx_ER is received when the Rx_...

Страница 737: ...descriptor Note When RER 1 even if this bit is set the next descriptor will return the list base address 23 22 Reserved Reserved the reset value must be maintained 21 11 RBS2 10 0 Receive buffer 2 si...

Страница 738: ...rement ETH_DMAMFBOCNT MISFRMCNT missed frame count by 1 repeat the process if there is more than one frame in RxFIFO If ETH_DMAOPMOD DFF 1 the frame at the top of RxFIFO will not be dropped When RDES0...

Страница 739: ...available to 1 9 When any write operation is performed to ETH_DMARXPD register or RxFIFO receives the next frame of data the suspend state can be exited When DMA exits suspended state DMA operation ju...

Страница 740: ...resolution of the timestamp counter and the time synchronization accuracy between the master node and the slave node is about 0 1us Synchronization accuracy The accuracy of time synchronization depend...

Страница 741: ...0 of the timestamp low register represent the sub second value of the system time the precision is equal to 109 ns 231 0 46ns In order to achieve a system time accuracy of 20ns the value of the sub se...

Страница 742: ...add the offset values of timestamp high and low update registers to the original system time 3 Wait for ETH_PTPTSCTRL TSUPDT bit to be cleared Steps to update system time with fine adjustment 1 Calcul...

Страница 743: ...Mbps 100Mbps communication speed etc and configure the information of the external PHY register to the ETH_MACCFG register 5 Initialize Ethernet DMA module Configure ETH_DMABUSMOD ETH_DMARXDLADDR ETH_...

Страница 744: ...cated in Rx_CLK domain there may be a delay caused by the difference between the HCLK and Rx_CLK clock frequencies from the time the application reads PMT register until these flags are cleared To avo...

Страница 745: ...4h ETH_MACMIIDAT Reserved MD 15 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 018h ETH_MACFLWCTRL PT 15 0 Reserved DZQP Reserved PLT 1 0 UP RFE TFE FCB_BPA Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

Страница 746: ...ed Reset Value 0 0 0 108h ETH_MMCTXINT Reserved TXGFRMIS Reserved TXMCOLGFIS TXSCOLGFIS Reserved Reset Value 0 0 0 10Ch ETH_MMCRXINTMSK Reserved RXUCGFIM Reserved RXALIGNERFIM RXCRCERFIM Reserved Rese...

Страница 747: ...Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1008h ETH_DMARXPD RPD 31 0 Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100Ch ETH_DMARXDLADDR...

Страница 748: ...2048 bytes will be truncated 1 Turn off receive watchdog timer and MAC can receive frames with a maximum length of 16383 bytes 22 JD Disable Jabber detection 0 Allows transmit frames of up to 2048 by...

Страница 749: ...these bits in ETH_MACCFG BL 1 0 after a collision 1 MAC will only attempt to send 1 time If a collision occurs on MII MAC will abort the transmission and report an excessive collision error in the tra...

Страница 750: ...AC enables receive state machine 1 0 Reserved Reserved the reset value must be maintained 25 5 3 ETH MAC frame filter register ETH_MACFFLT Address offset 0x0004 Reset value 0x0000 0000 MAC Frame Filte...

Страница 751: ...e frames and whether to process pause control frames depends only on the value of ETH_MACFLWCTRL RFE 00 MAC does not forward any control frames to the application 01 MAC forwards control frames other...

Страница 752: ...descriptor is always 0 0 Disable promiscuous mode 1 Enable promiscuous mode 25 5 4 ETH MAC HASH list high register ETH_MACHASHHI Address offset 0x0008 Reset value 0x0000 0000 A 64 bit HASH list can be...

Страница 753: ...PHY register to be accessed 5 Reserved Reserved the reset value must be maintained 4 2 CR 2 0 Clock range These bits are used to configure the clock of MDC according to the frequency of HCLK value MD...

Страница 754: ...ol register ETH_MACFLWCTRL Address offset 0x0018 Reset value 0x0000 0000 This register is used for the generation and reception of configuration control PAUSE frames Bit field Name Description 31 16 P...

Страница 755: ...w control enable bit When this bit is set to 1 MAC will turn off the transmitter for the specified time the value of the Pause Time field in the received frame 0 MAC does not parse PAUSE frames 1 MAC...

Страница 756: ...eset value must be maintained 16 ETC 12 bit VLAN tag comparison bits This bit selects VLAN tag to be compared with ETH_MACVLANTAG VLTI 11 0 12 bits or ETH_MACVLANTAG VLTI 15 0 16 bits 0 Use all 16 bit...

Страница 757: ...000 0000 Bit field Name Description 31 RWKUPFLTRST Remote wakeup frame filter register pointer reset 0 No effect 1 Reset ETH_MACRMTWUFRMFLT register pointer which is automatically cleared to 0 after t...

Страница 758: ...r mode is exited the hardware will automatically clear this bit to 0 This bit can only be set when ETH_MACPMTCTRLSTS RWKPKTEN or ETH_MACPMTCTRLSTS MGKPKTEN is 1 25 5 12 ETH MAC interrupt status regist...

Страница 759: ...5 13 ETH MAC interrupt mask register ETH_MACINTMSK Address offset 0x003C Reset value 0x0000 0000 Bit field Name Description 31 10 Reserved Reserved the reset value must be maintained 9 TSIM Timestamp...

Страница 760: ...set 0x0044 Reset value 0xFFFF FFFF Bit field Name Description 31 0 ADDRLO 31 0 MAC address 0 low 32 bits These bits contain the lower 32 bits of the 6 byte MAC address 0 These bits are used as the add...

Страница 761: ...l bit are as follows MBC 5 ETH_MACADDR1HI 15 8 MBC 4 ETH_MACADDR1HI 7 0 MBC 3 ETH_MACADDR1LO 31 24 MBC 2 ETH_MACADDR1LO 23 16 MBC 1 ETH_MACADDR1LO 15 8 MBC 0 ETH_MACADDR1LO 7 0 23 16 Reserved Reserved...

Страница 762: ...rresponding byte of the destination source address of the received frame with the corresponding byte of the MAC address 2 The MAC address bytes corresponding to each control bit are as follows MBC 5 E...

Страница 763: ...k byte control bits When a bit is set to 1 MAC will ignore the comparison of the corresponding byte of the destination source address of the received frame with the corresponding byte of the MAC addre...

Страница 764: ...e MMC counter the counter is not reset 1 After reading the MMC counter the counter is reset 1 CNTSTOPRO Counter stop rollover 0 After the counter reaches the maximum value it will start counting from...

Страница 765: ...um value 5 RXCRCERFIS Received frame CRC error status 0 CRC error received frame counter value has not reached half of the maximum value 1 CRC error received frame counter value reaches half of the ma...

Страница 766: ...half of the maximum value 13 0 Reserved Reserved the reset value must be maintained 25 5 25 ETH MMC receive interrupt mask register ETH_MMCRXINTMSK Address offset 0x010C Reset value 0x0000 0000 Bit fi...

Страница 767: ...ed the reset value must be maintained 15 TXMCOLGFIM Transmit good frame interrupt mask bit after more than 1 collision 0 Do not mask the interrupt that occurs when ETH_MMCTXINT TXMCOLGFIS is 1 1 Mask...

Страница 768: ...ffset 0x0150 Reset value 0x0000 0000 This register is used to count the number of frames successfully transmitted after more than one collision in half duplex mode Bit field Name Description 31 0 CNT...

Страница 769: ...n 31 0 CNT 31 0 CRC error received frame counter These bits are a counter of frames with CRC errors in the received frame 25 5 31 ETH MMC alignment error received frame counter register ETH_MMCRXFAECN...

Страница 770: ...EG Timestamp adder register update bit This bit is cleared to 0 after the update is complete This bit must be read as 0 before being set to 1 0 Do not update the value of the timestamp addend register...

Страница 771: ...p function 1 Enable timestamp function of received and transmitted frames Note The system time needs to be re initialized every time this bit is set to 1 25 5 34 ETH PTP subsecond increment register E...

Страница 772: ...d value of the system time Bit field Name Description 31 PN System time positive or negative sign 0 Time value is positive value 1 Time value is negative value 30 0 TSSS 30 0 System time subsecond The...

Страница 773: ...IT is set to 1 this bit should be 0 When ETH_PTPTSCTRL TSUPDT is set to 1 and this bit is 0 the timestamp update value is added to the system time otherwise the timestamp update value is subtracted fr...

Страница 774: ...71C Reset value 0x0000 0000 Bit field Name Description 31 0 TTS 31 0 Target timestamp high These bits represent the seconds value of the target time If the timestamp value equals or exceeds the target...

Страница 775: ...sequent transfers and addresses are aligned 24 PBLX8 8x PBL mode 0 The PBL value is used as the DMA transfer length value 1 The PBL value is multiplied by 8 as the DMA transfer length value For specif...

Страница 776: ...r If ETH_DMABUSMOD USP 1 these bits are only used for TxDMA transfers If ETH_DMABUSMOD USP 0 these bits are used for both TxDMA and RxDMA transfers 000001 The maximum number of data transfers is 1 000...

Страница 777: ...riptor is occupied by the CPU TDES0 OWN 0 Any value can be written to this register to enable sending queries Bit field Name Description 31 0 TPD 31 0 Transmit query request bit Write any value to the...

Страница 778: ...er points to the beginning of the receive descriptor queue Descriptor queues are located in physical memory and their addresses must be word aligned Writing to this register is only allowed when recep...

Страница 779: ...r them while writing 0 is invalid By setting the corresponding bits in the ETH_DMAINTEN register the interrupts triggered by these bits except reserved bits of bit0 bit16 can be masked Bit field Name...

Страница 780: ...DMA transfer of data EB 1 0 Error during write transfer 1 Error during read transfer EB 2 0 Error during data buffer access 1 Error during descriptor access 22 20 TPS 2 0 Transmit process status These...

Страница 781: ...hdog timeout ETH_DMASTS 10 Early send interrupt ETH_DMASTS 13 Bus fatal error Only unmasked interrupts will affect this bit The value of this bit is bound to the above bits After it is set to 1 this b...

Страница 782: ...Receive overflow status When this bit is 1 if some frame data has been forwarded to the memory set RDES0 OE to 1 0 No receive data overflow error occurred 1 Data overflow error occurred during frame...

Страница 783: ...ward it to the application and the value of ETH_DMAOPMOD RTC will be ignored 24 DFF Do not clear received frames 0 When the receive descriptor is not available or the receive buffer is not available t...

Страница 784: ...npredictable consequences may occur if this bit is set before other DMA registers have been set 12 8 Reserved Reserved the reset value must be maintained 7 FEF Forward error frames 0 When RxFIFO is op...

Страница 785: ...information of the previous frame 1 SR Start stop receive 0 RxDMA enters stop mode after forwarding the current received frame Holds the position of the next receive descriptor in the receive descrip...

Страница 786: ...TS 9 Receive watchdog timeout ETH_DMASTS 10 Early transmit interrupt ETH_DMASTS 13 Bus fatal error 14 ERIE Early receive interrupt enable 0 Mask early receive interrupt 1 When ETH_DMAINTEN NISE is 1 e...

Страница 787: ...enable 0 Mask transmit buffer unavailable interrupt 1 When ETH_DMAINTEN NISE is 1 enable transmit buffer unavailable interrupt 1 TPSE Transmit process stop interrupt enable 0 Mask transmit process to...

Страница 788: ...5 51 ETH DMA current transmit descriptor address register ETH_DMACHTXDESC Address offset 0x1048 Reset value 0x0000 0000 This register points to the start address base address of the transmit descript...

Страница 789: ...Reset value 0x0000 0000 This register points to the address of the transmit buffer that TxDMA is reading Bit field Name Description 31 0 ADDR 31 0 Transmit buffer address pointer These bits are clear...

Страница 790: ...evel COMP system connection block diagram The COMP module supports a maximum of seven independent comparators which are connected to the APB1 bus Figure 26 1 Comparator1 and comparator2 connection dia...

Страница 791: ...DAC1 PA4 VREF1 VREF2 DAC2 PA5 PB12 COMP Interrupt PB10 PC10 PA2 TIM1_BKIN TIM1_OCrefClear TIM1_IC1 TIM2_IC3 TIM2_OCrefClear TIM4_IC2 TIM4_OCrefClear TIM8_BKIN TIM5_IC2 TIM1_BKIN TIM8_BKIN PB15 PC4 DA...

Страница 792: ...PC9 COMP5 COMP6 PD10 Polarity Selection Polarity Selection TIM1_BKIN TIM8_OCrefClear TIM2_IC4 TIM3_IC4 TIM3_OCrefClear TIM4_IC4 TIM4_OCrefClear TIM8_BKIN TIM2_OCrefClear TIM8_IC1 TIM1_BKIN TIM8_BKIN T...

Страница 793: ...orm window comparators You can wake the system from Sleep mode or STOP0 mode by generating an interrupt Filter window size can be configured Filter threshold size can be configured The sampling freque...

Страница 794: ...rator function The output of a comparator can be output to an I O port Each comparator has a different remapped port You can configure the comparator register COMPx_CTRL OUTTRG 3 0 to enable the corre...

Страница 795: ...M1_BKIN TIM1_BKIN TIM1_BKIN TIM1_BKIN TIM1_BKIN TIM1_BKIN TIM1_BKIN 0010 TIM1_IC1 TIM1_IC1 TIM1_IC1 TIM3_IC3 TIM2_IC4 TIM2_IC1 TIM2_IC1 0011 TIM1_OCre fclear TIM1_OCrefcl ear TIM1_OCrefcl ear TIM3_OCr...

Страница 796: ...1 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 010h COMP1_CTRL Reserved INPDAC OUT BLKING 2 0 HYST 1 0 POL OUTSEL 3 0 INPSEL 2 0 INMSEL 2 0 EN Reset Value 0 0 0 0...

Страница 797: ...0 0 0 0 0 0 04Ch Reserved 050h COMP5_CTRL Reserved INPDAC OUT BLKING 2 0 HYST 1 0 POL OUTSEL 3 0 INPSEL 2 0 INMSEL 2 0 EN Reset Value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 054h COMP5_FILC Reserved SA...

Страница 798: ...eset Value 0 0 0 0 0 0 0 090h COMP_INTSTS Reserved CMP7IS CMP6IS CMP5IS CMP4IS CMP3IS CMP2IS CMP1IS Reset Value 0 0 0 0 0 0 0 094h COMP_VREFSCL Reserved VV2TRM 5 0 VV2EN VV1TRM 15 0 VV1EN Reset Value...

Страница 799: ...n selection Note For the specific enumeration value correspondence please refer to chapter 26 5 Comparator interconnection 6 4 INPSEL 2 0 Comparator non inverting input selection Note For the specific...

Страница 800: ...1 and 2 are not in window mode 1 Comparators 1 and 2 are in window mode 26 7 4 COMP lock register COMP_LOCK Address offset 0x84 Reset value 0x0000 0000 Bit field Name Description 31 7 Reserved Reserve...

Страница 801: ...CMP7IEN 2 CMP3IEN Same function as CMP7IEN 1 CMP2IEN Same function as CMP7IEN 0 CMP1IEN Same function as CMP7IEN 26 7 6 COMP interrupt status register COMP_INTSTS Address offset 0x90 Reset value 0x00...

Страница 802: ...te This value is required to be greater than SAMPW 2 0 FILEN Filter enable 0 Disable 1 Enable 26 7 8 COMP filter frequency division register COMPx_FILP Address offset 0x18 0x28 0x38 0x48 0x58 0x68 0x7...

Страница 803: ...m Address Nations Tower 109 Baoshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Bit field Name Description 7 VREF2EN VREF2 voltage scaler 0 disable 1 enable 6 1 VREF1SET 5 0 VRE...

Страница 804: ...odes can be configured Independent op amp mode Voltage follower Programmable gain amplifier Differential op amp of two op amps Programmable gain settings are 2X 4X 8X 16X 32X times Gain bandwidth 4MHz...

Страница 805: ...nstech com Address Nations Tower 109 Baoshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Figure 27 1 Block diagram of OPAMP1 and OPAMP2 connection diagram OPAMP1 OPAMP2 PA1 PA3...

Страница 806: ...P R China Figure 27 2 Block diagram of OPAMP3 and OPAMP4 connection diagram 27 1 2 Internal connection between OPAMP and COMP OPAMP1 OPAMP2 COMP1 COMP2 COMP3 ADC1 and ADC2 constitute a group of analo...

Страница 807: ...VREF2 DAC2 PA5 PB14 PE7 DAC1 PA4 VREF1 VREF2 DAC2 PA5 PB12 TIM1_BKIN TIM1_OCrefClear TIM1_IC1 TIM2_IC2 TIM2_OCrefClear TIM3_IC2 TIM3_OCrefClear TIM8_BKIN TIM1_BKIN TIM1_OCrefClear TIM1_IC1 TIM2_IC1 TI...

Страница 808: ...7 TIM1_BKIN TIM8_OCrefClear TIM3_IC3 TIM4_IC3 TIM4_OCrefClear TIM5_IC3 TIM8_BKIN COMP Interrupt PC5 PB12 PC11 COMP Interrupt PA11 PB0 PB6 PB11 COMP Interrupt PA12 PB7 PC9 DAC2 PA5 COMP4 COMP5 COMP6 OP...

Страница 809: ...tion system Four completely independent OPAMPs At this time the gain is determined by the external resistor network It can also be cascaded as required to form the required amplification gain As shown...

Страница 810: ...put voltage through a built in resistor feedback network OPAMPx_CS MOD 2b 10 is a PGA function that supports 2 4 8 16 32 magnification OPAMPx_CS VMSSEL or OPAMPx_CS VMSEL pins must be set to float OPA...

Страница 811: ...R China Figure 27 7 Internal gain mode 27 2 4 OPAMP with filter internal gain mode In this mode the amplification voltage is adjustable supports 2 4 8 16 32 and the OPAMPx_CS VPSSEL or OPAMAPx_CS VPS...

Страница 812: ...gured by VPSSEL VMSSEL as input otherwise use VPSEL VMSEL When TIM8_CC6 is high OPAMP3 and OPAMP4 select the port configured by VPSSEL VMSSEL as input otherwise use VPSEL VMSEL Set OPAMPx_CS TCMEN to...

Страница 813: ...d Name Description 31 22 Reserved Retained the reset value must be maintained 21 19 VPSSEL 2 0 OPAMP non inverted input secondary selection VPSSEL 2 0 OPAMP1 OPAMP2 OPAMP3 OPAMP4 000 PA1 PA7 PC9 PC3 0...

Страница 814: ...mode enabled 0 Normal mode 1 Calibration mode 10 8 VPSEL 2 0 OPAMP non inverted input selection VPSEL 2 0 OPAMP1 OPAMP2 OPAMP3 OPAMP4 000 PA1 PA7 PC9 PC3 001 PA3 PB0 PA1 DAC1 PA4 010 DAC2 PA5 PE8 DAC2...

Страница 815: ...lifier Enable 0 Disable 1 Enable 27 3 3 OPAMP Lock register OPAMP_LOCK Offset address 0x40 Reset value 0x0000 0000 Bit field Name Description 31 4 Reserved Reserved the reset value must be maintained...

Страница 816: ...CMOS sensor The polarity of input pixel clock DVP_PCLK frame synchronization signal DVP_VSYNC and horizontal synchronization signal DVP_HSYNC can be independently configured Support 8x 32bit FIFO FIFO...

Страница 817: ...high and capture data on the falling edge of DVP_PCLK to receive data correctly DVP data is only valid when the capture enable bit register DVP_CTRL CAPTURE is 1 and the capture enable bit must be 1 a...

Страница 818: ...needed The DVP module only stores the area data that needs to be reserved into the FIFO and other data are automatically discarded DVP_WST VST configures the starting line of the capture area In the v...

Страница 819: ...will be reported only after the corresponding interrupt enable bit in DVP_INTEN is turned on DVP_MINTSTS is the register of interrupt status that reported to system and users generally only use this...

Страница 820: ...Reset Value 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 004h DVP_STS Reserved FCNT 2 0 FNE Reset Value 0 0 0 0 008h DVP_INTSTS Reserved HERRIS VERRIS FOIS FWIS FFIS FEIS LEIS LSIS FMEIS FMSIS Reset Value 0 0 0 0...

Страница 821: ...lines 001 Capture 1 line of each 2 lines 010 Capture 1 line of each 3 lines 011 Capture 1 line of each 4 lines 100 Capture 1 line of each 5 lines 101 Capture 1 line of each 6 lines 110 Capture 1 line...

Страница 822: ...s automatically cleared 1 Continuous mode After transmitting a frame of data the CAPTURE bit is not cleared and continues to wait for the next frame synchronization signal 0 CAPTURE Capture enable In...

Страница 823: ...number of received data lines is less than the configured number of data lines per frame a VSYNC error is generated VSYNC arrives early 0 No error 1 There is a VSYNC error 7 FOIS FIFO overflow status...

Страница 824: ...MSIS Frame start state Software write 0 to clear 0 Frame not started 1 Frame has started 28 4 5 DVP Interrupt Enable Register Address offset 0x0c Reset value 0x0000 0000 Bit field Name Description 31...

Страница 825: ...interrupt enable 0 Disable line start interrupt 1 Enable line start interrupt 1 FMEIE End of frame interrupt enable 0 End of frame interrupt is not enabled 1 Enable end of frame interrupt 0 FMSIE Sta...

Страница 826: ...a length in the FIFO has reached DVP_CTRL FWM 2 0 and interrupt triggered 5 FFMIS FIFO full interrupt status This bit is related to the real time status of the FIFO and can only be cleared by reading...

Страница 827: ...number the first line starts at 0 12 11 Reserved Reserved the reset value must be maintained 10 0 HST 10 0 Starting pixel number the first pixel starts at 0 28 4 8 DVP image size register DVP_WSIZE Ad...

Страница 828: ...il info nationstech com Address Nations Tower 109 Baoshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Bit field Name Description 31 24 DAT3 7 0 Data byte 3 23 16 DAT2 7 0 Data b...

Страница 829: ...can be restored and the corresponding program can continue to be executed The hardware debugging module of the N32G45x kernel can be used when it is connected to the debugger when it is not disabled...

Страница 830: ...debug interface by default If you need to switch the debug interface you can switch between SWD interface and JTAG interface through the following operations JTAG debug to SWD debug switch 1 Sending...

Страница 831: ...2G45x can provide a variety of low power consumption modes refer to Power control PWR for details When debugging ensure that the FCLK and HCLK of the kernel are on and provide the necessary clock for...

Страница 832: ...31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 000h DBG_ID SRAM 3 0 Reserved DEV_NUM_L 3 0 FLASH 3 0 DEV_NUM_H 3 0 DEV_NUM_M 3 0 REV_NUM_H 3 0 REV_NUM_L 3 0 Res...

Страница 833: ...lue 0x0000 0000 not reset by system reset Bit field Name Description 31 22 Reserved Reserved the reset value must be maintained 21 CAN2_STOP When the kernel enters the debugging state CAN2 stops runni...

Страница 834: ...STANDBY mode is the same as resetting except that some status bits indicate that the microcontroller has just exited from the STANDBY state 1 FCLK ON HCLK ON The digital circuit part is not powered d...

Страница 835: ...ress Nations Tower 109 Baoshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Bit field Name Description clock system when exiting from sleep mode 1 FCLK ON HCLK ON In sleep mode b...

Страница 836: ...med during manufacture and any MCU microcontroller is guaranteed to be unique under any circumstances It can be read by user applications or external devices through CPU or SWD interface and cannot be...

Страница 837: ...ogies Inc Tel 86 755 86309900 Email info nationstech com Address Nations Tower 109 Baoshen Road Hi tech Park North Nanshan District Shenzhen 518057 P R China Version history Date Version Remark 2022 7...

Страница 838: ...gram 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 exemplar...

Отзывы: