h616 User Manual v1.0 PDF
h616 User Manual v1.0 PDF
Revision 1.0
Dec.28, 2019
DECLARATION
THIS DOCUMENTATION IS THE ORIGINAL WORK AND COPYRIGHTED PROPERTY OF ALLWINNER TECHNOLOGY
(“ALLWINNER”). REPRODUCTION IN WHOLE OR IN PART MUST OBTAIN THE WRITTEN APPROVAL OF ALLWINNER AND
GIVE CLEAR ACKNOWLEDGEMENT TO THE COPYRIGHT OWNER.
THE PURCHASED PRODUCTS, SERVICES AND FEATURES ARE STIPULATED BY THE CONTRACT MADE BETWEEN
ALLWINNER AND THE CUSTOMER. PLEASE READ THE TERMS AND CONDITIONS OF THE CONTRACT AND RELEVANT
INSTRUCTIONS CAREFULLY BEFORE USING, AND FOLLOW THE INSTRUCTIONS IN THIS DOCUMENTATION STRICTLY.
ALLWINNER ASSUMES NO RESPONSIBILITY FOR THE CONSEQUENCES OF IMPROPER USE(INCLUDING BUT NOT LIMITED
TO OVERVOLTAGE, OVERCLOCK, OR EXCESSIVE TEMPERATURE).
THE INFORMATION FURNISHED BY ALLWINNER IS PROVIDED JUST AS A REFERENCE OR TYPICAL APPLICATIONS, ALL
STATEMENTS, INFORMATION, AND RECOMMENDATIONS IN THIS DOCUMENT DO NOT CONSTITUTE A WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED. ALLWINNER RESERVES THE RIGHT TO MAKE CHANGES IN CIRCUIT DESIGN AND/OR
SPECIFICATIONS AT ANY TIME WITHOUT NOTICE.
NOR FOR ANY INFRINGEMENTS OF PATENTS OR OTHER RIGHTS OF THE THIRD PARTIES WHICH MAY RESULT FROM ITS
USE. NO LICENSE IS GRANTED BY IMPLICATION OR OTHERWISE UNDER ANY PATENT OR PATENT RIGHTS OF
ALLWINNER. THIRD PARTY LICENCES MAY BE REQUIRED TO IMPLEMENT THE SOLUTION/PRODUCT. CUSTOMERS SHALL
BE SOLELY RESPONSIBLE TO OBTAIN ALL APPROPRIATELY REQUIRED THIRD PARTY LICENCES. ALLWINNER SHALL NOT
BE LIABLE FOR ANY LICENCE FEE OR ROYALTY DUE IN RESPECT OF ANY REQUIRED THIRD PARTY LICENCE. ALLWINNER
SHALL HAVE NO WARRANTY, INDEMNITY OR OTHER OBLIGATIONS WITH RESPECT TO MATTERS COVERED UNDER ANY
REQUIRED THIRD PARTY LICENCE.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 2
Revision History
Revision History
Revision Date Description
1.0 Dec.28, 2019 Initial release version
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 3
About This Document
Contents
Chapter 1 About This Document ....................................................................................................................................... 5
Purpose ......................................................................................................................................................................... 5
Intended Audience ........................................................................................................................................................ 5
Symbol Conventions...................................................................................................................................................... 5
Notes ............................................................................................................................................................................. 6
Register Attributes ................................................................................................................................................ 6
Reset Value Conventions ....................................................................................................................................... 6
Numerical System ................................................................................................................................................. 6
Acronyms and Abbreviations ........................................................................................................................................ 7
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 4
About This Document
Purpose
This document describes the features, logical structures, functions, operating modes, and related registers of each
module about H616. For details about the interface timings and related parameters, the pins, pin usages, performance
parameters, and package dimension, refer to the Allwinner H616 Datasheet.
Intended Audience
Symbol Conventions
The symbols that may be found in this document are defined as follows.
Symbol Description
A warning means that injury or death is possible if the instructions are not
WARNING obeyed.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 5
About This Document
Notes
Register Attributes
The register attributes that may be found in this document are defined as follows.
Symbol Description
R Read Only
R/W Read/Write
Read/Write-Automatic-Clear, clear the bit automatically when the operation of
R/WAC
complete. Writing 0 has no effect
R/WC Read/Write-Clear
R/W0C Read/Write 0 to Clear. Writing 1 has no effect
R/W1C Read/Write 1 to Clear. Writing 0 has no effect
R/W1S Read/Write 1 to Set. Writing 0 has no effect
W Write Only
Numerical System
The expressions of data capacity, frequency, and data rate are described as follows.
The following table contains acronyms and abbreviations used in this document.
ADC Analog-to-Digital Converter
AE Automatic Exposure
AEC Audio Echo Cancellation
AES Advanced Encryption Standard
AF Automatic Focus
AGC Automatic Gain Control
AHB AMBA High-Speed Bus
ALC Automatic Level Control
ANR Active Noise Reduction
APB Advanced Peripheral Bus
ARM Advanced RISC Machine
AVS Audio Video Standard
AWB Automatic White Balance
BROM Boot ROM
CIR Consumer Infrared
CMOS Complementary Metal-Oxide Semiconductor
CP15 Coprocessor 15
CPU Central Processing Unit
CRC Cyclic Redundancy Check
CVBS Composite Video Broadcast Signal
DDR Double Data Rate
DES Data Encryption Standard
DLL Delay-Locked Loop
DMA Direct Memory Access
DRC Dynamic Range Compression
DVFS Dynamic Voltage and Frequency Scaling
ECC Error Correction Code
eFuse Electrical Fuse, A one-time programmable memory
EHCI Enhanced Host Controller Interface
eMMC Embedded Multi-Media Card
ESD Electrostatic Discharge
FBGA Fine Pitch Ball Grid Array
FEL Fireware Exchange Launch
FIFO First In First Out
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 7
About This Document
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 8
About This Document
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 9
Product Description
Contents
Chapter 2 Product Description ........................................................................................................................................ 12
2.1. Overview .............................................................................................................................................................. 12
2.2. Features................................................................................................................................................................ 12
2.2.1. CPU Architecture ....................................................................................................................................... 12
2.2.2. Memory Subsystem................................................................................................................................... 13
2.2.3. Video Engine ............................................................................................................................................. 14
2.2.4. Video and Graphics ................................................................................................................................... 15
2.2.5. System Peripherals .................................................................................................................................... 16
2.2.6. Video Output............................................................................................................................................. 18
2.2.7. Audio Subsystem ....................................................................................................................................... 19
2.2.8. Security Engine .......................................................................................................................................... 20
2.2.9. External Peripherals .................................................................................................................................. 21
2.2.10. Package ................................................................................................................................................... 24
2.3. Block Diagram ...................................................................................................................................................... 24
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 10
Product Description
Figures
Figure 2- 1. H616 System Block Diagram ............................................................................................................................ 24
Figure 2- 2. H616 OTT Box Solution .................................................................................................................................... 25
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 11
Product Description
2.1. Overview
H616 is a high-performance SoC that supports 4K@60fps decoding for over-the-top(OTT) and Internet Protocol
television(IPTV) markets. H616 integrates the 4-core 64-bit high performance CortexTM-A53 processor, built-in NEON
acceleration engine, powerful CPU processing capabilities to meet a variety of differentiated business requirements.
Maintain the best user experience in the industry in terms of stream compatibility, fluency of online video playback,
image quality and performance of the whole machine. H616 supports multi formats of video decoder such as H.265,
H.264, VP9, AVS2, AVS/AVS+, MPEG-1, MPEG-2, MPEG-4, VC1, VP8, and high-performance H.264 video encoder, which
can meet the growing needs of multimedia playback, video communication. H616 also provides rich peripheral
interfaces, such as USB2.0, SDIO3.0, 1000Mbps EMAC, TSC, SPI, UART, CIR, etc. H616 adopts the new generation of
power consumption technology, and reduces power consumption of 20% than the last generation.
2.2. Features
• G31
• Supports OpenGL ES 1.0/2.0/3.2, Vulkan 1.1, OpenCL 2.0
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 12
Product Description
• On-chip memory
• Supports system boot from the following devices:
- SD/eMMC(SMHC0, SMHC2)
- Nand Flash
- SPI Nor Flash
- SPI Nand Flash
• Supports secure boot and normal boot
• Supports mandatory upgrade process through SMHC0 and USB
• Secure brom supports load only certified firmware
• Secure brom ensures that the secure boot is a trusted environment
2.2.3.2. SDRAM
2.2.3.4. SMHC
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 13
Product Description
• H.264 BP/MP/HP
• H.264 supports I/P frame, and only supports single reference frame
• MJPEG/JPEG baseline
• Maximum 16-megapixel(4096 x 4096) resolution for H.264 encoding
• H.264 encoding capability: 4K@25fps
• JPEG snapshot performance of 1080p@60fps independently
• Supports the constant bit rate(CBR)/variable bit rate(VBR) bit rate control mode,ranging from 256 kbit/s to 100
Mbit/s
• Encoding of eight regions of interest(ROIs)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 14
Product Description
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 15
Product Description
2.2.6.1. Timer
• The timer module implements the timing and counting functions, including Timer0, Timer1, Watchdog and AVS0,
AVS1
• Timer0 and Timer1 for system scheduler counting
- Configurable 8 prescale factor
- Programmable 32-bit down timer
- Supports two working modes: continue mode and single count mode
- Generates an interrupt when the count is decreased to 0
• 1 Watchdog for transmitting a reset signal to reset the entire system after an exception occurs in the system
- Supports 12 initial values to configure
- Generation of timeout interrupts
- Generation of reset signal
- Watchdog restart the timing
• 2 AVS counters (AVS0 and AVS1) for synchronizing video and audio in the player
- Programmable 33-bit up timer
- Initial value can be updated anytime
- 12-bit frequency divider factor
- Pause/Start function
2.2.6.3. RTC
Provides a 16-bit counter for counting day, 5-bit counter for counting hour, 6-bit counter for counting minute,
6-bit counter for counting second
Supports one solution without low-frequency crystal, a precise 32.768 kHz counter clock can be generated by
using HOSC to calibrate the internal RC clock
Configurable initial value by software anytime
Periodically alarm to wakeup the external devices
16 general purpose registers for storing power-off information
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 16
Product Description
2.2.6.4. GIC
• Supports 16 Software Generated Interrupts(SGIs), 16 Private Peripheral Interrupts(PPIs) and 160 Shared
Peripheral Interrupts(SPIs)
• Enabling, disabling, and generating processor interrupts from hardware interrupt
• Interrupt masking and prioritization
2.2.6.5. DMA
• Up to 16-channel DMA
• Interrupt generated for each DMA channel
• Flexible data width of 8/16/32/64-bit
• Supports linear and IO address modes
• Supports data transfer types with memory-to-memory, memory-to-peripheral, peripheral-to-memory,
peripheral-to-peripheral
• Supports transfer with linked list
• DRQ response includes wait mode and handshake mode
• DMA channel supports pause function
2.2.6.6. CCU
• 12 PLLs
• One on-chip RC oscillator and one external 24 MHz DCXO
• Supports clock configuration and clock generated for corresponding modules
• Supports software-controlled clock gating and software-controlled reset for corresponding modules
• Temperature accuracy: ±3°C from 0°C to +100°C, ±5°C from -25°C to +125°C
• Supports over-temperature protection interrupt and over-temperature alarm interrupt
• Averaging filter for thermal sensor reading
• Four thermal sensors: sensor0 located in the GPU, sensor1 located in the VE, sensor2 located in the CPU and
sensor3 located in the DDR
• Capable of CPU reset, including core reset, debug circuit reset, etc
• Capable of other CPU-related control, including interface control and CP15 control
• Capable of checking CPU status, including idle status, SMP status, and interrupt status, etc
• Including CPU debug control and status register
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 17
Product Description
2.2.6.9. IOMMU
2.2.7.1. TCON_TV
2.2.7.2. TVE
2.2.7.3. HDMI
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 18
Product Description
2.2.8.3. DMIC
2.2.8.4. OWA
One OWA TX
IEC-60958 transmitter functionality
Supports channel status insertion for the transmitter
Hardware parity generation on the transmitter
One 128×24bits TXFIFO for audio data transfer
Programmable FIFO thresholds
Interrupt and DMA support
Supports 16-bit, 20-bit and 24-bit data formats
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 19
Product Description
2.2.9.2. Security ID
The SMC is always secure, only secure CPU can access the SMC
Set secure area of DRAM
Set secure property that Master accesses to DRAM
Set DRM area
Set whether DRM master can access to DRM area or not
The SPC is always secure, only secure CPU can access the SPC
Set secure property of peripherals
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 20
Product Description
2.2.10.1. USB
One USB 2.0 OTG (USB0), with integrated USB 2.0 analog PHY
- Compatible with USB2.0 Specification
- Supports High-Speed (HS, 480 Mbit/s), Full-Speed (FS, 12 Mbit/s) and Low-Speed (LS, 1.5 Mbit/s) in host mode
- Supports High-Speed (HS, 480 Mbit/s), Full-Speed (FS, 12 Mbit/s) in device mode
- Compatible with Enhanced Host Controller Interface (EHCI) Specification, Version 1.0, and the Open Host
Controller Interface (OHCI) Specification, Version 1.0a for host mode
- Up to 8 User-Configurable Endpoints (EPs) for Bulk, Isochronous and Interrupt bi-directional transfers
- Supports (4 KB + 64 bytes) FIFO for all EPs (including EP0)
- Supports point-to-point and point-to-multipoint transfer in both host and peripheral mode
• Three USB 2.0 HOST (USB1, USB2, USB3), with integrated USB 2.0 analog PHY
- Compatible with Enhanced Host Controller Interface (EHCI) Specification, Version 1.0, and the Open Host
Controller Interface (OHCI) Specification, Version 1.0a.
- Supports High-Speed (HS, 480 Mbit/s), Full-Speed (FS, 12 Mbit/s) and Low-Speed (LS,1.5 Mbit/s) device
- Only USB2 supports USB standby
2.2.10.2. EMAC
2.2.10.3. UART
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 21
Product Description
2.2.10.4. SPI
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 22
Product Description
2.2.10.7. PWM
2.2.10.9. TSC
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 23
Product Description
2.2.11. Package
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 24
Product Description
CIR 4xUSB
PA LINEOUT
EPHY Internet
Antenna
UART
24MHz
H616 OTT Box SDIO WIFI+BT
I2S
LCD
TWI
HDMI/CVBS
PMIC power vcc/
vdd
DDR NAND/SMHC TV
DD R3/DD R4/
LPDD R3/LPDD R4
Nand
flash
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 25
System
Contents
Chapter 3 System ............................................................................................................................................................. 30
3.1. Memory Mapping ................................................................................................................................................ 30
3.2. CPUX Configuration .............................................................................................................................................. 33
3.2.1. Overview ................................................................................................................................................... 33
3.2.2. Operations and Functional Descriptions ................................................................................................... 33
3.2.3. Programming Guidelines ........................................................................................................................... 35
3.2.4. Cluster 0 Configuration Register List ......................................................................................................... 35
3.2.5. Cluster 0 Configuration Register Description ............................................................................................ 36
3.2.6. CPU Subsystem Control Register List......................................................................................................... 42
3.2.7. CPU Subsystem Control Register Description ............................................................................................ 42
3.3. CCU ....................................................................................................................................................................... 45
3.3.1. Overview ................................................................................................................................................... 45
3.3.2. Operations and Functional Descriptions ................................................................................................... 45
3.3.3. Programming Guidelines ........................................................................................................................... 51
3.3.4. Register List ............................................................................................................................................... 54
3.3.5. Register Description .................................................................................................................................. 57
3.4. BROM System ..................................................................................................................................................... 125
3.4.1. Overview ................................................................................................................................................. 125
3.4.2. Operations and Functional Descriptions ................................................................................................. 125
3.5. System Configuration ......................................................................................................................................... 133
3.5.1. Overview ................................................................................................................................................. 133
3.5.2. Operations and Functional Descriptions ................................................................................................. 133
3.5.3. Register List ............................................................................................................................................. 133
3.5.4. Register Description ................................................................................................................................ 134
3.6. Timer .................................................................................................................................................................. 136
3.6.1. Overview ................................................................................................................................................. 136
3.6.2. Block Diagram ......................................................................................................................................... 137
3.6.3. Operations and Functional Descriptions ................................................................................................. 137
3.6.4. Programming Guidelines ......................................................................................................................... 140
3.6.5. Register List ............................................................................................................................................. 141
3.6.6. Register Description ................................................................................................................................ 142
3.7. High Speed Timer ............................................................................................................................................... 150
3.7.1. Overview ................................................................................................................................................. 150
3.7.2. Block Diagram ......................................................................................................................................... 150
3.7.3. Operations and Functional Descriptions ................................................................................................. 150
3.7.4. Programming Guidelines ......................................................................................................................... 152
3.7.5. Register List ............................................................................................................................................. 153
3.7.6. Register Description ................................................................................................................................ 153
3.8. GIC ...................................................................................................................................................................... 159
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 26
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 27
System
Figures
Figure 3- 1. CPUX Power Domain Block Diagram ................................................................................................................ 34
Figure 3- 2. System Bus Tree ............................................................................................................................................... 46
Figure 3- 3. Bus Clock Generation ....................................................................................................................................... 47
Figure 3- 4. Module Clock Generation ................................................................................................................................ 48
Figure 3- 5. Module Clock Tree ........................................................................................................................................... 49
Figure 3- 6. Boot Process Diagram .................................................................................................................................... 127
Figure 3- 7. Security BROM Process Diagram ................................................................................................................... 128
Figure 3- 8. Mandatory Upgrade Process ......................................................................................................................... 129
Figure 3- 9. USB FEL Process ............................................................................................................................................. 130
Figure 3- 10. GPIO Pin Boot Select Process ....................................................................................................................... 131
Figure 3- 11. eFuse Boot Select Process............................................................................................................................ 132
Figure 3- 12. Timer Block Diagram .................................................................................................................................... 137
Figure 3- 13. Timer Application Diagram .......................................................................................................................... 138
Figure 3- 14. HSTimer Block Diagram................................................................................................................................ 150
Figure 3- 15. HSTimer Application Diagram ...................................................................................................................... 151
Figure 3- 16. HSTimer Initialization Process...................................................................................................................... 152
Figure 3- 17. DMA Block Diagram ..................................................................................................................................... 164
Figure 3- 18. DMA Typical Application Diagram ............................................................................................................... 165
Figure 3- 19. DMA Descriptor ........................................................................................................................................... 167
Figure 3- 20. DMA Chain Transfer ..................................................................................................................................... 168
Figure 3- 21. DMA Transfer Mode .................................................................................................................................... 170
Figure 3- 22. DMA Transfer Process.................................................................................................................................. 172
Figure 3- 23. Thermal Sensor Controller Block Diagram ................................................................................................... 193
Figure 3- 24. Thermal Sensor Time Requirement ............................................................................................................. 194
Figure 3- 25. Thermal Sensor Controller Interrupt Source ............................................................................................... 194
Figure 3- 26. THS Initial Process ........................................................................................................................................ 195
Figure 3- 27. PSI Block Diagram ........................................................................................................................................ 205
Figure 3- 28. IOMMU Block Diagram ................................................................................................................................ 207
Figure 3- 29. Internal Switch Process ................................................................................................................................ 211
Figure 3- 30. VA-PA Switch Process .................................................................................................................................. 212
Figure 3- 31. Invalid TLB Address Range ........................................................................................................................... 213
Figure 3- 32. Level1 Page Table Format ............................................................................................................................ 214
Figure 3- 33. Level1 Page Table Format ............................................................................................................................ 214
Figure 3- 34. Read/Write Permission Control ................................................................................................................... 214
Figure 3- 35. RTC Clock Tree ............................................................................................................................................. 275
Figure 3- 36. RTC Application Diagram ............................................................................................................................. 276
Figure 3- 37. RTC Counter ................................................................................................................................................. 277
Figure 3- 38. RTC 1KHz Counter Step Structure ................................................................................................................ 277
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 28
System
Tables
Table 3- 1. Reset Signal Description .................................................................................................................................... 33
Table 3- 2. PLL Features ...................................................................................................................................................... 50
Table 3- 5. BOOT_MODE Setting....................................................................................................................................... 125
Table 3- 6. GPIO Pin Boot Select Configuration ................................................................................................................ 126
Table 3- 7. eFuse Boot Select Configuration ..................................................................................................................... 126
Table 3- 8. eFuse Boot Select Setting ................................................................................................................................ 126
Table 3- 10. DMA DRQ Table............................................................................................................................................. 166
Table 3- 11. Correspondence Relation between Master and Module.............................................................................. 207
Table 3- 12. Relation between ACI and Domain ............................................................................................................... 215
Table 3- 13. RTC External Signals ...................................................................................................................................... 276
Table 3- 14. RTC Counter Changing Range........................................................................................................................ 277
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 29
System
Chapter 3 System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 32
System
3.2.1. Overview
The C0_CPUX_CFG module is used for configuring cluster0, such as reset, control, cache, debug, CPU status.
The CPU_SUBSYS_CTRL module is used for the system resource control of CPU sub-system, such as GIC-400, JTAG.
For the detail of CPUX signal, please refer to ARM Cortex-A53 TRM, such as
DDI0464F_cortex_A53_mpcore_r0p5_trm.pdf
When the L2 cache of Cluster needs to enter WFI mode, firstly make sure that the CPU[3:0] of Cluster enters WFI
mode, which can be checked through the bit[19:16] of Cluster CPU Status Register, and then pull high the ACINACTM
of Cluster by writing 1 to the bit0 of Cluster Control Register1, and then check whether L2 enters idle status by
checking whether the STANDBYWFIL2 is high. Note that set the ACINACTM to low when exiting the L2 idle mode.
The CPUX reset includes core reset, power-on reset and H_Reset. And their scopes rank: core reset < power-on Reset
< H_Reset. The description of all reset signal in CPUX reset system is as follows.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 33
System
This power-on reset signal resets all the processor logic, including the Debug, ETM trace unit,
breakpoint, watchpoint logic, and performance monitors logic.
PWRON_RST It maps to a cold reset that covers reset of the processor logic and the integrated debug
functionality. This does not reset debug logic in the debug power domain.
Including CORE_RST/ETM_RST/DBG_RST.
AXI2MBUS_RST Reset the AXI2MBUS interface logic circuit.
L2_RST This single, cluster-wide signal resets the L2 memory system and the logic in the SCU.
ETM_RST Reset ETM debug logic circuit.
Reset only the debug, and breakpoint and watchpoint logic in the processor power domain. It
DBG_RST
also resets the debug logic for each processor in the debug power domain.
SOC_DBG_RST Reset all the debug logic including DBG_RST.
MBIST_RST Reset all resettable registers in the cluster, for entry into, and exit from, MBIST mode.
H_RST Including PWRON_RST/L2_RST/MBIST_RST/SOC_DBG_RST/C0_CPUX_CFG.
CPU_SUBSYS_RST Including C0_H_RST/GIC-400/CPU_SUBSYS_CTRL.
Since each CPU core and its appended circuits have the same power domain, the processor and related L1 cache, neon
and vfp should be taken as a whole core.
C0_CPUX_CFG and cluster0 belong to the same power domain, within opening and closing cluster0 process, when
cluster0 starts to power on again from power-off state, C0_CPUX_CFG holds in default state, at this time software
need initial C0_CPUX_CFG after C0_H_RST is de-asserted.
CPU_SUBSYS_CTRL belongs to system power domain. The power domains of CPU related module are as follows.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 34
System
The CPU-related operations (such as open/close core, cluster switch, status query) need proper configuration of
C0_CPUX_CFG module, as well as the combination of related system control resources including BUS, clock.
For CPU core and cluster operation, please see the H616_CPU_AP_Note.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 35
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 36
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 38
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 39
System
RVBARADDR[31:2]
31:2 R/W 0x0 Reset Vector Base Address[31:2] for executing in 64-bit state (AArch64) of
CPU2.
1:0 / / /
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 40
System
0: AMP mode
1: SMP mode
23:20 / / /
STANDBYWFI
Indicates if Cluster CPU[3:0] is in WFI standby mode
19:16 R 0x1
0: Processor not in WFI standby mode.
1: Processor in WFI standby mode
15:12 / / /
STANDBYWFE
Indicates if Cluster CPU[3:0] is in the WFE standby mode
11:8 R 0x0
0: Processor not in WFE standby mode
1: Processor in WFE standby mode
7:1 / / /
STANDBYWFIL2
Indicates if the Cluster L2 memory system is in WFI standby mode
0 R 0x0
0: Cluster L2 not in WFI standby mode
1: Cluster L2 in WFI standby mode
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 41
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 42
System
3.2.7.3. 0x000C GIC and Jtag Reset Control Register(Default Value: 0x0000_0F07)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 43
System
GIC_RST
GIC_reset_cpu_reg
0 R/W 0x1
0: assert
1: de-assert
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 44
System
3.3. CCU
3.3.1. Overview
The clock controller unit (CCU) controls the PLLs configuration and most of the clock generation, division, distribution,
synchronization and gating. CCU input signals include the external clock for the reference frequency (24 MHz). The
outputs from CCU are mostly clocks to other blocks in the system.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 45
System
Debug
TMASTER
CE
SMHC0 SMHC1 SMHC2 CPUX Extahb_Mode
MUX
AXIS2 MSI
DMA BIST MST SS_MBUS DRAM_CTRL
ARBI AXIS1
DS_HTOP DCU PRCM
AIX2PSI CPUS_CFG
KEY_SRAM
RTC
PSI
CPUX_GIC NAND0
AHB3 BUS
AHB2APB
SRAM A1+C
TS TS: transport stream controller
IOMMU
AHB2 BUS
KEY_SRAM
TV0/1
APB1 BUS
PWM
DRAM
AHB1 BUS
CCU SID HDMI0
UART(0~5) AXI
TWI(0~4) AHB
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 46
System
DCXO 24MHz
M
RC16M
U RTC_32K
/512
X
PLL_CPUX
M CPUX /M/N CPUX_AXI
U
X
PLL_PERI0(1X) M
U /M/N PSI AHB1
DCXO 24 MHz
X
AHB2
M
U /M/N AHB3
X
M
U /M/N APB1
X
M
U /M/N APB2
X
PLL_DDR0 M
U /M MBUS
PLL_DDR1 X
PLL_PERI0(2X)
DCXO 24MHz
M
RC16M
U RTC_32K
/512
X
PLL_PERI0(1X) /M M
U CPUS AHBS /M APBS1
DCXO 24 MHz
X
M
U /M APBS2
X
Figure 3-4 describes module clock generation. The frequencies in parantheses are the default typical frequencies.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 47
System
PLL_GPU0 432MHz
Note: default value PLL_VIDEO0(4X) PLL_VIDEO0(1X)
DIV4
PLL_VIDEO0(1X) 297MHz
PLL_VIDEO1(4X) PLL_VIDEO1(1X)
DIV4
PLL_VIDEO0(4X) 1188MHz
PLL_VIDEO2(4X) PLL_VIDEO2(1X)
PLL_VIDEO1(1X) 297MHz DIV4
PLL_VIDEO2(1X) 297MHz
PLL_VIDEO2(4X) 1188MHz
OSC24M 0
OSC24M
RTC_32K PLL_PERI0(1X) 1
busclk cpu_aclk PLL_VE GATE clkdiv3 ve_clk 2
PLL_CPUX div1/2/4 RC16M PLL_PERI1(1X) GATE clkdiv4 clkdiv2y nand_clk
PLL_PERI0(2X) 3
PLL_PERI1(2X) 4
PLL_PERI0(1X)
tclkgen cpu_pclk clkdiv2y nand_clk_div2
0
0 OSC24M
PLL_DE PLL_PERI0(1X) 1
2
GATE clkdiv4 de_clk PLL_PERI1(1X) GATE clkdiv4 clkdiv2y nand_clk1
PLL_PERI0(2X) 3
1
PLL_PERI0(2X) PLL_PERI1(2X) 4
0 GATE hdmi_slow_clk
OSC24M 0
OSC24M
GATE clkdiv4 clkdiv2y ce_clk 1
PLL_PERI0(2X) GATE clkdiv4 clkdiv2y smhc1_clk
1
PLL_PERI0(2X) 2
PLL_PERI1(2X)
0 0
PLL_AUDIO(1X) PLL_DDR0
1
PLL_AUDIO(2X) 0
GATE clkdiv2y audiohub_clk clkdiv2xy dram_clk OSC24M
2
PLL_AUDIO(4X) 1 1 GATE clkdiv4 clkdiv2y smhc2_clk
3 PLL_DDR1 PLL_PERI0(2X)
PLL_AUDIO(hs)
2
PLL_PERI1(2X)
0
PLL_AUDIO(1X)
1 0
PLL_AUDIO(2X) PLL_PERI0(1X) DIV24 GATE emac_25m_fanout OSC24M
GATE clkdiv2y dmic_clk PLL_PERI0(1X) 1
2
PLL_AUDIO(4X) 2
3 PLL_PERI1(1X) GATE clkdiv4 clkdiv2y spi0_clk
PLL_AUDIO(hs) PLL_PERI0(2X) 3
0 PLL_PERI1(2X) 4
PLL_AUDIO(1X) PLL_PERI0(1X) DIV2
1 USB48M
PLL_AUDIO(2X) GATE usb_48m_clk[3:0] 0
GATE clkdiv2y audiocodex_1x GEN OSC24M
2 PLL_PERI0(1X) 1
PLL_AUDIO(4X) OSC24M 2
3 PLL_PERI1(1X) GATE clkdiv4 clkdiv2y spi1_clk
PLL_AUDIO(hs) 3
DIV4 usb_phyclk PLL_PERI0(2X)
PLL_PERI1(2X) 4
PLL_AUDIO(1X) 0
PLL_AUDIO(2X) 1
PLL_AUDIO(1X) 0
GATE clkdiv2y audiocodex_4x
PLL_AUDIO(4X) 2
PLL_AUDIO(2X) 1
PLL_AUDIO(hs) 3 GATE clkdiv2y owa_clk
usb_12m_bak 2
OSC24M DIV2 usb_12m_clk[3:0] PLL_AUDIO(4X)
PLL_AUDIO(hs) 3
0 clk32k
PLL_VIDEO0(1X)
PLL_VIDEO0(4X) 1
2 GATE clkdiv4 clkdiv2y tcon_tv0_clk PLL_VIDEO0(1X) 0
PLL_VIDEO1(1X) 32.768kHz
3 PLL_VIDEO0(4X) 1
PLL_VIDEO1(4X) GATE clkdiv4 clkdiv2y tve_clk
PLL_VIDEO1(1X) 2
PLL_PERI0(2X) DIV
PLL_VIDEO1(4X) 3
0 GATE hdmi_cec_clk
PLL_VIDEO0(1X)
PLL_VIDEO0(4X) 1 clk32k
2 GATE clkdiv4 clkdiv2y tcon_tv1_clk
PLL_VIDEO1(1X)
PLL_VIDEO1(4X) 3
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 48
System
USB0/1/2/3、HDMI0 、TIMER、GPIO、PWM、CIR
C0_CPUX、C0_CPUX_AXI、PSI、AHB1、AHB2、AHB3、APB1、APB2、MBUS、CE、AVS、
NAND0、SMHC0/1/2、SID、EMAC0、SPI0/1
DCXO 24 MHz
PLL_CPUX C0_CPUX、C0_CPUX_AXI
PLL_DDR0 DRAM、MBUS
PLL_DDR1 DRAM、MBUS
PLL_PERI0(2X) MBUS、DE、DI、G2D、CE、NAND0、SMHC0/1/2、SPI0/1
PSI、AHB1、AHB2、AHB3、APB1、APB2、NAND0、SPI0/1、
PLL_PERI0(1X)
C0_CPUX、C0_CPUX_AXI
PLL_PERI1(2X) NAND0、SMHC0/1/2、SPI0/1
PLL_PERI1(1X) NAND0、SPI0/1
PLL_VIDEO0(4X) HDMI0、TCON_TV0/1、TVE0
PLL_VIDEO0(1X) HDMI0、TCON_TV0/1、TVE0
PLL_VIDEO1(4X) TCON_TV0/1、TVE0
PLL_VIDEO1(1X) TCON_TV0/1、TVE0
PLL_VIDEO2(4X) HDMI0
PLL_VIDEO2(1X) HDMI0
PLL_VE VE
PLL_DE DE、G2D、DI
DCXO 24MHz
M
C0_CPUX、C0_CPUX_AXI、PSI、AHB1、AHB2、AHB3、APB1、APB2、
RC16M U RTC_32K
X USB0/1/2/3、HDMI0、TIMER、LRADC、CIR、GPIO
/512
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 49
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 50
System
The frequency configuration formula of PLL_CPUX: PLL_CPUX = 24 MHz*N/P, where, the N parameter is
frequency-doubling factor of PLL, the next parameter configuration can proceed after PLL relock; the P parameter is
digital post-frequency division, which can be dynamically switched in real time, and it does not affect the normal work
of PLL.
The CPU PLL supports dynamic frequency configuration (modify the value of N). The CPU should first switch to a lower
intermediate frequency and then adjust to the target frequency when switching the frequency. The process is as
follows.
(1) Before you configure PLL_CPU, switch the clock source of CPU to PLL_PERI0(1X).
(2) Modify the N, P parameter of PLL_CPU.
(3) Write the PLL Lock Enable bit to 0 and then write it to 1.
(4) Wait the Lock bit (bit28) of PLL_CPUX_CTRL to 1.
(5) Switch the clock source of CPU to PLL_CPU.
The frequency configuration formula of PLL_AUDIO: PLL_AUDIO = 24 MHz*N/M0/M1/P. Changing any parameter of N,
M0, M1 and P will affect the normal work of PLL, which needs to be relocked. Therefore, dynamic adjustment is not
supported.
For PLL_AUDIO, two frequency points usually are needed: 24.576 MHz and 22.5792 MHz. There are generally specific
recommended configuration factors for the two frequencies. To implement the desired frequency point of PLL_AUDIO,
you need to use the decimal frequency division function. The process is as follows.
NOTE
The P factor of PLL_AUDIO is odd number, the clock output is non-equal duty.
For the clock of DDR, the switch of the clock source and the frequency division coefficient is burrless, but the
frequency adjustment of the module should follow the following rules.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 51
System
From high frequency to low frequency: switch the clock source first, and then set the frequency division
coefficient;
From low frequency to high frequency: switch the frequency division coefficient first, and then modify clock
source.
(1) At present, the PLL should be enabled. If the PLL is not enabled, refer to the PLL process from disable to enable in
section 3.3.3.5. For PLL, it is not suggested to switch during PLL using. When clock is not needed, it is suggested to
configure the PLL_OUTPUT_EN bit of PLL_CTRL to disable the output gate of PLL.
(2) General PLL cannot be used in the process of frequency modulation. It is suggested to configure the
PLL_OUTPUT_EN bit of PLL_CTRL to 0 in the process of PLL adjustment.
(3) Configure the N, M1, M0 factor. (It is not suggested to configure M1 factor, configure according to <<PLL
recommended configuration table>>)
(4) Write the PLL Lock Enable bit (bit29) of PLL_CTRL to 0 and then write it to 1.
(5) Wait the Lock bit (bit28) of PLL_CTRL to 1.
(6) Configure PLL_OUTPUT_EN to 1.
CAUTION
In the normal using of PLL, it is not recommended to switch PLL frequently, because the switch of PLL will cause
mutual interference between PLL, which will affect the stability of the system. Therefore, it is recommended to turn
off PLL by configuring the PLL_OUTPUT_EN bit of PLL_CTRL to 0, instead of writing 0 to the enable bit.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 52
System
The Bus clock supports dynamic switching, but the process of switching needs to follow the following two rules.
From high frequency to low frequency: switch the clock source first, and then set the frequency division factor;
From low frequency to high frequency: switch the frequency division factor first, and then switch clock source.
For the bus gating and reset register of modules, the reset is de-asserted first, and then the CLK gating is enabled, to
ensure that no problem will occur due to the module not being reset synchronously released.
For module clock, except DDR clock, the other clocks first configure the clock source and frequency division factor,
then release the clock gating (that is, set to 1). For the configuration order of the clock source and frequency division
factor, perform as the following rules:
With the increasing of the clock source frequency, first configure frequency division factor, then configure the
clock source;
With the decreasing of the clock source frequency, first configure the clock source, then configure the frequency
division factor.
NOTE
Having different PLL calculate formula for different PLL, please refer to each PLL_CTRL register.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 53
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 55
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 56
System
PLL_FACTOR_M is from 0 to 3.
Note: The bit is only for testing.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 58
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 59
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 60
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 61
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 62
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 63
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 64
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 65
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 66
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 67
System
PLL_FACTOR_N
PLL Factor N
15:8 R/W 0x2A N= PLL_FACTOR_N +1
PLL_FACTOR_N is from 0 to 254.
In application, PLL_FACTOR_N shall be more than or equal to 11.
7:2 / / /
PLL_INPUT_DIV_M1
PLL Input Div M1
1 R/W 0x0
M1=PLL_INPUT_DIV_M1 + 1
PLL_INPUT_DIV_M1 is from 0 to 1.
PLL_OUTPUT_DIV_M0
PLL Output Div M0
0 R/W 0x1
M0=PLL_OUTPUT_DIV_M0 + 1
PLL_OUTPUT_DIV_M0 is from 0 to 1.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 69
System
0: 24 MHz
1: 12 MHz
Note: When PLL_INPUT_DIV_M1 is 1, the bit is set to 1.
FREQ
Frequency
00: 31.5 kHz
18:17 R/W 0x0
01: 32 kHz
10: 32.5 kHz
11: 33 kHz
WAVE_BOT
16:0 R/W 0x0
Wave Bottom
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 71
System
FREQ
Frequency
00: 31.5 kHz
18:17 R/W 0x0
01: 32 kHz
10: 32.5 kHz
11: 33 kHz
WAVE_BOT
16:0 R/W 0x0
Wave Bottom
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 72
System
01: 32 kHz
10: 32.5 kHz
11: 33 kHz
WAVE_BOT
16:0 R/W 0x0
Wave Bottom
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 73
System
WAVE_BOT
16:0 R/W 0x0
Wave Bottom
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 74
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 75
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 76
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 77
System
23:21 / / /
20 R/W 0x0 FRAC_EN
19:17 / / /
16:0 R/W 0x0 FRAC_IN
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 78
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 79
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 80
System
31:21 / / /
PLL_BIAS_CTRL
20:16 R/W 0x3
PLL bias control [4:0]
15:0 / / /
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 81
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 82
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 83
System
CLK_SRC_SEL
Clock Source Select
00: OSC24M
25:24 R/W 0x0 01: RTC_32K
10: PSI
11: PLL_PERI0(1X)
APB1 CLK = Clock Source/M/N.
23:10 / / /
FACTOR_N
Factor N
00: 1
9:8 R/W 0x0
01: 2
10: 4
11: 8
7:2 / / /
FACTOR_M
1:0 R/W 0x0 Factor M.(M = FACTOR_M +1)
FACTOR_M is from 0 to 3.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 84
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 85
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 86
System
1: De-assert
15:1 / / /
DI_GATING
Gating Clock For DI
0 R/W 0x0
0: Mask
1: Pass
3.3.5.56. 0x063C G2D Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 87
System
3.3.5.59. 0x067C GPU Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 88
System
31:17 / / /
GPU_RST.
GPU Reset.
16 R/W 0x0
0: Assert
1: De-assert
15:1 / / /
GPU_GATING.
Gating Clock For GPU
0 R/W 0x0
0: Mask
1: Pass
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 89
System
CE_RST
CE Reset
16 R/W 0x0
0: Assert
1: De-assert
15:1 / / /
CE_GATING
Gating Clock for CE
0 R/W 0x0
0: Mask
1: Pass
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 90
System
1: Pass
3.3.5.64. 0x070C DMA Bus Gating Reset Register (Default Value: 0x0000_0000)
3.3.5.65. 0x073C HSTIMER Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 91
System
1: Clock is ON
SCLK = OSC24M.
30:0 / / /
3.3.5.67. 0x078C DBGSYS Bus Gating Reset Register (Default Value: 0x0000_0000)
3.3.5.68. 0x079C PSI Bus Gating Reset Register (Default Value: 0x0000_0000)
3.3.5.69. 0x07AC PWM Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 92
System
PWM_RST
PWM Reset
16 R/W 0x0
0: Assert
1: De-assert
15:1 / / /
PWM_GATING
Gating Clock for PWM
0 R/W 0x0 0: Mask
1: Pass
Note: The working clock of PWM is from APB1 or OSC24M.
3.3.5.70. 0x07BC IOMMU Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 93
System
3.3.5.72. 0x0804 MBUS Master Clock Gating Register (Default Value: 0x0000_0000)
NOTE
DE MCLK is put in DE module to control. DI MCLK is put in DI module to control.
3.3.5.73. 0x080C DRAM Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 94
System
DRAM_RST
DRAM Reset
16 R/W 0x0
0: Assert
1: De-assert
15:1 / / /
DRAM_GATING
Gating Clock for DRAM
0 R/W 0x0
0: Mask
1: Pass
3.3.5.76. 0x082C NAND Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 96
System
23:10 / / /
FACTOR_N
Factor N
00: 1
9:8 R/W 0x0
01: 2
10: 4
11: 8
7:4 / / /
FACTOR_M
3:0 R/W 0x0 Factor M.(M= FACTOR_M +1)
FACTOR_M is from 0 to 15.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 98
System
3.3.5.80. 0x084C SMHC Bus Gating Reset Register (Default Value: 0x0000_0000)
3.3.5.81. 0x090C UART Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 99
System
1: De-assert
UART3_RST
UART3 Reset
19 R/W 0x0
0: Assert
1: De-assert
UART2_RST
UART2 Reset
18 R/W 0x0
0: Assert
1: De-assert
UART1_RST
UART1 Reset
17 R/W 0x0
0: Assert
1: De-assert
UART0_RST
UART0 Reset
16 R/W 0x0
0: Assert
1: De-assert
15:6 / / /
UART5_GATING
Gating Clock for UART5
5 R/W 0x0
0: Mask
1: Pass
UART4_GATING
Gating Clock for UART4
4 R/W 0x0
0: Mask
1: Pass
UART3_GATING
Gating Clock for UART3
3 R/W 0x0
0: Mask
1: Pass
UART2_GATING
Gating Clock for UART2
2 R/W 0x0
0: Mask
1: Pass
UART1_GATING
Gating Clock for UART1
1 R/W 0x0
0: Mask
1: Pass
UART0_GATING
Gating Clock for UART0
0 R/W 0x0
0: Mask
1: Pass
NOTE
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 100
System
3.3.5.82. 0x091C TWI Bus Gating Reset Register (Default Value: 0x0000_0000)
TWI0_GATING
Gating Clock for TWI0
0 R/W 0x0
0: Mask
1: Pass
NOTE
The working clock of TWI is APB2.
SCLK_GATING
Gating Special Clock
31 R/W 0x0 0: Clock is OFF
1: Clock is ON
SCLK = Clock Source/M/N.
30:27 / / /
CLK_SRC_SEL
Clock Source Select
000: OSC24M
001: PLL_PERI0(1X)
26:24 R/W 0x0
010: PLL_PERI1(1X)
011: PLL_PERI0(2X)
100: PLL_PERI1(2X)
Others: /
23:10 / / /
FACTOR_N
Factor N
00: 1
9:8 R/W 0x0
01: 2
10: 4
11: 8
7:4 / / /
FACTOR_M
3:0 R/W 0x0 Factor M.(M= FACTOR_M +1)
FACTOR_M is from 0 to 15.
3.3.5.85. 0x096C SPI Bus Gating Reset Register (Default Value: 0x0000_0000)
SPI0_GATING
Gating Clock for SPI0
0 R/W 0x0
0: Mask
1: Pass
3.3.5.87. 0x097C EMAC Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 104
System
NOTE
The working clock of EMAC is from AHB3.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 105
System
0: Mask
1: Pass
3.3.5.90. 0x09FC THS Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 106
System
7:0 / / /
3.3.5.92. 0x0A2C OWA Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 107
System
3.3.5.94. 0x0A4C DMIC Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 108
System
0: Clock is OFF
1: Clock is ON
SCLK = Clock Source/M.
30:26 / / /
CLK_SRC_SEL
Clock Source Select
00: PLL_AUDIO(1X)
25:24 R/W 0x0
01: PLL_AUDIO(2X)
10: PLL_AUDIO(4X)
11: PLL_AUDIO(hs)
23:4 / / /
FACTOR_M
3:0 R/W 0x0 Factor M.(M= FACTOR_M +1)
FACTOR_M is from 0 to 15.
3.3.5.97. 0x0A5C AUDIO CODEC Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 109
System
00: PLL_AUDIO(1X)
01: PLL_AUDIO(2X)
10: PLL_AUDIO(4X)
11: PLL_AUDIO(hs)
23:10 / / /
FACTOR_N
Factor N
00: 1
9:8 R/W 0x0
01: 2
10: 4
11: 8
7:0 / / /
3.3.5.99. 0x0A6C AUDIO_HUB Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 110
System
0: Clock is OFF
1: Clock is ON
SCLK is from OSC24M.
28:26 / / /
OHCI0_12M_SRC_SEL
OHCI0 12M Source Select
00: 12M divided from 48 MHz
25:24 R/W 0x0
01: 12M divided from 24 MHz
10: LOSC
11: /
23:0 / / /
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 111
System
SCLK_GATING_OHCI2
Gating Special Clock For OHCI2
31 R/W 0x0
0: Clock is OFF
1: Clock is ON
USBPHY2_RST
USB PHY2 Reset
30 R/W 0x0
0: Assert
1: De-assert
SCLK_GATING_USBPHY2
Gating Special Clock For USBPHY2
29 R/W 0x0 0: Clock is OFF
1: Clock is ON
SCLK is from OSC24M.
28:26 / / /
OHCI2_12M_SRC_SEL
OHCI2 12M Source Select
00: 12M divided from 48 MHz
25:24 R/W 0x0
01: 12M divided from 24 MHz
10: LOSC
11: /
23:0 / / /
10: LOSC
11: /
23:0 / / /
3.3.5.104. 0x0A8C USB Bus Gating Reset Register (Default Value: 0x0000_0000)
1: De-assert
15:9 / / /
USBOTG_GATING
Gating Clock For USBOTG
8 R/W 0x0
0: Mask
1: Pass
USBEHCI3_GATING
Gating Clock For USBEHCI3
7 R/W 0x0
0: Mask
1: Pass
USBEHCI2_GATING
Gating Clock For USBEHCI2
6 R/W 0x0
0: Mask
1: Pass
USBEHCI1_GATING
Gating Clock For USBEHCI1
5 R/W 0x0
0: Mask
1: Pass
USBEHCI0_GATING
Gating Clock For USBEHCI0
4 R/W 0x0
0: Mask
1: Pass
USBOHCI3_GATING
Gating Clock For USBOHCI3
3 R/W 0x0
0: Mask
1: Pass
USBOHCI2_GATING
Gating Clock For USBOHCI2
2 R/W 0x0
0: Mask
1: Pass
USBOHCI1_GATING
Gating Clock For USBOHCI1
1 R/W 0x0
0: Mask
1: Pass
USBOHCI0_GATING
Gating Clock For USBOHCI0
0 R/W 0x0
0: Mask
1: Pass
3.3.5.105. 0x0A9C LRADC Bus Gating Reset Register (Default Value: 0x0000_0000)
LRADC_RST
LRADC Reset
16 R/W 0x0
0: Assert
1: De-assert
15:1 / / /
LRADC_GATING
Gating Clock For LRADC
0 R/W 0x0
0: Mask
1: Pass
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 115
System
3.3.5.109. 0x0B1C HDMI Bus Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 116
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 117
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 118
System
15:2 / / /
TCON_TV1_GATING
Gating Clock For TCON_TV1
1 R/W 0x0
0: Mask
1: Pass
TCON_TV0_GATING
Gating Clock For TCON_TV0
0 R/W 0x0
0: Mask
1: Pass
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 119
System
3.3.5.115. 0x0BBC TVE BUS Gating Reset Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 120
System
3.3.5.117. 0x0C4C HDMI HDCP Bus Gating Reset Register (Default Value: 0x0000_0000)
NOTE
If the secure bit in SID module has not been programed, the register is invalid.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 121
System
Debug Enable
0: Disable
1: Enable
30:25 / / /
DBG_SEL
Debug Select
00000: PLL_C0_CPUX
00001: /
00010: PLL_DDR0
00011: PLL_DDR1
00100: PLL_PERI0
00101: PLL_PERI1
00110: PLL_GPU
00111: /
01000: PLL_VIDEO0
01001: PLL_VIDEO1
01010: /
01011: PLL_VE
01100: PLL_DE
01101: /
24:20 R/W 0x0
01110: /
01111: PLL_AUDIO
10000: /
10001: /
10010: /
10011: /
10100: /
10101: /
10110: /
10111: /
11000: /
11001: /
11010: /
11011: /
11100: /
Others: /
19 / / /
UNLOCK_LEVEL
Unlock Level
18:17 R/W 0x0 00: 21-29 Clock Cycles
01: 22-28 Clock Cycles
1X: 20-30 Clock Cycles
LOCK_LEVEL
16 R/W 0x0 Lock Level
0: 24-26 Clock Cycles
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 122
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 123
System
3.3.5.123. 0x0F20 24M or 27M Clock Output Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 124
System
3.4.1. Overview
The BROM system has several ways to boot. It has an integrated on-chip Boot ROM (BROM) which could be considered
the primary program-loader. On startup process, the SoC starts to fetch the first instruction from address 0x0, where is
the BROM located.
The BROM system divides into two parts: FEL and Media Boot. The task of FEL is to write the external data to the local
NVM, the task of the Media Boot is to load an effective and legitimate BOOT0 from NVM and running.
There are two ways of Boot Select: GPIO Pin Select and eFuse Select. On startup, the BROM will read the state of
BOOT_MODE, according to the state of BOOT_MODE to decide whether GPIO pin or eFuse to select the kind of boot
media to boot. The BOOT_MODE is actually a bit at SID. Table 3-3 shows BOOT_MODE Setting.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 125
System
If the state of the BOOT_MODE is 0, that is to choose GPIO pin. And in GPIO pin mode, there are 5 bits to select which
boot media to boot. Table 3-4 shows boot media devices in GPIO pin mode.
NOTE
For H616 package, Boot_Select[0] is fixed at 1, so the SLC_NAND media is not supported.
If the state of the BOOT_MODE is 1, that is to choose the eFuse type. The eFuse type has one 12 bits configuration,
every 3 bits is divided into a group of the Boot Select, so it has four groups of boot_select. Table 3-5 shows eFuse Boot
Select Configuration.
eFuse_Boot_Select_Cfg[11:0]
Description
(at BROM_TRY[11:0] of SID module)
eFuse_Boot_Select[2:0] eFuse_Boot_Select_1
eFuse_Boot_Select[5:3] eFuse_Boot_Select_2
eFuse_Boot_Select[8:6] eFuse_Boot_Select_3
eFuse_Boot_Select[11:9] eFuse_Boot_Select_4
Table 3-6 describes each group of the eFuse Boot Select Setting. The first group to the third group are the same
settings, but the fourth group need to be careful. If eFuse_Boot_Select_7 is set to 111, that means the way of the Try.
The way of Try is followed by SMHC0, SMHC2, Nand Flash, SPI NOR Flash, SPI NAND Flash.
In Normal boot mode, the system boot will start from CPU0. BROM will read the Hotplug Flag Regsiter, according to
the flag whether to go through the appropriate process. Finally, BROM will read the state of the FEL Pin, if the FEL Pin
signal is detected pulling to high level, then the system will jump to the Try Media Boot process, or jump to the
mandatory upgrade process. Figure 3-6 shows the BROM Process.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 127
System
Before runing Security Boot, software must check whether it has been modified or replaced, so the system will check
and verify the integrity of the certificate, because the certificate has been using the RSA algorithm signature. The
system also uses the Crypto Engine (CE) hardware module to accelerate the speed of encryption and decryption. Using
standard cryptography ensure that the firmware images can be trusted, so the Secure BROM ensure the system
security state is as expected.
In Security boot mode, by comparison witch Normal BROM, after the Try Media Boot process finishes, the system will
go to run Security BROM software. Figure 3-7 shows the Secure BROM Process.
When the system chooses to whether enter Mandatory Upgrade Processor, if the FEL signal is detected pulling to low
level, then the system will jump to the Mandatory Upgrade Process. Figure 3-8 shows the mandatory upgrade process.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 128
System
NOTE
The FEL address of the Normal BROM is 0x20.
The FEL address of the Secure BROM is 0x64.
When the system chooses to enter Mandatory Upgrade Process, then the system will jump to the FEL process. Figure
3-9 shows the FEL upgrade process.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 129
System
When the system chooses to whether enters mandatory upgrade process, if the FEL pin signal is detected pulling high,
then the system will jump to the try media boot process.
Try Media Boot Process will read the state of BOOT_MODE register, the state of BOOT_MODE decides whether to boot
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 130
System
from GPIO pin or efuse. Figure 3-10 shows GPIO pin boot select process. Figure 3-11 shows efuse boot select process.
NOTE
SMHC0 usually is external SD/TF Card.
SMHC2 usually is external eMMC.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 131
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 132
System
3.5.1. Overview
The system configuration module is used to configure parameter for system domain, such as SRAM, CPU, PLL, BROM,
and so on.
The address range of SRAM is as follows.
Area Address Size
SRAM A1 0x0002 0000---0x0002 7FFF 32KB(Supports Byte operation, the clock source is AHB1)
Borrows 128KB from VE, borrows 64KB from DE,
SRAM C 0x0002 8000---0x0005 7FFF supports Byte operation, the clock source can be
switched to AHB1)
3.5.2.1. SRAM
The system SRAM includes SRAM A1 and SRAM C. The address between SRAM A1 and SRAM C is continuous.
The SRAM A1 is used in System area, the SRAM C is a memory which system borrows from specific module(such as DE,
VE), only in special scene(such as BOOT, STANDBY, etc), the SRAM C will switch to system to use.
When the SRAM of the module switchs to SRAM C, then the clock of the SRAM switchs to AHB1, if using SRAM C, the
switch needs be opened, and the bus gating of the module needs be opened, the SRAM can be accessed.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 133
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 134
System
EMAC0 CLK_SEL
18 R/W 0x1 0 : 25 MHz
1 : 24 MHz
EMAC0 LED_POL
17 R/W 0x0 0 : High active
1 : Low active
EMAC0 SHUTDOWN
16 R/W 0x1 0 : Power up
1 : Shutdown
EMAC0 PHY_SELECT
15 R/W 0x1 0 : External PHY
1 : Internal PHY
14 / / /
EMAC0 RMII_EN
0 : Disable RMII Module
13 R/W 0x0 1 : Enable RMII Module
When this bit is asserted, MII or RGMII interface is disabled( This means bit13
is prior to bit2)
EMAC0 ETXDC
12:10 R/W 0x0
Configure EMAC Transmit Clock Delay Chain
EMAC0 ERXDC
9:5 R/W 0x0
Configure EMAC Receive Clock Delay Chain
EMAC0 ERXIE
Enable EMAC Receive Clock Invertor
4 R/W 0x0
0: Disable
1: Enable
EMAC0 ETXIE
Enable EMAC Transmit Clock Invertor
3 R/W 0x0
0: Disable
1: Enable
EMAC0 EPIT
EMAC PHY Interface Type
2 R/W 0x0
0: MII
1: RGMII
EMAC0 ETCS
EMAC Transmit Clock Source
00: Transmit clock source for MII
1:0 R/W 0x0
01: External transmit clock source for GMII and RGMII
10: Internal transmit clock source for GMII and RGMII
11: Reserved
NOTE
When configuring RMII interface, the bit13 should be written to 1, and the bit2 should be written to 0. Select TXCLK
as the clock source of RMII, the bit0 can be written to 0.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 135
System
3.6. Timer
3.6.1. Overview
The timer module implements the timing and counting functions. The timer module includes timer0, timer1,
watchdog and AVS0, AVS1.
The timer 0 and timer 1 are completely consistent. The timer 0 and timer 1 have the following features:
Configurable count clock: LOSC and OSC24M. LOSC is the internal low-frequency clock or the external
low-frequency clock by setting LOSC_SRC_SEL. The external low-frequency has much accuracy.
Configurable 8 prescale factor
Programmable 32-bit down timer
Two working modes: continue mode and single count mode
Generates an interrupt when the count is decreased to 0
The watchdog is used to transmit a reset signal to reset the entire system after an exception occurs in the system. The
watchdog has the following features:
Single clock source: OSC24M/750
12 initial values to configure
Generation of timeout interrupts
Generation of reset signal
Watchdog restart the timing
The AVS is used to the synchronization of audio and video. The AVS module includes AVS0 and AVS1, the AVS0 and AVS1
are completely consistent. The AVS has the following features:
Single clock source: OSC24M
Programmable 33-bit up timer
Initial value can be updated anytime
12-bit frequency divider factor
Pause/Start function
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 136
System
/1 Timer0
/2
/4 IRQ EN
24M Single
/8 Yes
/1 Interval Value Enable IV=0 ? Pending IRQ
6
/32
LOSC Continuous
/64
/128
Timer1
16k cycles
32k cycles Yes
Reset Whole System Enable Time out ? Pending Reset
64k cycles
96k cycles
24M/750 Watchdog Restart
128k cycles
160k cycles
192k cycles Yes
Interrupt Enable Time out ? Pending IRQ
other cycles
Restart
AVS0
Cycle output
24M Enable Pause
AVS1
TMR0_INTV_VALUE_REG - TMR0_CUR_VALUE_REG
× TMR0_CLK_PRES
TMR0_CLK_SRC
Ttimer0 =
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 137
System
APB1
Reset
Watchdog Timer AVS
IRQ IRQ
3.6.3.3.1. Timer
The timer is a 32-bit down counter, the counter value is decreased by 1 on each rising edge of the count clock. Each
timer has independent interrupt.
Continuous mode
The bit7 of the TMRn_CTRL_REG is set to the continuous mode, when the count value is decreased to 0, the timer
module reloads data from TMRn_INTV_VALUE_REG then continues to count.
Single mode
The bit7 of the TMRn_CTRL_REG is set to the single mode, when the count value is decreased to 0, the timer stops
counting. The timer starts to count again only when a new initial value is loaded.
Each timer has a prescaler that divides the working clock frequency of each timer by 1,2,4,8,16,32,64,128.
3.6.3.3.2. Watchdog
The watchdog is a 32-bit down counter, the counter value is decreased by 1 on each rising edge of the count clock.
Interrupt mode
The WDOG0_CFG_REG is set to 0x2, when the counter value reaches 0 and WDOG0_IRQ_EN_REG is enabled, the
watchdog generates an interrupt, the watchdog enters into interrupt mode.
Reset mode
The WDOG0_CFG_REG is set to 0x1, when the counter value reaches 0, the watchdog generates a reset signal to reset
the entire system.
The clock source of the watchdog is OSC24M/750. There are 12 configurable initial count values.
The watchdog can restart to count by setting the WDOG0_CTRL_REG: write 0xA57 to bit[12:1], then write 1 to bit[0].
3.6.3.3.3. AVS
The AVS is a 33-bit up counter. The counter value is increased by 1 on each rising edge of the count clock.
The AVS can be operated after its clock gating in CCU module is opened.
The AVS has an OSC24M clock source and a 12-bit division factor(N1 or N2). When the timer increases to N1 or N2 from
0, AVS counter adds 1; when the counter reaches 33-bit upper limit, the AVS will start to count from initial value again.
In counter working process, the division factor and initial counter of the AVS can be changed anytime. And the AVS can
stop or start to operate counter anytime.
(1) Configure the timer parameters: clock source, prescale factor, working mode. The configuration of these
parameters have no sequence, and can be implemented by writing TMRn_CTRL_REG.
(2) Write the initial value: write TMRn_INTV_VALUE_REG to provide an initial value for the timer; write the bit[1] of
TMRn_CTRL_REG to load the initial value to the timer, if the bit[1] is 1, writing operation cannot perform; if is 0,
this indicates successful loading.
(3) Enable timer: write the bit[0] of TMRn_CTRL_REG to enable timer count; read TMRn_CUR_VALUE_REG to get the
current count value.
(1) Enable interrupt: write corresponding interrupt enable bit of TMR_IRQ_EN_REG, when timer counter time reaches,
the corresponding interrupt generates.
(2) After enter interrupt process, write TMR_IRQ_STA_REG to clear the interrupt pending, and execute the process of
waiting for the interrupt.
(3) Resume the interrupt and continue to execute the interrupted process.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 139
System
(1) Write WDOG0_CFG_REG to configure the generation of the interrupts and the output of reset signal.
(2) Write WDOG0_MODE_REG to configure the initial count value.
(3) Write WDOG0_MODE_REG to enable the watchdog.
3.6.4.1. Timer
Take making a 1ms delay for an example, 24M clock source, single mode and 2 pre-scale will be selected in the
instance.
writel(0x2EE0,TMR_0_INTV); //Set interval value
writel(0x94, TMR_0_CTRL); //Select Single mode,24 MHz clock source,2 pre-scale
writel(readl(TMR_0_CTRL)|(1<<1), TMR_0_CTRL); //Set Reload bit
while((readl(TMR_0_CTRL)>>1)&1); //Waiting Reload bit turns to 0
writel(readl(TMR_0_CTRL)|(1<<0), TMR_0_CTRL); //Enable Timer0
In the following instance making configurations for Watchdog: configure clock source as 24M/750, configure Interval
Value as 1s and configure Watchdog Configuration as To whole system. This instance indicates that reset system after
1s.
In the following instance making configurations for Watchdog: configure clock source as 24M/750, configure Interval
Value as 1s and configure Watchdog Configuration as To whole system. In the following instance, if the time of other
codes is larger than 1s, watchdog will reset the whole system. If the sentence of restart watchdog is implemented
inside 1s, watchdog will be restarted.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 141
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 142
System
NOTE
The value setting should consider the system clock and the timer clock source.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 143
System
NOTE
The value should consider the system clock and the timer clock source.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 145
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 146
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 147
System
AVS_CNT0_D
Divisor N for AVS Counter 0
AVS CN0 CLK=24 MHz/Divisor_N0.
Divisor N0 = Bit [11:0] + 1
The number N is from 1 to 0x7ff. The zero value is reserved.
11:0 R/W 0x5DB The internal 33-bit counter engine will maintain another 12-bit counter. The
12-bit counter is used for counting the cycle number of one 24 MHz clock.
When the 12-bit counter reaches (>= N) the divisor value, the internal 33-bit
counter register will increase 1 and the 12-bit counter will reset to zero and
restart again.
It can be configured by software at any time.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 149
System
3.7.1. Overview
The high speed timer(HSTimer) module implements more precise timing and counting functions.
N_Mode Single
IRQ EN
Yes
AHBCLK HSTimer Interval Value Enable IV=0 ? Pending IRQ
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 150
System
AHB1
AHB1CLK
High Speed Timer
IRQ
The high speed timer is a 56-bit down counter, the counter value is decreased by 1 on each rising edge of the count
clock.
Continuous mode: The bit7 of HS_TMR0_CTRL_REG is set to the continuous mode, when the count value is
decreased to 0, the high speed timer module reloads data from HS_TMR_INTV_LO_REG and HS_TMR_INTV_HI_REG,
then continues to count.
Single mode: The bit7 of HS_TMR0_CTRL_REG is set to the single mode, when the count value is decreased to 0,
the high speed timer stops counting. The high speed timer starts to count again only when a new initial value is loaded.
Normal mode: When the bit31 of HS_TMR0_CTRL_REG is set to the normal mode, the high speed timer is used as
56-bit down counter, which can finish continuous timing and single timing.
Test mode: When the bit31 of HS_TMR0_CTRL_REG is set to the test mode, then HS_TMR_INTV_LO_REG must be
set to 0x1, the high speed timer is used as 24-bit down counter, and HS_TMR_INTV_HI_REG is the initial value of the
high speed timer.
Each high speed timer has a prescaler that divides the working clock frequency of each working timer by 1,2,4,8,16.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 151
System
Enable HSTimer
(1) Enable interrupt: Write the corresponding interrupt enable bit of HS_TMR_IRQ_EN_REG, when the counting time
of high speed timer reaches, the corresponding interrupt generates.
(2) After enter the interrupt process, write HS_TMR_IRQ_STAS_REG to clear the interrupt pending.
(3) Resume the interrupt and continue to execute the interrupted process.
Take making a 1us delay using HSTimer0 for an instance as follows, AHB1CLK will be configured as 100 MHz and
n_mode,single mode and 2 pre-scale will be selected in this instance.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 152
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 153
System
HS_TMR0_RELOAD
High Speed Timer 0 Reload
1 R/W1S 0x0
0: No effect
1: Reload High Speed Timer 0 Interval Value
HS_TMR0_EN
High Speed Timer 0 Enable
0: Stop/Pause
1: Start
If the timer starts, it will reload the interval value to internal register, and the
current counter will count from interval value to 0.
0 R/W 0x0 If the current counter does not reach the zero, the timer enable bit is set to
“0”, the current value counter will pause. At least wait for 2 cycles, the start
bit can be set to 1.
In timer pause state, the interval value register can be modified. If the timer
starts again, and the software hopes the current value register to down-count
from the new interval value, the reload bit and the enable bit should be set
to 1 at the same time.
NOTE
The interval value register is a 56-bit register. When read or write the interval value, the Lo register should be read
or written first. And the High register should be written after the Lo register.
NOTE
HS timer current value is a 56-bit down-counter (from interval value to 0).
The current value register is a 56-bit register. When read or write the current value, the Low register should be read
or written first.
HS_TMR1_RELOAD
High Speed Timer 1 Reload
1 R/W1S 0x0
0: No effect
1: Reload High Speed Timer 1 Interval Value
HS_TMR1_EN
High Speed Timer 1 Enable
0: Stop/Pause
1: Start
If the timer starts, it will reload the interval value to internal register, and the
current counter will count from interval value to 0.
0 R/W 0x0 If the current counter does not reach the zero, the timer enable bit is set to
“0”, the current value counter will pause. At least wait for 2 cycles, the start
bit can be set to 1.
In timer pause state, the interval value register can be modified. If the timer
starts again, and the software hopes the current value register to down-count
from the new interval value, the reload bit and the enable bit should be set
to 1 at the same time.
NOTE
The interval value register is a 56-bit register. When read or write the interval value, the Lo register should be read
or written first. And the High register should be written after the Lo register.
NOTE
HS timer current value is a 56-bit down-counter (from interval value to 0).
The current value register is a 56-bit register. When read or write the current value, the Low register should be read
or written first.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 158
System
3.8. GIC
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 160
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 161
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 162
System
For complete GIC information, refer to the GIC PL400 technical reference manual and ARM GIC Architecture
Specification V2.0.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 163
System
3.9. DMA
3.9.1. Overview
The direction memory access (DMA) is used to transfer data between a peripheral and a memory, between peripherals,
or between memories. DMA is a high-speed data transfer operation that reduces the CPU resources.
Memory Bus
DMA_CHANNEL0 DMA_MPORT
DMA_CHANNEL1
DMA_FIFO CTRL
DRQs
DMA_ARBITER
DMA_CHANNEL 14
DMA_CHANNEL 15
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 164
System
next channel of the current channel has the higher priority; if DMA_ARBITER is idle, the channel0 has the highest
priority, whereas the channel 15 has the lowest priority.
DMA_MPORT: Receive read/write requirement of DMA_ARBITER, and convert to the corresponding MBUS access.
DMA_FIFOCTL: Internal FIFO cell control module.
DMA_REGIF: Common register module, mainly used to resolve AHB1 demand.
DMA_CLKGATE: Hardware auto clock gating control module.
DMA integrates 16 independent DMA channels. When DMA channel starts, DMA gets DMA descriptor by
DMA_DESC_ADDR_REG to use for the configuration information of the current DMA package transfer, and DMA can
transfer data between the specified peripherals through the configuration information. When a package transfer
finished, DMA judges whether the current channel transfer finished or continues to obtain/transfer the descriptor of
the next package through the linked information in descriptor. When the chained address information of the
descriptor indicates the current channel transfer is completed, DMA will close chain-transfer and the channel.
DMA is on AHB1. The clock of AHB1 influences the transfer efficiency of DMA.
Device 0
Device 1
Device 2
Device 3
BUS
AHB Slave Interface DMA
Interface
Device 4
Device 5
Device 14
Device 15
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 165
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 166
System
Port41 Port41
Port42 Port42
Port43 TWI0 Port43 TWI0
Port44 TWI1 Port44 TWI1
Port45 TWI2 Port45 TWI2
Port46 TWI3 Port46 TWI3
Port47 TWI4 Port47 TWI4
Port48 S_TWI0 Port48 S_TWI0
Configuration
Source
Address
Destination
Address
Byte Counter
Parameter
Link
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 167
System
3.9.3.5. Interrupt
The half package interrupt is enabled, DMA sends half package interrupt after the half package transfer completes.
The total package interrupt is enabled, DMA sends package end interrupt after the total package transfer completes.
The total queue interrupt is enabled, DMA sends queue end interrupt after the total queue completes.
Notice that when CPU does not respond to the interrupts timely, or two DMA interrupts generate very closely, the
later interrupt may override the former one. So For CPU, the DMA has only a system interrupt source.
3.9.3.6. Security
DMA supports system Trustzone, and supports DMA channel secure mode. Each DMA channel is secure by default.
When system Trustzone is enabled, DMA is secure, only the secure devices can access DMA.
When DMA channel is configured to non-secure, then the channel can only access the non-secure memory area. DMA
cannot write data to secure memory area, the read-back data from secure memory area is 0.
DMA CLK GATE module is the clock module of auto-controlled by hardware. DMA CLK GATE module is mainly used to
generate the clock of DMA sub-module and the local circuit in module, including clock gating of channel and clock
gating of public part.
The clock gating of the channel indicates DMA clock can auto-open when the system accesses the current DMA
channel register and DMA channel is enabled. When DMA transfer is completed, DMA channel clock can auto-close
after 16 HCLK delay, meanwhile the clock of the corresponding channel control and FIFO control will be closed.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 168
System
The clock gating of the common part indicates the clock of the common circuit can auto-close when all DMA channels
are opened. The common circuit includes the common circuit of FIFO control module, MPORT module and memory
bus clock.
DMA clock gating can support all the functions stated above or not by software.
DMA supports two data transfer modes: wait mode and handshake mode.
When device request signal enters DMA, the device request signal is transformed into the internal DRQ signal through
block and wait counter. The transformed principle is as follows.
When DMA detects the external request signal valid, DMA starts to operate the device, the internal DRQ always
holds high level before the block operating amount reaches.
When the transfer amount of DMA reaches the block operating amount, the internal DRQ pulls low
automatically.
After the internal DRQ holds low automatically at the DMA cycle of wait counter times, DMA restarts to detect
the external request, if the external request signal is valid, then the next transfer starts.
When DMA detects the external request signal valid, DMA starts to operate the device, the internal DRQ always
holds high level before the block operating amount reaches.
When the transfer amount of DMA reaches the block operating amount, the internal DRQ pulls low
automatically; meanwhile within the last DMA operation before reaching block amount, DMA follows the
operating demand to send DMA last signal simultaneously.
The DMA last signal that is used as a part of DMA demand transmits at BUS, when the device receives the
operating demand of DMA last at BUS, the device can judge DMA transfer block length finished, that is before
transmit the request again, DMA operation cannot appear, and a DMA active signal is generated to the DMA
controller. Notice that each DRQ signal of device corresponds to an active signal, if the device has many DRQ
signals, then DMA returns different active signal through different bus operation.
When DMA receives the transmitted active signal of devices, DMA ACK signal is returned to devices.
After the device receives DMA ACK signal, if all operations of devices are completed , FIFO status and DRQ status
are refreshed, then active signal is set as invalid.
When DMA detects the falling edge of active signal, then the corresponding ACK signal is set as invalid, and DMA
restarts to detect the external request signal. If the request signal is valid, then the next transfer starts.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 169
System
reach
autom block siz
atica e,
lly,se DRQ pull
nd DM do
A last wn
signa
l
l
signa
active
turn
ig nal,re
ive last s
Rece
Rece
ive a ctive
signa
l,re turn
DMAC ACK DEVICE
lidate
,inva
pdate
RQ u
w a it ing D nal
CK, sig
Rece
ive A active
Dete
signa c
l ,inva t falling ed
li
signa date ACK ge of activ
l ,star ; e
t nex re-detect
t tran r
simis equest
sion
The DMA supports address alignment of non-IO devices, that is when the start address of non-IO devices is non
32-byte aligned, DMA firstly aligns the burst transfer within 32-byte to 32-byte. If the device of a DMA channel is
configured to non-IO type, and the start address is 0x86, then DMA firstly aligns 26-byte burst transfer to 0xA0, then
DMA transfers by 64-byte burst(maximum transfer amount of MBUS allowed). The address 32-byte alignment helps to
improve the DRAM access efficiency.
IO devices do not support address alignment, so the bit width of IO devices must match the address offset, or not
DMA ignores the non-consistency and indirectly transmits data of the corresponding bit width to the address.
The DMA descriptor address does not support auto-aligned function. The address must ensure word-aligned, or not
DMA cannot identify descriptor.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 170
System
The DMA clock is synchronous with AHB1 clock. Make sure that open the DMA gating bit of AHB1 clock before
access DMA register.
The reset input signal of DMA is asynchronous with AHB1, and is low valid by default. Make sure that de-assert
the reset signal of DMA before access DMA register.
To avoid indefinite state within registers , firstly de-assert the reset signal, secondly open the gating bit of AHB1.
DMA has the function of clock auto gating, DMA clock can be disabled in DMA idle state using software to reduce
power consumption. DMA enables clock auto gating by default.
(1) Request DMA channel, and judge the idle state of the channel by whether DMA channel is enabled.
(2) Write the descriptor(6 words) into memory, the descriptor must be word-aligned. Refer to 3.9.3.4 DMA descriptor
in detail.
(3) Write the start address of storing descriptor to DMA_DESC_ADDR_REG.
(4) Enable DMA channel, and write the corresponding channel to DMA_EN_REG.
(5) DMA obtains the descriptor information.
(6) Start to transmit a package, when half package is completed, DMA sends Half Package Transfer Interrupt; when
total package is completed, DMA sends Package End Transfer Interrupt. These interrupt status can be read by
DMA_IRQ_PEND_REG.
(7) Set DMA_PAU_REG to pause or resume the data transfer.
(8) After completed the total package transfer, DMA decides to start the next package transfer or end the transfer by
the link of the descriptor. If the link is 0xFFFFF800, the transfer ends; if the link is other value, the next package
starts to transmit. When the transfer ends, DMA sends Queue End Transfer Interrupt.
(9) Disable the DMA channel.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 171
System
Request DMA
No
Any Idle?
Half-Pend
DMA transmit package data Yes
Pkg-Pend
Resume?
Pause? Yes
No
Link=0xFFFFF800?
Yes
End-Pend
(1) Enable interrupt: write the corresponding interrupt enable of DMA_IRQ_EN_REG, when the corresponding
interrupt condition is satisfied, the corresponding interrupt generates.
(2) After enter the interrupt process, write DMA_IRQ_PEND_REG to clear the interrupt pending, and execute the
process of waiting for the interrupt.
(3) Resume the interrupt and continue to execute the interrupted process.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 172
System
(1) The transfer width of IO type device is consistent with the offset of start address.
(2) MBUS protocol does not support read operation of non-integer word, so for non-integer word read operation,
device must ignore redundant inconsistent data between data width and configuration, that is, the device of
non-integer word must interpret DMA demand through its FIFO width instead of read demand width.
(3) When the DMA transfer is paused, this is equivalent to invalid DRQ. Because DMA transfer command has a certain
time delay, DMA will not stop transfer immediately until the current command and the command in Arbiter
finished, at most 32-byte data.
DMA supports increasing data package in transfer, there are a few points to note here.
When the value of DMA Channel Descriptor Address Register is 0xFFFFF800, it indicates that DMA channel has
got back the descriptor of the last package. When DMA channel completed the package data transfer, DMA
channel will stop automatically data transfer.
If data packages are needed to increase, then at first it is essential to judge that whether DMA channel has got
back the descriptor of the last package, if DMA channel has got back the descriptor of the last package, then this
is impossible for increasing data package, DMA channel need start again. If DMA is not transmitting the last
package, then the last descriptor address 0xFFFFF800 can be changed to the start address of the next descriptor.
To ensure that the data changed valid, we can read again the value of DMA Channel Descriptor Address Register
after changed the data. If there is not 0xFFFFF800, then it indicates that increasing data package is succeed, and
fail otherwise. Because the process of increasing data package needs some time, during this time, DMA channel
may get back the descriptor of the last package. At the moment we can read again DMA Channel Current Source
Address Register and DMA Channel Current Destination Address Register, if the increasing memory address
accords with the information of the increasing data package, then the increasing data package is succeed, and fail
otherwise.
To ensure the higher success rate, it is suggested that increase data package before half package interrupt of
penultimate data package.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 173
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 174
System
0: Disable
1: Enable
27 / / /
DMA6_QUEUE_IRQ_EN
DMA 6 Queue End Transfer Interrupt Enable
26 R/W 0x0
0: Disable
1: Enable
DMA6_PKG_IRQ_EN
DMA 6 Package End Transfer Interrupt Enable
25 R/W 0x0
0: Disable
1: Enable
DMA6_HLAF_IRQ_EN
DMA 6 Half Package Transfer Interrupt Enable
24 R/W 0x0
0: Disable
1: Enable
23 / / /
DMA5_QUEUE_IRQ_EN
DMA 5 Queue End Transfer Interrupt Enable
22 R/W 0x0
0: Disable
1: Enable
DMA5_PKG_IRQ_EN
DMA 5 Package End Transfer Interrupt Enable
21 R/W 0x0
0: Disable
1: Enable
DMA5_HLAF_IRQ_EN
DMA 5 Half package Transfer Interrupt Enable
20 R/W 0x0
0: Disable
1: Enable
19 / / /
DMA4_QUEUE_IRQ_EN
DMA 4 Queue End Transfer Interrupt Enable.
18 R/W 0x0
0: Disable
1: Enable
DMA4_PKG_IRQ_EN
DMA 4 Package End Transfer Interrupt Enable
17 R/W 0x0
0: Disable
1: Enable
DMA4_HLAF_IRQ_EN
DMA 4 Half Package Transfer Interrupt Enable
16 R/W 0x0
0: Disable
1: Enable
15 / / /
DMA3_QUEUE_IRQ_EN
14 R/W 0x0 DMA 3 Queue End Transfer Interrupt Enable
0: Disable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 175
System
1: Enable
DMA3_PKG_IRQ_EN
DMA 3 Package End Transfer Interrupt Enable
13 R/W 0x0
0: Disable
1: Enable
DMA3_HLAF_IRQ_EN
DMA 3 Half Package Transfer Interrupt Enable
12 R/W 0x0
0: Disable
1: Enable
11 / / /
DMA2_QUEUE_IRQ_EN
DMA 2 Queue End Transfer Interrupt Enable
10 R/W 0x0
0: Disable
1: Enable
DMA2_PKG_IRQ_EN
DMA 2 Package End Transfer Interrupt Enable
9 R/W 0x0
0: Disable
1: Enable
DMA2_HLAF_IRQ_EN
DMA 2 Half Package Transfer Interrupt Enable
8 R/W 0x0
0: Disable
1: Enable
7 / / /
DMA1_QUEUE_IRQ_EN
DMA 1 Queue End Transfer Interrupt Enable
6 R/W 0x0
0: Disable
1: Enable
DMA1_PKG_IRQ_EN
DMA 1 Package End Transfer Interrupt Enable.
5 R/W 0x0
0: Disable
1: Enable
DMA1_HLAF_IRQ_EN
DMA 1 Half Package Transfer Interrupt Enable
4 R/W 0x0
0: Disable
1: Enable
3 / / /
DMA0_QUEUE_IRQ_EN
DMA 0 Queue End Transfer Interrupt Enable
2 R/W 0x0
0: Disable
1: Enable
DMA0_PKG_IRQ_EN
DMA 0 Package End Transfer Interrupt Enable
1 R/W 0x0
0: Disable
1: Enable
0 R/W 0x0 DMA0_HLAF_IRQ_EN
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 176
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 177
System
DMA13_HLAF_IRQ_EN
DMA 13 Half package Transfer Interrupt Enable
20 R/W 0x0
0: Disable
1: Enable
19 / / /
DMA12_QUEUE_IRQ_EN
DMA 12 Queue End Transfer Interrupt Enable.
18 R/W 0x0
0: Disable
1: Enable
DMA12_PKG_IRQ_EN
DMA 12 Package End Transfer Interrupt Enable
17 R/W 0x0
0: Disable
1: Enable
DMA12_HLAF_IRQ_EN
DMA 12 Half Package Transfer Interrupt Enable
16 R/W 0x0
0: Disable
1: Enable
15 / / /
DMA11_QUEUE_IRQ_EN
DMA 11 Queue End Transfer Interrupt Enable
14 R/W 0x0
0: Disable
1: Enable
DMA11_PKG_IRQ_EN
DMA 11 Package End Transfer Interrupt Enable
13 R/W 0x0
0: Disable
1: Enable
DMA11_HLAF_IRQ_EN
DMA 11 Half Package Transfer Interrupt Enable
12 R/W 0x0
0: Disable
1: Enable
11 / / /
DMA10_QUEUE_IRQ_EN
DMA 10 Queue End Transfer Interrupt Enable
10 R/W 0x0
0: Disable
1: Enable
DMA10_PKG_IRQ_EN
DMA 10 Package End Transfer Interrupt Enable
9 R/W 0x0
0: Disable
1: Enable
DMA10_HLAF_IRQ_EN
DMA 10 Half Package Transfer Interrupt Enable
8 R/W 0x0
0: Disable
1: Enable
7 / / /
6 R/W 0x0 DMA9_QUEUE_IRQ_EN
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 178
System
3.9.6.3. 0x0010 DMA IRQ Pending Status Register 0 (Default Value: 0x0000_0000)
1: Pending
27 / / /
DMA6_QUEUE_IRQ_PEND
DMA 6 Queue End Transfer Interrupt Pending. Setting 1 to the bit will
26 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA6_PKG_IRQ_ PEND
DMA 6 Package End Transfer Interrupt Pending. Setting 1 to the bit will
25 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA6_HLAF_IRQ_PEND
DMA 6 Half Package Transfer Interrupt Pending. Setting 1 to the bit will
24 R/W1C 0x0 clear it.
0: No effect
1: Pending
23 / / /
DMA5_QUEUE_IRQ_PEND
DMA 5 Queue End Transfer Interrupt Pending. Setting 1 to the bit will
22 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA5_PKG_IRQ_ PEND
DMA 5 Package End Transfer Interrupt Pending. Setting 1 to the bit will
21 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA5_HLAF_IRQ_PEND
DMA 5 Half Package Transfer Interrupt Pending. Setting 1 to the bit will
20 R/W1C 0x0 clear it.
0: No effect
1: Pending
19 / / /
DMA4_QUEUE_IRQ_PEND
DMA 4 Queue End Transfer Interrupt Pending. Setting 1 to the bit will
18 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA4_PKG_IRQ_ PEND
DMA 4 Package End Transfer Interrupt Pending. Setting 1 to the bit will
17 R/W1C 0x0 clear it.
0: No effect
1: Pending
16 R/W1C 0x0 DMA4_HLAF_IRQ_PEND
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 180
System
DMA 4 Half Package Transfer Interrupt Pending. Setting 1 to the bit will
clear it.
0: No effect
1: Pending
15 / / /
DMA3_QUEUE_IRQ_PEND
DMA 3 Queue End Transfer Interrupt Pending. Setting 1 to the bit will
14 R/W1C 0x0 clear it.
0: No effect
1: Pending.
DMA3_PKG_IRQ_PEND
DMA 3 Package End Transfer Interrupt Pending. Setting 1 to the bit will
13 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA3_HLAF_IRQ_PEND
DMA 3 Half Package Transfer Interrupt Pending. Setting 1 to the bit will
12 R/W1C 0x0 clear it.
0: No effect
1: Pending
11 / / /
DMA2_QUEUE_IRQ_PEND
DMA 2 Queue End Transfer Interrupt Pending. Setting 1 to the bit will
10 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA2_PKG_IRQ_PEND
DMA 2 Package End Transfer Interrupt Pending. Setting 1 to the bit will
9 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA2_HLAF_IRQ_PEND
DMA 2 Half Package Transfer Interrupt Pending. Setting 1 to the bit will
8 R/W1C 0x0 clear it.
0: No effect
1: Pending
7 / / /
DMA1_QUEUE_IRQ_PEND
DMA 1 Queue End Transfer Interrupt Pending. Setting 1 to the bit will
6 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA1_PKG_IRQ_PEND
5 R/W1C 0x0 DMA 1 Package End Transfer Interrupt Pending. Setting 1 to the bit will
clear it.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 181
System
0: No effect
1: Pending
DMA1_HLAF_IRQ_PEND
DMA 1 Half Package Transfer Interrupt Pending. Setting 1 to the bit will
4 R/W1C 0x0 clear it.
0: No effect
1: Pending
3 / / /
DMA0_QUEUE_IRQ_PEND
DMA 0 Queue End Transfer Interrupt Pending. Setting 1 to the bit will
2 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA0_PKG_IRQ_ PEND
DMA 0 Package End Transfer Interrupt Pending. Setting 1 to the bit will
1 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA0_HLAF_IRQ_PEND
DMA 0 Half Package Transfer Interrupt Pending. Setting 1 to the bit will
0 R/W1C 0x0 clear it.
0: No effect
1: Pending
3.9.6.4. 0x0014 DMA IRQ Pending Status Register 1 (Default Value: 0x0000_0000)
27 / / /
DMA14_QUEUE_IRQ_PEND
DMA 14 Queue End Transfer Interrupt Pending. Setting 1 to the bit will
26 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA14_PKG_IRQ_ PEND
DMA 14 Package End Transfer Interrupt Pending. Setting 1 to the bit will
25 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA14_HLAF_IRQ_PEND
DMA 14 Half Package Transfer Interrupt Pending. Setting 1 to the bit
24 R/W1C 0x0 will clear it.
0: No effect
1: Pending
23 / / /
DMA13_QUEUE_IRQ_PEND
DMA 13 Queue End Transfer Interrupt Pending. Setting 1 to the bit will
22 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA13_PKG_IRQ_ PEND
DMA 13 Package End Transfer Interrupt Pending. Setting 1 to the bit will
21 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA13_HLAF_IRQ_PEND
DMA 13 Half Package Transfer Interrupt Pending. Setting 1 to the bit
20 R/W1C 0x0 will clear it.
0: No effect
1: Pending
19 / / /
DMA12_QUEUE_IRQ_PEND
DMA 12 Queue End Transfer Interrupt Pending. Setting 1 to the bit will
18 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA12_PKG_IRQ_ PEND
DMA 12 Package End Transfer Interrupt Pending. Setting 1 to the bit will
17 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA12_HLAF_IRQ_PEND
16 R/W1C 0x0
DMA 12 Half Package Transfer Interrupt Pending. Setting 1 to the bit
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 183
System
1: Pending
DMA9_HLAF_IRQ_PEND
DMA 9 Half Package Transfer Interrupt Pending. Setting 1 to the bit will
4 R/W1C 0x0 clear it.
0: No effect
1: Pending
3 / / /
DMA8_QUEUE_IRQ_PEND
DMA 8 Queue End Transfer Interrupt Pending. Setting 1 to the bit will
2 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA8_PKG_IRQ_ PEND
DMA 8 Package End Transfer Interrupt Pending. Setting 1 to the bit will
1 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA8_HLAF_IRQ_PEND
DMA 8 Half Package Transfer Interrupt Pending. Setting 1 to the bit will
0 R/W1C 0x0 clear it.
0: No effect
1: Pending
DMA11_SEC
DMA channel 11 security
11 R/W 0x0
0: Secure
1: Non-secure
DMA10_SEC
DMA channel 10 security
10 R/W 0x0
0: Secure
1: Non-secure
DMA9_SEC
DMA channel 9 security
9 R/W 0x0
0: Secure
1: Non-secure
DMA8_SEC
DMA channel 8 security
8 R/W 0x0
0: Secure
1: Non-secure
DMA7_SEC
DMA channel 7 security
7 R/W 0x0
0: Secure
1: Non-secure
DMA6_SEC
DMA channel 6 security
6 R/W 0x0
0: Secure
1: Non-secure
DMA5_SEC
DMA channel 5 security
5 R/W 0x0
0: Secure
1: Non-secure
DMA4_SEC
DMA channel 4 security
4 R/W 0x0
0: Secure
1: Non-secure
DMA3_SEC
DMA channel 3 security
3 R/W 0x0
0: Secure
1: Non-secure
DMA2_SEC
DMA channel 2 security
2 R/W 0x0
0: Secure
1: Non-secure
DMA1_SEC
DMA channel 1 security
1 R/W 0x0
0: Secure
1: Non-secure
0 R/W 0x0 DMA0_SEC
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 186
System
NOTE
When initializing DMA Controller, the bit-2 should be set up.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 187
System
DMA13_STATUS
DMA Channel 13 Status
13 R 0x0
0: Idle
1: Busy
DMA12_STATUS
DMA Channel 12 Status
12 R 0x0
0: Idle
1: Busy
DMA11_STATUS
DMA Channel 11 Status
11 R 0x0
0: Idle
1: Busy
DMA10_STATUS
DMA Channel 10 Status
10 R 0x0
0: Idle
1: Busy
DMA9_STATUS
DMA Channel 9 Status
9 R 0x0
0: Idle
1: Busy
DMA8_STATUS
DMA Channel 8 Status
8 R 0x0
0: Idle
1: Busy
DMA7_STATUS
DMA Channel 7 Status
7 R 0x0
0: Idle
1: Busy
DMA6_STATUS
DMA Channel 6 Status
6 R 0x0
0: Idle
1: Busy
DMA5_STATUS
DMA Channel 5 Status
5 R 0x0
0: Idle
1: Busy
DMA4_STATUS
DMA Channel 4 Status
4 R 0x0
0: Idle
1: Busy
DMA3_STATUS
DMA Channel 3 Status
3 R 0x0
0: Idle
1: Busy
2 R 0x0 DMA2_STATUS
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 188
System
3.9.6.10. 0x0108+N*0x0040 DMA Channel Descriptor Address Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 189
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 190
System
11: 16
DMA_SRC_DRQ_TYPE
5:0 R 0x0 DMA Source DRQ Type
The details in DRQ Type and Port Corresponding Relation.
3.9.6.12. 0x0110+N*0x0040 DMA Channel Current Source Address Register (Default Value: 0x0000_0000)
3.9.6.13. 0x0114+N*0x0040 DMA Channel Current Destination Address Register (Default Value: 0x0000_0000)
3.9.6.14. 0x0118+N*0x0040 DMA Channel Byte Counter Left Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 191
System
31:4 / / /
DMA_DST_MODE
3 R/W 0x0 0: Wait mode
1: Handshake mode
DMA_SRC_MODE
2 R/W 0x0 0: Wait mode
1: Handshake mode
1:0 / / /
3.9.6.17. 0x012C+N*0x0040 DMA Former Descriptor Address Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 192
System
3.10.1. Overview
Thermal sensors have became common elements in wide range of modern system on chip (SoC) platform. Thermal
sensors are used to constantly monitor the temperature on the chip.
The Thermal Sensor Controller(THS) embeds four thermal sensors, sensor0 is located in GPU, sensor1 is located in VE,
sensor2 is located in CPU, sensor3 is located in DDR. The thermal sensor can generate interrupt to SW to lower
temperature via DVFS, on reaching a certain thermal threshold.
CLK_IN
Clock Div
24MHz
THS0
THS1 M Digital APB
THS2
U ADC Logic Reg
X Process BUS
THS3
Vref
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 193
System
The THS gets one clock source. Table 3-9 describes the clock source for Thermal Sensor Controller. Users can see Clock
Controller Unit(CCU) for clock setting, configuration and gating information.
CLK_IN = 24 MHz
CONV_TIME(Conversion Time) = 1/(24 MHz/14Cycles) =0.583 (us)
TACQ> 1/(24 MHz/24 Cycles)
THERMAL_PER > ADC Sample Frequency > TACQ+CONV_TIME
TACQ CONV_TIME
ADC_Sample_Frequency
THERMAL_PER
3.10.3.3. Interrupt
The THS has four interrupt sources, such as DATA_IRQ, SHUTDOWN_IRQ, ALARM_IRQ and ALARM_OFF_IRQ.
Figure 3-25 shows the thermal sensor interrupt sources.
DATA_IRQ_EN
DATA_IRQ
SHUTDOWN_IRQ_EN THS_IRQ
SHUTDOWN_IRQ
ALRM_IRQ_EN
ALARM_IRQ
ALARM_OFF_IRQ
When temperature is higher than Alarm_Threshold, ALARM_IRQ is generated. When temperature is lower than
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 194
System
Start
Set THS_ACQ,THERMAL_PER,
Median filter,Interrupt enable,
Alarm threshold,shutdown threshold,
THS0/1/2/3_CDATA
Enable THS
Before enabling THS, read eFUSE value and write the value to THS_CDATA.
(1).Query Mode
Step11: Read the bit[11:0] of THS_DATA, calculate THS temperature based on THS Temperature Conversion Formula in
Section 3.10.3.4.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 196
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 197
System
0:Disable
1:Enable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 198
System
0:Disable
1:Enable
SHUT_INT2_EN
Selects shutdown interrupt for sensor2
2 R/W 0x0
0:Disable
1:Enable
SHUT_INT1_EN
Selects shutdown interrupt for sensor1
1 R/W 0x0
0:Disable
1:Enable
SHUT_INT0_EN
Selects shutdown interrupt for sensor0
0 R/W 0x0
0:Disable
1:Enable
3.10.6.7. 0x0020 THS Data Interrupt Status Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 199
System
THS3_DATA_IRQ _STS
3 R/W1C 0x0 Data interrupt status for sensor3
Write ‘1’ to clear this interrupt.
THS2_DATA_IRQ _STS
2 R/W1C 0x0 Data interrupt status for sensor2
Write ‘1’ to clear this interrupt.
THS1_DATA_IRQ _STS
1 R/W1C 0x0 Data interrupt status for sensor1
Write ‘1’ to clear this interrupt.
THS0_DATA_IRQ _STS
0 R/W1C 0x0 Data interrupt status for sensor0
Write ‘1’ to clear this interrupt.
3.10.6.8. 0x0024 THS Shut Interrupt Status Register (Default Value: 0x0000_0000)
3.10.6.9. 0x0028 THS Alarm Off Interrupt Status Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 200
System
ALARM_ OFF1_STS
1 R/W1C 0x0 Alarm interrupt off pending for sensor1
Write ‘1’ to clear this interrupt.
ALARM_ OFF0_STS
0 R/W1C 0x0 Alarm interrupt off pending for sensor0
Write ‘1’ to clear this interrupt.
3.10.6.10. 0x002C THS Alarm Interrupt Status Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 201
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 202
System
ALARM3_T_HYST
11:0 R/W 0x684
Thermal Sensor3 alarm threshold for hysteresis temperature
3.10.6.16. 0x0080 THS0&1 Shutdown Threshold Control Register (Default Value: 0x04E9_04E9)
3.10.6.17. 0x0084 THS2&3 Shutdown Threshold Control Register (Default Value: 0x04E9_04E9)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 203
System
31:28 / / /
THS3_CDATA
27:16 R/W 0x800
Thermal Sensor3 calibration data
15:12 / / /
THS2_CDATA
11:0 R/W 0x800
Thermal Sensor2 calibration data
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 204
System
3.11. PSI
3.11.1. Overview
PSI(Peripheral System Interconnect) is a peripheral bus interconnect device based on AHB and APB protocol, which
supports 16 AHB master and 16 slave bus. The type of slave bus can be AHB bus or APB bus. Each bus supports 64
slave devices.
AHB AHB
Master0 Master15
AHB_Interface
PSI_TOP
Register
Control h2i h2i
PSI_Interface
PSI CTRL
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 205
System
3.12. IOMMU
3.12.1. Overview
IOMMU(I/O Memory management unit) is designed for product specific memory requirements. It maps the virtual
address(sent by peripheral access memory) to the physical address. IOMMU allows multiple ways to manage the
location of physical address, and it can use physical address which has potentially conflict mapping for different
processes to allocate memory space, and also allow application of non-continuous address mapping to continuous
virtual address space.
Features:
Supports virtual address to physical address mapping by hardware implementation
Supports DE, DI, VE_R, VE, G2D parallel address mapping
Supports DE, DI, VE_R, VE, G2D bypass function independently
Supports DE, DI, VE_R, VE, G2D prefetch independently
Supports DE, DI, VE_R, VE, G2D interrupt handing mechanism independently
Supports 2 levels TLB (level1 TLB for special using, and level2 TLB for sharing)
Supports TLB Fully cleared and Partially disabled
Supports trigger PTW behavior when TLB miss
Supports checking the permission
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 206
System
IOMMU
DE MBUS VA->PA Translation MBUS
APB
CPU APB
Interface
Prefetch
Logic6
Prefetch
Logic5
Prefetch
Logic4
Prefetch
Logic3
Prefetch
Logic2
Prefetch
Logic1
Prefetch
Logic0
PTW Cache
PTW Logic Page Table Walk
MBUS
IOMMU contains two clock domains in the module. Address mapping is generated by MBUS clock domain, and
Register and interrupt processing are generated by APB clock domain. The two domains are asynchronous, and they
are from different clock sources.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 207
System
3.12.3.2.1. Initialization
Release the IOMMU reset signal by writing 1 to the bit[31] of the IOMMU Reset Register;
Write the base address of the first TLB to the IOMMU Translation Table Base Register;
Set up the IOMMU Interrupt Enable Register;
Enable the IOMMU by configuring the IOMMU Enable Register in the final.
In the process of address mapping, The peripheral virtual address VA[31:12] are retrieved in the Level1 TLB, when TLB
hits, the mapping finished, or they are retrieved in the Level2 TLB in the same way. If TLB hits, it will write the hit
mapping to the Level1 TLB, and hits in Level1 TLB. If Level1 and Level2 TLB are retrieved fail, it will trigger the PTW.
After opening peripheral bypass function by setting IOMMU Bypass Register, IOMMU will not map the address for
peripheral typed the address, and it will output the virtual address as physical address. The typical application is as
follows.
Permission error
a). Permission checking always performs in the address conversion;
b). Once the permission checking makes mistake, the new access of the master suspends, before this visit continues;
c). Set the error status register;
d). Trigger interrupt.
NOTE
Invalid page table has two situations: the reading target page table from the memory is invalid; and the page table
stored in PTW Cache with target page table is found to be invalid after using;
If a page table is invalid, then total cache line( that is two page tables) need to be invalidated.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 209
System
NOTE
Invalid page table has two situations: the reading target page table from the memory is invalid; and the page table
stored in Macro TLB with target page table is found to be invalid after using.
If a page table is invalid, then total cache line(that is two page tables) need to be invalidated.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 210
System
Start
Yes
Micro TLB hit
No
Trigger PTW
Yes
No
No
Valid L2 page table
Yes
End
IOMMU page table is defined as Level2 mapping, the first level is 1M address space mapping, the second level is 4K
address space. This version does not support 1K, 16K and other page table size. IOMMU supports a page table only, its
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 211
System
meaning is:
All peripherals that connected to IOMMU use the same virtual address space;
The virtual address space of the peripherals can overlap;
Different virtual addresses can map to the same physical address space;
Base address of the page table is defined by software, and it needs 16 KB address alignment; Page table of the Level2
table item needs 1 KB address alignment. A complete VA-PA address translation process is shown in Figure 3-30.
31 14 0
IOMMU_TTB_REG Start address of Level1 page table
31 2019 1211 0
Virtual address(VA) Index of Level1 page table Index of Level2 page table Offset within page
31 1413 2 1 0
Address of Level1
Start address of Level1 page table Index of Level1 page table 00
page table
31 10 2 1 0
Level1 page table
Start address of Level2 page table Reserved 01
entry
31 10 9 2 1 0
Address of Level2
Start address of Level2 page table Index of Level2 page table 00
page table
31 12 7 4 1 0
Level2 page table
Physical base address ACI 1
entry
31 1211 0
Physical address(PA) Physical base address Offset within page
When multi page table content refresh, or table address changes, all VA-PA mapping which has been cached in TLB will
no longer be valid , then you need configure IOMMU TLB Flush Enable Register to clear the TLB or PTW Cache. First
suspend access to TLB or Cache, then configure the corresponding Flush bit of IOMMU TLB Flush Enable Register ,
after operation takes effect, related peripherals can continue to send new access memory operations.
When some page table is invalid or incorrect mapping, you can set the TLB Invalidation relevant register to invalidate
TLB VA-PA mapping pairs. The invalid TLB supports two modes.
(1) Mode0
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 212
System
Firstly, set IOMMU TLB Invalidation Mode Select Register to 0 to select mode0;
Secondly, write target address to IOMMU TLB Invalidation Address Register;
Thirdly, set configuration values to IOMMU TLB Invalidation Address Mask Register, the requirements are as follows:
The value of IOMMU TLB Invalidation Address Mask Register cannot be less than the IOMMU TLB
Invalidation Address Register.
The higher bit of IOMMU TLB Invalidation Address Mask Register must be continuous 1, the lower bit must
be continuous 0, for example, 0xfffff000, 0xffffe000, 0xffffc000, 0xffff8000, 0xffff0000 belongs to the legal
value; and 0xffffd000, 0xffffb000, 0xffffa000, 0xffff9000, 0xffff7000 belongs to illegal values.
Finally, configure IOMMU TLB Invalidation Enable Register to enable invalid operation. Among the way to determine
the invalid address is to get maximum valid bit and determine target address range by target address AND mask
address. The process is shown as follows.
IOMMU_TLB_IVLD_ADDR_REG,REG0 IOMMU_TLB_IVLD_ADDR_MASK_REG,REG1
31 11 0 31 Y 11 0
XXXXXXXXXXXXXXXXXXXX 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11≤Z≤31, Z≥Y
bit[Z+1]=1
bit[Z]~bit[11]=0
31 Z 11 0
Max range of target address,
X X X X X X X X X X X X X X X X X ???0 0 0 0 0 0 0 0 0 0 0 0
H_ADDR
(2) Mode1
Firstly, set IOMMU TLB Invalidation Mode Select Register to 1 to select mode1;
Secondly, set the starting address of invalid TLB by IOMMU TLB Invalidation Start Address Register, and set the
ending address of invalid TLB by IOMMU TLB Invalidation Start Address Register;
Finally, configure IOMMU TLB Invalidation Enable Register to enable invalid operation, then invalid related TLB
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 213
System
The read/write access control of series register such as IOMMU Domain Authority Control Register is as follows.
The value of IOMMU Domain Authority Control Register is read-only by default. Other registers can configure through
system requirement. In address switch process, the corresponding relation between ACI and Domain is as follows.
Before the IOMMU module software reset operation, make sure IOMMU is never opened, or all bus operations are
completed, or DRAM and peripherals already open the corresponding switch, to shield the influence of IOMMU reset.
Before opening the IOMMU address mapping function, Translation Table Base Register should be correctly configured,
or all the masters are in the bypass state, or all the masters do not send the bus command.
Operating the register must close IOMMU address mapping function, namely IOMMU_ENABLE_REG [0] is 0; or Bypass
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 215
System
In the Flush operation, all TLB/Cache access will be suspended; but the operation entered the TLB will continue to
complete before the Flush starts.
For virtual address, read/write the corresponding physical address data to make sure whether IOMMU module
address mapping function is normal. First, make sure to read or write, and then configure the target virtual address or
write data, then start to read or write, after the operation is finished, check if the results are as expected.
When PMU function is used for the first time, set IOMMU PMU Enable Register to enable statistics function; when
reading the relevant Register, clear the enable bit of IOMMU PMU Enable Register; when PMU function is used next
time, first IOMMU PMU Clear Register is set, after counter is cleared, set the enable bit of IOMMU PMU Enable
Register.
Given a Level2 page table administers continuous 4 KB address, if Micro TLB misses in continuous virtual address,
there may need to return a Level2 page table to hit from Macro TLB; but the hit number is not recorded in the Macro
TLB hit and Micro TLB hit related register. So the true hit rate calculation is as follows:
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 216
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 219
System
When PTW Cache occurs abnormal, the bit is used to reset PTW Cache
individually.
MACRO_TLB_RESET
Macro TLB address convert lane software reset switch.
0: Set reset signal
16 R/W 0x1
1: Release reset signal
When PTW Cache occurs abnormal, the bit is used to reset PTW Cache
individually.
15:7 / / /
MASTER6_RESET
Master6 address convert lane software reset switch.
0: Set reset signal
6 R/W 0x1
1: Release reset signal
When Master6 occurs abnormal, the bit is used to reset PTW Cache
individually.
MASTER5_RESET
Master5 address convert lane software reset switch.
0: Set reset signal
5 R/W 0x1
1: Release reset signal
When Master5 occurs abnormal, the bit is used to reset PTW Cache
individually.
MASTER4_RESET
Master4 address convert lane software reset switch.
0: Set reset signal
4 R/W 0x1
1: Release reset signal
When Master4 occurs abnormal, the bit is used to reset PTW Cache
individually.
MASTER3_RESET
Master3 address convert lane software reset switch.
0: Set reset signal
3 R/W 0x1
1: Release reset signal
When Master3 occurs abnormal, the bit is used to reset PTW Cache
individually.
MASTER2_RESET
Master2 address convert lane software reset switch.
0: Set reset signal
2 R/W 0x1
1: Release reset signal
When Master2 occurs abnormal, the bit is used to reset PTW Cache
individually.
MASTER1_RESET
Master1 address convert lane software reset switch.
0: Set reset signal
1 R/W 0x1
1: Release reset signal
When Master1 occurs abnormal, the bit is used to reset PTW Cache
individually.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 220
System
MASTER0_RESET
Master0 address convert lane software reset switch.
0: Set reset signal
0 R/W 0x1
1: Release reset signal
When Master0 occurs abnormal, the bit is used to reset PTW Cache
individually.
physical address.
0: Disable bypass function
1: Enable bypass function
MASTER3_BYPASS
Master3 bypass switch
After bypass function is opened, IOMMU can not map the address of
3 R/W 0x1 Master3 sending, and directly output the virtual address to MBUS as
physical address.
0: Disable bypass function
1: Enable bypass function
MASTER2_BYPASS
Master2 bypass switch
After bypass function is opened, IOMMU can not map the address of
2 R/W 0x1 Master2 sending, and directly output the virtual address to MBUS as
physical address.
0: Disable bypass function
1: Enable bypass function
MASTER1_BYPASS
Master1 bypass switch
After bypass function is opened, IOMMU can not map the address of
1 R/W 0x1 Master1 sending, and directly output the virtual address to MBUS as
physical address.
0: Disable bypass function
1: Enable bypass function
MASTER0_BYPASS
Master0 bypass switch
After bypass function is opened, IOMMU can not map the address of
0 R/W 0x1 Master0 sending, and directly output the virtual address to MBUS as
physical address.
0: Disable bypass function
1: Enable bypass function
NOTE
Operating the register belongs to non-accurate timing sequence control function. That is, before the function is
valid, master operation will complete address mapping function, and after the operation will not perform address
mapping. It is suggested that master is in reset state or in no any bus operation before operating the register .
3.12.6.5. 0x0044 IOMMU Write Buffer Control Register (Default Value: 0x0000_0039)
3.12.6.6. 0x0048 IOMMU Out Of Order Control Register (Default Value: 0x0000_007F)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 223
System
0: Disable out-of-order
1: Enable out-of-order
MASTER3_OOO_CTRL
Master3 out-of-order control bit
3 R/W 0x1
0: Disable out-of-order
1: Enable out-of-order
MASTER2_OOO_CTRL
Master2 out-of-order control bit
2 R/W 0x1 0: Disable out-of-order
1: Enable out-of-order
Note: AI does not support out-of-order, the bit is invalid.
MASTER1_OOO_CTRL
Master1 out-of-order control bit
1 R/W 0x1
0: Disable out-of-order
1: Enable out-of-order
MASTER0_OOO_CTRL
Master0 out-of-order control bit
0 R/W 0x1
0: Disable out-of-order
1: Enable out-of-order
3.12.6.7. 0x004C IOMMU 4KB Boundary Protect Control Register (Default Value: 0x0000_007F)
NOTE
When the virtual address sent by master is over the 4KB boundary, 4KB protection unit will split it into two serial
access.
3.12.6.8. 0x0050 IOMMU Translation Table Base Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 225
System
0: Disable
1: Enable
MICRO_TLB5_ENABLE
Micro TLB5 enable bit
5 R/W 0x1
0: Disable
1: Enable
MICRO_TLB4_ENABLE
Micro TLB4 enable bit
4 R/W 0x1
0: Disable
1: Enable
MICRO_TLB3_ENABLE
Micro TLB3 enable bit
3 R/W 0x1
0: Disable
1: Enable
MICRO_TLB2_ENABLE
Micro TLB2 enable bit
2 R/W 0x1
0: Disable
1: Enable
MICRO_TLB1_ENABLE
Micro TLB1 enable bit
1 R/W 0x1
0: Disable
1: Enable
MICRO_TLB0_ENABLE
Micro TLB0 enable bit
0 R/W 0x1
0: Disable
1: Enable
0: Disable
1: Enable
MICRO_TLB3_PREFETCH
Micro TLB3 prefetch enable
3 R/W 0x0
0: Disable
1: Enable
MICRO_TLB2_PREFETCH
Micro TLB2 prefetch enable
2 R/W 0x0
0: Disable
1: Enable
MICRO_TLB1_PREFETCH
Micro TLB1 prefetch enable
1 R/W 0x0
0: Disable
1: Enable
MICRO_TLB0_PREFETCH
Micro TLB0 prefetch enable
0 R/W 0x0
0: Disable
1: Enable
3.12.6.11. 0x0080 IOMMU TLB Flush Enable Register (Default Value: 0x0000_0000)
NOTE
When performing flush operation, all TLB/Cache access will be paused.
Before flush starts, the operation that has entered TLB continues to complete.
3.12.6.12. 0x0084 IOMMU TLB Invalidation Mode Select Register (Default Value: 0x0000_0000)
3.12.6.13. 0x0088 IOMMU TLB Invalidation Start Address Register (Default Value: 0x0000_0000)
3.12.6.14. 0x008C IOMMU TLB Invalidation End Address Register (Default Value: 0x0000_0000)
3.12.6.15. 0x0090 IOMMU TLB Invalidation Address Register (Default Value: 0x0000_0000)
NOTE
When performing invalidation operation, TLB/Cache operation has not affected.
After or Before invalidation starts, there is no absolute relationship between same address switch operation and
Invalidation operation.
3.12.6.16. 0x0094 IOMMU TLB Invalidation Address Mask Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 229
System
3.12.6.17. 0x0098 IOMMU TLB Invalidation Enable Register (Default Value: 0x0000_0000)
3.12.6.20. 0x00B0 IOMMU Domain Authority Control Register 0 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 230
System
NOTE
Software can be set up 15 different permission control types , which are set in IOMMU_DM_AUT_CTRL_REG0 ~ 7.
As well as a default access control type, domain0. The read/write operation of DOMIAN1 ~ 15 is unlimited by
default.
Software needs to set the corresponding permission control domain index of the page table item in the secondary
page table entries[7:4], the default value is 0, use domian0, namely the read/write operation is not controlled.
Setting REG_ARD_OVWT can mask the Domain control defined by IOMMU_DM_AUT_CTRL_REG0~7. All Level2 page
table type are covered by the type of REG_ARD_OVWT. The read/write operation is permitted by default.
3.12.6.21. 0x00B4 IOMMU Domain Authority Control Register 1 (Default Value: 0x0000_0000)
DM3_M0_RD_AUT_CTRL
Domain3 read permission control for master0
16 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
15:14 / / /
DM2_M6_WT_AUT_CTRL
Domain2 write permission control for master6
13 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM2_M6_RD_AUT_CTRL
Domain2 read permission control for master6
12 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM2_M5_WT_AUT_CTRL
Domain2 write permission control for master5
11 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM2_M5_RD_AUT_CTRL
Domain2 read permission control for master5
10 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM2_M4_WT_AUT_CTRL
Domain2 write permission control for master4
9 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM2_M4_RD_AUT_CTRL
Domain2 read permission control for master4
8 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM2_M3_WT_AUT_CTRL
Domain2 write permission control for master3
7 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM2_M3_RD_AUT_CTRL
Domain2 read permission control for master3
6 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM2_M2_WT_AUT_CTRL
Domain2 write permission control for master2
5 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM2_M2_RD_AUT_CTRL
Domain2 read permission control for master2
4 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 235
System
DM2_M1_WT_AUT_CTRL
Domain2 write permission control for master1
3 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM2_M1_RD_AUT_CTRL
Domain2 read permission control for master1
2 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM2_M0_WT_AUT_CTRL
Domain2 write permission control for master0
1 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM2_M0_RD_AUT_CTRL
Domain2 read permission control for master0
0 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
3.12.6.22. 0x00B8 IOMMU Domain Authority Control Register 2 (Default Value: 0x0000_0000)
3.12.6.23. 0x00BC IOMMU Domain Authority Control Register 3 (Default Value: 0x0000_0000)
3.12.6.24. 0x00C0 IOMMU Domain Authority Control Register 4 (Default Value: 0x0000_0000)
DM9_M0_RD_AUT_CTRL
Domain9 read permission control for master0
16 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
15:14 / / /
DM8_M6_WT_AUT_CTRL
Domain8 write permission control for master6
13 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM8_M6_RD_AUT_CTRL
Domain8 read permission control for master6
12 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM8_M5_WT_AUT_CTRL
Domain8 write permission control for master5
11 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM8_M5_RD_AUT_CTRL
Domain8 read permission control for master5
10 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM8_M4_WT_AUT_CTRL
Domain8 write permission control for master4
9 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM8_M4_RD_AUT_CTRL
Domain8 read permission control for master4
8 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM8_M3_WT_AUT_CTRL
Domain8 write permission control for master3
7 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM8_M3_RD_AUT_CTRL
Domain8 read permission control for master3
6 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM8_M2_WT_AUT_CTRL
Domain8 write permission control for master2
5 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM8_M2_RD_AUT_CTRL
Domain8 read permission control for master2
4 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 243
System
DM8_M1_WT_AUT_CTRL
Domain8 write permission control for master1
3 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM8_M1_RD_AUT_CTRL
Domain8 read permission control for master1
2 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM8_M0_WT_AUT_CTRL
Domain8 write permission control for master0
1 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM8_M0_RD_AUT_CTRL
Domain8 read permission control for master0
0 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
3.12.6.25. 0x00C4 IOMMU Domain Authority Control Register 5 (Default Value: 0x0000_0000)
3.12.6.26. 0x00C8 IOMMU Domain Authority Control Register 6 (Default Value: 0x0000_0000)
3.12.6.27. 0x00CC IOMMU Domain Authority Control Register 7 (Default Value: 0x0000_0000)
DM15_M0_RD_AUT_CTRL
Domain15 read permission control for master0
16 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
15:14 / / /
DM14_M6_WT_AUT_CTRL
Domain14 write permission control for master6
13 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM14_M6_RD_AUT_CTRL
Domain14 read permission control for master6
12 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM14_M5_WT_AUT_CTRL
Domain14 write permission control for master5
11 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM14_M5_RD_AUT_CTRL
Domain14 read permission control for master5
10 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM14_M4_WT_AUT_CTRL
Domain14 write permission control for master4
9 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM14_M4_RD_AUT_CTRL
Domain14 read permission control for master4
8 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM14_M3_WT_AUT_CTRL
Domain14 write permission control for master3
7 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM14_M3_RD_AUT_CTRL
Domain14 read permission control for master3
6 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM14_M2_WT_AUT_CTRL
Domain14 write permission control for master2
5 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM14_M2_RD_AUT_CTRL
Domain14 read permission control for master2
4 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 251
System
DM14_M1_WT_AUT_CTRL
Domain14 write permission control for master1
3 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM14_M1_RD_AUT_CTRL
Domain14 read permission control for master1
2 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
DM14_M0_WT_AUT_CTRL
Domain14 write permission control for master0
1 R/W 0x0
0: The write-operation is permitted
1: The write-operation is prohibited
DM14_M0_RD_AUT_CTRL
Domain14 read permission control for master0
0 R/W 0x0
0: The read-operation is permitted
1: The read-operation is prohibited
3.12.6.28. 0x00D0 IOMMU Domain Authority Overwrite Register (Default Value: 0x0000_0000)
NOTE
Setting the REG_ARD_OVWT can mask the Domain control defined by IOMMU_DM_AUT_CTRL_REG0~7. All the
property of Level2 are covered by the property defined in REG_ARD_OVWT. Allow read and write for all by default.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 253
System
NOTE
Invalid page table and permission error can not make one device or multi-devices in system work normally.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 254
System
Permission error usually happens in MicroTLB. The error generates interrupt, and waits for processing through
software.
Invalid page table usually happens in MacroTLB. The error can not influence the access of other devices. So the
error page table needs go back the way it comes, but the error should not be written in each level TLB.
3.12.6.32. 0x0110 IOMMU Interrupt Error Address Register 0 (Default Value: 0x0000_0000)
3.12.6.33. 0x0114 IOMMU Interrupt Error Address Register 1 (Default Value: 0x0000_0000)
3.12.6.34. 0x0118 IOMMU Interrupt Error Address Register 2 (Default Value: 0x0000_0000)
3.12.6.35. 0x011C IOMMU Interrupt Error Address Register 3 (Default Value: 0x0000_0000)
3.12.6.36. 0x0120 IOMMU Interrupt Error Address Register 4 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 257
System
3.12.6.37. 0x0124 IOMMU Interrupt Error Address Register 5 (Default Value: 0x0000_0000)
3.12.6.38. 0x0128 IOMMU Interrupt Error Address Register 6 (Default Value: 0x0000_0000)
3.12.6.39. 0x0130 IOMMU Interrupt Error Address Register 7 (Default Value: 0x0000_0000)
3.12.6.40. 0x0134 IOMMU Interrupt Error Address Register 8 (Default Value: 0x0000_0000)
3.12.6.41. 0x0150 IOMMU Interrupt Error Data Register 0 (Default Value: 0x0000_0000)
3.12.6.42. 0x0154 IOMMU Interrupt Error Data Register 1 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 258
System
3.12.6.43. 0x0158 IOMMU Interrupt Error Data Register 2 (Default Value: 0x0000_0000)
3.12.6.44. 0x015C IOMMU Interrupt Error Data Register 3 (Default Value: 0x0000_0000)
3.12.6.45. 0x0160 IOMMU Interrupt Error Data Register 4 (Default Value: 0x0000_0000)
3.12.6.46. 0x0164 IOMMU Interrupt Error Data Register 5 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 259
System
3.12.6.47. 0x0168 IOMMU Interrupt Error Data Register 6 (Default Value: 0x0000_0000)
3.12.6.48. 0x0170 IOMMU Interrupt Error Data Register 7 (Default Value: 0x0000_0000)
3.12.6.49. 0x0174 IOMMU Interrupt Error Data Register 8 (Default Value: 0x0000_0000)
3.12.6.50. 0x0180 IOMMU L1 Page Table Interrupt Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 260
System
MASTER1_L1PG_INT
1 R 0x0
Master1 address switch causes L1 page table to occur interrupt.
MASTER0_L1PG_INT
0 R 0x0
Master0 address switch causes L1 page table to occur interrupt.
3.12.6.51. 0x0184 IOMMU L2 Page Table Interrupt Register (Default Value: 0x0000_0000)
3.12.6.53. 0x0194 IOMMU Virtual Address Data Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 261
System
3.12.6.54. 0x0198 IOMMU Virtual Address Configuration Register (Default Value: 0x0000_0000)
3.12.6.57. 0x0230 IOMMU PMU Access Low Register 0 (Default Value: 0x0000_0000)
3.12.6.58. 0x0234 IOMMU PMU Access High Register 0 (Default Value: 0x0000_0000)
3.12.6.59. 0x0238 IOMMU PMU Hit Low Register 0 (Default Value: 0x0000_0000)
3.12.6.60. 0x023C IOMMU PMU Hit High Register 0 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 263
System
3.12.6.61. 0x0240 IOMMU PMU Access Low Register 1 (Default Value: 0x0000_0000)
3.12.6.62. 0x0244 IOMMU PMU Access High Register 1 (Default Value: 0x0000_0000)
3.12.6.63. 0x0248 IOMMU PMU Hit Low Register 1 (Default Value: 0x0000_0000)
3.12.6.64. 0x024C IOMMU PMU Hit High Register 1 (Default Value: 0x0000_0000)
3.12.6.65. 0x0250 IOMMU PMU Access Low Register 2 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 264
System
3.12.6.66. 0x0254 IOMMU PMU Access High Register 2 (Default Value: 0x0000_0000)
3.12.6.67. 0x0258 IOMMU PMU Hit Low Register 2 (Default Value: 0x0000_0000)
3.12.6.68. 0x025C IOMMU PMU Hit High Register 2 (Default Value: 0x0000_0000)
3.12.6.69. 0x0260 IOMMU PMU Access Low Register 3 (Default Value: 0x0000_0000)
3.12.6.70. 0x0264 IOMMU PMU Access High Register 3 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 265
System
3.12.6.71. 0x0268 IOMMU PMU Hit Low Register 3 (Default Value: 0x0000_0000)
3.12.6.72. 0x026C IOMMU PMU Hit High Register 3 (Default Value: 0x0000_0000)
3.12.6.73. 0x0270 IOMMU PMU Access Low Register 4 (Default Value: 0x0000_0000)
3.12.6.74. 0x0274 IOMMU PMU Access High Register 4 (Default Value: 0x0000_0000)
3.12.6.75. 0x0278 IOMMU PMU Hit Low Register 4 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 266
System
3.12.6.76. 0x027C IOMMU PMU Hit High Register 4 (Default Value: 0x0000_0000)
3.12.6.77. 0x0280 IOMMU PMU Access Low Register 5 (Default Value: 0x0000_0000)
3.12.6.78. 0x0284 IOMMU PMU Access High Register 5 (Default Value: 0x0000_0000)
3.12.6.79. 0x0288 IOMMU PMU Hit Low Register 5 (Default Value: 0x0000_0000)
3.12.6.80. 0x028C IOMMU PMU Hit High Register 5 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 267
System
3.12.6.81. 0x0290 IOMMU PMU Access Low Register6 (Default Value: 0x0000_0000)
3.12.6.82. 0x0294 IOMMU PMU Access High Register 6 (Default Value: 0x0000_0000)
3.12.6.83. 0x0298 IOMMU PMU Hit Low Register 6 (Default Value: 0x0000_0000)
3.12.6.84. 0x029C IOMMU PMU Hit High Register 6 (Default Value: 0x0000_0000)
3.12.6.85. 0x02D0 IOMMU PMU Access Low Register 7 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 268
System
3.12.6.86. 0x02D4 IOMMU PMU Access High Register 7 (Default Value: 0x0000_0000)
3.12.6.87. 0x02D8 IOMMU PMU Hit Low Register 7 (Default Value: 0x0000_0000)
3.12.6.88. 0x02DC IOMMU PMU Hit High Register 7 (Default Value: 0x0000_0000)
3.12.6.89. 0x02E0 IOMMU PMU Access Low Register 8 (Default Value: 0x0000_0000)
3.12.6.90. 0x02E4 IOMMU PMU Access High Register 8 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 269
System
3.12.6.91. 0x02E8 IOMMU PMU Hit Low Register 8 (Default Value: 0x0000_0000)
3.12.6.92. 0x02EC IOMMU PMU Hit High Register 8 (Default Value: 0x0000_0000)
3.12.6.93. 0x0300 IOMMU Total Latency Low Register 0 (Default Value: 0x0000_0000)
3.12.6.94. 0x0304 IOMMU Total Latency High Register 0 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 270
System
3.12.6.96. 0x0310 IOMMU Total Latency Low Register 1(Default Value: 0x0000_0000)
3.12.6.97. 0x0314 IOMMU Total Latency High Register 1 (Default Value: 0x0000_0000)
3.12.6.99. 0x0320 IOMMU Total Latency Low Register 2 (Default Value: 0x0000_0000)
3.12.6.100. 0x0324 IOMMU Total Latency High Register 2 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 271
System
3.12.6.102. 0x0330 IOMMU Total Latency Low Register 3 (Default Value: 0x0000_0000)
3.12.6.103. 0x0334 IOMMU Total Latency High Register 3 (Default Value: 0x0000_0000)
3.12.6.105. 0x0340 IOMMU Total Latency Low Register 4 (Default Value: 0x0000_0000)
3.12.6.106. 0x0344 IOMMU Total Latency High Register 4 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 272
System
3.12.6.108. 0x0350 IOMMU Total Latency Low Register 5 (Default Value: 0x0000_0000)
3.12.6.109. 0x0354 IOMMU Total Latency High Register 5 (Default Value: 0x0000_0000)
3.12.6.111. 0x0360 IOMMU Total Latency Low Register 6 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 273
System
3.12.6.112. 0x0364 IOMMU Total Latency High Register 6 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 274
System
3.13. RTC
3.13.1. Overview
The RTC(Real Time Clock) is used to display the real time and periodically wakeup. The RTC can display the year, month,
day, week, hour, minute, second in real time. The RTC has the independent power to continue to work in system
power-off.
CLK16M_RC_EN
RC CLK SRC SEL
16M RC /32 /N
0 CLK32K_LOSC
SYSTEM
Cali 1
DCXO RTC_32K
/32 RTC
Debounce circuit
32K_FANOUT_SRC_SEL
00
SYSTEM_PLL_32K 01 PAD
HOSC DIV 10
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 275
System
RTC clock tree can be selected by corresponding switch, there are 2 options: 32K obtained by frequency division of RC,
Cali 32K after calibrated.
Clock source: internal 16 MHz RC oscillator, if using calibration output, the high-frequency crystal of DCXO is needed.
Output clock: CLK32K_LOSC and RTC_32K.
Fanout: The clock source of fanout can select RTC_32K, or 32K divided by PLL_PERI(2X), or 32K divided by HOSC.
Signal Description
X32KFOUT 32.768 kHz clock fanout, provides low frequency clock to the external device
The RTC module has the independent reset signal, the signal follows VCC_RTC. When VCC_RTC powers on, the reset
signal resets the RTC module; after VCC_RTC reaches stable, the reset signal always holds high level. Watchdog Reset
cannot reset RTC.
The RTC module accesses its register by APBS1.
VCC-POWER APBS1
10k
X32KFOUT
RTC
Alarm0_int
The system accesses RTC register by APBS1 to generate the real time.
If the external device needs low frequency oscillator, which can be provided by X32KFOUT.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 276
System
Clock
1K Counter 3FA 3FB 3FC 3FD 3FE 3FF 0000 0001 0002 0003 0004 0005
Second
Clock
1K
counter
Counter Range
Second 0~59
Minute 0~59
Hour 0~23
Day 0~65535 (The year, month, day need be transformed by software according to day counter)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 277
System
CAUTION
Because there is no error correction mechanism in the hardware, note that each counter configuration should not
exceed a reasonable counting range.
3.13.3.4.3. Alarm 0
The principle of alarm0 is a comparator. When RTC timer reaches scheduled time, the RTC generates the interrupt.
The RTC only generates one interrupt when RTC timer reached the scheduled day, hour, minute and second counter,
then the RTC needs set a new scheduled time, the next interrupt can be generated.
The RTC provides sixteen 32-bit general purpose register to store power-off information.
When the system is in shutdown or standby scene, CPU can judge software process by the storing information.
3.13.3.4.5. RTC_VIO
The RTC module has a LDO, the input source of the LDO is VCC_RTC, the output of the LDO is RTC_VIO. But VCC_RTC of
H616 package is connected internally to VCC_PLL, and RTC_VIO is not available in H616 package.
3.13.3.4.6. RC Calibration
The basic circuit of RC calibration is shown in Figure 3-39. Whether to output the calibrated RC clock can be selected
by the RC_Cali_SEL control bit, the calibration principle is as follows.
As shown in Figure 3-40, with HOSC(24M) as the reference clock, calculate the counter number M of RC clock within
1ms/16ms/128ms to obtain the accurate frequency of internal RC. By dividing the accurate frequency by 32.768 kHz,
the frequency divider(K) from RC clock to 32.768 kHz is obtained. Lastly, RC16M is divided into 32.768 kHz frequency
by the frequency divider(K).
NOTE
The calibration principle is output 32.768 kHz, not input 16 MHz.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 278
System
RC16m
/32 /N 0
CALI_RC32K
/Cali 1
RC
HOSC
1ms/16ms/128ms
The logic of DCXO timed wakeup circuit is relatively simple, including two controls: timed wakeup hardware automatic
enable and timed wakeup time length (software configuration). The timed wakeup means that DCXO circuit is required
to wakeup the output clock once every second(1s~60s, usually the ambient temperature changes little in a few
seconds) for 32K calibration in the super standby or shutdown scenario,after calibration, DCXO circuit is closed, the
closed time is timed wakeup time length(software configuration).The time of DCXO circuit from wakeup starting to
stable output is 3~4ms. Although the timed wakeup function is closed, DCXO circuit always had worked. The process of
timed wakeup is shown in Figure 3-41.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 279
System
Shut-down/Enter Start-up/Exit
Time axis
The time of a calibration in shutdown or super standby: the timed wakeup time configured by software + the clock
time of DCXO from wakeup to stable output + the time of a calibration. The timed wakeup time configured by the
software in the figure is 1s, and can be configured by software in application. It is the theoretical maximum value for
DCXO from wakeup to stable output clock in 4ms , the specific value is subject to IC measured results. In the any time
of these three periods, the startup or exit of the super standby action will not cause DCXO abnormal.
The enable signal of DCXO and the enable signal of timed wakeup DCXO is “OR” logic, and they do not contradict each
other.
The interval between continuous DCXO enable operation and disable operation is at least greater than 4us.
(1) Write time initial value: Write the current time to RTC_DAY_REG and RTC_HH_MM_SS_REG.
(2) After configured time, read the bit[8:7] of LOSC_CTRL_REG to ensure that configuration is completed.
(3) After update time, the RTC restarts to count again. The software can read the current time anytime.
NOTE
The RTC can only provide day counter, so the current day counter need be converted to year, month, day and week
by software.
After configured time at each time, you need ensure the bit[8:7] of LOSC_CTRL_REG is 0 before the next setting is
performed.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 280
System
3.13.3.5.2. Alarm0
3.13.3.5.3. Fanout
Set the bit0 of 32K_FANOUT_GATING_REG to 1, and ensure that external pull-up resistor and voltage are normal, then
32.768 kHz fanout square wave can be output.
If using DRAM data encrypt, the DRAM data read by CPU is the encrypted data. The steps are as follows.
Before write/read CRY_KEY_REG and CRY_EN_REG, the bit[15:0] of CRY_CONFIG_REG should be written to 0x1689.
NOTE
Note that this step needs to be performed before each read and write operation, otherwise the register operation is
not successful.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 281
System
Read (RTC_DAY_REG);
Read (RTC_HH_MM_SS_REG);
3.13.4.2. Alarm 0
irq_request(GIC_SRC_R_Alarm0, Alm0_handler);
irq_enable(GIC_SRC_R_Alarm0);
writel(1, ALARM0_DAY_SET_REG);
writel(1, RTC_HH_MM_SS_REG); //set 1 second corresponding to normal mode;
writel(1, ALM0_EN);
writel(1, ALM_CONFIG); //NMI output
while(!readl(ALM0_IRQ_STA));
writel(1, ALM0_IRQ_EN);
while(readl(ALM0_IRQ_STA));
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 282
System
NOTE
If the bit[8:7] of LOSC_CTRL_REG is set, the RTC HH-MM-SS, DD and ALARM DD-HH-MM-SS register cannot be
written.
3.13.6.2. 0x0008 Internal OSC Clock Prescalar Register (Default Value: 0x0000_000F)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 283
System
3.13.6.3. 0x000C Internal OSC Clock Auto Calibration Register (Default Value: 0x01E8_0000)
NOTE
Ensure that the bit[7] of LOSC_CTRL_REG is 0 before updating RTC_DAY_REG.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 284
System
NOTE
Ensure that the bit[8] of LOSC_CTRL_REG is 0 before updating RTC_HH_MM_SS_REG.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 285
System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 286
System
NOTE
General purpose register 0~15 value can be stored if the RTC-VIO is larger than 0.7V.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 287
System
0x06: 150s
Others: /
WAKEUP_CNT FOR READY SLEEP
Wake up counter for ready sleep
0x00: 250ms
0x01: 500ms
0x02: 750ms
0x03: 1s
0x04: 1.25s
0x05: 1.5s
0x06: 1.75s
11:8 R/W 0x0
0x07: 2s
0x08: 2.25s
0x09: 2.5s
0x0A: 2.75s
0x0B: 3s
0x0C: 3.25s
0x0D: 3.5s
0x0E: 3.75s
0x0F: 4s
WAKEUP_CNT FOR SLEEP
Wake up counter for sleep
0x00: 250ms
0x01: 500ms
0x02: 1s
0x03: 10s
0x04: 60s
0x05: 120s
0x06: 180s
7:4 R/W 0x4
0x07: 240s
0x08: 300s
0x09: 360s
0x0A: 420s
0x0B: 480s
0x0C: 540s
0x0D: 600s
0x0E: 1200s
0x0F: 1800s
WAIT DCXO SEL
Select for DCXO active after DCXO enable
0x0: 1ms
3:0 R/W 0x3 0x1:2ms
0x2:3ms
0x3:4ms
...
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 289
System
0xF: 16ms
3.13.6.17. 0x01F4 VDD To RTC Isolation Software Control Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 290
System
KEY_FIELD
Key Field
31:16 W 0x0
This field should be filled with 0x16AA, and then the bit15 can be
configured.
When use vdd_sys to RTC isolation software control, write this bit to 1, it will
15 WAC 0x0
only be cleared by resetb release.
14:1 / / /
DRAM_CH_PAD_HOLD
Hold the pad of DRAM channel
0:not hold
0 R/W 0x0
1:hold dram Pad
This bit should be set to 1 before VDD_SYS power off while it should be set
to 0 after the VDD_SYS power on.
3.13.6.19. 0x01FC Super Standby Software Entry Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 291
System
3.13.6.21. 0x0204 EFUSE High Voltage Power Switch Control Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 293
Video and Graphics
Contents
Chapter 4 Video and Graphics ....................................................................................................................................... 296
4.1. DE ....................................................................................................................................................................... 296
4.2. DI ........................................................................................................................................................................ 297
4.3. G2D..................................................................................................................................................................... 298
4.4. Video Decoding .................................................................................................................................................. 299
4.4.1. Overview ................................................................................................................................................. 299
4.4.2. Block Diagram ......................................................................................................................................... 300
4.5. Video Encoding .................................................................................................................................................. 302
4.5.1. VE ............................................................................................................................................................ 302
4.5.2. JPGE ......................................................................................................................................................... 303
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 294
Video and Graphics
Figures
Figure 4- 1. DE Block Diagram ........................................................................................................................................... 296
Figure 4- 2. VE Block Diagram ........................................................................................................................................... 303
Figure 4- 3. JPGE Block Diagram........................................................................................................................................ 304
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 295
Video and Graphics
4.1. DE
The Display Engine(DE) is a hardware composer to transfer image layers from a local bus or a video buffer to the LCD
interface. The DE supports four overlay windows to blend, and supports image post-processing in the video channel.
The block diagram of DE is shown in Figure 4-1.
RT-Mixer TCON
M
B
U
S Write-Back
4.2. DI
The De-interlacer300 (DI300) is a module which provides de-interlacing functions. It is an off-line processing module
which reading input frame buffer and writing output frame buffer by memory bus. In this version of DI, it also provides
Temporal Noise Reduction function to reduce the random noise. And the new-add Film Mode Detection function can
detect the pull-down content from video and recover the film with maximum details.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 297
Video and Graphics
4.3. G2D
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 298
Video and Graphics
4.4.1. Overview
The Video Decoding consists of Video Control Firmware(VCF) running on ARM processor and embedded hardware
Video Engine(VE). VCF gets the bitstream from topper software, parses bitstream, invokes the Video Engine, and
generates the decoding image sequence. The decoder image sequence is transmitted by the video output controller to
the display device under the control of the topper software.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 299
Video and Graphics
INT
Video Engine
DeBlock
Inter /SAO
prediction
IQuant/
CABAC/C IDCT/
AVLC Recon
Intra
prediction
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 300
Video and Graphics
The process of Video Decoding includes reading video stream and parsing syntax, intra-frame prediction, inter-frame
prediction, inverse quantization, inverse transform, de-blocking filter, and finally writing the decoded picture into DDR.
After the driver software gets the interrupt of Video Decoding, the picture in DDR is sent to the display module.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 301
Video and Graphics
The Video Encoding consists of the video encoding unit(VE) and JPEG encoder(JPGE). The VE supports H.264 encoding,
and JPGE supports JPEG/MJPEG encoding.
4.5.1. VE
4.5.1.1. Overview
The VE is a H.264 encoding accelerator implemented by using hardware. It features low CPU usage, short delay and
low power consumption.
The VE has the following features:
• Supports ITU-T H.264 high profile/main profile/baseline profile@Level 4.2 encoding
- Encoding of multiple slice
- Motion compensation with 1/2 and 1/4 pixel precision
- Two prediction unit (PU) types of 16x16 and 8x8 for inter-prediction
- Three prediction unit types of Intra16x16, Intra8x8 and Intra4x4 for intra-prediction
- Trans4x4 and trans8x8
- CABAC and CAVLC entropy encoding
- De-blocking filtering
• Supports the output picture format of semi-planar YCbCr4:2:0
• Supports configurable picture resolutions
• Supports region of interest (ROI) encoding
• Supports on-screen display (OSD) encoding protection that can be enabled or disabled
• Supports OSD front-end overlaying
• Supports three bit rate control modes: constant bit rate (CBR), variable bit rate (VBR) and FIXQP
• Supports the output bit rate ranging from 256 kbit/s to 100 Mbit/s
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 302
Video and Graphics
ARM
Rate Interrupt
Upper level software
control handling
Video Input Port
Reconstruction
Input picture bitstream
/Reference
buffer buffer
picture buffer
VE INT
DeBlock
CABAC
/SAO
ME/Inter
prediction
IQuant/
DCT/
OSD IDCT/
Quant
Recon
Intra
prediction
4.5.2. JPGE
4.5.2.1. Overview
The JPGE is a high-performance JPEG encoder implemented by using hardware. It supports 64-megapixel snapshot or
HD MJPEG encoding.
The JPGE has the following features:
• Supports ISO/IEC 10918-1 (CCITT T.81) baseline process (DCT sequential) encoding
• Encodes the pictures in the chrominance sampling format of YCbCr4:2:0, YCbCr4:2:2 and YCbCr4:4:4
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 303
Video and Graphics
ARM
JPGE INT
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 304
Memory
Contents
Chapter 5 Memory......................................................................................................................................................... 308
5.1. SDRAM Controller(DRAMC) ............................................................................................................................... 308
5.1.1. Overview ................................................................................................................................................. 308
5.2. Nand Flash Controller(NDFC) ............................................................................................................................. 309
5.2.1. Overview ................................................................................................................................................. 309
5.2.2. Block Diagram ......................................................................................................................................... 309
5.2.3. Operations and Functional Descriptions ................................................................................................. 310
5.2.4. Programming Guidelines ......................................................................................................................... 319
5.2.5. Register List ............................................................................................................................................. 321
5.2.6. Register Description ................................................................................................................................ 322
5.3. SD/MMC Host Controller(SMHC) ....................................................................................................................... 353
5.3.2. Block Diagram ......................................................................................................................................... 353
5.3.3. Operations and Functional Descriptions ................................................................................................. 354
5.3.4. Programming Guidelines ......................................................................................................................... 358
5.3.5. Register List ............................................................................................................................................. 362
5.3.6. Register Description ................................................................................................................................ 363
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 305
Memory
Figures
Figure 5- 1. NDFC Block Diagram ...................................................................................................................................... 310
Figure 5- 2. Conventional Serial Access Cycle Diagram (SAM0) ........................................................................................ 312
Figure 5- 3. EDO Type Serial Access after Read Cycle (SAM1) .......................................................................................... 312
Figure 5- 4. Extending EDO Type Serial Access Mode (SAM2) .......................................................................................... 312
Figure 5- 5. Command Latch Cycle .................................................................................................................................... 313
Figure 5- 6. Address Latch Cycle ....................................................................................................................................... 313
Figure 5- 7. Write Data to Flash Cycle ............................................................................................................................... 313
Figure 5- 8. Waiting R/B# Ready Diagram ......................................................................................................................... 314
Figure 5- 9. WE# High to RE# Low Timing Diagram........................................................................................................... 314
Figure 5- 10. RE# High to WE# Low Timing Diagram ........................................................................................................ 314
Figure 5- 11. Address to Data Loading Timing Diagram .................................................................................................... 315
Figure 5- 12. Page Read Command Diagram .................................................................................................................... 316
Figure 5- 13. Page Program Diagram ................................................................................................................................ 316
Figure 5- 14. EF-NAND Page Read Diagram ...................................................................................................................... 317
Figure 5- 15. Interleave Page Read Diagram ..................................................................................................................... 317
Figure 5- 16. Internal DMA Descriptor Chain Structure .................................................................................................... 318
Figure 5- 17. SMHC Block Diagram ................................................................................................................................... 354
Figure 5- 18. IDMAC Descriptor Structure Diagram .......................................................................................................... 355
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 306
Memory
Tables
Table 5- 1. NDFC External Signals...................................................................................................................................... 310
Table 5- 2. NDFC Clock Sources......................................................................................................................................... 311
Table 5- 3. SMHC External Signals..................................................................................................................................... 354
Table 5- 4. SMHC Clock Sources ........................................................................................................................................ 355
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 307
Memory
Chapter 5 Memory
5.1.1. Overview
The SDRAM Controller (DRAMC) provides a simple, flexible, burst-optimized interface to all in-dusty-standard
DDR4/DDR3/DDR3L and Low Power DDR3/4 SDRAM. It supports up to a 32 Gbits memory address space.
The DRAMC automatically handles memory management, initialization, and refresh operations. It gives the host CPU a
simple command interface, hiding details of the required address, page, and burst handling procedures. All memory
parameters are runtime-configurable, including timing, memory setting, SDRAM type, and Extended-Mode-Register
settings.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 308
Memory
5.2.1. Overview
The NDFC is the NAND Flash Controller which supports all NAND flash memory available in the market. New type flash
can be supported by software re-configuration.
The On-the-fly error correction code (ECC) is built-in NDFC for enhancing reliability. BCH is implemented and it can
detect and correct up to 80 bits error per 1024 bytes data. The on chip ECC and parity checking circuit of NDFC frees
CPU for other tasks. The ECC function can be disabled by software.
The data can be transferred by DMA or by CPU memory-mapped IO method. The NDFC provides automatic timing
control for reading or writing external Flash. The NDFC maintains the proper relativity for CLE, CE# and ALE control
signal lines. There are three different kinds of modes for serial read access, mode0 is for conventional serial access ,
mode1 is for EDO type and the mode2 is for extension EDO type. NDFC can monitor the status of R/B# signal line.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 309
Memory
Table 5-1 describes the external signals of NDFC. DQ0~DQ7 and DQS are bidirectional I/O. WE,ALE,CLE,CE,RE are
output pin, RB is input pin. The RB pin in the NAND device is an open-drain driver, which must need a pull-up resistor.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 310
Memory
To ensure ECC efficiency,ECC engine and NDFC internal logic use different clock. The clock of NDFC internal logic is set
by NAND_0 Clock Register, the clock of ECC engine is set by NAND_1 Clock Register .Note that NAND_0 Clock
Register set the internal logic clock of NDFC, but the frequency of external Nand Flash device is half of NDFC internal
logic clock. That is, if external Nand Flash runs at 40 MHz, then NDFC need set to 80 MHz.
Both ECC engine and NDFC internal logic have five different clock sources. Users can select one of them to make ECC
engine or internal logic clock source. Table 5-2 describles the clock sources of NDFC. Users can see CCU in chapter 3.3
for clock setting, configuration and gating information.
Typically, there are two kinds of serial access methods. One method is conventional method which fetching data at the
rise edge of NDFC_RE# signal line. Another one is EDO type which fetching data at the next fall edge of NDFC_RE#
signal line.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 311
Memory
NDFC_CLE
NDFC_CE# t3 t4
NDFC_WE#
t14
NDFC_RE# t12 sample 0 sample n-1
t13
NDFC_ALE
t10
NDFC_RB#
NDFC_IOx D(0) D(n-1)
NDFC_WE#
t14
NDFC_RE# t12 sample 0
t13
NDFC_ALE
t10
NDFC_RB#
NDFC_IOx D(0) D(n-1)
NDFC_WE#
t14
sample 0
NDFC_RE# t12
t13
NDFC_ALE
t10
NDFC_RB#
NDFC_IOx D(0) D(n-1)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 312
Memory
t1 t2
NDFC_CLE
t3 t4
NDFC_CE#
NDFC_WE# t5
NDFC_RE#
NDFC_ALE t7 t11
t8 t9
NDFC_IOx COMMAND
NDFC_CLE t1
NDFC_CE# t3 t4
t15
NDFC_WE# t6
NDFC_RE# t5
t7 t11
NDFC_ALE
t8 t9
NDFC_IOx Addr(0) Addr(n-1)
NDFC_CLE t1
NDFC_CE# t3 t4
t15
NDFC_WE# t6
NDFC_RE# t5
t7 t11
NDFC_ALE
t8 t9
NDFC_IOx D(0) D(n-1)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 313
Memory
NDFC_CLE
NDFC_CE#
NDFC_WE#
t14
t12 t13
NDFC_RE
NDFC_ALE
t16
NDFC_RB#
NDFC_CE#
NDFC_WE#
t17
NDFC_RE
NDFC_ALE
NDFC_RB#
NDFC_CE#
NDFC_WE#
t18
NDFC_RE
NDFC_ALE
NDFC_RB#
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 314
Memory
NDFC_CLE
NDFC_CE#
t19
NDFC_WE#
NDFC_RE
NDFC_ALE
NDFC_RB#
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 315
Memory
NDFC_CLE
NDFC_CE#
NDFC_WE#
NDFC_RE
Page Command
cmdio[31:30]=2
NDFC_ALE
NDFC_RB#
NDFC_CLE
NDFC_CE#
NDFC_WE#
NDFC_ALE
NDFC_RB#
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 316
Memory
NDFC_CLE
NDFC_CE#
NDFC_WE#
NDFC_RE
Page Command
cmdio[31:30]=2
NDFC_ALE
NDFC_RB#
NDFC_IOx 00h col0 col1 row0row1row2 30h 70h d(0) 00h Data output
NDFC_CLE
NDFC_CE#
NDFC_WE#
NDFC_RE
Page Command
cmdio[31:30]=2
NDFC_ALE
NDFC_IOx 00h col0 col1 row0row1row2 30h Data output 05h col0 col1 E0h Data output
The internal DMA controller of the NDFC can transfer data between DMA FIFO in NDFC and DMA buffer in host
memory using DMA descriptors. DMA descriptors in the host memory with chain structure is shown in Figure 5-16.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 317
Memory
The start address of DMA descriptor list must be word (32-bit) aligned, and will be configured to NDFC DMA
Descriptor List Base Address Register. Each DMA descriptor consists of four words(32-bit).
Config
Bit Description
31:4 /
FIRST_FLAG
3 When set, this bit indicates that this descriptor contains the first buffer of data. Must be set to 1 in first
descriptor.
LAST_FLAG
2
When set, this bit indicates that the buffers pointed by this descriptor are the last data buffer.
1:0 /
Size
Bit Description
31:16 /
BUFF_SIZE
15:0 These bits indicate the data buffer byte size, which must be a multiple of 8 bytes. If this filed is 0, the DMA
ignores this buffer and proceeds to the next descriptor.
Buff Addr
Bit Description
BUFF_ADDR
31:0 These bits indicate the physical address of DMA data buffer in host memory. The buffer address must be 4
bytes aligned.
Next Description
Bit Description
NEXT_DESC_ADDR
31:0
These bits indicate the pointer to the physical host memory of the next descriptor is present.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 318
Memory
ECC_DATA_BLOCK is written or read through the value of NDFC Data Block Mask Register. But in real application
scenario, capacity could not waste, so writing operation usually does not use the function, only reading operation uses.
In reading operation, we divides Sequence mode and Interleave mode through the store position of user_data.
Sequence mode: The user_data of every 1K main area data and ECC encoder data are next to main area data.
Interleave mode: All user_data and ECC encoder data are stored from page_size position.
When any ECC_DATA_BLOCK within page is read through batch command(NDFC_CMD_TYPE in 0x24 register is 0x10),
the register is used differently for Sequence mode and Interleave mode.
Sequence mode can only support continue ECC_DATA_BLOCK, the register value can only be 0x1,0x3,0x7,etc. But
Interleave mode has not limit.
Whether Sequence mode or Interleave mode, the first reading ECC_DATA_BLOCK is used to calculate corresponding
column address, and column address is written to 0x14 and 0x18 register.
The bit[24] and bit[23:16] of the register are used to judge whether free space need be padded random data except
valid data when batch command function is used.
NOTE
Make sure that random function is enabled if there need be sent random data,that is, the NDFC_RANDOM_EN of
0x34 register is 0x1, or else the padding data is non-random, is all-0.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 320
Memory
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 321
Memory
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 322
Memory
7 / / /
NDFC_CE_ACT
Chip Select Signal CE# Control during NAND Operation
0: De-active Chip Select Signal NDFC_CE# during data loading, serial access and
6 R/W 0x0
other no operation stage for power consumption. NDFC automatic controls Chip
Select Signals.
1: Chip select signal NDFC_CE# is always active after NDFC is enabled
5 / / /
NDFC_RB_SEL
NDFC External R/B Signal Select
4:3 R/W 0x0
The value 0-3 selects the external R/B signal. The same R/B signal can be used
for multiple chip select flash.
NDFC_BUS_WIDTH
2 R/W 0x0 0: 8-bit bus
1: 16-bit bus
NDFC_RESET
1 R/W1C 0x0 NDFC Reset
Write 1 to reset NDFC and clear to 0 after reset
NDFC_EN
NDFC Enable Control
0 R/W 0x0
0: Disable NDFC
1: Enable NDFC
5.2.6.3. 0x0008 NDFC Interrupt and DMA Enable Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 325
Memory
NDFC_CMD_INT_ENABLE
Enable or disable interrupt when NDFC has finished the procession of a single
1 R/W 0x0 command in normal command work mode or one batch command work mode.
0: Disable
1: Enable
NDFC_B2R_INT_ENABLE
Enable or disable interrupt when NDFC_RB# signal is transferring from BUSY
0 R/W 0x0 state to READY state.
0: Disable
1: Enable
In DDR mode:
1~15 is valid.(These bits configure the number of clock when data is valid after
RE#’s falling edge)
7:6 / / /
NDFC_DC_CTL
NDFC Delay Chain Control.
5:0 R/W 0x0
These bits are only valid in DDR data interface, and configure the relative phase
between DQS and DQ[0…7] .
T_CCS
Change Column Setup Time
00: 12*2T
17:16 R/W 0x0
01: 20*2T
10: 28*2T
11: 60*2T
T_CLHZ
CLE High to Output Hi-z
00: 2*2T
15:14 R/W 0x0
01: 8*2T
10: 16*2T
11: 31*2T
T_CS
CE Setup Time
00: 2*2T
13:12 R/W 0x0
01: 8*2T
10: 16*2T
11: 31*2T
T_CDQSS
DQS Setup Time for Data Input Start
11 R/W 0x0
0: 4*2T
1: 20*2T
T_CAD
Command, Address, Data Delay
000: 2*2T
001: 6*2T
10:8 R/W 0x0 010: 10*2T
011: 14*2T
100: 22*2T
101: 30*2T
110/111: 62*2T
T_RHW
Cycle Number from RE# High to WE# Low
00: 4*2T
7:6 R/W 0x2
01: 12*2T
10: 20*2T
11: 28*2T
T_WHR
Cycle Number from WE# High to RE# Low
00: 0*2T
5:4 R/W 0x1
01: 6*2T
10: 14*2T
11: 22*2T
T_ADL
3:2 R/W 0x1
Cycle Number from Address to Data Loading
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 327
Memory
00: 0*2T
01: 6*2T
10: 14*2T
11: 22*2T
T_WB
Cycle Number from WE# High to Busy
00:14*2T
1:0 R/W 0x1
01: 22*2T
10: 30*2T
11: 38*2T
5.2.6.7. 0x0018 NDFC Address High Word Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 328
Memory
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 31 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
31 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 30 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
30 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 29 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
29 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 28 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
28 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 27 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
27 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 26 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
26 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 25 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
25 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
24 R/W 0x0 It is used to indicate the data block 24 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 329
Memory
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 23 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
23 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 22 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
22 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 21 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
21 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 20 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
20 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 19 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
19 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 18 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
18 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 17 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
17 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 330
Memory
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 16 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
16 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 15 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
15 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 14 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
14 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 13 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
13 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 12 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
12 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 11 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
11 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 10 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
10 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
9 R/W 0x0 It is used to indicate the data block 9 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 331
Memory
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 8 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
8 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 7 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
7 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 6 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
6 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 5 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
5 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 4 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
4 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 3 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
3 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 2 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
2 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 332
Memory
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 1 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
1 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
NDFC_DATA_BLOCK_MASK
It is used to indicate the data block 0 should be written or read during batch
command procession(NDFC_CMD_TYPE=0x10 in NDFC_CMD).
0 R/W 0x0
0: Disable
1: Enable
1 data block = 1024 bytes main field data.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 335
Memory
31 / / /
NDFC_RANDOM_SEED
30:16 R/W 0x4a80 The seed value for randomize engine. It is only active when NDFC_RANDOM_EN
is set to ‘1’.
NDFC_ECC_MODE
00000000: BCH-16
00000001: BCH-24
00000010: BCH-28
00000011: BCH-32
00000100: BCH-40
00000101: BCH-44
00000110: BCH-48
15:8 R/W 0x0 00000111: BCH-52
00001000: BCH-56
00001001: BCH-60
00001010: BCH-64
00001011: BCH-68
00001100: BCH-72
00001101: BCH-76
00001110: BCH-80
Others : Reserved
NDFC_RANDOM_SIZE
7 R/W 0x0 0: ECC block size
1: Page size
NDFC_RANDOM_DIRECTION
6 R/W 0x0 0: LSB first
1: MSB first
NDFC_RANDOM_EN
5 R/W 0x0 0: Disable Data Randomize
1: Enable Data Randomize
NDFC_ECC_EXCEPTION
0: Normal ECC
1: For ECC, there is an exception. If all data is 0xff or 0x00 for the block. When
4 R/W 0x0
reading this page, ECC assumes that it is right. For this case, no error information
is reported.
Note: It is only active when ECC is ON
NDFC_ECC_PIPELINE
Pipeline function enable or disable for batch command
3 R/W 0x1
0: Error Correction function no pipeline with next block operation
1: Error Correction pipeline
2:1 / / /
NDFC_ECC_EN
0 R/W 0x0 0: ECC is OFF
1: ECC is ON
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 336
Memory
5.2.6.17. 0x0044 NDFC Read Data Status Control Register(Default Value: 0x0100_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 345
Memory
0: Disable to count the number of bit 1 and bit 0 during current read operation
1: Enable to count the number of bit 1 and bit 0 during current read operation
The number of bit 1 and bit 0 during current read operation can be used to check
whether a page is blank or bad.
23:19 / / /
NDFC_RDATA_STA_TH
The threshold value to generate data status
If the number of bit 1 during current read operation is less than or equal to
18:0 R/W 0x0
threshold value, the bit 13 of NDFC_ST register will be set.
If the number of bit 0 during current read operation is less than or equal to
threshold value, the bit 12 of NDFC_ST register will be set.
5.2.6.18. 0x0048 NDFC Read Data Status Register 0(Default Value: 0x0000_0000)
5.2.6.19. 0x004C NDFC Read Data Status Register 1(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 346
Memory
5.2.6.21. 0x0070+N*0x04 NDFC User Data Length Register N(Default Value: 0x0000_0000)
5.2.6.22. 0x0080 + N*0x04 NDFC User Data Register N(Default Value: 0xFFFF_FFFF)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 347
Memory
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 348
Memory
0: Disable
1: Enable
0 / / /
5.2.6.27. 0x0120 NDFC Normal DMA Mode Control Register(Default Value: 0x0000_00E5)
5.2.6.28. 0x0200 NDFC MBUS DMA Descriptor List Base Address Register(Default Value: 0x0000_0000)
5.2.6.29. 0x0204 NDFC MBUS DMA Interrupt Status Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 349
Memory
5.2.6.30. 0x0208 NDFC MBUS DMA Interrupt Enable Register(Default Value: 0x0000_0000)
5.2.6.31. 0x020C NDFC MBUS DMA Current Descriptor Address Register(Default Value: 0x0000_0000)
5.2.6.32. 0x0210 NDFC MBUS DMA Current Buffer Address Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 350
Memory
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 351
Memory
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 352
Memory
5.3.1. Overview
The SD-MMC Host Controller(SMHC) controls the read/write operations on the secure digital(SD) card and multimedia
card(MMC), and supports various extended devices based on the secure digital input/output(SDIO) protocol. The H616
provides three SMHC interfacs for controlling the SD card,MMC and SDIO device.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 353
Memory
AHB
S
Y
Register CMD Path
N
C CLK
CMD
SD/MMC/eMMC
Data Path DATA
...
Data RX
DMAC FIFO
Data TX
Each SMHC gets three different clocks. User can select one of them to make SMHC clock source. Table 5-2 describes
the clock sources of SMHC. Users can see CCU in chapter 3.3 for clock setting, configuration and gating information.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 354
Memory
SMHC has an internal DMA controller (IDMAC) to transfer data between host memory and SMHC port. With a
descriptor, IDMAC can efficiently move data from source to destination by automatically loading next DMA transfer
arguments, which need less CPU intervention. Before transfer data in IDMAC, host driver should construct a descriptor
list, configure arguments of every DMA transfer, then launch the descriptor and start the DMA. IDMAC has an
interrupt controller, when enabled, it can interrupt the HOST CPU in situations such as data transmission completed or
some errors happened.
The IDMAC uses a descriptor with a chain structure, and each descriptor points to a unique buffer and the next
descriptor.
…
DES0 DES0 DES0
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 355
Memory
DES0 is a notation used to denote the [31:0] bits, DES1 to denote [63:32] bits, DES2 to denote [95:64] bits, and DES3
to denote [127:96] bits in a descriptor.
For SMHC0/SMCH1:
Bits Name Descriptor
31:16 / /
BUFF_SIZE
These bits indicate the data buffer byte size, which must be a multiple of 4
15:0 Buffer size
bytes. If this filed is 0, the DMA ignores this buffer and proceeds to the next
descriptor.
For SMHC2:
Bits Name Descriptor
31:13 / /
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 356
Memory
BUFF_SIZE
These bits indicate the data buffer byte size, which must be a multiple of 4
12:0 Buffer size
bytes. If this filed is 0, the DMA ignores this buffer and proceeds to the next
descriptor.
The sample clock delay chain and data strobe delay chain(this chain is only in SMHC2) are used to generate delay to
make proper timing between internal card clock/data strobe and data signals. Each delay chain is made up with 64
delay cells. The delay time of one delay cell can be estimated through delay chain calibration.
Step1: Enable SMHC. In order to calibrate delay chain by operation registers in SMHC, SMHC must be enabled
through SMHC Bus Gating Reset Register and SMHC0/1/2 Clock Register.
Step2: Configure a proper clock for SMHC. Calibration delay chain is based on the clock for SMHC from Clock Control
Unit(CCU). Calibration delay chain is an internal function in SMHC and does not need device. So, it is unnecessary to
enable clock signal for device. The recommended clock frequency is 200 MHz.
Step3: Set proper initial delay value. Writing 0xA0 to delay control register enables Delay Software Enable (bit[7]) and
sets initial delay value 0x20 to Delay chain(bit[5:0]). Then write 0x0 to delay control register to clear the value.
Step4: Write 0x8000 to delay control register to start calibrate delay chain.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 357
Memory
Step5: Wait until the flag(bit14 in delay control register) of calibration done is set. The number of delay cells is shown
at bit[13:8] in delay control register. The delay time generated by these delay cells is equal to the cycle of SMHC’s clock
nearly. This value is the result of calibration.
Step6: Calculate the delay time of one delay cell according to the cycle of SMHC’s clock and the result of calibration.
NOTE
In the above descriptions, delay control register contains SMHC Sample Delay Control Register and SMHC Data
Strobe Delay Control Register. Delay Software Enable contains Sample Delay Software Enable and Data Strobe
Delay Software Enable. Delay chain contains Sample Delay Software and Data Strobe Delay Software.
5.3.4.1. Initialization
Before data and command are exchanged between a card and the SMHC, the SMHC need to be initialized. The SMHC
is initialized as follows.
Step1: Configure GPIO register as SMHC function by Port Controller module; reset clock by writing 1 to
SMHC_BGR_REG[SMHCx_RST], open clock gating by writing 1 to SMHC_BGR_REG[SMHCx_GATING]; select clock
sources and set division factor by configuring the SMHCx_CLK_REG(x=0,1,2) register.
Step2: Configure SMHC_CTRL to reset FIFO and controller, enable total interrupt; configure SMHC_INTMASK to 0xFFCE
to enable normal interrupt and error abnormal interrupt, and register interrupt function.
Step3: Configure SMHC_CLKDIV to open clock for device; configure SMHC_CMD as change clock command(for
example 0x80202000); send update clock command to deliver clock to device.
Step4: Configure SMHC_CMD to normal command, configure SMHC_CMDARG to set command parameter, configure
SMHC_CMD to set response type, etc, then command can send. According to initial process in the protocol, you
can finish SMHC initializing by sending corresponding command one by one.
Step1: Write 0x1 to SMHC_CTRL[DMA_RST] to reset internal DMA controller; write 0x82 to SMHC_IDMAC to enable
IDMAC interrupt, configure AHB master burst transfers; configure SMHC_IDIE to enable transfer interrupt,
receive interrupt, and abnormal interrupt.
Step2: Configure SMHC_FIFOTH to determine burst size, TX/RX trigger level. For example, if SMHC_FIFOTH is
configured as 0x300F00F0, which indicates that Burst size is 16, TX_TL is 15, RX_TL is 240. Configure
SMHC_DLBA to determine the start address of DMA descriptor.
Step3: If writing 1 data block to the sector 1, then SMHC_BYCNT[BYTE_CNT] need be set to 0x200, the descriptor is set
based on data size; set the data sector address of CMD24(Single Data Block Write) to 0x1, write 0x80002758 to
SMHC_CMD, send CMD24 command to write data to device.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 358
Memory
Step4: Check whether SMHC_RINTSTS[CC] is 1. If yes, command sends successful; if no, continue to wait until timeout,
then exit process.
Step5: Check whether SMHC_IDST_REG[TX_INT] is 1. If yes, writing DMA data transfer is complete, then write 0x337
to SMHC_IDST_REG to clear interrupt flag; if no, continue to wait until timeout, then exit process.
Step6: Check whether SMHC_RINTSTS[DTC] is 1. If yes, data transfer is complete and CMD24 writing operation is
complete. If no, that is, abnormity exists. Read SMHC_RINTSTS,SMHC_STATUS to query existing abnormity.
Step7: Send CMD13 command to query whether device writing operation is complete and whether return to idle
status. For example, device RCA is 0x1234, first set SMHC_CMDARG to 0x12340000, write 0x8000014D to
SMHC_CMD, go to step4 to ensure command transfer completed, then check whether the highest bit of
SMHC_RESP0(CMD13 response) is 1. If yes, device is in Idle status, then the next command can be sent. If no,
device is in busy status, then continue to send CMD13 to wait device in the idle status until timeout exit.
Step1: Write 0x1 to SMHC_CTRL[DMA_RST] to reset internal DMA controller; write SMHC_IDMAC to 0x82 to enable
IDMAC interrupt and configure AHB master burst transfers; configure SMHC_IDIE to enable transfer
interrupt,receive interrupt, and abnormal interrupt.
Step2: Configure SMHC_FIFOTH to determine burst size, TX/RX trigger level. For example, if SMHC_FIFOTH is
configured as 0x300F00F0, which indicates that Burst size is 16, TX_TL is 15,RX_TL is 240. Configure SMHC_DLBA
to determine the start address of DMA descriptor.
Step3: If reading 1 data block from the sector 1, then SMHC_BYCNT[BYTE_CNT] need be set to 0x200, the descriptor is
set based on data size; set the data sector address of CMD17 command(Single Data Block Read) to 0x1, write
0x80002351 to SMHC_CMD, send CMD17 command to read data from device to DRAM/SRAM.
Step4: Check whether SMHC_RINTSTS[CC] is 1. If yes, command sends successful; if no, continue to wait until timeout,
then exit process.
Step5: Check whether SMHC_IDST_REG[RX_INT] is 1. If yes, writing DMA data transfer is complete, then write 0x337
to SMHC_IDST_REG to clear interrupt flag; if no, continue to wait until timeout, then exit process.
Step6: Check whether SMHC_RINTSTS[DTC] is 1. If yes, data transfer is complete and CMD17 reading operation is
complete. If no, that is, abnormity exists. Read SMHC_RINTSTS,SMHC_STATUS to query existing abnormity.
Step1: Write 0x1 to SMHC_CTRL[DMA_RST] to reset internal DMA controller; write SMHC_IDMAC to 0x82 to enable
IDMAC interrupt and configure AHB master burst transfers; configure SMHC_IDIE to enable transfer
interrupt,receive interrupt, and abnormal interrupt.
Step2: Configure SMHC_FIFOTH to determine burst size, TX/RX trigger level. For example, if SMHC_FIFOTH is
configured as 0x300F00F0, which indicates that Burst size is 16, TX_TL is 15, RX_TL is 240. Configure
SMHC_DLBA to determine the start address of DMA descriptor.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 359
Memory
Step3: If writing 3 data blocks to the sector 0, then SMHC_BYCNT[BYTE_CNT] need be set to 0x600, the descriptor is
set based on data size; set the data sector address of CMD25 command(Multiple Data Blocks Write) to 0x0,
write 0x80003759 to SMHC_CMD, send CMD25 command to write data to device, when data transfer is
complete, CMD12 will be sent automatically .
Step4: Check whether SMHC_RINTSTS[CC] is 1. If yes, command sends successful; if no, continue to wait until timeout,
then exit process.
Step5: Check whether SMHC_IDST_REG[TX_INT] is 1. If yes, writing DMA data transfer is complete, then write 0x337
to SMHC_IDST_REG to clear interrupt flag; if no, continue to wait until timeout, then exit process.
Step6: Check whether SMHC_RINTSTS[ACD] and SMHC_RINTSTS[DTC] are all 1. If yes, data transfer is complete,
CMD12 transfer is complete and CMD25 writing operation is complete. If no, that is, abnormity exists. Read
SMHC_RINTSTS,SMHC_STATUS to query existing abnormity.
Step7: Send CMD13 command to query whether device writing operation is complete and whether return to idle
status. For example, device RCA is 0x1234,first set SMHC_CMDARG to 0x12340000, write 0x8000014D to
SMHC_CMD, go to step4 to ensure command transfer completed, then check whether the highest bit of
SMHC_RESP0(CMD13 response) is 1. If yes, device is in Idle status,then the next command can be sent. If no,
device is in busy status, then continue to send CMD13 to wait device in the idle status until timeout exit.
Step1: Write 0x1 to SMHC_CTRL[DMA_RST] to reset internal DMA controller; write SMHC_IDMAC to 0x82 to enable
IDMAC interrupt and configure AHB master burst transfers; configure SMHC_IDIE to enable transfer
interrupt,receive interrupt, and abnormal interrupt.
Step2: Configure SMHC_FIFOTH to determine burst size, TX/RX trigger level. For example, if SMHC_FIFOTH is
configured as 0x300F00F0, which indicates that Burst size is 16, TX_TL is 15, RX_TL is 240. Configure
SMHC_DLBA to determine the start address of DMA descriptor.
Step3: If reading 3 data blocks from the sector 0, then SMHC_BYCNT[BYTE_CNT] need be set to 0x600, the descriptor
is set based on data size; set the data sector address of CMD18 command(Multiple Data Blocks Read) to 0x0,
write 0x80003352 to SMHC_CMD, send CMD18 command to read data to device, when data transfer is
complete, CMD12 will be sent automatically.
Step4: Check whether SMHC_RINTSTS[CC] is 1. If yes, command sends successful; if no, continue to wait until timeout,
then exit process.
Step5: Check whether SMHC_IDST_REG[RX_INT] is 1. If yes, writing DMA data transfer is complete, then write 0x337
to SMHC_IDST_REG to clear interrupt flag; if no, continue to wait until timeout, then exit process.
Step6: Check whether SMHC_RINTSTS[ACD] and SMHC_RINTSTS[DTC] are all 1. If yes, data transfer is complete,
CMD12 transfer is complete and CMD18 reading operation is complete. If no, that is, abnormity exists. Read
SMHC_RINTSTS,SMHC_STATUS to query existing abnormity.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 360
Memory
Step1: Write 0x1 to SMHC_CTRL[DMA_RST] to reset internal DMA controller; write SMHC_IDMAC to 0x82 to enable
IDMAC interrupt and configure AHB master burst transfers; configure SMHC_IDIE to enable transfer
interrupt,receive interrupt, and abnormal interrupt.
Step2: Configure SMHC_FIFOTH to determine burst size, TX/RX trigger level. For example, if SMHC_FIFOTH is
configured as 0x300F00F0, which indicates that Burst size is 16, TX_TL is 15,RX_TL is 240. Configure
SMHC_DLBA to determine the start address of DMA descriptor.
Step3: If writing 3 data blocks, setting SMHC_CMDARG to 0x3 to ensure the block number to be operated, writing
0x80000157 to SMHC_CMD to send CMD23 command. Check whether SMHC_RINTSTS[CC] is 1. If yes,
command sends successful; if no, continue to wait until timeout, then exit process.
Step4: SMHC_BYCNT[BYTE_CNT] need be set to 0x600, the descriptor is set based on data size; set the data sector
address of CMD25 command(Multiple Data Blocks Write) to 0x0, write 0x80002759 to SMHC_CMD, send
CMD25 command to write data to device.
Step5: Check whether SMHC_RINTSTS[CC] is 1. If yes, command sends successful; if no, continue to wait until timeout,
then exit process.
Step6: Check whether SMHC_IDST_REG[TX_INT] is 1. If yes, writing DMA data transfer is complete, then write 0x337
to SMHC_IDST_REG to clear interrupt flag; if no, continue to wait until timeout, then exit process.
Step7: Check whether SMHC_RINTSTS[DTC] is 1. If yes, data transfer is complete and CMD25 writing operation is
complete. If no, that is, abnormity exists. Read SMHC_RINTSTS,SMHC_STATUS to query existing abnormity.
Step8: Send CMD13 command to query whether device writing operation is complete and whether return to idle
status. For example, device RCA is 0x1234,first set SMHC_CMDARG to 0x12340000, write 0x8000014D to
SMHC_CMD,go to step4 to ensure command transfer completed, then check whether the highest bit of
SMHC_RESP0(CMD13 response) is 1. If yes, device is in Idle status,then the next command can be sent. If no,
device is in busy status, then continue to send CMD13 to wait device in the idle status until timeout exit.
Step1: Write 0x1 to SMHC_CTRL[DMA_RST] to reset internal DMA controller; write SMHC_IDMAC to 0x82 to enable
IDMAC interrupt and configure AHB master burst transfers; configure SMHC_IDIE to enable transfer
interrupt,receive interrupt, and abnormal interrupt.
Step2: Configure SMHC_FIFOTH to determine burst size, TX/RX trigger level. For example, if SMHC_FIFOTH is
configured as 0x300F00F0, which indicates that Burst size is 16, TX_TL is 15,RX_TL is 240. Configure SMHC_DLBA
to determine the start address of DMA descriptor.
Step3: If reading 3 data blocks, setting SMHC_CMDARG to 0x3 to ensure the block number to be operated, writing
0x80000157 to SMHC_CMD to send CMD23 command. Check whether SMHC_RINTSTS[CC] is 1. If yes,
command sends successful; if no, continue to wait until timeout, then exit process.
Step4: SMHC_BYCNT[BYTE_CNT] need be set to 0x600, the descriptor is set based on data size; set the data sector
address of CMD18(Multiple Data Blocks Read) to 0x0, write 0x80002352 to SMHC_CMD, send CMD18 command
to read data from device to DRAM/SRAM.
Step5: Check whether SMHC_RINTSTS[CC] is 1. If yes, command sends successful; if no, continue to wait until timeout,
then exit process.
Step6: Check whether SMHC_IDST_REG[TX_INT] is 1. If yes, writing DMA data transfer is complete, then write 0x337
to SMHC_IDST_REG to clear interrupt flag; if no, continue to wait until timeout, then exit process.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 361
Memory
Step7: Check whether SMHC_RINTSTS[DTC] is 1. If yes, data transfer is complete and CMD18 writing operation is
complete. If no, that is, abnormity exists. Read SMHC_RINTSTS,SMHC_STATUS to query existing abnormity.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 363
Memory
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 364
Memory
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 365
Memory
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 366
Memory
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 368
Memory
CMD_RESP2
31:0 R 0x0 Response 2
Bit[95:64] of response
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 369
Memory
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 370
Memory
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 371
Memory
SDIO Interrupt
This is write-1-to-clear bits.
DEE
Data End-bit Error
When set during receiving data, it means that host controller does not
15 R/W1C 0x0 receive valid data end bit.
When set during transmitting data, it means that host controller does not
receive CRC status taken.
This is write-1-to-clear bits.
ACD
Auto Command Done
14 R/W1C 0x0
When set, it means auto stop command(CMD12) completed.
This is write-1-to-clear bits.
DSE_BC
Data Start Error
When set during receiving data, it means that host controller found a
error start bit. It is valid at 4-bit or 8-bit bus mode. When it set, host finds
13 R/W1C 0x0
start bit at data0, but does not find start bit at some or all of the other
data lines.
When set during transmitting data, it means that busy signal is cleared.
This is write-1-to-clear bits.
CB_IW
12 R/W1C 0x0 Command Busy and Illegal Write
This is write-1-to-clear bits.
FU_FO
11 R/W1C 0x0 FIFO Underrun/Overflow
This is write-1-to-clear bits.
DSTO_VSD
10 R/W1C 0x0 Data Starvation Timeout/V1.8 Switch Done
This is write-1-to-clear bits.
DTO_BDS
Data Timeout/Boot Data Start
9 R/W1C 0x0 When set during receiving data, it means host does not find start bit on
data0.
This is write-1-to-clear bits.
RTO_BACK
8 R/W1C 0x0 Response Timeout/Boot ACK Received
This is write-1-to-clear bits.
DCE
Data CRC Error
When set during receiving data, it means that the received data have
7 R/W1C 0x0 data CRC error.
When set during transmitting data, it means that the received CRC status
taken is negative.
This is write-1-to-clear bits.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 372
Memory
RCE
6 R/W1C 0x0 Response CRC Error
This is write-1-to-clear bits.
DRR
Data Receive Request
5 R/W1C 0x0 When set, it means that there are enough data in FIFO during receiving
data.
This is write-1-to-clear bits.
DTR
Data Transmit Request
4 R/W1C 0x0 When set, it means that there are enough space in FIFO during
transmitting data.
This is write-1-to-clear bits.
DTC
Data Transfer Complete
3 R/W1C 0x0 When set, it means that current command completes even through error
occurs.
This is write-1-to-clear bits.
CC
Command Complete
2 R/W1C 0x0 When set, it means that current command completes even through error
occurs.
This is write-1-to-clear bits.
RE
Response Error
1 R/W1C 0x0 When set, Transmit Bit error or End Bit error or CMD Index error may
occur.
This is write-1-to-clear bits.
0 / / /
FSM_BUSY
10 R 0x0 Data FSM Busy
Data transmit or receive state-machine is busy
CARD_BUSY
Card Data Busy
9 R 0x0 Inverted version of DATA[0]
0: card data not busy
1: card data busy
CARD_PRESENT
Data[3] Status
8 R 0x0 Level of DATA[3], checks whether card is present
0: card not present
1: card present
FSM_STA
Command FSM States
0000: Idle
0001: Send init sequence
0010: TX CMD start bit
0011: TX CMD TX bit
0100: TX CMD index + argument
0101: TX CMD CRC7
0110: TX CMD end bit
7:4 R 0x0
0111: RX response start bit
1000: RX response IRQ response
1001: RX response TX bit
1010: RX response CMD index
1011: RX response data
1100: RX response CRC7
1101: RX response end bit
1110: CMD path wait NCC
1111: Wait; CMD-to-response turnaround
FIFO_FULL
FIFO Full
3 R 0x0
1: FIFO full
0: FIFO not full
FIFO_EMPTY
FIFO Empty
2 R 0x1
1: FIFO Empty
0: FIFO not Empty
FIFO_TX_LEVEL
FIFO TX Water Level Flag
1 R 0x1
0: FIFO didn’t reach transmit trigger level
1: FIFO reached transmit trigger level
FIFO_RX_LEVEL
0 R 0x0
FIFO RX Water Level Flag
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 374
Memory
Recommended:
MSize = 16, TX_TL = 240, RX_TL = 15 (for SMHC2)
MSize = 8, TX_TL = 248, RX_TL = 7 (for SMHC0,SMHC1)
27:24 / / /
RX_TL
RX Trigger Level
0x0~0xFE: RX Trigger Level is 0~254
0xFF: Reserved
FIFO threshold when FIFO request host to receive data from FIFO. When
FIFO data level is greater than this value, DMA is request is raised if DMA
23:16 R/W 0xF enabled, or RX interrupt bit is set if interrupt enabled. At the end of
packet, if the last transfer is less than this level, the value is ignored and
relative request will be raised as usual.
Recommended:
15 (means greater than 15, for SMHC2)
7 (means greater than 7, for SMHC0,SMHC1)
15:8 / / /
TX_TL
TX Trigger Level
7:0 R/W 0x0 0x1~0xFF: TX Trigger Level is 1~255
0x0: No trigger
FIFO threshold when FIFO requests host to transmit data to FIFO. When
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 375
Memory
FIFO data level is less than or equal to this value, DMA TX request is
raised if DMA enabled, or TX request interrupt bit is set if interrupt
enabled. At the end of packet, if the last transfer is less than this level,
the value is ignored and relative request will be raised as usual.
Recommended:
240(means less than or equal to 240, for SMHC2)
248(means less than or equal to 248, for SMHC0,SMHC1)
5.3.6.19. 0x0048 SMHC Transferred Byte Count Register 0 (Default Value: 0x0000_0000)
5.3.6.20. 0x004C SMHC Transferred Byte Count Register 1 (Default Value: 0x0000_0000)
5.3.6.21. 0x0054 SMHC CRC Status Detect Control Register(Default Value: 0x0000_0003)
NOTE
The register is only for SMHC2.
5.3.6.22. 0x0058 SMHC Auto Command 12 Argument Register (Default Value: 0x0000_FFFF)
5.3.6.23. 0x005C SMHC New Timing Set Register (Default Value: 0x8171_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 377
Memory
MODE_SELEC
31 R/W 0x1 0: Old mode of Sample/Output Timing
1: New mode of Sample/Output Timing
30:28 / / /
DAT0_BYPASS
Select data0 input asyn or bypass sample logic, it is used to check card
27 R/W 0x0 busy or not.
0: Enable data0 bypass
1: Disable data0 bypass
26:25 / / /
CMD_DAT_RX_PHASE_CLR
Clear command line’s and data lines’ input phase during update clock
24 R/W 0x1 operation.
0: Disable
1: Enable
23 / / /
DAT_CRC_STATUS_RX_PHASE_CLR
Clear data lines’ input phase before receive CRC status.
22 R/W 0x1
0: Disable
1: Enable
DAT_TRANS_RX_PHASE_CLR
Clear data lines’ input phase before transfer data.
21 R/W 0x1
0: Disable
1: Enable
DAT_RECV_RX_PHASE_CLR
Clear data lines’ input phase before receive data.
20 R/W 0x1
0: Disable
1: Enable
19:17 / / /
CMD_SEND_RX_PHASE_CLR
Clear command rx phase before send command.
16 R/W 0x1
0: Disable
1: Enable
15:10 / / /
DAT_SAMPLE_TIMING_PHASE
00: Sample timing phase offset 900
9:8 R/W 0x0 01: Sample timing phase offset 1800
10: Sample timing phase offset 2700
11: Ignore
7:6 / / /
CMD_SAMPLE_TIMING_PHASE
00: Sample timing phase offset 900
5:4 R/W 0x0
01: Sample timing phase offset 1800
10: Sample timing phase offset 2700
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 378
Memory
11: Ignore
3:0 / / /
NOTE
This register is valid for SMHC0,SMHC1.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 379
Memory
5.3.6.26. 0x0084 SMHC Descriptor List Base Address Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 380
Memory
5.3.6.28. 0x008C SMHC IDMAC Interrupt Enable Register (Default Value: 0x0000_0000)
5.3.6.29. 0x0100 SMHC Card Threshold Control Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 382
Memory
5.3.6.30. 0x0104 SMHC Sample FIFO Control Register (Default Value: 0x0000_0006)
NOTE
The register is for SMHC2.
5.3.6.31. 0x0108 SMHC Auto Command 23 Argument Register (Default Value: 0x0000_0000)
NOTE
The register is for SMHC2.
5.3.6.32. 0x010C SMHC eMMC4.5 DDR Start Bit Detection Control Register (Default Value: 0x0000_0000)
It is required to set this bit to '1' before initiating any data transfer CMD
in HS400 mode.
30:1 / / /
HALF_START_BIT
Control for start bit detection mechanism inside mstorage based on
duration of start bit.
For eMMC 4.5, start bit can be:
0 R/W 0x0
0: Full cycle
1: Less than one full cycle
Set HALF_START_BIT=1 for eMMC 4.5 and above; set to 0 for SD
applications.
NOTE
This register is valid for SMHC0, SMHC1.
NOTE
This register is valid for SMHC0, SMHC1.
NOTE
This register is valid for SMHC0, SMHC1.
NOTE
This register is valid for SMHC0, SMHC1.
NOTE
This register is valid for SMHC0, SMHC1.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 385
Memory
NOTE
This register is valid for SMHC0, SMHC1.
NOTE
This register is valid for SMHC0, SMHC1.
In SDR mode, the higher 16 bits indicate the CRC of all data.
NOTE
This register is valid for SMHC0, SMHC1.
NOTE
This register is valid for SMHC0, SMHC1.
NOTE
This register is valid for SMHC0, SMHC1.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 387
Memory
NOTE
This register is valid for SMHC2.
NOTE
This register is valid for SMHC2.
5.3.6.45. 0x0140 SMHC Drive Delay Control Register (Default Value: 0x0001_0000)
For SMHC2:
0: Command drive phase offset is 900 at SDR mode, 450 at DDR8 mode, 900 at
DDR4/HS400 mode
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 388
Memory
1: Command drive phase offset is 1800 at SDR mode, 900 at DDR8 mode, 1800
at DDR4/HS400 mode
15:0 / / /
5.3.6.46. 0x0144 SMHC Sample Delay Control Register (Default Value: 0x0000_2000)
5.3.6.47. 0x0148 SMHC Data Strobe Delay Control Register(Default Value: 0x0000_2000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 389
Memory
DS_DL_CAL_DONE
Data Strobe Delay Calibration Done
14 R 0x0
When set, it means that sample delay chain calibration is done and the result
of calibration is shown in DS_DL.
DS_DL
Data Strobe Delay
It indicates the number of delay cells corresponding to current card clock.
13:8 R 0x20
The delay time generated by these delay cells is equal to the cycle of SMHC’s
clock nearly.
This bit is valid only when SAMP_DL_CAL_DONE is set.
DS_DL_SW_EN
7 R/W 0x0
Sample Delay Software Enable
6 / / /
DS_DL_SW
5:0 R/W 0x0
Data Strobe Delay Software
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 390
EMAC
Contents
Chapter 6 EMAC ............................................................................................................................................................. 394
6.1. Overview ............................................................................................................................................................ 394
6.2. Block Diagram .................................................................................................................................................... 394
6.3. Operations and Functional Descriptions ............................................................................................................ 395
6.3.1. External Signals ....................................................................................................................................... 395
6.3.2. Clock Sources .......................................................................................................................................... 397
6.3.3. Typical Application .................................................................................................................................. 397
6.3.4. EMAC RX/TX Descriptor .......................................................................................................................... 397
6.3.5. Transmit Descriptor ................................................................................................................................. 398
6.3.6. Receive Descriptor .................................................................................................................................. 399
6.4. Register List ........................................................................................................................................................ 401
6.5. Register Description ........................................................................................................................................... 402
6.5.1. 0x0000 EMAC Basic Control Register0 (Default Value: 0x0000_0000).................................................... 402
6.5.2. 0x0004 EMAC Basic Control Register1 (Default Value: 0x0800_0000).................................................... 402
6.5.3. 0x0008 EMAC Interrupt Status Register (Default Value: 0x0000_0000) ................................................. 403
6.5.4. 0x000C EMAC Interrupt Enable Register (Default Value: 0x0000_0000) ................................................ 404
6.5.5. 0x0010 EMAC Transmit Control Register0 (Default Value: 0x0000_0000) .............................................. 406
6.5.6. 0x0014 EMAC Transmit Control Register1 (Default Value: 0x0000_0000) .............................................. 406
6.5.7. 0x001C EMAC Transmit Flow Control Register (Default Value: 0x0000_0000) ....................................... 407
6.5.8. 0x0020 EMAC Transmit DMA Descriptor List Address Register (Default Value: 0x0000_0000) .............. 408
6.5.9. 0x0024 EMAC Receive Control Register0 (Default Value: 0x0000_0000) ............................................... 408
6.5.10. 0x0028 EMAC Receive Control Register1 (Default Value: 0x0000_0000) ............................................. 409
6.5.11. 0x0034 EMAC Receive DMA Descriptor List Address Register (Default Value: 0x0000_0000) ............. 410
6.5.12. 0x0038 EMAC Receive Frame Filter Register (Default Value: 0x0000_0000) ........................................ 410
6.5.13. 0x0040 EMAC Receive Hash Table Register0 (Default Value: 0x0000_0000) ........................................ 411
6.5.14. 0x0044 EMAC Receive Hash Table Register1 (Default Value: 0x0000_0000) ........................................ 412
6.5.15. 0x0048 EMAC MII Command Register (Default Value: 0x0000_0000) .................................................. 412
6.5.16. 0x004C EMAC MII Data Register (Default Value: 0x0000_0000) ........................................................... 412
6.5.17. 0x0050 EMAC MAC Address High Register0 (Default Value: 0x0000_FFFF).......................................... 413
6.5.18. 0x0054 EMAC MAC Address Low Register0 (Default Value: 0xFFFF_FFFF) ........................................... 413
6.5.19. 0x0050+0x08*N EMAC MAC Address High Register N (Default Value: 0x0000_0000) ......................... 413
6.5.20. 0x0054+0x08*N EMAC MAC Address Low Register N (Default Value: 0x0000_0000) .......................... 413
6.5.21. 0x00B0 EMAC Transmit DMA Status Register (Default Value: 0x0000_0000)....................................... 414
6.5.22. 0x00B4 EMAC Transmit DMA Current Descriptor Register (Default Value: 0x0000_0000)................... 414
6.5.23. 0x00B8 EMAC Transmit DMA Current Buffer Address Register (Default Value: 0x0000_0000) ............ 414
6.5.24. 0x00C0 EMAC Receive DMA Status Register (Default Value: 0x0000_0000) ........................................ 414
6.5.25. 0x00C4 EMAC Receive DMA Current Descriptor Register (Default Value: 0x0000_0000) .................... 415
6.5.26. 0x00C8 EMAC Receive DMA Current Buffer Address Register (Default Value: 0x0000_0000) ............. 415
6.5.27. 0x00D0 EMAC RGMII Status Register (Default Value: 0x0000_0000) ................................................... 415
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 391
EMAC
Figures
Figure 6- 1. EMAC Block Diagram...................................................................................................................................... 395
Figure 6- 2. EMAC Typical Application .............................................................................................................................. 397
Figure 6- 3. EMAC RX/TX Descriptor List ........................................................................................................................... 398
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 392
EMAC
Tables
Table 6- 1. EMAC Pin Mapping.......................................................................................................................................... 395
Table 6- 2. EMAC RGMII Pin List........................................................................................................................................ 396
Table 6- 3. EMAC RMII Pin List .......................................................................................................................................... 396
Table 6- 4. EMAC Clock Characteristics ............................................................................................................................. 397
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 393
EMAC
Chapter 6 EMAC
6.1. Overview
The Ethernet Medium Access Controller (EMAC) enables a host to transmit and receive data over Ethernet in
compliance with the IEEE 802.3-2002 standard. It supports 10/100/1000 Mbps external PHY with RMII/RGMII interface
in both full and half duplex mode. The internal DMA is designed for packet-oriented data transfers based on a linked
list of descriptors. 4 KB TXFIFO and 16 KB RXFIFO are provided to keep continuous transmission and reception. Flow
Control, CRC Pad & Stripping, and address filtering are also supported in this module.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 394
EMAC
TXFIFO RXFIFO
MDC
MAC CSR
OMR
DMA CSR
Register
AHB Slave
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 396
EMAC
xMII
TX+/TX- TX+/TX-
RX+/RX- RX+/RX-
External
EMAC Transformer RJ45
PHY
MDC
MDIO
The internal DMA of EMAC transfers data between host memory and internal RX/TX FIFO with a linked list of
descriptors. Each descriptor is consisted of four words, and contains some necessary information to transfer TX and RX
frames. The descriptor list structure is shown in Figure 6-3. The address of each descriptor must be 32-bit aligned.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 397
EMAC
2nd: Buffer Size 2nd: Buffer Size 2nd: Buffer Size 2nd: Buffer Size
2rd: Buffer Addr 2rd: Buffer Addr 2rd: Buffer Addr 2rd: Buffer Addr
4th: Next Desc 4th: Next Desc 4th: Next Desc 4th: Next Desc
Bits Description
TX_DESC_CTL
31 When set, current descriptor can be used by DMA. This bit is cleared by DMA when the whole frame is
transmitted or all data in current descriptor’s buffer are transmitted.
30:17 Reserved
TX_HEADER_ERR
16
When set, the checksum of transmitted frame’s header is wrong.
15 Reserved
TX_LENGHT_ERR
14
When set, the length of transmitted frame is wrong.
13 Reserved
TX_PAYLOAD_ERR
12
When set, the checksum of transmitted frame’s payload is wrong.
11 Reserved
TX_CRS_ERR
10
When set, carrier is lost during transmission.
TX_COL_ERR_0
9
When set, the frame is aborted because of collision after contention period.
TX_COL_ERR_1
8
When set, the frame is aborted because of too many collisions.
7 Reserved
TX_COL_CNT
6:3
The number of collisions before transmission.
TX_DEFER_ERR
2
When set, the frame is aborted because of too much deferral.
TX_UNDERFLOW_ERR
1
When set, the frame is aborted because of TX FIFO underflow error.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 398
EMAC
TX_DEFER
0
When set in Half-Duplex mode, the EMAC defers the frame transmission.
Bits Description
TX_INT_CTL
31
When set and the current frame have been transmitted, the TX_INT in Interrupt Status Register will be set.
LAST_DESC
30
When set, current descriptor is the last one for current frame.
FIR_DESC
29
When set, current descriptor is the first one for current frame.
CHECKSUM_CTL
28:27
These bits control to insert checksums in transmit frame.
CRC_CTL
26
When set, CRC field is not transmitted.
25:11 Reserved
BUF_SIZE
10:0
The size of buffer specified by current descriptor.
Bits Description
BUF_ADDR
31:0
The address of buffer specified by current descriptor.
Bits Description
NEXT_DESC_ADDR
31:0
The address of next descriptor. It must be 32-bit aligned.
Bits Description
RX_DESC_CTL
31 When setting the bit, current descriptor can be used by DMA. This bit is cleared by DMA when complete
frame is received or current descriptor’s buffer is full.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 399
EMAC
RX_DAF_FAIL
30
When setting the bit, current frame does not pass DA filter.
RX_FRM_LEN
When LAST_DESC is not set and no error bit is set, this field is the length of received data for current frame.
29:16
When LAST_DESC is set, RX_OVERFLOW_ERR and RX_NO_ENOUGH_BUF_ERR are not set, this field is the
length of receive frame.
15 Reserved
RX_NO_ENOUGH_BUF_ERR
14
When setting the bit, current frame is clipped because of no enough buffer.
RX_SAF_FAIL
13
When setting the bit, current fame does not pass SA filter.
12 Reserved
RX_OVERFLOW_ERR
11
When set, a buffer overflow error occurred and current frame is wrong.
10 Reserved
FIR_DESC
9
When setting the bit, current descriptor is the first descriptor for current frame.
LAST_DESC
8
When setting the bit, current descriptor is the last descriptor for current frame.
RX_HEADER_ERR
7
When setting the bit, the checksum of frame’s header is wrong.
RX_COL_ERR
6
When setting the bit, there is a late collision during reception in half-duplex mode.
5 Reserved
RX_LENGTH_ERR
4
When setting the bit, the length of current frame is wrong.
RX_PHY_ERR
3
When setting the bit, the receive error signal from PHY is asserted during reception.
2 Reserved
RX_CRC_ERR
1
When setting the bit, the CRC filed of received frame is wrong.
RX_PAYLOAD_ERR
0
When setting the bit, the checksum or length of received frame’s payload is wrong.
Bits Description
RX_INT_CTL
31
When setting the bit, and a frame has been received, the RX_INT will not be set.
30:11 Reserved
BUF_SIZE
10:0
The size of buffer specified by current descriptor.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 400
EMAC
Bits Description
BUF_ADDR
31:0
The address of buffer specified by current descriptor.
Bits Description
NEXT_DESC_ADDR
31:0
The address of next descriptor. This field must be 32-bit aligned.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 402
EMAC
0: No valid
1: Reset
All clock inputs must be valid before soft rest. This bit is cleared internally
when the reset operation is completed fully. Before write any register, this bit
should read a 0.
31:14 / / /
RX_EARLY_INT_EN
Early Receive Interrupt
13 R/W 0x0
0: Disable
1: Enable
RX_OVERFLOW_INT_EN
Receive Overflow Interrupt
12 R/W 0x0
0: Disable
1: Enable
RX_TIMEOUT_INT_EN
Receive Timeout Interrupt
11 R/W 0x0
0: Disable
1: Enable
RX_DMA_STOPPED_INT_EN
Receive DMA FSM Stopped Interrupt
10 R/W 0x0
0: Disable
1: Enable
RX_BUF_UA_INT_EN
Receive Buffer Unavailable Interrupt
9 R/W 0x0
0: Disable
1: Enable
RX_INT_EN
Receive Interrupt
8 R/W 0x0
0: Disable
1: Enable
7:6 / / /
TX_EARLY_INT_EN
Early Transmit Interrupt
5 R/W 0x0
0: Disable
1: Enable
TX_UNDERFLOW_INT_EN
Transmit Underflow Interrupt
4 R/W 0x0
0: Disable
1: Enable
TX_TIMEOUT_INT_EN
Transmit Timeout Interrupt
3 R/W 0x0
0: Disable
1: Enable
TX_BUF_UA_INT_EN
Transmit Buffer Available Interrupt
2 R/W 0x0
0: Disable
1: Enable
TX_DMA_STOPPED_INT_EN
1 R/W 0x0 Transmit DMA FSM Stopped Interrupt
0: Disable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 405
EMAC
1: Enable
TX_INT_EN
Transmit Interrupt
0 R/W 0x0
0: Disable
1: Enable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 406
EMAC
001: 128
010: 192
011: 256
Others: Reserved
7:2 / / /
TX_MD
Transmission Mode
1 R/W 0x0
0: TX start after TX DMA FIFO bytes is greater than TX_TH
1: TX start after TX DMA FIFO located a full frame
FLUSH_TX_FIFO
Flush the data in the TX FIFO
0 R/W 0x0
0: Enable
1: Disable
6.5.7. 0x001C EMAC Transmit Flow Control Register (Default Value: 0x0000_0000)
6.5.8. 0x0020 EMAC Transmit DMA Descriptor List Address Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 408
EMAC
15:0 / / /
RX_RUNT_FRM
2 R/W 0x0 When setting, forward undersized frames with no error and length less than
64 bytes
RX_MD
Receive Mode
1 R/W 0x0
0: RX start read after RX DMA FIFO bytes is greater than RX_TH
1: RX start read after RX DMA FIFO located a full frame
FLUSH_RX_FRM
Flush Receive Frames
0 R/W 0x0
0: Enable when receive descriptors/buffers is unavailable
1: Disable
6.5.11. 0x0034 EMAC Receive DMA Descriptor List Address Register (Default Value: 0x0000_0000)
6.5.12. 0x0038 EMAC Receive Frame Filter Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 410
EMAC
11: Receive all control frames when pass the address filter
11:10 / / /
HASH_MULTICAST
Filter Multicast Frames Set
9 R/W 0x0
0: by comparing the DA field in DA MAC address registers
1: according to the hash table
HASH_UNICAST
Filter Unicast Frames Set
8 R/W 0x0
0: by comparing the DA field in DA MAC address registers
1: according to the hash table
7 / / /
SA_FILTER_EN
Receive SA Filter Enable
6 R/W 0x0 0: Receive frames and update the result of SA filter
1: Update the result of SA filter. In addition, if the SA field of received frame
does not match the values in SA MAC address registers, drop this frame.
SA_INV_FILTER
Receive SA Invert Filter Set
5 R/W 0x0
0: Pass Frames whose SA field matches SA MAC address registers
1: Pass Frames whose SA field not matches SA MAC address registers
DA_INV_FILTER
0: Normal filtering of frames is performed
4 R/W 0x0
1: Filter both unicast and multicast frames by comparing DA field in inverse
filtering mode
3:2 / / /
FLT_MD
0: If the HASH_MULTICAST or HASH_UNICAST is set, the frame is passed only
1 R/W 0x0 when it matches the Hash filter
1: Receive the frame when it passes the address register filter or the hash
filter(set by HASH_MULTICAST or HASH_UNICAST)
RX_ALL
Receive All Frame Enable
0 R/W 0x0 0: Receive the frames that pass the SA/DA address filter
1: Receive all frames and update the result of address filter(pass or fail) in
the receive status word
6.5.13. 0x0040 EMAC Receive Hash Table Register0 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 411
EMAC
6.5.14. 0x0044 EMAC Receive Hash Table Register1 (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 412
EMAC
6.5.17. 0x0050 EMAC MAC Address High Register0 (Default Value: 0x0000_FFFF)
6.5.18. 0x0054 EMAC MAC Address Low Register0 (Default Value: 0xFFFF_FFFF)
6.5.19. 0x0050+0x08*N EMAC MAC Address High Register N (Default Value: 0x0000_0000)
6.5.20. 0x0054+0x08*N EMAC MAC Address Low Register N (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 413
EMAC
MAC_ADDR_LOWN
31:0 R/W 0x0
The lower 32bits of MAC address N (N: 1~7).
6.5.21. 0x00B0 EMAC Transmit DMA Status Register (Default Value: 0x0000_0000)
6.5.22. 0x00B4 EMAC Transmit DMA Current Descriptor Register (Default Value: 0x0000_0000)
6.5.23. 0x00B8 EMAC Transmit DMA Current Buffer Address Register (Default Value: 0x0000_0000)
6.5.24. 0x00C0 EMAC Receive DMA Status Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 414
EMAC
010: Reserved
011: RUN_WAIT_FRM, waiting for frame
100: SUSPEND, RX descriptor unavailable
101: RUN_CLOSE_DESC, closing RX descriptor
110: Reserved
111: RUN_TRANS_DATA, passing frame from host memory to RX DMA FIFO;
6.5.25. 0x00C4 EMAC Receive DMA Current Descriptor Register (Default Value: 0x0000_0000)
6.5.26. 0x00C8 EMAC Receive DMA Current Buffer Address Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 415
Video Output Interfaces
Contents
Chapter 7 Video Output Interfaces................................................................................................................................ 419
7.1. TCON_TV ............................................................................................................................................................ 419
7.1.1. Overview ................................................................................................................................................. 419
7.1.2. Block Diagram ......................................................................................................................................... 419
7.1.3. Operations and Functional Descriptions ................................................................................................. 419
7.1.4. Programming Guidelines ......................................................................................................................... 422
7.1.5. Register List ............................................................................................................................................. 424
7.1.6. Registers Description ............................................................................................................................... 424
7.2. TVE ..................................................................................................................................................................... 435
7.2.1. Overview ................................................................................................................................................. 435
7.2.2. Block Diagram ......................................................................................................................................... 435
7.2.3. Operations and Functional Descriptions ................................................................................................. 435
7.2.4. Programming Guidelines ......................................................................................................................... 436
7.2.5. Register List ............................................................................................................................................. 438
7.2.6. Register Description ................................................................................................................................ 439
7.3. HDMI .................................................................................................................................................................. 459
7.3.1. Overview ................................................................................................................................................. 459
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 416
Video Output Interfaces
Figures
Figure 7- 1. TCON_TV Block Diagram ................................................................................................................................ 419
Figure 7- 2. HV Interface Vertical Timing .......................................................................................................................... 420
Figure 7- 3. HV Interface Horizontal Timing...................................................................................................................... 421
Figure 7- 4. TCON_TV Clock System .................................................................................................................................. 421
Figure 7- 5. TCON TV Initial Process .................................................................................................................................. 422
Figure 7- 6. TCON TV 3D Mode Diagram........................................................................................................................... 423
Figure 7- 7. TVE Block Diagram ......................................................................................................................................... 435
Figure 7- 8. Operate TVE Process ...................................................................................................................................... 436
Figure 7- 9. Auto Detect Function ..................................................................................................................................... 437
Figure 7- 10. DAC Calibration ............................................................................................................................................ 437
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 417
Video Output Interfaces
Tables
Table 7- 1. HV Panel Signals .............................................................................................................................................. 420
Table 7- 2. TCON_TV Clock Sources .................................................................................................................................. 421
Table 7- 3. TVE External Signals ........................................................................................................................................ 435
Table 7- 4. TVE Clock Sources ........................................................................................................................................... 436
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 418
Video Output Interfaces
7.1. TCON_TV
7.1.1. Overview
The TCON_TV(Timing Controller_TV) is a module that processes video signals received from systems using a
complicated arithmetic and then generates control signals and transmits them to the HDMI or TVE.
DCLK
VPLL TVE TIMING GENERATOR TV ctrl
HV I/F is also known as Sync + DE mode, which is used to transfer signal to HDMI I/F. Its signals are defined as:
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 419
Video Output Interfaces
Vertial Timing
VT
VBP
VSPW
Vsync
Hsync
D[23..0] Vertical invalid data period DH1 DH2 DHy Vertical invalid data period
Odd/Even field
VT
VSPW
Vsync
VBP
1//2
H
Hsync
D[23..0] Vertical invalid data period DH1 DH2 DHy Vertical invalid data period
Even field
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 420
Video Output Interfaces
HT
HBP
HSPW
Hsync
Tdclk
DCLK
DE
The following table describes the clock sources of TCON_TV. Table 7-2 describes the clock sources of TCON_TV.
/8(deflick_en)
TVE /16(deflick_dis)
PLL_VIDEO0/1(1X/4X) TCON_TV
digital clk Pixel_clk
NOTE
Rr, Rg, Rb, ,Gr, Gg, Gb, Br, Bg, Bb bool 0,1
R, G, B u10 [0-1023]
R’ have the range of [Rmin ,Rmax]
G’ have the range of [Rmin ,Rmax]
B’ have the range of [Rmin ,Rmax]
Setup Interrtupt
Enable TCON TV
Line or Vb Interrupt?
Interrupt Process
Step1: Set special clock of CCU ,and dessert TCON TV related AHB clock gating and AHB reset .
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 422
Video Output Interfaces
Step2: Set timing parameter register of TCON TV, set corresponding resolution and standards followed, such as EIA or
VESA.There are 8 parameters, including X,HT,HBP,HSPW,Y,VT,VBP,VSPW. Note that for the controller,HBP includes
HSPW width, VBP includes VSPW width, this is different with standard HBP and VBP.Note that for conversion.
Step3: Select TCON TV data sources. For the selecting of TCON TV data sources, it is decided by two setting. The first
setting is the bit1(TV_SRC_SEL_GOBAL) of TV_CTL_REG, if setting to 1,then blue data is output; if setting to 0, then data
source is decided by TV0_SRC_CTL_REG. According to needs, set up TV_SRC_SEL, select the required data sources.
Step4: The register offset of TCON TV IO Output Function Setting is 0x8C, writing 0 to the register open output
function.
Step5: Set and open interrupt. When using line interrupt, firstly the TV_LINE_INT_NUM bit of TV_GINT1 need be set,
secondly line interrupt is enabled, that is , the bit 28(TV_LINE_INT_EN) of TV_GINT0 is set to 1.
Step6: Start TCON TV.
As shown in the above figure, VT= VBLL + YL + VBLR + YR, Y = YL + VBLR + YR. But note that VT in this picture is the actual
VT, is the half of VT in register.
In 3D mode, the 2 frames is synthesized into 1 frame to send data, so the effective data area will contain a blank area,
this blank need be filled, and generally filled 0. The rest is to confirm the beginning and the end line of padding, the
formula is as follows:
Lbegin = VT/2 + 1, Lend=VT/2+(VT-Y)/2
Lastly, write Lbegin to the bit[23:12] of TV_FILL_BEGIN_REG0(0x304), write Lend to the bit[23:12] of
TV_FILL_END_RGB0(0x308), write 0 to TV_FILL_DATA_REG0(0x30C).
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 423
Video Output Interfaces
TV_EN
0: Disable
31 R/W 0x0
1: Enable
When it is disabled, the module will be reset to idle state.
30:0 / / /
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 425
Video Output Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 426
Video Output Interfaces
IO3_OUTPUT_TRI_EN
1: Disable
27 R/W 0x1
0: Enable
Enable the output of IO3.
IO2_OUTPUT_TRI_EN
1: Disable
26 R/W 0x1
0: Enable
Enable the output of IO2.
IO1_OUTPUR_TRI_EN
1: Disable
25 R/W 0x1
0: Enable
Enable the output of IO1.
IO0_OUTPUT_TRI_EN
1: Disable
24 R/W 0x1
0: Enable
Enable the output of IO0.
23:0 / / /
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 427
Video Output Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 428
Video Output Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 429
Video Output Interfaces
ECC_FIFO_BLANK_EN
0: Disable ECC function in blanking
8 R/W 0x0 1: Enable ECC function in blanking
ECC function is tent to trigger in blanking area at HV mode, set ‘0’ when in HV
mode.
7:4 / / /
ECC_FIFO_SETTING
0:Enable
3 R/W 0x0
1:Disable
Enable ECC FIFO function.
2:0 / / /
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 430
Video Output Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 431
Video Output Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 432
Video Output Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 433
Video Output Interfaces
15:10 / / /
G/Y Channel Data_Output_Tri_En
1: disable
9:0 R/W 0x3ff
0: enable
Only higher 6-bit is valid.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 434
Video Output Interfaces
7.2. TVE
7.2.1. Overview
The TV Encoder(TVE) module is a highly programmable digital video encoder supporting worldwide video standards
Composite Video Broadcast Signal (CVBS).
digital analog
De-
Y noise
Peaking Y LPF1 DELAY Y
SIN Up DAC
CVBS
U LPF2 sample 10bit 216MSPS
De-flick
C
U DELAY
V LPF2
Burst
V DELAY COS
Plug Detect
DDFS
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 435
Video Output Interfaces
The TVE module requires one clock with 50% duty. Digital circuit and Analog circuit work by this clock. Mode and
Clock frequency is shown below.
(1) Operate TVE module by the following step, the process is shown in Figure 7-8.
Step1: Set CCU clock source for TVE, and release AHB bus, and module reset.
Step2: Initial DAC amplitude value from efuse calibration value which has burned.
Step3: Enable plug-in detect function, and detect plug-in status every 200ms.
Step4: When plug-in has detected, configure TVE module to output mode setting by application.
Delay 200ms
No
Plug-In?
Yes
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 436
Video Output Interfaces
Insert DAC
Pulse cycle
Detect Status Filter Detect Signal time
75R 75R
comparator
Pulse
Start
Ref voltage
Ref voltage
DAC outputs constant current, when insert, external load is 37.5Ω; when pull out, external load is 75Ω. The method
that comparator judges pin level can detect plug action.
Because plug action may exist jitter, then there need be a filter to filter jitter, the debounce time of filter is set through
the bit[3:0] of TV Encoder Auto Detection de-bounce Setting Register.
The pulse cycle time can be set through the bit[30:16] of TV Encoder Auto Detect Configuration Register1, the pulse
start time can be set through the bit[14:0] of TV Encoder Auto Detect Configuration Register1.The clock sources of the
two time are 32KHz clock.
Pulse width is cycle time of 4 clock sources.
Pulse amplitude can be set through the bit[9:0] of TV Encoder Auto Detect Configuration Register0.
EFUSE
EFUSE
BIAS Current Generator
……
10 switch
Get Value(10bits) to control switchs
DAC Vout
37.5R
After FT, 10-bit calibration value is burned into efuse. Every time software can read the 10-bit calibration value from
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 437
Video Output Interfaces
efuse, to control BIAS current and BIAS current switch, then a specific BIAS current is generated to calibrate maximum
output voltage of DAC.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 438
Video Output Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 439
Video Output Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 442
Video Output Interfaces
7.2.6.11. 0x000C TV Encoder Notch and DAC Delay Register(Default Value: 0x0201_4924)
7.2.6.18. 0x0034 TV Encoder Auto Detection Interrupt Status Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 448
Video Output Interfaces
7.2.6.20. 0x003C TV Encoder Auto Detection Debounce Setting Register(Default Value: 0x0000_0000)
7.2.6.23. 0x0100 TV Encoder Color Burst Phase Reset Configuration Register (Default Value: 0x0000_0001)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 449
Video Output Interfaces
7.2.6.25. 0x0108 TV Encoder Notch Filter Frequency Register (Default Value: 0x0000_0002)
7.2.6.27. 0x0110 TV Encoder Tint and Color Burst Phase Register (Default Value: 0x0000_0000)
7.2.6.30. 0x011C TV Encoder Sync and VBI Level Register (Default Value: 0x0010_00F0)
7.2.6.32. 0x0124 TV Encoder Video Active Line Register (Default Value: 0x0000_05A0)
7.2.6.33. 0x0128 TV Encoder Video Chroma BW and CompGain Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 453
Video Output Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 456
Video Output Interfaces
7.2.6.40. 0x0384 TV Encoder Low Pass Filter Control Register(Default Value: 0x0000_0000)
7.2.6.42. 0x038C TV Encoder Low Pass Gain Control Register(Default Value: 0x0000_0000)
7.2.6.43. 0x0390 TV Encoder Low Pass Shoot Control Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 457
Video Output Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 458
Video Output Interfaces
7.3. HDMI
7.3.1. Overview
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 459
Audio
Contents
Chapter 8 Audio ............................................................................................................................................................. 463
8.1. Audio HUB .......................................................................................................................................................... 463
8.1.1. Overview ................................................................................................................................................. 463
8.1.2. Block Diagram ......................................................................................................................................... 463
8.1.3. Operations and Functional Descriptions ................................................................................................. 465
8.1.4. Operation Modes .................................................................................................................................... 468
8.1.5. Typical Application .................................................................................................................................. 470
8.1.6. Register List ............................................................................................................................................. 471
8.1.7. Register Description ................................................................................................................................ 473
8.2. DMIC................................................................................................................................................................... 513
8.2.1. Overview ................................................................................................................................................. 513
8.2.2. Block Diagram ......................................................................................................................................... 513
8.2.3. Operations and Functional Descriptions ................................................................................................. 513
8.2.4. Register List ............................................................................................................................................. 515
8.2.5. Register Description ................................................................................................................................ 516
8.3. OWA ................................................................................................................................................................... 526
8.3.1. Overview ................................................................................................................................................. 526
8.3.2. Block Diagram ......................................................................................................................................... 526
8.3.3. Operations and Functional Descriptions ................................................................................................. 526
8.3.4. Register List ............................................................................................................................................. 530
8.3.5. Register Description ................................................................................................................................ 531
8.4. Audio Codec ....................................................................................................................................................... 539
8.4.1. Overview ................................................................................................................................................. 539
8.4.2. Block Diagram ......................................................................................................................................... 539
8.4.3. Operations and Functional Descriptions ................................................................................................. 540
8.4.4. Programming Guidelines ......................................................................................................................... 546
8.4.5. Register List ............................................................................................................................................. 547
8.4.6. Register Description ................................................................................................................................ 548
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 460
Audio
Figures
Figure 8- 1. Audio HUB Block Diagram .............................................................................................................................. 464
Figure 8- 2. Audio HUB Crossbar Switch and Clients ........................................................................................................ 464
Figure 8- 3. Signal Exchange between TX and RX Clients.................................................................................................. 465
Figure 8- 4. Timing Diagram for Standard I2S/TDM-I2S Mode ......................................................................................... 466
Figure 8- 5. Timing Diagram for Left-justified/TDM-Left Mode ........................................................................................ 467
Figure 8- 6. Timing Diagram for Right-justified/TDM-Right Mode ................................................................................... 467
Figure 8- 7. Timing Diagram for PCM Mode (long frame)................................................................................................. 467
Figure 8- 8. Timing Diagram for PCM Mode (short frame) ............................................................................................... 468
Figure 8- 9. AUDIO HUB Operation Flow .......................................................................................................................... 468
Figure 8- 10.USB MIC Karaoke Date Streaming ................................................................................................................ 470
Figure 8- 11. Analog MIC Karaoke Date Streaming ........................................................................................................... 471
Figure 8- 12. DMIC Block Diagram .................................................................................................................................... 513
Figure 8- 13. DMIC Operation Mode................................................................................................................................. 514
Figure 8- 14. OWA Block Diagram ..................................................................................................................................... 526
Figure 8- 15. OWA Biphase-Mark Code ............................................................................................................................ 527
Figure 8- 16. OWA Sub-Frame Format .............................................................................................................................. 528
Figure 8- 17. OWA Frame/Block Format ........................................................................................................................... 529
Figure 8- 18. OWA Operation Flow ................................................................................................................................... 529
Figure 8- 19. Audio Codec Block Diagram ......................................................................................................................... 539
Figure 8- 20. Audio Codec Clock Diagram ......................................................................................................................... 541
Figure 8- 21. Audio Codec Digital Part Reset System ........................................................................................................ 542
Figure 8- 22. Audio Codec Analog Part Reset System ....................................................................................................... 542
Figure 8- 23. Audio Codec Data Path Diagram .................................................................................................................. 542
Figure 8- 24. Audio Codec Interrupt System ..................................................................................................................... 543
Figure 8- 25. DAP Data Flow ............................................................................................................................................. 544
Figure 8- 26. DRC Block Diagram....................................................................................................................................... 544
Figure 8- 27. DRC Static Curve Parameters ....................................................................................................................... 544
Figure 8- 28. DRC Process ................................................................................................................................................. 545
Figure 8- 29. Energy Filter Structure ................................................................................................................................. 545
Figure 8- 30. Gain Smooth Filter ....................................................................................................................................... 546
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 461
Audio
Tables
Table 8- 1. Audio HUB External Signals ............................................................................................................................. 465
Table 8- 2. Audio HUB Clock Sources ................................................................................................................................ 466
Table 8- 3. DMIC External Signals...................................................................................................................................... 513
Table 8- 4. DMIC Clock Sources......................................................................................................................................... 514
Table 8- 5. OWA External Signals ...................................................................................................................................... 527
Table 8- 6. OWA Clock Sources ......................................................................................................................................... 527
Table 8- 7. Biphase-Mark Encoder .................................................................................................................................... 528
Table 8- 8. Preamble Codes .............................................................................................................................................. 529
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 462
Audio
Chapter 8 Audio
8.1.1. Overview
The Audio HUB(AHUB) defines an audio subsystem to support various types of audio protocols and function modules.
To provide a flexible audio streaming environment, it is essential to implement a versatile audio fabric to connect
audio modules independently and simultaneously.
The Audio HUB is a crossbar switch matrix connecting various audio modules such as I2S/PCM, Digital Audio
MIXER(DAM), etc. Audio HUB is attached to the APB bus and is programmable through the bus.
Features:
Concurrent switching between audio clients
- The audio client are I2S/PCM, DAM and APBIF
- A TX client can talk to multiple RX clients simultaneously
- A RX client can only talk to one TX clients
Scalable MxN crossbar switch, where
- M is the number of TX clients
- N is the number of RX clients
Supports three 64x32bit TX streams FIFO and three 128x32bit RX streams FIFO for APB DMA operations
Supports 2 DAM, and 1 I2S/PCM for HDMI
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 463
Audio
APBIF
RX DIF
DMA TX FIFO TX DIF
RX DIF DAM0
RX DIF
TX DIF ConfigLink
TX DIF ConfigLink
ConfigLink
AHUB
RX DIF I2S/PCM0
TX DIF ConfigLink
RX DIF HDMI
(I2S/PCM1)
TX DIF ConfigLink
RX DIF I2S/PCM2
TX CIF ConfigLink
APB DATA Interface
RX DIF I2S/PCM3
CIF Interface
TX CIF ConfigLink
Config Interface
External Interface
ConfigLink
Audio HUB
APBIF TXDIF
DAM0 TXDIF
DAM1 TXDIF
I2S0 TXDIF
I2S2 TXDIF
I2S3 TXDIF
HDMI_I2S RXDIF
DAM0 RXDIF
DAM1 RXDIF
APBIF RXDIF
I2S2 RXDIF
I2S0 RXDIF
I2S3 RXDIF
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 464
Audio
data
chan
fsync RX DIF
ready
data data
chan chan
TX DIF fsync fsync RX DIF
ready ready
data
chan
fsync RX DIF
ready
The following table describes the external signals of Audio HUB. In the Audio HUB controller, the I2S/PCM contacts
external signals. BCLK and LRCK are bidirectional I/O. When I2S/PCM is configured as Master device, BCLK and LRCK is
output pin; when I2S/PCM is configure as slave device, BCLK and LRCK is input pin. MCLK is output pin for external
device. SDO is always the serial data output pin, and SDI is the serial data input. For information about General
Purpose I/O port, see Port Controller.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 465
Audio
Audio HUB System controller uses the APB CLK and AUDIO_PLL. The APB CLK is the system clock and the Audio PLL is
the protocol clock. Table 8-2 describes the clock sources for Audio HUB system. Users can see Clock Controller
Unit(CCU) for clock setting, configuration and gating information.
The Audio HUB consists of three I2S/PCM, one I2S/PCM for HDMI, and two DAM(Digital Audio MIXER). The I2S/PCM
supports standard I2S mode, Left-justified I2S mode, Right-justified I2S mode, PCM mode and TDM mode. Software
can select one of them in which the I2S/PCM works by setting the I2S/PCM Control Register. From Figure 8-4 to Figure
8-8 describe the waveforms for LRCK, BCLK and DOUT, DIN.
DOUT/DIN 16 slot 0 2 4 12 14 1 3 5 13 15
DOUT/DIN 8 slot 0 2 4 6 1 3 5 7
m Slot m=0~15
DOUT/DIN 4 slot 0 2 1 3
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 466
Audio
1 / fs
LRCK Left Channel Right Channel
BCLK
DOUT/DIN 16 slot 0 2 4 12 14 1 3 5 13 15
DOUT/DIN 8 slot 0 2 4 6 1 3 5 7
m Slot m=0~15
DOUT/DIN 4 slot 0 2 1 3
DOUT/DIN 16 slot 0 2 4 12 14 1 3 5 13 15
DOUT/DIN 8 slot 0 2 4 6 1 3 5 7
DOUT/DIN 2 slot 0 1
n-1 n-2 …
MSB sample LSB
LRCK
(long frame)
BCLK
DOUT/DIN 16 slot 0 1 2 3 4 5 6 7 14 15
DOUT/DIN 8 slot 0 1 2 3 4 5 6 7
DOUT/DIN 4 slot 0 1 2 3
m Slot m=0~15
DOUT/DIN 2 slot 0 1
n-1 n-2 … 1 0 sample
MSB LSB
DOUT/DIN 1 slot 0
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 467
Audio
LRCK
(short frame)
BCLK
DOUT/DIN 16 slot 0 1 2 3 4 5 6 7 14 15
DOUT/DIN 8 slot 0 1 2 3 4 5 6 7
DOUT/DIN 4 slot 0 1 2 3
m Slot m=0~15
DOUT/DIN 2 slot 0 1
n-1 n-2 … 1 0 sample
MSB LSB
DOUT/DIN 1 slot 0
The software operation of the AHUB has eight steps: system setup, TXDIF Initial and Enable, RXDIF Initial and Enable,
I2SnInitial and Enable, DAM Initial and Enable, DMA setup, AHUB disable and Check Record_buffer. Eight steps are
described in detail in the following sections.
I2S_PCM Reset
GPIO Configuration
System Setup
I2S_PCM Gating
DAM Reset
DMA Setup
Globe and TX/RX Disable
TXDIF/RXDIF Gating
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 468
Audio
In the system setup, the first step is properly programming the GPIO.
Follow the clock source for Audio HUB. Choose 24.576 MHz or 22.5792 MHz. At first, set up the frequency of
PLL_AUDIO in the PLL_AUDIO_CTRL_REG, and disable the PLL_ENABLE bit of PLL_AUDIO_CTRL_REG. Then, enable
the PLL_ENABLE bit of PLL_AUDIO_CTRL_REG, clear the AUDIO_HUB Clock Register and the AUDI0_HUB Bus Gating
Reset Register. Then open the Audio HUB SCLK_GATING by writing 1 to AUDIO_HUB Clock Register[31], and open the
Bus reset and gating by writing 1 to AUDI0_HUB Bus Gating Reset Register[0]/[16].
Firstly, Reset and open the gating clock of the TXDIFn(n=0~2) by writing 1 to the AHUB Reset[31:29] and AHUB
Gating[31:29]. When the TXDIF is used, the corresponding bit will be set. Secondly, set up the format of the TXDIF,
including TX_width, chan_num, txim and txtl. You can setup the format by writing value to TXn_Control and TXn FIFO
Control.
RXDIF initialization is similar to TXDIF. Firstly, reset and open the gating clock of the RXDIFn(n=0~2) by writing 1 to the
AHUB Reset[27:25] and AHUB Gating[27:25]. When the TXDIF is used, the corresponding bit will be set. Secondly, set
up the format of the RXDIF, including RX_width, chan_num, rxom , rxtl and rx_src. You can setup the format by writing
value to RXn_Control and RXn FIFO Control. And setup the rx_src by writing value to RXn Contact Select Register.
When the TXDIF contact to this RXDIF, the corresponding bit will be set.
Firstly, reset and open the gating clock of the I2Sn(n=0~3) by writing 1 to the AHUB Reset[23:20] and AHUB
Gating[23:20]. When the I2S is used, the corresponding bit will be set. Secondly, you should close the globe enable
bit(I2Sn_CTRL[0]), disable TX and RX bit(I2Sn_CTRL[2:1]). Thirdly, you can setup the I2S/PCM of mater and slave. And
choose the contact object to setup I2Sn_RXDIF_CONT. The configuration can be referred to the protocol of I2S/PCM.
Thirdly, you can set up the translation mode, the sample resolution, the wide of slot, the channel slot number and so
on. And then, setup the globe enable, TX enable and RX enable.
DAM initialization is similar to I2S. Firstly, reset and open the gating clock of the DAMn(n=0~1) by writing 1 to the
AHUB Reset[15:14] and AHUB Gating[15:14]. When the DAM is used, the corresponding bit will be set. Secondly, you
can setup the DAM of RXn_chan_num(n=0~2) and TX_chan_num. And choose the contact object to setup
DAM_RXDIFn_SRC(n=0~2). Thirdly, you can set up the RXn(n=0~2) and the TX channel in the DAM, and the channel
volume. Please refer to the specification for more details.
The Audio HUB supports two methods to transfer the data. The most common way is DMA, the setup of DMA can be
found in the DMA specification. In this module, you just enable the DRQ and open the streaming start.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 469
Audio
At last, you must disable the Audio HUB by writing 0x0 to the AHUB_RST Register.
APBIF
RX DIF
USB MIC DMA TX FIFO TX DIF
RX DIF DAM0
Accompanying sound RX DIF
System sound
TX DIF ConfigLink
TX DIF ConfigLink
ConfigLink AHUB
CVBS Output
RX DIF I2S0
TX DIF ConfigLink
HDMI Output
RX DIF HDMI_I2S1
TX DIF ConfigLink
RX DIF I2S2
TX CIF ConfigLink
RX DIF I2S3
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 470
Audio
APBIF
RX DIF
DMA TX FIFO TX DIF
RX DIF DAM0
Accompanying sound
RX DIF
System sound
TX DIF ConfigLink
TX DIF ConfigLink
ConfigLink AHUB
CVBS Output
RX DIF I2S0
TX DIF ConfigLink
RX DIF I2S2
TX CIF ConfigLink
RX DIF I2S3
TX CIF ConfigLink
ConfigLink
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 471
Audio
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 473
Audio
DAM1_RST
14 R/W 0x0 0: Assert
1: De-assert
13:0 / / /
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 474
Audio
0: Clock is OFF
1: Clock is ON
DAM1_GAT
14 R/W 0x0 0: Clock is OFF
1: Clock is ON
13:0 / / /
8.1.7.3. 0x0010+n*0x0030 AHUB APBIF TXn Control Register (Default Value: 0x0000_0100)
8.1.7.4. 0x0014+n*0x0030 AHUB APBIF TXn DMA & Interrupt Control Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 475
Audio
1: Enable
2 / / /
TXnOI_EN
TX FIFO Overrun Interrupt Enable
1 R/W 0x0
0: Disable
1: Enable
TXnEI_EN
TX FIFO Empty Interrupt Enable
0 R/W 0x0
0: Disable
1: Enable
8.1.7.5. 0x0018+n*0x0030 AHUB APBIF TXn DMA & Interrupt Status Register (Default Value: 0x0000_0001)
8.1.7.6. 0x0020+n*0x0030 AHUB APBIF TXn FIFO Control Register (Default Value: 0x0000_0200)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 476
Audio
TXnIM
TX FIFO Input Mode(Mode 0, 1)
0: Valid data at the MSB of TXFIFO register
0 R/W 0x0 1: Valid data at the LSB of TXFIFO register
Example for 20-bit transmitted audio sample:
Mode0: FIFO_I[31:0]={APB_WDATA[31:12], 12’h0}
Mode1: FIFO_I[31:0]={APB_WDATA[19:0], 12’h0}
8.1.7.7. 0x0024+n*0x0030 AHUB APBIF TXn FIFO Status Register (Default Value: 0x0000_0140)
8.1.7.8. 0x0030+n*0x0030 AHUB APBIF TXn FIFO Register (Default Value: 0x0000_0000)
8.1.7.9. 0x0034+n*0x0030 AHUB APBIF TXn FIFO Counter Register (Default Value: 0x0000_0000)
8.1.7.10. 0x0100+n*0x0030 AHUB APBIF RXn Control Register (Default Value: 0x0000_0100)
8.1.7.11. 0x0104+n*0x0030 AHUB APBIF RXn DMA & Interrupt Control Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 478
Audio
1: Enable
1 / / /
RXnAI_EN
RX FIFO Data Available Interrupt Enable
0 R/W 0x0
0: Disable
1: Enable
8.1.7.12. 0x0108+n*0x0030 AHUB APBIF RXn DMA & Interrupt Status Register (Default Value: 0x0000_0001)
8.1.7.13. 0x0110+n*0x0030 AHUB APBIF RXn FIFO Control Register (Default Value: 0x0000_0400)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 479
Audio
8.1.7.14. 0x0114+n*0x0030 AHUB APBIF RXn FIFO Status Register (Default Value: 0x0000_0000)
8.1.7.15. 0x0118+n*0x0030 AHUB APBIF RXn Contact Select Register (Default Value: 0x0000_0000)
11:0 / / /
8.1.7.16. 0x0120+n*0x0030 AHUB APBIF RXn FIFO Register (Default Value: 0x0000_0000)
8.1.7.17. 0x0124+n*0x0030 AHUB APBIF RXn FIFO Counter Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 482
Audio
LOOPBACK
Loop back test
3 R/W 0x0 0: Normal mode
1: Loopback test
When set ‘1’, connecting the SDO0 with the SDI
TXEN
Transmitter Block Enable
2 R/W 0x0
0: Disable
1: Enable
RXEN
Receiver Block Enable
1 R/W 0x0
0: Disable
1: Enable
GEN
Globe Enable
0 R/W 0x0 A disable on this bit overrides any other block or channel enables.
0: Disable
1: Enable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 483
Audio
N = 7 : 8 BCLKs width
...
N = 1023 : 1024 BCLKs width
BCLK_POLARITY
7 R/W 0x0 0: Normal mode, negative edge drive and positive edge sample
1: Invert mode, positive edge drive and negative edge sample
SR
Sample Resolution
000: Reserved
001: 8-bit
010: 12-bit
6:4 R/W 0x3
011: 16-bit
100: 20-bit
101: 24-bit
110: 28-bit
111: 32-bit
EDGE_TRANSFER
0: SDO drive data and SDI sample data at the different BCLK edge
3 R/W 0x0 1: SDO drive data and SDI sample data at the sample BCLK edge
BCLK_PLARITY = 0, use negative edge
BCLK_PLARITY = 1, use positive edge
SW
Slot Width Select
000: Reserved
001: 8-bit
010: 12-bit
2:0 R/W 0x3
011: 16-bit
100: 20-bit
101: 24-bit
110: 28-bit
111: 32-bit
1: LSB First
SEXT
Sign Extend in slot [sample resolution < width]
00: Zeros or audio gain padding at LSB position
5:4 R/W 0x3
01: Sign extension at MSB position
10: Reserved
11: Transfer 0 after each sample in each slot
RX_PDM
PCM Data Mode
00: Linear PCM
3:2 R/W 0x0
01: reserved
10: 8-bit u-law
11: 8-bit A-law
TX_PDM
PCM Data Mode
00: Linear PCM
1:0 R/W 0x0
01: reserved
10: 8-bit u-law
11: 8-bit A-law
8.1.7.21. 0x020C+n*0x0100 AHUB I2Sn Clock Divide Register (Default Value: 0x0000_0000)
8.1.7.22. 0x0220+n*0x0100 AHUB I2Sn RXDIF Contact Select Register (Default Value: 0x0000_0000)
Bit[13]:Reserved
Bit[12]:Reserved
When the TXDIF Contact to this RXDIF, the corresponding bit will be set.
11:0 / / /
8.1.7.23. 0x0224+n*0x0100 AHUB I2Sn Channel Configuration Register (Default Value: 0x0000_0000)
8.1.7.24. 0x0228+n*0x0100 AHUB I2Sn DMA & Interrupt Control Register (Default Value: 0x0000_0000)
8.1.7.25. 0x022C+n*0x0100 AHUB I2Sn DMA & Interrupt Status Register (Default Value: 0x0000_0000)
8.1.7.26. 0x0230+n*0x0100+m*0x0010 AHUB I2Sn Output SLOT Control Register (Default Value: 0x0000_0000)
Offset: 0x0230+n*0x0100+m*0x0010
Register Name: I2Sn_SDOUTm_SLOTCTR
(n=0~3)(m=0~3)
Bit Read/Write Default/Hex Description
31:22 / / /
SDOUTm_OFFSET
SDOUT offset tune, SDOUT data offset to LRCK
21:20 R/W 0x0
0: no offset
n: data is offset by n BCLKs to LRCK
SDOUTm_SLOT_NUM
SDOUT slot number select for each output
0000: 1 Slots
...
19:16 R/W 0x0
0111: 8 Slots
1000: 9 Slots
...
1111: 16 Slots
SDOUTm_SLOT_EN
SDOUT slot enable, bit[15:0] refer to slot[15:0]. When one or more
15:0 R/W 0x0 slot(s) is(are) disable, the affected slot(s) is(are) set to disable state
0: Disable
1: Enable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 488
Audio
8.1.7.27. 0x0234+n*0x0100+m*0x0010 AHUB SDOUTm Channel Mapping Register 0(Default Value: 0x7654_3210)
Offset: 0x0234+n*0x0100+m*0x0010
Register Name: I2Sn_SDOUTmCHMAP0
(n=0~3)(m=0~3)
Bit Read/Write Default/Hex Description
SDOUTm_SLOT7_MAP
SDOUT Slot7 Mapping
31:28 R/W 0x7 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT6_MAP
SDOUT Slot6 Mapping
27:24 R/W 0x6 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT5_MAP
SDOUT Slot5 Mapping
23:20 R/W 0x5 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT4_MAP
SDOUT Slot4 Mapping
19:16 R/W 0x4 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT3_MAP
SDOUT Slot3 Mapping
15:12 R/W 0x3 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT2_MAP
SDOUT Slot2 Mapping
11:8 R/W 0x2 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT1_MAP
SDOUT Slot1 Mapping
7:4 R/W 0x1 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT0_MAP
3:0 R/W 0x0 SDOUT Slot0 Mapping
0000: 1st channel data
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 489
Audio
...
1111: 16th channel data
8.1.7.28. 0x0238+n*0x0100+m*0x0010 AHUB SDOUTm Channel Mapping Register 1(Default Value: 0xFEDC_BA98)
Offset: 0x0238+n*0x0100+m*0x0010
Register Name: I2Sn_SDOUTmCHMAP1
(n=0~3)(m=0~3)
Bit Read/Write Default/Hex Description
SDOUTm_SLOT15_MAP
SDOUT Slot15 Mapping
31:28 R/W 0xF 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT14_MAP
SDOUT Slot14 Mapping
27:24 R/W 0xE 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT13_MAP
SDOUT Slot13 Mapping
23:20 R/W 0xD 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT12_MAP
SDOUT Slot12 Mapping
19:16 R/W 0xC 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT11_MAP
SDOUT Slot11 Mapping
15:12 R/W 0xB 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT10_MAP
SDOUT Slot10 Mapping
11:8 R/W 0xA 0000: 1st channel data
...
1111: 16th channel data
SDOUTm_SLOT9_MAP
SDOUT Slot9 Mapping
7:4 R/W 0x9 0000: 1st channel data
...
1111: 16th channel data
3:0 R/W 0x8 SDOUTm_SLOT8_MAP
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 490
Audio
8.1.7.29. 0x0270+n*0x0100 AHUB I2Sn Input Slot Control Register (Default Value: 0x0000_0000)
8.1.7.30. 0x0274+n*0x0100 AHUB SDIN Channel Mapping Register 0(Default Value: 0x0302_0100)
10: SDI2
11: SDI3
RXFIFO_Sample2_MAP
RXFIFO Sample2 Mapping
19:16 R/W 0x2 0: 1st channel data
...
15: 16th channel data
15:14 / / /
RXFIFO_Sample1_Select
00: SDI0
13:12 R/W 0x0 01: SDI1
10: SDI2
11: SDI3
RXFIFO_Sample1_MAP
RXFIFO Sample1 Mapping
11:8 R/W 0x1 0: 1st channel data
...
15: 16th channel data
7:6 / / /
RXFIFO_Sample0_Select
00: SDI0
5:4 R/W 0x0 01: SDI1
10: SDI2
11: SDI3
RXFIFO_Sample0_MAP
RXFIFO Sample0 Mapping
3:0 R/W 0x0 0: 1st channel data
...
15: 16th channel data
8.1.7.31. 0x0278+n*0x0100 AHUB SDIN Channel Mapping Register 1(Default Value: 0x0706_0504)
8.1.7.32. 0x027C+n*0x0100 AHUB SDIN Channel Mapping Register 2(Default Value: 0x0B0A_0908)
11: SDI3
RXFIFO_Sample11_MAP
RXFIFO Sample11 Mapping
27:24 R/W 0xB 0: 1st channel data
...
15: 16th channel data
23:22 / / /
RXFIFO_Sample10_Select
00: SDI0
21:20 R/W 0x0 01: SDI1
10: SDI2
11: SDI3
RXFIFO_Sample10_MAP
RXFIFO Sample10 Mapping
19:16 R/W 0xA 0: 1st channel data
...
15: 16th channel data
15:14 / / /
RXFIFO_Sample9_Select
00: SDI0
13:12 R/W 0x0 01: SDI1
10: SDI2
11: SDI3
RXFIFO_Sample9_MAP
RXFIFO Sample9 Mapping
11:8 R/W 0x9 0: 1st channel data
...
15: 16th channel data
7:6 / / /
RXFIFO_Sample8_Select
00: SDI0
5:4 R/W 0x0 01: SDI1
10: SDI2
11: SDI3
RXFIFO_Sample8_MAP
RXFIFO Sample8 Mapping
3:0 R/W 0x8 0: 1st channel data
...
15: 16th channel data
8.1.7.33. 0x0280+n*0x0100 AHUB SDIN Channel Mapping Register 3(Default Value: 0x0F0E_0D0C)
31:30 / / /
RXFIFO_Sample15_Select
00: SDI0
29:28 R/W 0x0 01: SDI1
10: SDI2
11: SDI3
RXFIFO_Sample15_MAP
RXFIFO Sample15 Mapping
27:24 R/W 0xF 0: 1st channel data
...
15: 16th channel data
23:22 / / /
RXFIFO_Sample14_Select
00: SDI0
21:20 R/W 0x0 01: SDI1
10: SDI2
11: SDI3
RXFIFO_Sample14_MAP
RXFIFO Sample14 Mapping
19:16 R/W 0xE 0: 1st channel data
...
15: 16th channel data
15:14 / / /
RXFIFO_Sample13_Select
00: SDI0
13:12 R/W 0x0 01: SDI1
10: SDI2
11: SDI3
RXFIFO_Sample13_MAP
RXFIFO Sample13 Mapping
11:8 R/W 0xD 0: 1st channel data
...
15: 16th channel data
7:6 / / /
RXFIFO_Sample12_Select
00: SDI0
5:4 R/W 0x0 01: SDI1
10: SDI2
11: SDI3
RXFIFO_Sample12_MAP
RXFIFO Sample12 Mapping
3:0 R/W 0xC 0: 1st channel data
...
15: 16th channel data
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 495
Audio
8.1.7.34. 0x0A00 + n*0x0080 AHUB DAM Control Register (Default Value: 0x0000_0000)
8.1.7.35. 0x0A10 + n*0x0080 AHUB DAM RXDIF0 Source Select (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 496
Audio
Bit[27]:I2S0_TXDIF
Bit[26]:I2S1_TXDIF(HDMI)
Bit[25]:I2S2_TXDIF
Bit[24]:Reserved
Bit[23]:I2S3_TXDIF
Bit[22]:Reserved
Bit[21]:Reserved
Bit[20]:Reserved
Bit[19]:DAM0_TXDIF0
Bit[18]:Reserved
Bit[17]:Reserved
Bit[16]:Reserved
Bit[15]:DAM1_TXDIF0
Bit[14]:Reserved
Bit[13]:Reserved
Bit[12]:Reserved
When the TXDIF Contact to this RXDIF, the corresponding bit will be set.
11:0 / / /
8.1.7.36. 0x0A14 + n*0x0080 AHUB DAM RXDIF1 Source Select (Default Value: 0x0000_0000)
When the TXDIF Contact to this RXDIF, the corresponding bit will be set.
11:0 / / /
8.1.7.37. 0x0A18 + n*0x0080 AHUB DAM RXDIF2 Source Select (Default Value: 0x0000_0000)
8.1.7.38. 0x0A30 + n*0x0080 AHUB DAM MIX Control 0(Default Value: 0x0111_0000)
8.1.7.39. 0x0A34 + n*0x0080 AHUB DAM MIX Control 1(Default Value: 0x0333_0222)
8.1.7.40. 0x0A38 + n*0x0080 AHUB DAM MIX Control 2(Default Value: 0x0555_0444)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 499
Audio
31:28 / / /
TXCH5_MIX_RXCH2
27:24 R/W 0x5 RX2 Channel NUM to TXDIF Channel 5
N: TXDIF Channel 5 MIX RX2 Channel N
TXCH5_MIX_RXCH1
23:20 R/W 0x5 RX1 Channel NUM to TXDIF Channel 5
N: TXDIF Channel 5 MIX RX1 Channel N
TXCH5_MIX_RXCH0
19:16 R/W 0x5 RX0 Channel NUM to TXDIF Channel 5
N: TXDIF Channel 5 MIX RX0 Channel N
15:12 / / /
TXCH4_MIX_RXCH2
11:8 R/W 0x4 RX2 Channel NUM to TXDIF Channel 4
N: TXDIF Channel 4 MIX RX2 Channel N
TXCH4_MIX_RXCH1
7:4 R/W 0x4 RX1 Channel NUM to TXDIF Channel 4
N: TXDIF Channel 2 MIX RX1 Channel N
TXCH4_MIX_RXCH0
3:0 R/W 0x4 RX0 Channel NUM to TXDIF Channel 4
N: TXDIF Channel 4 MIX RX0 Channel N
8.1.7.41. 0x0A3C + n*0x0080 AHUB DAM MIX Control 3(Default Value: 0x0777_0666)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 500
Audio
8.1.7.42. 0x0A40 + n*0x0080 AHUB DAM MIX Control 4(Default Value: 0x0999_0888)
8.1.7.43. 0x0A44 + n*0x0080 AHUB DAM MIX Control 5(Default Value: 0x0BBB_0AAA)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 501
Audio
15:12 / / /
TXCHA_MIX_RXCH2
11:8 R/W 0xA RX2 Channel NUM to TXDIF Channel A
N: TXDIF Channel A MIX RX2 Channel N
TXCHA_MIX_RXCH1
7:4 R/W 0xA RX1 Channel NUM to TXDIF Channel A
N: TXDIF Channel A MIX RX1 Channel N
TXCHA_MIX_RXCH0
3:0 R/W 0xA RX0 Channel NUM to TXDIF Channel A
N: TXDIF Channel A MIX RX0 Channel N
8.1.7.44. 0x0A48 + n*0x0080 AHUB DAM MIX Control 6(Default Value: 0x0DDD_0CCC)
8.1.7.45. 0x0A4C + n*0x0080 AHUB DAM MIX Control 7(Default Value: 0x0FFF_0EEE)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 502
Audio
8.1.7.46. 0x0A50 + n*0x0080 AHUB DAM Volume Control 0(Default Value: 0x0111_0111)
Others: Reserved
15:12 / / /
TXCH0_GAIN_RXCH2
RX2 Channel NUM to TXDIF Channel 0 Gain
0000: Mute
11:8 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
TXCH0_GAIN_RXCH1
RX1 Channel NUM to TXDIF Channel 0 Gain
0000: Mute
7:4 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
TXCH0_GAIN_RXCH0
RX0 Channel NUM to TXDIF Channel 0 Gain
0000: Mute
3:0 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
8.1.7.47. 0x0A54 + n*0x0080 AHUB DAM Volume Control 1(Default Value: 0x0111_0111)
8.1.7.48. 0x0A58 + n*0x0080 AHUB DAM Volume Control 2(Default Value: 0x0111_0111)
0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
TXCH5_GAIN_RXCH0
RX0 Channel NUM to TXDIF Channel 5 Gain
0000: Mute
19:16 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
15:12 / / /
TXCH4_GAIN_RXCH2
RX2 Channel NUM to TXDIF Channel 4 Gain
0000: Mute
11:8 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
TXCH4_GAIN_RXCH1
RX1 Channel NUM to TXDIF Channel 4 Gain
0000: Mute
7:4 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
TXCH4_GAIN_RXCH0
RX0 Channel NUM to TXDIF Channel 4 Gain
0000: Mute
3:0 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
8.1.7.49. 0x0A5C + n*0x0080 AHUB DAM Volume Control 3(Default Value: 0x0111_0111)
0100:-12dB
Others: Reserved
TXCH7_GAIN_RXCH1
RX1 Channel NUM to TXDIF Channel 7 Gain
0000: Mute
23:20 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
TXCH7_GAIN_RXCH0
RX0 Channel NUM to TXDIF Channel 7 Gain
0000: Mute
19:16 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
15:12 / / /
TXCH6_GAIN_RXCH2
RX2 Channel NUM to TXDIF Channel 6 Gain
0000: Mute
11:8 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
TXCH6_GAIN_RXCH1
RX1 Channel NUM to TXDIF Channel 6 Gain
0000: Mute
7:4 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
TXCH6_GAIN_RXCH0
RX0 Channel NUM to TXDIF Channel 6 Gain
0000: Mute
3:0 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
8.1.7.50. 0x0A60 + n*0x0080 AHUB DAM Volume Control 4(Default Value: 0x0111_0111)
TXCH9_GAIN_RXCH2
RX2 Channel NUM to TXDIF Channel 9 Gain
0000: Mute
27:24 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
TXCH9_GAIN_RXCH1
RX1 Channel NUM to TXDIF Channel 9 Gain
0000: Mute
23:20 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
TXCH9_GAIN_RXCH0
RX0 Channel NUM to TXDIF Channel 9 Gain
0000: Mute
19:16 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
15:12 / / /
TXCH8_GAIN_RXCH2
RX2 Channel NUM to TXDIF Channel 8 Gain
0000: Mute
11:8 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
TXCH8_GAIN_RXCH1
RX1 Channel NUM to TXDIF Channel 8 Gain
0000: Mute
7:4 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
TXCH8_GAIN_RXCH0
RX0 Channel NUM to TXDIF Channel 8 Gain
0000: Mute
3:0 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 508
Audio
8.1.7.51. 0x0A64 + n*0x0080 AHUB DAM Volume Control 5(Default Value: 0x0111_0111)
0010: -6dB
0100:-12dB
Others: Reserved
8.1.7.52. 0x0A68 + n*0x0080 AHUB DAM Volume Control 6(Default Value: 0x0111_0111)
Others: Reserved
TXCHC_GAIN_RXCH0
RX0 Channel NUM to TXDIF Channel C Gain
0000: Mute
3:0 R/W 0x1 0001: 0dB
0010: -6dB
0100:-12dB
Others: Reserved
8.1.7.53. 0x0A6C + n*0x0080 AHUB DAM Volume Control 7(Default Value: 0x0111_0111)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 512
Audio
8.2. DMIC
8.2.1. Overview
The DMIC controller supports one 8-channels digital microphone interface, the DMIC controller can output 128fs or
64fs (fs= ADC sample rate).
PLL_AUDIO
Clock
DMIC_CLK
Divider
APB RXFIFO
I/F
Receiver DMIC_DATA[3:0]
Table 8-4 describes the clock source for DMIC. Users can see Clock Controller Unit(CCU) for clock setting,
configuration and gating information.
The software operation of the DMIC is divided into five steps: system setup, DMIC initialization, channel setup, DMA
setup and Enable/Disable module. Five steps are described in detail in the following sections.
System Setup
Pin Multiplex
Globe Disable
DMIC Initial
PLL_AUDIO Frequence and Enable
Channel Setup
Flush RXFIFO
CLK Reset and Gating
DMA Setup
The first step in the system setup is properly programming the GPIO. Because the DMIC port is a multiplex pin. You can
find the function in the pin multiplex specification.
The clock source for the DMIC should be followed. At first you must disable the PLL_AUDIO through the PLL_ENABLE
bit of PLL_AUDIO_CTRL_REG in the CCU. The second step, you must set up the frequency of the PLL_AUDIO in the
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 514
Audio
PLL_AUDIO_CTRL_REG. Then enable PLL_AUDIO. After that, you must open the DMIC gating through the
DMIC_CLK_REG when you checkout that the LOCK bit of PLL_AUDIO_CTRL_REG becomes 1. At last, you must reset
and open the DMIC bus gating in the DMIC_BGR_REG.
After the system setup, the register of DMIC can be setup. At first, you should initialize the DMIC. You should close the
globe enable bit(DMIC_EN[8]) , data channel enable bit(DMIC_EN[7:0]) by writing 0 to it. After that, you must flush
the RXFIFO by writing 1 to DMIC_RXFIFO_CTR[31]. At last, you can clear the Data/RXFIFO counter by writing 1 to
DMIC_RXFIFO_STA, DMIC_CNT.
You can set up the sample rate, the sample resolution, the over sample rate, the channel number, the RXFIFO output
mode and the RXFIFO trigger level and so on. The setup of register can be found in the specification.
The DMIC supports two methods to transfer the data. The most common way is DMA, the setup of DMA can be found
in the DMA specification. In this module, you just enable the DRQ.
To enable the function, you can enable data channel enable bit (DMIC_EN[7:0]) by writing 1 to it. After that, you must
enable DMIC by writing 1 to the Globe Enable bit (DMIC_EN[8]). Write 0 to Globe Enable bit to disable DMIC.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 515
Audio
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 516
Audio
1: Enable
DATA0_CHL_EN
DATA0 Left Channel Enable
0 R/W 0x0
0: Disable
1: Enable
1: Enable
DATA1 Left Data and Right Data Swap Enable
5 R/W 0x0 0: Disable
1: Enable
DATA0 Left Data and Right Data Swap Enable
4 R/W 0x0 0: Disable
1: Enable
3:1 / / /
DMIC Oversample Rate
0 R/W 0x0 0: 128 (Support 8 kHz ~ 24 kHz)
1: 64 (Support 16 kHz ~ 48 kHz)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 518
Audio
RXFIFO_OVERRUN_IRQ_PENDING
DMIC RXFIFO Overrun Pending Interrupt
0: No pending IRQ
1 R/W1C 0x0
1: RXFIFO overrun pending IRQ
Writing ‘1’ to clear this interrupt or automatically clear if interrupt condition
fails.
RXFIFO_DATA_IRQ_PENDING
DMIC RXFIFO Data Available Pending Interrupt
0: No pending IRQ
0 R/ W1C 0x0
1: Data available pending IRQ
Writing ‘1’ to clear this interrupt or automatically clear if interrupt condition
fails.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 519
Audio
8.2.5.12. 0x0030 DATA0 and DATA1 Volume Control Register (Default Value: 0xA0A0_A0A0)
0x01: -119.25 dB
………..
0x9F: -0.75 dB
0xA0: 0 dB
0xA1: 0.75 dB
……….
0xFF: 71.25 dB
DATA0L_VOL
(-119.25 dB to 71.25 dB, 0.75 dB/Step)
0x00: Mute
0x01: -119.25 dB
………..
15:8 R/W 0xA0
0x9F: -0.75 dB
0xA0: 0 dB
0xA1: 0.75 dB
……….
0xFF: 71.25 dB
DATA0R_VOL
(-119.25 dB to 71.25 dB, 0.75 dB/Step)
0x00: Mute
0x01: -119.25 dB
………..
7:0 R/W 0xA0
0x9F: -0.75 dB
0xA0: 0 dB
0xA1: 0.75 dB
……….
0xFF: 71.25 dB
8.2.5.13. 0x0034 DATA2 and DATA3 Volume Control Register (Default Value: 0xA0A0_A0A0)
0x00: Mute
0x01: -119.25 dB
………..
0x9F: -0.75 dB
0xA0: 0 dB
0xA1: 0.75 dB
……….
0xFF: 71.25 dB
DATA2L_VOL
(-119.25 dB to 71.25 dB, 0.75 dB/Step)
0x00: Mute
0x01: -119.25 dB
………..
15:8 R/W 0xA0
0x9F: -0.75 dB
0xA0: 0 dB
0xA1: 0.75 dB
……….
0xFF: 71.25 dB
DATA2R_VOL
(-119.25 dB to 71.25 dB, 0.75 dB/Step)
0x00: Mute
0x01: -119.25 dB
………..
7:0 R/W 0xA0
0x9F: -0.75 dB
0xA0: 0 dB
0xA1: 0.75 dB
………..
0xFF: 71.25 dB
8.2.5.14. 0x0038 High Pass Filter Enable Control Register (Default Value: 0x0000_0000)
0: Disable
1: Enable
HPF_DATA2_CHL_EN
High Pass Filter DATA2 Left Channel Enable
4 R/W 0x0
0: Disable
1: Enable
HPF_DATA1_CHR_EN
High Pass Filter DATA1 Right Channel Enable
3 R/W 0x0
0: Disable
1: Enable
HPF_DATA1_CHL_EN
High Pass Filter DATA1 Left Channel Enable
2 R/W 0x0
0: Disable
1: Enable
HPF_DATA0_CHR_EN
High Pass Filter DATA0 Right Channel Enable
1 R/W 0x0
0: Disable
1: Enable
HPF_DATA0_CHL_EN
High Pass Filter DATA0 Left Channel Enable
0 R/W 0x0
0: Disable
1: Enable
8.2.5.15. 0x003C High Pass Filter Coef Register (Default Value: 0x00FF_AA45)
8.2.5.16. 0x0040 High Pass Filter Gain Register (Default Value: 0x00FF_D522)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 525
Audio
8.3. OWA
8.3.1. Overview
The One Wire Audio(OWA) provides a serial bus interface for audio data between system. This interface is widely used
for consumer audio.
TXFIFO
Clock Divider
DMA & INT
PLL_AUDIO
OWA is a Biphase-Mark Encoding Digital Audio Transfer protocol. In this protocol, the clock signal and data signal are
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 526
Audio
transfer in the same line. Table 8-5 describes the external signals of OWA. OWA_OUT is output pin for output clock
and DATA.
Table 8-6 describes the clock sources for OWA. Users can see Chapter 3.3.CCU for clock setting, configuration and
gating information.
In OWA format, the digital signal is coded using the biphase-mark code (BMC). The clock, frame, and data are
embedded in only one signal—the data pin. In the BMC system, each data bit is encoded into two logical states (00, 01,
10, or 11) at the pin. Figure 8-15 and Table 8-7 show how data is encoded to the BMC format.
As shown in Figure 8-15, the frequency of the clock is twice the data bit rate. In addition, the clock is always
programmed to 128xfs, where fs is the sample rate. The device receiving in OWA format can recover the clock and
frame information from the BMC signal.
Clock
128×FS
Data
1 0 1 1 0 0 1 0 1 1 0
BMC
1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 1 0 1 0 1 1
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 527
Audio
The OWA supports digital audio data transfer out and receive in. And it supports full-duplex synchronous work mode.
Software can set the work mode by the OWA Control Register.
Every audio sample transmitted in a subframe consists 32-bit, numbered from 0 to 31. Figure 8-16 shows a subframe.
0 3 4 7 8 27 28 31
L M
Sync
Aux S Audio sample word S V U C P
preamble
B B
Validity flag
User data
Channel status
Parity bit
Bit 4-27 carry the audio sample word in linear 2s-complement representation. The most-significant bit (MSB) is carried
by bit 27. When a 24-bit coding range is used, the least-significant bit (LSB) is in bit 4. When a 20-bit coding range is
used, Bit 8-27 carry the audio sample word with the LSB in bit 8. Bit 4-7 may be used for other applications and are
designated auxiliary sample bits.
If the source provides fewer bits than the interface allows (either 20 or 24), the unused LSBs are set to logical 0. For a
nonlinear PCM audio application or a data application, the main data field may carry any other information.
Bit 28 carries the validity bit (V) associated with the main data field in the subframe.
Bit 29 carries the user data channel (U) associated with the main data field in the subframe.
Bit 30 carries the channel status information (C) associated with the main data field in the subframe. The channel
status indicates if the data in the subframe is digital audio or some other type of data.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 528
Audio
Bit 31 carries a parity bit (P) such that Bit 4-31 carry an even number of 1s and an even number of 0s (even parity). As
shown in Table 8-8, the preambles (Bit 0-3) are also defined with even parity.
Sub-frame Sub-frame
Block
The software operation of the OWA is divided into five steps: system setup, OWA initialization, channel setup, DMA
setup and enable/disable module. These five steps are described in detail in the following sections.
System Setup
Pin Multiplex
Globe/TX Disable
OWA Initial
PLL_AUDIO Frequency and Enable
Channel Setup
Clear TXFIFO
CLK Reset and Gating
DMA Setup
The first step in the OWA initialization is properly programming the GPIO. Because the OWA port is a multiplex pin.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 529
Audio
The clock source for the OWA should be followed. At first you must reset the audio PLL in the CCU. The second step,
you must setup the frequency of the Audio PLL. After that, you must open the OWA gating. At last, you must open the
OWA bus gating.
After the system setup, the register of OWA can be setup. At first, you should reset the OWA by writing 1 to
OWA_CTL[0] and clear the TX FIFO by writing 1 to OWA_FCTL[30]. After that you should enable the globe enable bit
by writing 1 to OWA_CTL[1], and clear the interrupt and TX counter by the OWA_ISTA and OWA_TX_CNT.
The OWA supports three methods to transfer the data. The most common way is DMA, the configuration of DMA can
be found in the DMA. In this module, you just enable the DRQ by writing the OWA_INT[7].
To enable the function, you can enable TX by writing the OWA_TX_CFIG[0]. After that, you must enable OWA by
writing 1 to the GEN bit in the OWA_CTL register. Writing 0 to the GEN bit to disable process.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 530
Audio
Self clear to 0.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 532
Audio
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 533
Audio
1:0 / / /
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 534
Audio
1101: Reserved
1110: 192 kHz
1111: Reserved
CN
23:20 R/W 0x0
Channel Number
SN
19:16 R/W 0x0
Source Number
CC
Category Code
15:8 R/W 0x0
Indicates the kind of equipment that generates the digital audio interface
signal.
MODE
Mode
7:6 R/W 0x0
00: Default Mode
01~11: Reserved
EMP
Emphasis
Additional format information
For bit 1 = “0”, Linear PCM audio mode:
000: 2 audio channels without pre-emphasis
001: 2 audio channels with 50 μs / 15 μs pre-emphasis
5:3 R/W 0x0 010: Reserved (for 2 audio channels with pre-emphasis)
011: Reserved (for 2 audio channels with pre-emphasis)
100~111: Reserved
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 536
Audio
110: 21 bit
111: Reserved
MWL
Max Word Length
0 R/W 0x0
0: Maximum audio sample word length is 20 bits
1: Maximum audio sample word length is 24 bits
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 538
Audio
8.4.1. Overview
The Audio Codec has 2-ch DAC with a high level of mixed-signal integration. The DRC with integrated hardware DAP
engine can be used in playback path.
REXT BIAS
AVCC Digital Control Register
AGND
TXFIFO Analog Control Register
C DAC_L
O LINEOUTL(P)
Output
DAP D Mixer
E LINEOUTR(N)
R DAC_R
AVCC VDD_SYS
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 539
Audio
8.4.3.1.2. Reference
8.4.3.1.3. Power/Ground
Figure 8-20 describes the Audio Codec clock source. Users can see CCU for clock setting, configuration and gating
information.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 540
Audio
HPF&DRC
DACCLK
DAC_DIGITAL
Digital Part
PLL_AUDIO
24.576M/22.5792M
CK_DAC
DAC_ANALOG
CKHOSC
HOSC_24M CK_HOSC
CK32K
CK_32K
Analog Part
The clock of digital part is from PLL_AUDIO(1X). The clock of analog part includes CK_ADC, CK_DAC, CK_DITHER,
CK_HOSC, CK_32K. Where, CK_ADC, CK_DAC and CK_DITHER is provided by PLL_AUDIO. CK_HOSC, CK_32K is provided
by system oscillator 24M. These clocks need ensure that VDD-SYS is not power-off.
The SYS_RST will be provided by the VDD_SYS domain, which comes from VDD_SYS domain and is produced by RTC
domain. Each domain has the de-bounce to confirm whether the reset system is strong. The codec register part, MIX
will be reset by the SYS_RST during the power on or the system soft writing the reset control logic. The other parts will
be reset by the soft configuration through writing register.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 541
Audio
REGISTER DAC
DIGITAL PART
SYS_RST
SOFT_RST
HPF&DRC
MIX
When AVCC is powered on, it will send the AVCC_POR signal. And the AVCC_POR signal passes the level shift and RC
filter part to ADDA logic core, which will reset the AVCC analog part.
AVCC ANALOG
POWER ON LS RC
PART
Reg314[11]
Reg314[23:20]
Reg000[31]
Reg310[15]
Reg310[6] Reg310[4:0]
APB DAC_L M + M M G
Reg310[13]
LINEOUTL
M Reg310[12] AReg310[5]
M M
Reg310[4:0] -1 U LINEOUTR
M G X Reg310[11]
Reg314[10] Reg310[10]
Reg314[19:16]
Reg000[31]
Reg310[14]
APB +
DAC_R M
M
The stereo DAC sample rate can be configured by setting the register. In order to save power, the DAC can be
enabled/disabled by setting the bit[15:14] of the DAC_REG register. The digital DAC part can be enabled/disabled by
the bit[31] of the AC_DAC_DPC register.
8.4.3.7. Interrupt
The Audio Codec has two interrupts. Figure 8-24 describes the Audio Codec interrupt system.
DAC_IRQ_EN
DAC_IRQ_STATUS
DAC_OVERRUN_IRQ_EN DAC_IRQ
DAC_OVERRUN_IRQ_STATUS
DAC_UNDERRUN_IRQ_EN
DAC_UNDERRUN_IRQ_STATUS
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 543
Audio
8.4.3.8. DAP
M
U L
HPF X
Alpha Filter
M M
Compression Smooth U
U
X control Filter X
Alpha Filter
M
U R
HPF X
The DRC scheme has three thresholds, three offset, and four slope (all programmable). There is one ganged DRC for
the left/right channels. The diagram of DRC input/output is as follows.
x(n) g(n)
Energy Compression Smooth
Filter control Filter
Figure 8- 26. DRC Block Diagram
-100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0
(Outpu t dB)
-10
-20
OPL
Kl -30
OPC Kc
-40
-50
Kn
-60
OPE
-70
-80
Ke
-90
-100
NT ET CT LT (Inpu t dB)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 544
Audio
Each DRC has adjustable threshold, offset, and compression levels, programmable energy, attack, and decay time
constants.
Transparent compression: Compressors can attack fast enough to avoid apparent clipping before engaging, and decay
times can be set slow enough to avoid pumping.
x(n) g(n)
Energy Compression Smooth
Filter control Filter
Energy Filter
The Energy Filter is to estimate the RMS value of the audio data stream into DRC, and has two parameters, which
determine the time window over which RMS to be made. The parameter is computed by 1 e 2.2Ts / ta .
Compression Control
This element has ten parameters ( ET, CT, LT, Ke, Kn, Kc, Kl, OPL, OPC, OPE), which are all programmable, and the
computation will be explained as follows.
TdB
Tin
6.0206
There, TdB must less than zero, the positive value is illegal.
For example, it is desired to set CT=-40dB, then the Tin require to set CT to -40dB is CTin = - (-40dB)/6.0206 = 6.644,
CTin is entered as a 32-bit number in 8.24 format.
Therefore, CTin = 6.644 = 0000 0110.1010 0100 1101 0011 1100 0000 = 0x06A4 D3C0 in 8.24 format.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 545
Audio
Input
Signal
Output
Signal
Target
Level
Gain
Attack
Decay Time
Time
(1) Codec initial: Open audio codec bus clock gating and de-assert bus reset through AUDIO_CODEC_BGR_REG,
configure PLL_Audio frequency and enable PLL_Audio through PLL_AUDIO_CTRL_REG. Please refer to CCU in
chapter 3.3 about detail.
(2) Configure MIX path.
(3) Set sample rate, configure data transfer format, enable DAC.
(4) DMA configure and DMA request.
(5) Enable DAC DRQ and DMA.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 546
Audio
HPF_EN
High Pass Filter Enable
18 R/W 0x0
0: Disable
1: Enable
DVOL
17:12 R/W 0x0 Digital volume control: DVC, ATT=DVC[5:0]*(-1.16dB)
64 steps, -1.16dB/step
11:1 / / /
HUB_EN
Audio Hub Enable
0 R/W 0x0
0: Disable
1: Enable
23 / / /
DAC_DRQ_CLR_CNT
When TX FIFO available room is less than or equal N, DRQ Request will be
de-asserted. N is defined here:
22:21 R/W 0x0 00: IRQ/DRQ De-asserted when WLEVEL > TXTL
01: 4
10: 8
11: 16
20:15 / / /
TX_TRIG_LEVEL
TX FIFO Empty Trigger Level (TXTL[12:0])
Interrupt and DMA request trigger level for TX FIFO normal condition.
14:8 R/W 0x40
IRQ/DRQ generated when WLEVEL ≤ TXTL
Note: WLEVEL represents the number of valid samples in the TX FIFO.
Only TXTL[6:0] valid when TXMODE = 0
7 / / /
DAC_MONO_EN
DAC Mono Enable
6 R/W 0x0 0: Stereo, 64 levels FIFO
1: mono, 128 levels FIFO
When enabled, L & R channel send same data.
TX_SAMPLE_BITS
Transmitting Audio Sample Resolution
5 R/W 0x0
0: 16 bits
1: 24 bits
DAC_DRQ_EN
DAC FIFO Empty DRQ Enable
4 R/W 0x0
0: Disable
1: Enable
DAC_IRQ_EN
DAC FIFO Empty IRQ Enable
3 R/W 0x0
0: Disable
1: Enable
FIFO_UNDERRUN_IRQ_EN
DAC FIFO Underrun IRQ Enable
2 R/W 0x0
0: Disable
1: Enable
FIFO_OVERRUN_IRQ_EN
DAC FIFO Overrun IRQ Enable
1 R/W 0x0
0: Disable
1: Enable
FIFO_FLUSH
0 R/WC 0x0 DAC FIFO Flush
Write ‘1’ to flush TX FIFO, self clear to ‘0’
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 550
Audio
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 551
Audio
TX Sample Counter
The audio sample number of sending into TXFIFO.
When one sample is put into TXFIFO by DMA or by host IO, the TX sample
counter register increases by one. The TX sample counter register can be set to
any initial valve at any time. After been updated by the initial value, the counter
register should count on base of this initial value.
Note: It is used for Audio/Video Synchronization
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 552
Audio
8.4.6.8. 0x0100 DAC DRC High HPF Coef Register (Default Value: 0x0000_00FF)
8.4.6.9. 0x0104 DAC DRC Low HPF Coef Register (Default Value: 0x0000_FAC1)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 553
Audio
0: Not completed
1: Completed
14:10 / / /
Signal delay time setting
6'h00 : (8x1)fs
6'h01 : (8x2)fs
6'h02 : (8x3)fs
----------------------------------------
13:8 R/W 0x0
6'h2e : (8*47)fs
6'h2f : (8*48)fs
6'h30 -- 6'h3f : (8*48)fs
Delay time = 8*(n+1)fs, n<6'h30;
When the delay function is disabled, the signal delay time is unused.
The delay buffer use or not when the drc is disabled and the drc buffer data
output completely.
7 R/W 0x1
0: Don't use the buffer
1: Use the buffer
DRC gain max limit enable
6 R/W 0x0 0: Disable
1: Enable
DRC gain min limit enable
When this function is enabled, it will overwrite the noise detect funciton.
5 R/W 0x0
0: Disable
1: Enable
Control the drc to detect noise when ET enable
4 R/W 0x0 0: Disable
1: Enable
Signal function select
0: RMS filter
1: Peak filter
When signal function selects Peak filter, the RMS parameter is unused.
3 R/W 0x0
(AC_DRC_LRMSHAT/AC_DRC_LRMSLAT/AC_DRC_LRMSHAT/AC_DRC_LRMSLAT)
When signal function selects RMS filter, the Peak filter parameter is
unused.(AC_DRC_LPFHAT/AC_DRC_LPFLAT/AC_DRC_RPFHAT/AC_DRC_RPFLAT
/AC_DRC_LPFHRT/AC_DRC_LPFLRT/AC_DRC_RPFHRT/AC_DRC_RPFLRT)
Delay function enable
0: Disable
2 R/W 0x0
1: Enable
When the bit is disabled, the signal delay time is unused.
DRC LT enable
0: Disable
1 R/W 0x0
1: Enable
When the bit is disabled, Kl and OPL parameter is unused.
DRC ET enable
0 R/W 0x0
0: Disable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 554
Audio
1: Enable
When the bit is disabled, Ke and OPE parameter is unused.
8.4.6.11. 0x010C DAC DRC Left Peak Filter High Attack Time Coef Register (Default Value: 0x0000_000B)
8.4.6.12. 0x0110 DAC DRC Left Peak Filter Low Attack Time Coef Register (Default Value: 0x0000_77BF)
8.4.6.13. 0x0118 DAC DRC Left Peak Filter Low Attack Time Coef Register (Default Value: 0x0000_77BF)
8.4.6.14. 0x011C DAC DRC Left Peak Filter High Release Time Coef Register (Default Value: 0x0000_00FF)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 555
Audio
8.4.6.15. 0x0120 DAC DRC Left Peak Filter Low Release Time Coef Register(Default Value: 0x0000_E1F8)
8.4.6.16. 0x0124 DAC DRC Right Peak Filter High Release Time Coef Register(Default Value: 0x0000_00FF)
8.4.6.17. 0x0128 DAC DRC Right Peak Filter Low Release Time Coef Register(Default Value: 0x0000_E1F8)
8.4.6.18. 0x012C DAC DRC Left RMS Filter High Coef Register(Default Value: 0x0000_0001)
8.4.6.19. 0x0130 DAC DRC Left RMS Filter Low Coef Register(Default Value: 0x0000_2BAF)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 556
Audio
31:16 / / /
The left RMS filter average time parameter setting, which is determined by the
15:0 R/W 0x2BAF equation that AT = 1-exp(-2.2Ts/tav). The format is 3.24. (The default value is
10ms)
8.4.6.20. 0x0134 DAC DRC Right RMS Filter High Coef Register(Default Value: 0x0000_0001)
8.4.6.21. 0x0138 DAC DRC Right RMS Filter Low Coef Register(Default Value: 0x0000_2BAF)
8.4.6.22. 0x013C DAC DRC Compressor Theshold High Setting Register(Default Value: 0x0000_06A4)
8.4.6.23. 0x0140 DAC DRC Compressor Slope High Setting Register(Default Value: 0x0000_D3C0)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 557
Audio
8.4.6.24. 0x0144 DAC DRC Compressor Slope High Setting Register(Default Value: 0x0000_0080)
8.4.6.25. 0x0148 DAC DRC Compressor Slope Low Setting Register(Default Value: 0x0000_0000)
8.4.6.26. 0x014C DAC DRC Compressor High Output at Compressor Threshold Register (Default Value:
0x0000_F95B)
8.4.6.27. 0x0150 DAC DRC Compressor Low Output at Compressor Threshold Register(Default Value: 0x0000_2C3F)
8.4.6.28. 0x0154 DAC DRC Limiter Theshold High Setting Register(Default Value: 0x0000_01A9)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 558
Audio
The limiter threshold setting, which is set by the equation that LTin = -LT/6.0206,
15:0 R/W 0x01A9
The format is 8.24. (The default value is -10dB)
8.4.6.29. 0x0158 DAC DRC Limiter Theshold Low Setting Register(Default Value: 0x0000_34F0)
8.4.6.30. 0x015C DAC DRC Limiter Slope High Setting Register(Default Value: 0x0000_0005)
8.4.6.31. 0x0160 DAC DRC Limiter Slope Low Setting Register(Default Value: 0x0000_1EB8)
8.4.6.32. 0x0164 DAC DRC Limiter High Output at Limiter Threshold Register(Default Value: 0x0000_FBD8)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 559
Audio
8.4.6.33. 0x0168 DAC DRC Limiter Low Output at Limiter Threshold Register(Default Value: 0x0000_FBA7)
8.4.6.34. 0x016C DAC DRC Expander Theshold High Setting Register(Default Value: 0x0000_0BA0)
8.4.6.35. 0x0170 DAC DRC Expander Theshold Low Setting Register(Default Value: 0x0000_7291)
8.4.6.36. 0x0174 DAC DRC Expander Slope High Setting Register(Default Value: 0x0000_0500)
8.4.6.37. 0x0178 DAC DRC Expander Slope Low Setting Register(Default Value: 0x0000_0000)
larger than 50. The format is 8.24. (The default value is <1:5>)
8.4.6.38. 0x017C DAC DRC Expander High Output at Expander Threshold Register(Default Value: 0x0000_F45F)
8.4.6.39. 0x0180 DAC DRC Expander Low Output at Expander Threshold Register(Default Value: 0x0000_8D6E)
8.4.6.40. 0x0184 DAC DRC Linear Slope High Setting Register(Default Value: 0x0000_0100)
8.4.6.41. 0x0188 DAC DRC Linear Slope Low Setting Register(Default Value: 0x0000_0000)
8.4.6.42. 0x018C DAC DRC Smooth Filter Gain High Attack Time Coef Register(Default Value: 0x0000_0002)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 561
Audio
8.4.6.43. 0x0190 DAC DRC Smooth Filter Gain Low Attack Time Coef Register(Default Value: 0x0000_5600)
8.4.6.44. 0x0194 DAC DRC Smooth Filter Gain High Release Time Coef Register(Default Value: 0x0000_0000)
8.4.6.45. 0x0198 DAC DRC Smooth Filter Gain Low Release Time Coef Register(Default Value: 0x0000_0F04)
8.4.6.46. 0x019C DAC DRC MAX Gain High Setting Register(Default Value: 0x0000_FE56)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 562
Audio
8.4.6.47. 0x01A0 DAC DRC MAX Gain Low Setting Register(Default Value: 0x0000_CB0F)
8.4.6.48. 0x01A4 DAC DRC MIN Gain High Setting Register(Default Value: 0x0000_F95B)
8.4.6.49. 0x01A8 DAC DRC MIN Gain Low Setting Register(Default Value: 0x0000_2C3F)
8.4.6.50. 0x01AC DAC DRC Expander Smooth Time High Coef Register(Default Value: 0x0000_0000)
8.4.6.51. 0x01B0 DAC DRC Expander Smooth Time Low Coef Register(Default Value: 0x0000_640C)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 563
Audio
The gain smooth filter release and attack time parameter setting in expander
15:0 R/W 0x640C region, which are determined by the equation that RT = 1-exp(-2.2Ts/tr). The
format is 3.24. (The default value is 30ms)
8.4.6.52. 0x01B8 DAC DRC HPF Gain High Coef Register(Default Value: 0x0000_0100)
8.4.6.53. 0x01BC DAC DRC HPF Gain Low Coef Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 564
Audio
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 567
Interfaces
Contents
Chapter 9 Interfaces....................................................................................................................................................... 573
9.1. TWI ..................................................................................................................................................................... 573
9.1.1. Overview ................................................................................................................................................. 573
9.1.2. Block Diagram ......................................................................................................................................... 573
9.1.3. Operations and Functional Descriptions ................................................................................................. 574
9.1.4. Programming Guidelines ......................................................................................................................... 578
9.1.5. Register List ............................................................................................................................................. 582
9.1.6. Register Description ................................................................................................................................ 583
9.2. UART ................................................................................................................................................................... 594
9.2.1. Overview ................................................................................................................................................. 594
9.2.2. Block Diagram ......................................................................................................................................... 595
9.2.3. Operations and Functional Descriptions ................................................................................................. 595
9.2.4. Programming Guidelines ......................................................................................................................... 600
9.2.5. Register List ............................................................................................................................................. 604
9.2.6. Register Description ................................................................................................................................ 605
9.3. SPI ....................................................................................................................................................................... 623
9.3.1. Overview ................................................................................................................................................. 623
9.3.2. Block Diagram ......................................................................................................................................... 623
9.3.3. Operations and Functional Descriptions ................................................................................................. 624
9.3.4. Programming Guidelines ......................................................................................................................... 631
9.3.5. Register List ............................................................................................................................................. 634
9.3.6. Register Description ................................................................................................................................ 635
9.4. USB2.0 OTG ........................................................................................................................................................ 650
9.4.1. Overview ................................................................................................................................................. 650
9.4.2. Block Diagram ......................................................................................................................................... 650
9.4.3. Operations and Functional Descriptions ................................................................................................. 651
9.5. USB2.0 Host Controller ...................................................................................................................................... 652
9.5.1. Overview ................................................................................................................................................. 652
9.5.2. Operations and Functional Descriptions ................................................................................................. 652
9.5.3. USB Host Register List ............................................................................................................................. 653
9.5.5. OHCI Register Description ....................................................................................................................... 668
9.5.6. HCI Contgroller and PHY Interface Description ....................................................................................... 685
9.6. Port Controller.................................................................................................................................................... 689
9.6.1. Overview ................................................................................................................................................. 689
9.6.2. Block Diagram ......................................................................................................................................... 689
9.6.3. Operations and Functional Descriptions ................................................................................................. 690
9.6.4. Register List ............................................................................................................................................. 695
9.6.5. GPIO(PC,PF,PG,PH,PI) Register Description ............................................................................................. 696
9.6.6. GPIO(PL) Register Description ................................................................................................................. 759
9.7. LRADC ................................................................................................................................................................. 761
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 568
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 569
Interfaces
Figures
Figure 9- 1. TWI Block Diagram ......................................................................................................................................... 574
Figure 9- 2. 7-bit Standard Address Write Timing............................................................................................................. 575
Figure 9- 3. 7-bit Standard Address Read Timing.............................................................................................................. 576
Figure 9- 4. 10-bit Extended Address Write Timing .......................................................................................................... 576
Figure 9- 5. 10-bit Extended Address Read Timing ........................................................................................................... 576
Figure 9- 6. TWI Programming State Diagram .................................................................................................................. 577
Figure 9- 7. TWI Initialization Process ............................................................................................................................... 579
Figure 9- 8. TWI Write Data Process ................................................................................................................................. 580
Figure 9- 9. TWI Read Data Process .................................................................................................................................. 581
Figure 9- 10. TWI Driver Packet Transmission Process ..................................................................................................... 582
Figure 9- 11. UART Block Diagram .................................................................................................................................... 595
Figure 9- 12. UART Application Diagram........................................................................................................................... 596
Figure 9- 13. UART Serial Data Format ............................................................................................................................. 596
Figure 9- 14. RTS/CTS Autoflow Control Timing ............................................................................................................... 597
Figure 9- 15. Serial IrDA Data Format ............................................................................................................................... 597
Figure 9- 16. RS-485 Timing .............................................................................................................................................. 597
Figure 9- 17. Process of UART Transmitting/Receiving Data in Interrupt Mode .............................................................. 602
Figure 9- 18. Process of DMA Transmitting Data in DMA Mode ...................................................................................... 604
Figure 9- 19. SPI Block Diagram ........................................................................................................................................ 623
Figure 9- 20. SPI Application Block Diagram ..................................................................................................................... 625
Figure 9- 21. SPI Phase 0 Timing Diagram ......................................................................................................................... 626
Figure 9- 22. SPI Phase 1 Timing Diagram ......................................................................................................................... 626
Figure 9- 23. SPI 3-Wire Mode .......................................................................................................................................... 627
Figure 9- 24. SPI Dual-Input/Dual-Output Mode .............................................................................................................. 628
Figure 9- 25. SPI Dual I/O Mode........................................................................................................................................ 628
Figure 9- 26. SPI Quad-Input/Quad-Output Mode ........................................................................................................... 629
Figure 9- 27. SPI Write/Read Data in CPU Mode .............................................................................................................. 632
Figure 9- 28. SPI Write/Read Data in DMA Mode ............................................................................................................. 633
Figure 9- 29. USB2.0 OTG Controller Block Diagram ........................................................................................................ 651
Figure 9- 30. USB2.0 OTG Controller and PHY Connection Diagram ................................................................................ 651
Figure 9- 31. USB2.0 HOST Controller and PHY Connection Diagram............................................................................... 653
Figure 9- 32. Port Controller Block Diagram ..................................................................................................................... 689
Figure 9- 33. Pull up/down Logic....................................................................................................................................... 693
Figure 9- 34. IO Buffer Strength Diagram ......................................................................................................................... 694
Figure 9- 35. LRADC Block Diagram................................................................................................................................... 761
Figure 9- 36. LRADC Interrupt ........................................................................................................................................... 762
Figure 9- 37. LRADC Initial Process ................................................................................................................................... 763
Figure 9- 38. CIR Receiver Block Diagram ......................................................................................................................... 767
Figure 9- 39. CIR Receiver Clock ........................................................................................................................................ 768
Figure 9- 40. CIR Receiver Application Diagram................................................................................................................ 768
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 570
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 571
Interfaces
Tables
Table 9- 1. TWI External Signals ........................................................................................................................................ 574
Table 9- 2. TWI Clock Sources ........................................................................................................................................... 575
Table 9- 3. UART External Signals...................................................................................................................................... 595
Table 9- 4. UART Clock Sources......................................................................................................................................... 596
Table 9- 5. UART Mode Baud and Error Rates .................................................................................................................. 598
Table 9- 6. IrDA Mode Baud and Error Rates .................................................................................................................... 598
Table 9- 7. RS485 Mode Baud and Error Rates ................................................................................................................. 599
Table 9- 8. SPI External Signals.......................................................................................................................................... 624
Table 9- 9. SPI Clock Sources ............................................................................................................................................. 625
Table 9- 10. SPI Transmit Format ...................................................................................................................................... 626
Table 9- 11. SPI Sample Mode and Run Clock ................................................................................................................... 630
Table 9- 12. USB2.0 OTG External Signals ......................................................................................................................... 651
Table 9- 13. USB2.0 HOST External Signals ....................................................................................................................... 652
Table 9- 14. H616 Multi-function Port Table .................................................................................................................... 690
Table 9- 15. PC Multiplex Function Select......................................................................................................................... 690
Table 9- 16. PF Multiplex Function Select ......................................................................................................................... 691
Table 9- 17. PG Multiplex Function Select ........................................................................................................................ 691
Table 9- 18. PH Multiplex Function Select ........................................................................................................................ 691
Table 9- 19. PI Multiplex Function Select.......................................................................................................................... 692
Table 9- 20. PL Multiplex Function Select ......................................................................................................................... 693
Table 9- 21. Port Function ................................................................................................................................................. 693
Table 9- 22. LRADC External Signals .................................................................................................................................. 762
Table 9- 23. LRADC Clock Sources ..................................................................................................................................... 762
Table 9- 24. CIR Receiver External Signals ........................................................................................................................ 768
Table 9- 25. PWM External Signals ................................................................................................................................... 779
Table 9- 26. TSC External Signals....................................................................................................................................... 801
Table 9- 27. TSC Clock Sources .......................................................................................................................................... 801
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 572
Interfaces
Chapter 9 Interfaces
9.1. TWI
9.1.1. Overview
The TWI is designed as an interface between CPU host and the serial TWI bus. It can support all the standard TWI
transfer, including slave and master. The communication of the 2-wire bus is carried out by a byte-wise mode based on
interrupt or polled handshaking. The TWI can be operated in standard mode (100 kbit/s) or fast-mode (400 kbit/s).
The 10-bit addressing mode is supported for this specified application. General call addressing is also supported in
slave mode.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 573
Interfaces
INT TWI_TOP
RESET
DRV_EN TWI_ENGINE
APB
0
TWI_DRIVER
CFG_REG CCU
CFG_REG
1
dma_tx_req SEND_FIFO
TWI_SCK
dma_rx_req RECV_FIFO PE
TWI_SDA
The TWI controller has 6 TWIs. Table 9-1 describes the external signals of TWI. TWI_SCK and TWI_SDA are
bidirectional I/O, when TWI is configured as master device, TWI-SCK is output pin; when TWI is configurable as slave
device, TWI-SCK is input pin. The unused TWI ports are used as General Purpose I/O ports. For information about
General Purpose I/O ports, see Port Controller in chapter9.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 574
Interfaces
Each TWI controller has a fixed clock source. Table 9-2 describes the clock source for TWI. Users can see Clock
Controller Unit(CCU) in chapter3 and Power Reset Clock Management(PRCM) for clock setting, configuration and
gating information.
After selected a proper clock, for using the TWI0/1/2/3/4, user must open the gating of TWI and release the reset bit.
For using the S_TWI0, user also needs to open the gating of R-TWI and release the reset bit .
For more details on the gating/reset register, see CCU and PRCM specification.
Figure 9-2 describes the write timing in 7-bit standard address mode.
Figure 9-3 describes the read timing in 7-bit standard address mode.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 575
Interfaces
Sr:RE-START condition
Figure 9-4 describes the write timing in 10-bit extended address mode.
Figure 9-5 describes the read timing in 10-bit extended address mode.
Sr:RE-START condition
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 576
Interfaces
Figure 9-6 shows the TWI programming state diagram. For the value between two states, see TWI_STAT register in
section 9.1.6.5.
M_SEND_S: master sends START signal;
M_SEND_ADDR: master sends slave address;
M_SEND_XADD: master sends slave extended address;
M_SEND_SR: master repeated start;
M_SEND_DATA: master sends data;
M_SEND_P: master sends STOP signal;
M_RECV_DATA: master receives data;
ARB_LOST: Arbitration lost;
C_IDLE: Idle;
ARB_LOST
arb_lost
M_SEND_S
M_SEND_ADDR
C_IDLE
M_SEND_XADD
M_RECV_DATA
M_SEND_SR
M_SEND_DATA
M_SEND_P
There are four operation modes on the TWI bus. They are Master Transmit, Master Receive, Slave Transmit and Slave
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 577
Interfaces
Receive. In general, CPU host controls TWI engine by writing command and data to its registers. TWI engine transmits
an interrupt to CPU when each time a byte transfer is done or a START/STOP command is detected. The CPU host can
also poll the status register for current status if the interrupt mechanism is not disabled by the CPU host.
When the CPU host wants to start a bus transfer, it initiates a bus START to enter the master mode by setting IM_STA
bit of the TWI_CNTR register to high (before it must be low). The TWI engine will assert INT line and INT_FLAG to
indicate a completion for the START command and each consequent byte transfer. At each interrupt, the
micro-processor needs to check the TWI_STAT register for current status. A transfer has to be concluded with STOP
command by setting M_STP bit to high.
In Slave mode, the TWI engine also constantly samples the bus and look for its own slave address during addressing
cycles. Once a match is found, it is addressed and interrupt the CPU host with the corresponding status. Upon request,
the CPU host should read the status, read/write TWI_DATA data register, and set the TWI_CNTR control register. After
each byte transfer, a slave device always stop the operation of remote master by holding the next low pulse on SCL
line until the microprocessor responds to the status of previous byte transfer or START command.
The TWI controller operates in 8-bit data format. The data on the TWI_SDA line is always 8 bits long. At first, the TWI
controller will sent a start condition. When in the addressing formats of 7-bit, TWI sends out one 8 bits message which
includes 7 MSB slave address and 1 LSB read/write flag. The least significant of the salve address indicates the
direction of transmission. When TWI works in 10-bit slave address mode, the operation will be divided into two steps,
for details on the operation, see the register description in Section 9.1.6.1 and 9.1.6.2.
9.1.4.1. Initialization
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 578
Interfaces
Configure GPIO
TWI Reset NO
Success?
YES
NO Open TWI
Gating Success?
YES
Set BPS
Configure TWI
Controller regs
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 579
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 580
Interfaces
Figure 9-10 shows a software operation flow for packet transmission by TWI driver.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 581
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 582
Interfaces
10-bit addressing:
1, 1, 1, 1, 0, SLAX[9:8]
GCE
General Call Address Enable
0 R/W 0x0
0: Disable
1: Enable
NOTE
For 7-bit addressing:
SLA6 – SLA0 is the 7-bit address of the TWI in slave mode. When the TWI receives this address after a START
condition, it will generate an interrupt and enter slave mode. (SLA6 corresponds to the first bit received from the
TWI bus.) If GCE is set to ‘1’, the TWI will also recognize the general call address (00h).
For 10-bit addressing:
When the address received starts with 11110b, the TWI recognizes this as the first part of a 10-bit address and if the
next two bits match ADDR[2:1] (i.e. SLAX9 and SLAX8 of the device’s extended address), it sends an ACK. (The device
does not generate an interrupt at this point.) If the next byte of the address matches the XADDR register (SLAX7 –
SLAX0), the TWI generates an interrupt and goes into slave mode.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 583
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 584
Interfaces
The M_STA bit is cleared automatically after a START condition has been
sent. Writing a ‘0’ to this bit has no effect.
M_STP
Master Mode Stop
If M_STP is set to ‘1’ in master mode, a STOP condition is transmitted on the
TWI bus. If the M_STP bit is set to ‘1’ in slave mode, the TWI will indicate if
a STOP condition has been received, but no STOP condition will be
4 R/W1C 0x0
transmitted on the TWI bus. If both M_STA and M_STP bits are set, the TWI
will first transmit the STOP condition (if in master mode) then transmit the
START condition.
The M_STP bit is cleared automatically: writing a ‘0’ to this bit has no effect.
INT_FLAG
Interrupt Flag
INT_FLAG is automatically set to ‘1’ when any of 28 (out of the possible 29)
states is entered (see ‘STAT Register’ below). The only state that does not
3 R/W1C 0x0 set INT_FLAG is state F8h. If the INT_EN bit is set, the interrupt line goes
high when IFLG is set to ‘1’. If the TWI is operating in slave mode, data
transfer is suspended when INT_FLAG is set and the low period of the TWI
bus clock line (SCL) is stretched until ‘1’ is written to INT_FLAG. The TWI
clock line is then released and the interrupt line goes low.
A_ACK
Assert Acknowledge
When A_ACK is set to ‘1’, an Acknowledge (low level on SDA) will be sent
during the acknowledge clock pulse on the TWI bus if:
(1). Either the whole of a matching 7-bit slave address or the first or the
second byte of a matching 10-bit slave address has been received.
(2). The general call address has been received and the GCE bit in the ADDR
register is set to ‘1’.
(3). A data byte has been received in master or slave mode.
2 R/W 0x0
When A_ACK is ‘0’, a Not Acknowledge (high level on SDA) will be sent
when a data byte is received in master or slave mode.
If A_ACK is cleared to ‘0’ in slave transmitter mode, the byte in the DATA
register is assumed to be the ‘last byte’. After this byte has been
transmitted, the TWI will enter state C8h then return to the idle state
(status code F8h) when INT_FLAG is cleared.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 585
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 586
Interfaces
For Example:
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 587
Interfaces
31:2 / / /
DBN
Data Byte Number Follow Read Command Control
00 : No data byte can be written after read command
1:0 R/W 0x0
01 : Only 1 byte data can be written after read command
10 : 2 bytes data can be written after read command
11 : 3 bytes data can be written after read command
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 590
Interfaces
ADDR_BYTE
23:16 R/W 0x1 How many bytes be sent as slave device reg address
0~255
DATA_BYTE
15:0 R/W 0x1 How many bytes be sent/received as data
1~65535
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 591
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 592
Interfaces
RECV_FIFO_CONTENT
21:16 R 0x0
The number of data in RECV_FIFO
15:7 / / /
SEND_FIFO_CLEAR
6 R/WAC 0x0
Set this bit to clear SEND_FIFO pointer, and this bit is cleared automatically
SEND_FIFO_CONTENT
5:0 R 0x0
The number of data in SEND_FIFO
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 593
Interfaces
9.2. UART
9.2.1. Overview
The UART is used for serial communication with a peripheral, modem (data carrier equipment, DCE) or data set. Data
is written from a master (CPU) over the APB bus to the UART and it is converted to serial form and transmitted to the
destination device. Serial data is also received by the UART and stored for the master (CPU) to read back.
The UART contains registers to control the character length, baud rate, parity generation/checking, and interrupt
generation. Although there is only one interrupt output signal from the UART, there are several prioritized interrupt
types that can be responsible for its assertion. Each of the interrupt types can be separately enabled/disabled with the
control registers.
The UART has 16450 and 16550 modes of operation, which are compatible with a range of standard software drivers.
In 16550 mode, transmit and receive operations are both buffered by FIFOs. In 16450 mode, these FIFOs are disabled.
The UART supports word lengths from five to eight bits, an optional parity bit and 1, 1 ½ or 2 stop bits, and is fully
programmable by an AMBA APB CPU interface. A 16-bit programmable baud rate generator and an 8-bit scratch
register are included, together with separate transmit and receive FIFOs. Eight modem control lines and a diagnostic
loop-back mode are provided.
Interrupts can be generated for a range of TX Buffer/FIFO, RX Buffer/FIFO, Modem Status and Line Status conditions.
For integration in system where Infrared SIR serial data format is required, the UART can be configured to have a
software-programmable IrDA SIR mode. If this mode is not selected, only the UART (RS232 standard) serial data
format is available.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 594
Interfaces
RX Block
IRQ
Control
DRQ TX
RX FIFO
RX
APB
Register
Status
Controller RTS
TX Block
PCLK CTS
Control
TX FIFO
TX RX
UART RX TX
Module
Interface CTS RTS
RTS CTS
GND
One Character
One Bit
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 596
Interfaces
CTS-
RX Start Data N Stop Start Data N+1 Stop Start Data N+2 Stop
RTS-
Data Bits
Bit Time
SIN/SOUT S Stop
3/16 Bit Time 3/16 Bit Time
SIR_OUT
3/16 Bit Time
SIR_IN
The UART_LCR register can set basic parameter of a data frame: data width(5 to 8 bits), stop bit number(1/1.5/2),
parity type.
A frame transfer of the UART includes the start signal, data signal, parity bit and stop signal. The LSB is transmitted
first.
Start signal(start bit): It is the start flag of a data frame. According to UART protocol, the low level of TXD signal
indicates the start of a data frame. When the UART transmits data, the level need hold high.
Data signal(data bit): The data bit width can be configured as 5-bit,6-bit,7-bit,8-bit through different applications.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 597
Interfaces
Parity bit: It is 1-bit error correction signal. Parity bit includes odd parity, even parity. The UART can enable and
disable the parity bit by setting the UART_LCR register.
Stop Signal(stop bit): It is the stop bit of a data frame. The stop bit can be set to 1-bit,1.5-bit and 2-bit by the
UART_LCR register. The high level of TXD signal indicates the end of a data frame.
The baud rate is calculated as follows: Baud rate = SCLK /(16 * divisor). SCLK is usually APB2 and can be set in CCU.
Divisor is frequency divider of UART. The frequency divider has 16-bit,the low 8-bit is in the UART_DLL register, the
high 8-bit is in the UART_DLH register.
The relationship between different UART mode and error rate is as follows.
DLAB control bit (UART_LCR[7]) is the access control bit of divisor Latch register.
If DLAB is 0, then 0x00 offset address is TX/RX FIFO register, 0x04 offset address is IER register.
If DLAB is 1, then 0x00 offset address is DLL register, 0x04 offset address is DLH register.
When UART initial, divisor need be set. That is, writing 1 to DLAB can access the DLL and DLH register, after finished
setting, writing 0 to DLAB can access the TX/RX FIFO register.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 599
Interfaces
9.2.4.1. Initialization
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 600
Interfaces
Data transfer
Step1 Write data to UART_THR to start data transfer.
Step2 Check TX_FIFO status by reading UART_USR[TFNF]. If the bit is 1, data can continue to be written; if the bit
is 0, wait data transfer, and data cannot continue to write until FIFO is not full.
Data receive
Step1 Check RX_FIFO status by reading UART_USR[RFNE].
Step2 Read data from UART_RBR if RX_FIFO is not empty.
Step3 If UART_USR[RFNE] is 0, data is received completely.
Data transfer
Step1 Set UART_IER[ETBEI] to 1 to enable UART transfer interrupt.
Step2 Write data to be transmitted to UART_THR.
Step3 When the data of TX_FIFO meets trigger condition(such as FIFO/2, FIFO/4), UART transfer interrupt is
generated.
Step4 Check UART_USR[TFE] and determine whether TX_FIFO is empty. If UART_USR[TFE] is 1, it indicates that
the data in TX_FIFO is transmitted completely.
Step5 Clear UART_IER[ETBEI] to 0 to disable transfer interrupt.
Data receive
Step1 Set UART_IER[ERBFI] to 1 to enable UART receive interrupt.
Step2 When the received data from RX_FIFO meets trigger condition(such as FIFO/2, FIFO/4), UART receive
interrupt is generated.
Step3 Read data from UART_RBR.
Step4 Check RX_FIFO status by reading UART_USR[RFNE] and determine whether to read data. If the bit is 1,
continue to read data from UART_RBR until UART_USR[RFNE] is cleared to 0, which indicates data is received
completely.
Figure 9-17 shows the process of UART transmitting and receiving data in interrupt mode.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 601
Interfaces
Start
Configure APB2
Enable CHCFG_AT_BUSY
(UART_HALT[1])
Write 1 to DLAB
Set DLL and DLH
Write 0 to DLAB
Set other bits of LCR
Update CHANGE_UPDATE
(UART_HALT[2])
Read RX FIFO/
Write TX FIFO/
Clear Flag if needed
N Transmission
Complete?
Disable IRQ
End
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 602
Interfaces
Data transfer
Step1 Configure UART DMA interrupt according to initialization process.
Step2 Configure DMA data channel, including transfer source address, transfer destination address, number of
data to be transferred, and transfer type, etc(For details, see the description in DMAC module).
Step3 Enable DMA transfer function of the UART by setting the register of DMA module.
Step4 Determine whether UART data is transferred completely based on DMA status. If all data is transferred
completely, disable DMA transfer function of the UART.
Data receive
Step1 Configure DMA data channel, including transfer source address, transfer destination address, number of
data to be transferred, and transfer type, etc(For details, see the description in DMAC module).
Step2 Enable DMA receive function of the UART by setting the register of DMA module.
Step3 Determine whether UART data is received completely based on DMA status. If all data is received
completely, disable DMA receive function of the UART.
Figure 9-18 shows the process of UART transmitting data in DMA mode.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 603
Interfaces
Start
Configure APB2
Enable CHCFG_AT_BUSY
(UART_HALT[1])
Write 1 to DLAB
Set DLL and DLH
Write 0 to DLAB
Set other bits of LCR
Update CHANGE_UPDATE
(UART_HALT[2])
Trigger DMA
N
DMA Transmission
Complete?
End
UART4 0x05001000
UART5 0x05001400
If in FIFO mode and FIFOs are enabled (FCR[0] set to one), this register
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 605
Interfaces
accesses the head of the receive FIFO. If the receive FIFO is full and this
register can not read before the next data character arrives, then the data
already in the FIFO is preserved, but any incoming data are lost and an
overrun error occurs.
If in FIFO mode and FIFOs are enabled (FCR[0] = 1) and THRE is set, 16
number of characters data may be written to the THR before the FIFO is
full. When the FIFO is full, any write data results in the write data being
lost.
The output baud rate is equal to the serial clock (sclk) frequency divided by
7:0 R/W 0x0
sixteen times the value of the baud rate divisor, as follows: baud rate =
(serial clock freq) / (16 * divisor).
Note that when the Divisor Latch Registers (DLL and DLH) are set to zero,
the baud clock is disabled and no serial communications occur. Also, once
the DLL is set, at least 8 clock cycles of the slowest UART clock should be
allowed to pass before transmitting or receiving data.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 606
Interfaces
The output baud rate is equal to the serial clock (sclk) frequency divided by
7:0 R/W 0x0
sixteen times the value of the baud rate divisor, as follows: baud rate =
(serial clock freq) / (16 * divisor).
Note that when the Divisor Latch Registers (DLL and DLH) is set to zero, the
baud clock is disabled and no serial communications occur. Also, once the
DLH is set, at least 8 clock cycles of the slowest UART clock should be
allowed to pass before transmitting or receiving data.
Level Type
0001 - None None -
Receiver Overrun/parity/framing errors or
0110 Highest Reading the line status register
line status break interrupt
RS485 In RS485 mode, receives address
0011 Second Writes 1 to addr flag to reset
Interrupt data and match setting address
Receiver data available (non-FIFO Reading the receiver buffer register
Received
mode or FIFOs disabled) or RCVR (non-FIFO mode or FIFOs disabled) or
0100 Third data
FIFO trigger level reached (FIFO the FIFO drops below the trigger level
available
mode and FIFOs enabled) (FIFO mode and FIFOs enabled)
No characters in or out of the
Character RCVR FIFO during the last 4
1100 Fourth timeout character times and there is at Reading the receiver buffer register
indication least 1character in it during
This time
Transmitter holding register Reading the IIR register (if source of
Transmit
empty (Program THRE mode interrupt); or, writing into THR (FIFOs or
holding
0010 Fifth disabled) or XMIT FIFO at or THRE mode not selected or disabled) or
register
below threshold (Program THRE XMIT FIFO above threshold (FIFOs and
empty
mode enabled) THRE mode selected and enabled).
Clear to send or data set ready or
ring indicator or data carrier
Modem detect. Note that if auto flow
0000 Sixth Reading the Modem status register
status control mode is enabled, a
change in CTS (that is, DCTS set)
does not cause an interrupt.
UART_16550_COMPATIBLE = NO
Busy and master has tried to write to
0111 Seventh detect the Line Control Register while Reading the UART status register
indication the UART is busy (USR[0] is set to
one).
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 609
Interfaces
1: Mode 1
In this mode, if TX FIFO is enabled and the PTE is high, the TX DMA request
will send when TFL is less than or equal to FIFO Trigger Level. If PTE is low,
the TX DMA request will send when TX FIFO is empty and the request stops
only when TX FIFO is full.
If RFL is equal to or more than FIFO Trigger Level, the rx drq will be set to 1,
in otherwise, it will be set to 0.
XFIFOR
XMIT FIFO Reset
2 W 0x0 The bit resets the control portion of the transmit FIFO and treats the FIFO
as empty. This also de-asserts the DMA TX request.
It is 'self-clearing'. It is not necessary to clear this bit.
RFIFOR
RCVR FIFO Reset
1 W 0x0 The bit resets the control portion of the receive FIFO and treats the FIFO as
empty. This also de-asserts the DMA RX request.
It is 'self-clearing'. It is not necessary to clear this bit.
FIFOE
Enable FIFOs
0 W 0x0 The bit enables/disables the transmit (XMIT) and receive (RCVR) FIFOs.
Whenever the value of this bit is changed, both the XMIT and RCVR
controller portion of FIFOs is reset.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 610
Interfaces
It is writeable only when UART is not busy (USR[0] is zero) and always
readable. This is used to select the number of stop bits per character that
the peripheral transmits and receives. If setting to 0, one stop bit is
transmitted in the serial data. If setting to 1 and the data bits are set to 5
(LCR[1:0] set to zero) one and a half stop bits is transmitted. Otherwise, two
stop bits are transmitted. Note that regardless of the number of stop bits
selected, the receiver checks only the first stop bit.
0: 1 stop bit
1: 1.5 stop bits when DLS (LCR[1:0]) is zero, else 2 stop bit
DLS
Data Length Select
It is writeable only when UART is not busy (USR[0] is zero) and always
readable. This is used to select the number of data bits per character that
the peripheral transmits and receives. The number of bit that may be
1:0 R/W 0x0
selected areas follows:
00: 5 bits
01: 6 bits
10: 7 bits
11: 8 bits
back to the sin line, internally. In this mode all the interrupts are fully
functional. Also, in loopback mode, the modem control inputs (dsr_n, cts_n,
ri_n, dcd_n) are disconnected and the modem control outputs (dtr_n, rts_n,
out1_n, out2_n) are looped back to the inputs, internally. If operating in
infrared mode (SIR_MODE == Enabled AND active, MCR[6] is set to one),
data on the sir_out_n line is held low, while serial data output is inverted
and looped back to the sir_in line.
3:2 / / /
RTS
Request to Send
This is used to directly control the Request to Send (rts_n) output. The RTS
(rts_n) output is used to inform the modem or data set that the UART is
ready to exchange data. When Auto RTS Flow Control is not enabled
(MCR[5] is set to zero), the rts_n signal is set low by programming MCR[1]
(RTS) to a high. In Auto Flow Control, AFCE_MODE == Enabled and active
(MCR[5] is set to one) and FIFOs enable (FCR[0] is set to one), the rts_n
1 R/W 0x0
output is controlled in the same way, but is also gated with the receiver FIFO
threshold trigger (rts_n is inactive high when above the threshold). The
rts_n signal is de-asserted when MCR[1] is set low.
0: rts_n de-asserted (logic 1)
1: rts_n asserted (logic 0)
Note that in Loopback mode (MCR[4] is set to one), the rts_n output is held
inactive high while the value of this location is internally looped back to an
input.
DTR
Data Terminal Ready
This is used to directly control the Data Terminal Ready (dtr_n) output. The
value written to this location is inverted and driven out on dtr_n.
0: dtr_n de-asserted (logic 1)
0 R/W 0x0 1: dtr_n asserted (logic 0)
The Data Terminal Ready output is used to inform the modem or data set
that the UART is ready to establish communications.
Note that in Loopback mode (MCR[4] is set to one), the dtr_n output is held
inactive high while the value of this location is internally looped back to an
input.
bit is set to “1” when there is at least one PE, FE, or BI in the RX FIFO. It is
cleared by a read from the LSR register provided, there are no subsequent
errors in the FIFO.
TEMT
Transmitter Empty
If the FIFOs are disabled, this bit is set to "1" whenever the TX Holding
6 R 0x1
Register and the TX Shift Register are empty. If the FIFOs are enabled, this
bit is set whenever the TX FIFO and the TX Shift Register are empty. In both
cases, this bit is cleared when a byte is written to the TX data channel.
THRE
TX Holding Register Empty
If the FIFOs are disabled, this bit is set to "1" whenever the TX Holding
Register is empty and ready to accept new data and it is cleared when the
5 R 0x1
CPU writes to the TX Holding Register.
If the FIFOs are enabled, this bit is set to "1" whenever the TX FIFO is empty
and it is cleared when at least one byte is written to the TX FIFO.
BI
Break Interrupt
This is used to indicate the detection of a break sequence on the serial input
data.
If in UART mode (SIR_MODE == Disabled), it is set whenever the serial input,
sir_in, is held in a logic '0' state for longer than the sum of start time + data
bits + parity + stop bits.
In the FIFO mode, the character associated with the break condition is
carried through the FIFO and is revealed when the character is at the top of
the FIFO. Reading the LSR clears the BI bit. In the non-FIFO mode, the BI
indication occurs immediately and persists until the LSR is read.
FE
Framing Error
This is used to indicate the occurrence of a framing error in the receiver. A
framing error occurs when the receiver does not detect a valid STOP bit in
the received data.
3 RC 0x0
In the FIFO mode, since the framing error is associated with a character
received, it is revealed when the character with the framing error is at the
top of the FIFO. When a framing error occurs, the UART tries to
resynchronize. It does this by assuming that the error was due to the start
bit of the next character and then continues receiving the other bit i.e. data,
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 614
Interfaces
and/or parity and stop. It should be noted that the Framing Error (FE) bit
(LSR[3]) is set if a break interrupt has occurred, as indicated by Break
Interrupt (BI) bit (LSR[4]).
0: no framing error
1:framing error
Reading the LSR clears the FE bit.
PE
Parity Error
This is used to indicate the occurrence of a parity error in the receiver if the
Parity Enable (PEN) bit (LCR[3]) is set. In the FIFO mode, since the parity
error is associated with a character received, it is revealed when the
2 RC 0x0 character with the parity error arrives at the top of the FIFO. It should be
noted that the Parity Error (PE) bit (LSR[2]) is set if a break interrupt has
occurred, as indicated by Break Interrupt (BI) bit (LSR[4]).
0: no parity error
1: parity error
Reading the LSR clears the PE bit.
OE
Overrun Error
This occurs if a new data character was received before the previous data
was read. In the non-FIFO mode, the OE bit is set when a new character
arrives in the receiver before the previous character was read from the RBR.
When this happens, the data in the RBR is overwritten. In the FIFO mode, an
1 RC 0x0
overrun error occurs when the FIFO is full and a new character arrives at the
receiver. The data in the FIFO is retained and the data in the receive shift
register is lost.
0: no overrun error
1: overrun error
Reading the LSR clears the OE bit.
DR
Data Ready
This is used to indicate that the receiver contains at least one character in
the RBR or the receiver FIFO.
0 R 0x0
0: no data ready
1: data ready
This bit is cleared when the RBR is read in non-FIFO mode, or when the
receiver FIFO is empty, in FIFO mode.
This is used to indicate that a change on the input ri_n (from an active-low
to an inactive-high state) has occurred since the last time the MSR was read.
0: no change on ri_n since last read of MSR
1: change on ri_n since last read of MSR
Reading the MSR clears the TERI bit.
DDSR
Delta Data Set Ready
This is used to indicate that the modem control line dsr_n has changed since
the last time the MSR was read.
0: no change on dsr_n since last read of MSR
1 RC 0x0 1: change on dsr_n since last read of MSR
Reading the MSR clears the DDSR bit. In Loopback Mode (MCR[4] = 1), DDSR
reflects changes on MCR[0] (DTR).
Note: If the DDSR bit is not set and the dsr_n signal is asserted (low) and a
reset occurs (software or otherwise), then the DDSR bit is set when the
reset is removed if the dsr_n signal remains asserted.
DCTS
Delta Clear to Send
This is used to indicate that the modem control line cts_n has changed since
the last time the MSR was read.
0: no change on ctsdsr_n since last read of MSR
0 RC 0x0 1: change on ctsdsr_n since last read of MSR
Reading the MSR clears the DCTS bit. In Loopback Mode (MCR[4] = 1), DCTS
reflects changes on MCR[1] (RTS).
Note: If the DCTS bit is not set and the cts_n signal is asserted (low) and a
reset occurs (software or otherwise), then the DCTS bit is set when the
reset is removed if the cts_n signal remains asserted.
RFF
Receive FIFO Full
This is used to indicate that the receive FIFO is completely full.
4 R 0x0
0: Receive FIFO not full
1: Receive FIFO Full
This bit is cleared when the RX FIFO is no longer full.
RFNE
Receive FIFO Not Empty
This is used to indicate that the receive FIFO contains one or more entries.
3 R 0x0
0: Receive FIFO is empty
1: Receive FIFO is not empty
This bit is cleared when the RX FIFO is empty.
TFE
Transmit FIFO Empty
This is used to indicate that the transmit FIFO is completely empty.
2 R 0x1
0: Transmit FIFO is not empty
1: Transmit FIFO is empty
This bit is cleared when the TX FIFO is no longer empty.
TFNF
Transmit FIFO Not Full
This is used to indicate that the transmit FIFO in not full.
1 R 0x1
0: Transmit FIFO is full
1: Transmit FIFO is not full
This bit is cleared when the TX FIFO is full.
BUSY
UART Busy Bit
0 R 0x0
0: Idle or inactive
1: Busy
RFL
8:0 R 0x0 Receive FIFO Level
The bit indicates the number of data entries in the receive FIFO.
In DMA0 mode, if PTE is set to 1 and FIFO is on, when TFL is less than trig,
send DMA request. If PTE is set to 1 and FIFO is off, when THRE is empty,
send DMA request. If PTE is set to 0, when FIFO is empty, send DMA
request.
DMA_PTE_RX
The sending of RX_DRQ.
In DMA1 mode, when RFL is more than or equal to trig or receive timeout,
6 R/W 0x0 send DRQ.
In DMA0 mode, if DMA_PTE_RX is 1 and FIFO is on, when RFL is more than
trig, send DRQ. In other cases, once the receive data is valid, send DRQ.
SIR_RX_INVERT
SIR Receiver Pulse Polarity Invert
5 R/W 0x0
0: Not invert receiver signal
1: Invert receiver signal
SIR_TX_INVERT
SIR Transmit Pulse Polarity Invert
4 R/W 0x0
0: Not invert transmit pulse
1: Invert transmit pulse
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 619
Interfaces
3 / / /
CHANGE_UPDATE
After the user uses HALT[1] to change the baud rate or LCR configuration,
2 R/WAC 0x0 write 1 to update the configuration and wait this bit to self-clear to 0 to
finish update process. Writing 0 to this bit has no effect.
1: Update trigger, Self clear to 0 when finish update.
CHCFG_AT_BUSY
This is an enable bit for the user to change LCR register configuration and
1 R/W 0x0
baud rate register (DLH and DLL) when the UART is busy.
1: Enable change when busy
HALT_TX
Halt TX
This register is used to halt transmissions for testing, so that the transmit
0 R/W 0x0 FIFO can be filled by the master when FIFOs are implemented and enabled.
0 : Halt TX disabled
1 : Halt TX enabled
Note: If FIFOs are not enabled, the setting has no effect on operation.
9.2.6.20. 0x00C0 UART RS485 Control and Status Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 620
Interfaces
9.2.6.22. 0x00C8 UART RS485 Bus Idle Check Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 621
Interfaces
BUS_STATUS
The Flag of Bus Status
6 R 0x0
0:Idle
1:Busy
ADJ_TIME
5:0 R 0x0 Bus Idle Time
The unit is 8*16*Tclk.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 622
Interfaces
9.3. SPI
9.3.1. Overview
The SPI is a full-duplex, synchronous, serial communication interface which allows rapid data communication with
fewer software interrupts. The SPI controller contains one 64x8 bits receiver buffer (RXFIFO) and one 64x8 bits
transmit buffer (TXFIFO). It can work at master mode and slave mode.
spi_top
spi_mosi_oen
spi_mosi_out
tbuf txfifo spi_tx
spi_miso_oen
spi_miso_out
AHB sckt
spi_ss_oen
spi_ss_out
spi_ss_in
TX DMA spi_rf spi_cmu spi_sck_oen
spi_sck_out
spi_sck_in
RX DMA
sckr
spi_mosi_in
rbuf rxfifo spi_rx
INTC spi_miso_in
hclk sclk
domain domain
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 623
Interfaces
Table 9-8 describes the external signals of SPI. MOSI and MISO are bidirectional I/O, when SPI is configured as master
device, CLK and CS is output pin; when SPI is configurable as slave device, CLK and CS is input pin. The unused SPI
ports are used as General Purpose I/O ports.
The SPI controller get 5 different clock sources, users can select one of them to make SPI clock source. Table 9-9
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 624
Interfaces
Figure 9-20 shows the application block diagram when the SPI master device is connected to a slave device.
The SPI supports 4 different formats for data transfer. Software can select one of the four modes in which the SPI
works by setting the bit1(Polarity) and bit0(Phase) of SPI Transfer Control Register. The SPI controller master uses the
SPI_SCLK signal to transfer data in and out of the shift register. Data is clocked using any one of four programmable
clock phase and polarity combinations.
During Phase 0, Polarity 0 and Phase 1, Polarity 1 operations, output data changes on the falling clock edge and input
data is shifted in on the rising edge.
During Phase 1, Polarity 0 and Phase 0, Polarity 1 operations, output data changes on the rising edges of the clock and
is shifted in on falling edges.
The POL defines the signal polarity when SPI_SCLK is in idle state. The SPI_SCLK is high level when POL is ‘1’ and it is low
level when POL is ‘0’. The PHA decides whether the leading edge of SPI_SCLK is used for setup or sample data. The
leading edge is used for setup data when PHA is ‘1’ and for sample data when PHA is ‘0’. The four modes are listed in
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 625
Interfaces
Table 9-10.
Figure 9-21 and Figure 9-22 describe four waveforms for SPI_SCLK.
The SPI controller can be configured to a master or slave device. Master mode is selected by setting the MODE bit in
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 626
Interfaces
the SPI Global Control Register; slave mode is selected by clearing the MODE bit in the SPI Global Control Register.
In master mode, SPI_CLK is generated and transmitted to external device, and data from the TX FIFO is transmitted on
the MOSI pin, the data from slave is received on the MISO pin and sent to RX FIFO. Chip Select(SPI_SS) is active low
signal. SPI_SS must be set low before data are transmitted or received. SPI_SS can be selected SPI auto control or
software manual control. When using auto control, SS_OWNER(the bit 6 in the SPI Transfer Control Register) must be
cleared(default value is 0);when using manual control, SS_OWNER must be set, Chip Select level is controlled by
SS_LEVEL bit(the bit 7 in the SPI Transfer Control Register).
In slave mode, after software selects the MODE bit to '0',it waits for master initiate a transaction. When the master
asserts SPI_SS and SPI_CLK is transmitted to the slave, the slave data is transmitted from TX FIFO on MISO pin and data
from MOSI pin is received in RX FIFO.
The SPI 3-wire mode is only valid when the SPI controller work in master mode, and is selected when the Work Mode
Select(bit[1:0]) is equal to 0x2 in the SPI Bit-Aligned Transfer Configure Register. And in the 3-wire mode, the input
data and the output data use the same single data line. The following figure describes this mode.
The dual read mode(SPI x2) is selected when the DRM(bit28) is set in the SPI Master Burst Control Counter Register.
Using the dual mode allows data to be transferred to or from the device at double the rate of standard single mode SPI
devices, data can be read at fast speed using two data bits(MOSI and MISO) at a time. The following figure describes
the dual-input/dual-output SPI(Figure 9-24) and the dual I/O SPI(Figure 9-25).
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 627
Interfaces
The quad read mode(SPI x4) is selected when the Quad_EN(bit29) is set in the SPI Master Burst Control Counter
Register. Using the quad mode allows data to be transferred to or from the device at 4 times the rate of standard
single mode SPI devices, data can be read at fast speed using four data bits(MOSI, MISO, IO2(WP#)and IO3(HOLD#)) at
the same time. The following figure describes the quad-input/quad-output SPI.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 628
Interfaces
In SPI master mode, the transmit and receive burst(byte in unit) are configured before the SPI transfers serial data
between the processor and external device. The transmit bursts are written in MWTC(bit[23:0]) of SPI Master Transmit
Counter Register. The transmit bursts in single mode before automatically sending dummy burst are written in
STC(bit[23:0]) of SPI Master Burst Control Counter Register. For dummy data, SPI controller can automatically sent
before receiving by writing DBC(bit[27:24]) in SPI Master Burst Control Counter Register. If users donot use SPI
controller to sent dummy data automatically, then the dummy bursts are used as the transmit counters to write
together in MWTC(bit[23:0]) of SPI Master Transmit Counter Register. In master mode, the total burst numbers are
written in MBC(bit[23:0]) of SPI Master Burst Counter Register. When all transmit burst and receive burst are
transferred, SPI controller will send an completed interrupt, at the same time, SPI controller will clear DBC,MWTC and
MBC.
The SPI controller runs at 3 kHz~100 MHz at its interface to external SPI devices. The internal SPI clock should run at
the same frequency as the outgoing clock in master mode. The SPI clock is selected different clock sources, SPI must
configure different work mode. There are three work modes: normal sample mode, delay half cycle sample mode,
delay one cycle sample mode. Delay half cycle sample mode is the default mode of SPI controller. When SPI runs at 40
MHz or below 40 MHz, SPI can work at normal sample mode or delay half cycle sample mode. When SPI runs over 60
MHz, setting the SDC bit in SPI Transfer Control Register to ‘1’ makes the internal read sample point with a half cycle
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 629
Interfaces
delay of SPI_CLK, which is used in high speed read operation to reduce the error caused by the time delay of SPI_CLK
propagating between master and slave. The different configuration of SPI sample mode shows in Table 9-11.
If any error conditions occur, hardware will set the corresponding status bits in the SPI Interrupt Status Register and
stop the transfer. For the SPI controller, the following error scenarios can happen.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 630
Interfaces
The SPI transfers serial data between the processor and external device. CPU and DMA are the two main operational
modes for SPI. For each SPI, data is simultaneously transmitted(shifted out serially) and received (shifted in
serially).SPI has 2 channels, TX channel and RX channel. TX channel has the path from TX FIFO to external device. RX
channel has the path from external device to RX FIFO.
Write Data: CPU or DMA must write data on the register SPI_TXD, data on the register are automatically moved to TX
FIFO.
Read Data: To read data from RX FIFO, CPU or DMA must access the register SPI_RXD and data are automatically sent
to the register SPI_RXD.
In CPU or DMA mode, the SPI sends an completed interrupt(the TC bit in SPI Interrupt Status Register) to the
processor at the end of each transfer.
(1).CPU Mode
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 631
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 632
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 633
Interfaces
The SPI has one delay chain, which is used to generate delay to make proper timing between internal SPI clock signal
and data signals. Delay chain is made up with 64 delay cells. The delay time of one delay cell can be estimated through
delay chain calibration.
Step1: Enable SPI. In order to calibrate delay chain by operation registers in SPI, SPI must be enabled through AHB reset
and AHB clock gating control registers.
Step2: Configure a proper clock for SPI. Calibration delay chain is based on the clock for SPI from CCU.
Step3: Set proper initial delay value. Write 0xA0 to delay control register to set initial delay value 0x20 to delay chain.
Then write 0x0 to delay control register to clear this value.
Step4: Write 0x8000 to delay control register to start calibrate delay chain.
Step5: Wait until the flag(Bit14 in delay control register) of calibration done is set. The number of delay cells is shown
at Bit8~Bit14 in delay control register. The delay time generated by these delay cells is equal to the cycle of SPI’s clock
nearly. This value is the result of calibration.
Step6: Calculate the delay time of one delay cell according to the cycle of SPI’s clock and the result of calibration.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 634
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 635
Interfaces
1: Enable
7 / / /
TF_FUL_INT_EN
TX FIFO Full Interrupt Enable
6 R/W 0x0
0: Disable
1: Enable
TX_EMP_INT_EN
TX FIFO Empty Interrupt Enable
5 R/W 0x0
0: Disable
1: Enable
TX_ERQ_INT_EN
TX FIFO Empty Request Interrupt Enable
4 R/W 0x0
0: Disable
1: Enable
3 / / /
RF_FUL_INT_EN
RX FIFO Full Interrupt Enable
2 R/W 0x0
0: Disable
1: Enable
RX_EMP_INT_EN
RX FIFO Empty Interrupt Enable
1 R/W 0x0
0: Disable
1: Enable
RF_RDY_INT_EN
RX FIFO Ready Request Interrupt Enable
0 R/W 0x0
0: Disable
1: Enable
1: Transfer completed
TF_UDF
TXFIFO Underrun
11 R/W1C 0x0 This bit is set when if the TXFIFO is underrun. Writing 1 to this bit clears it.
0: TXFIFO is not underrun
1: TXFIFO is underrun
TF_OVF
TXFIFO Overflow
10 R/W1C 0x0 This bit is set when if the TXFIFO is overflow. Writing 1 to this bit clears it.
0: TXFIFO is not overflow
1: TXFIFO is overflowed
RX_UDF
RXFIFO Underrun
9 R/W1C 0x0
When set, this bit indicates that RXFIFO has underrun. Writing 1 to this bit
clears it.
RX_OVF
RXFIFO Overflow
When set, this bit indicates that RXFIFO has overflowed. Writing 1 to this bit
8 R/W1C 0x0
clears it.
0: RXFIFO is available
1: RXFIFO is overflowed
7 / / /
TX_FULL
TXFIFO Full
6 R/W1C 0x0 This bit is set when if the TXFIFO is full . Writing 1 to this bit clears it.
0: TXFIFO is not Full
1: TXFIFO is Full
TX_EMP
TXFIFO Empty
5 R/W1C 0x1 This bit is set if the TXFIFO is empty. Writing 1 to this bit clears it.
0: TXFIFO contains one or more words.
1: TXFIFO is empty
TX_READY
TXFIFO Ready
0: TX_WL > TX_TRIG_LEVEL
4 R/W1C 0x1
1: TX_WL <= TX_TRIG_LEVEL
This bit is set any time if TX_WL <= TX_TRIG_LEVEL. Writing “1” to this bit
clears it. TX_WL is the water level of TXFIFO.
3 / / /
RX_FULL
RXFIFO Full
2 R/W1C 0x0 This bit is set when the RXFIFO is full . Writing 1 to this bit clears it.
0: Not Full
1: Full
1 R/W1C 0x1 RX_EMP
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 640
Interfaces
RXFIFO Empty
This bit is set when the RXFIFO is empty . Writing 1 to this bit clears it.
0: Not empty
1: empty
RX_RDY
RXFIFO Ready
0: RX_WL < RX_TRIG_LEVEL
0 R/W1C 0x0
1: RX_WL >= RX_TRIG_LEVEL
This bit is set any time if RX_WL >= RX_TRIG_LEVEL. Writing “1” to this bit
clears it. RX_WL is the water level of RXFIFO.
‘1’ to this bit will switch RX FIFO read and write function to AHB bus. This bit
is used to test the RX FIFO, donot set in normal operation and donot set
RF_TEST and TF_TEST at the same time.
13:9 / / /
RF_DRQ_EN
RX FIFO DMA Request Enable
8 R/W 0x0
0: Disable
1: Enable
RX_TRIG_LEVEL
7:0 R/W 0x1
RX FIFO Ready Request Trigger Level
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 642
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 643
Interfaces
9.3.6.11. 0x0038 SPI Master Burst Control Counter Register(Default Value: 0x0000_0000)
DRM
Master Dual Mode RX Enable
0: RX use single-bit mode
28 R/W 0x0
1: RX use dual mode
Cannot be written when XCH=1.
It is only valid when Quad_Mode_EN=0.
DBC
Master Dummy Burst Counter
In master mode, this field specifies the burst number that should be sent
before receive in dual SPI mode. The data does not care by the device.
27:24 R/W 0x0 0: 0 burst
1: 1 burst
…
N: N bursts
Cannot be written when XCH=1.
STC
Master Single Mode Transmit Counter
In master mode, this field specifies the burst number that should be sent in
single mode before automatically sending dummy burst. This is the first
transmit counter in all bursts.
23:0 R/W 0x0
0: 0 burst
1: 1 burst
…
N: N bursts
Cannot be written when XCH=1.
In Standard Sample Mode, SPI master samples the data at the standard
rising edge of SCLK for each SPI mode;
In Delay Sample Mode, SPI master samples data at the edge that is half cycle
delayed by the standard rising edge of SCLK defined in respective SPI mode.
29:26 / / /
TBC
Transfer Bits Completed
When set, this bit indicates that the last bit of the serial data frame in SPI TX
Bit Register(or SPI RX Bit Register) has been transferred completely. Writing 1
25 R/W1C 0x0
to this bit clears it.
0: Busy
1: Transfer Completed
It is only valid when Work Mode Select==0x10/0x11.
TBC_INT_EN
Transfer Bits Completed Interrupt Enable
24 R/W 0x0 0: Disable
1: Enable
It is only valid when Work Mode Select==0x10/0x11.
23:22 / / /
Configure the length of serial data frame(burst) of RX
000000: 0bit
000001: 1bit
…
21:16 R/W 0x00
100000: 32bits
Other values: reserved
It is only valid when Work Mode Select==0x10/0x11, and cannot be written
when TCE=1.
15:14 / / /
Configure the length of serial data frame(burst) of TX
000000: 0bit
000001: 1bit
…
13:8 R/W 0x00
100000: 32bits
Other values: reserved
It is only valid when Work Mode Select==0x10/0x11, and cannot be written
when TCE=1.
SS_LEVEL
When control SS signal manually , set this bit to ‘1’ or ‘0’ to control the level of
SS signal.
7 R/W 0x1 0: Set SS to low
1: Set SS to high
It is only valid when Work Mode Select==0x10/0x11, and only work in Mode0,
cannot be written when TCE=1.
SS_OWNER
6 R/W 0x0
SS Output Owner Select
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 646
Interfaces
Usually, controller sends SS signal automatically with data together. When this
bit is set to 1, software must manually write SPI_CTL_REG.SS_LEVEL to 1 or 0
to control the level of SS signal.
0: SPI controller
1: Software
It is only valid when Work Mode Select==0x10/0x11, and only work in Mode0,
cannot be written when TCE=1.
SPOL
SPI Chip Select Signal Polarity Control
0: Active high polarity (0 = Idle)
5 R/W 0x1
1: Active low polarity (1 = Idle)
It is only valid when Work Mode Select==0x10/0x11, and only work in Mode0,
cannot be written when TCE=1.
4 / / /
SS_SEL
SPI Chip Select
Select one of four external SPI Master/Slave Devices
00: SPI_SS0 will be asserted
3:2 R/W 0x0 01: SPI_SS1 will be asserted
10: SPI_SS2 will be asserted
11: SPI_SS3 will be asserted
It is only valid when Work Mode Select= =0x10/0x11, and only work in
Mode0, cannot be written when TCE=1.
Work Mode Select
00: Data frame is byte aligned in standard SPI, dual-output/dual input SPI, dual
IO SPI and quad-output/quad-input SPI.
1:0 R/W 0x0
01: Reserved
10: Data frame is bit aligned in 3-wire SPI
11: Data frame is bit aligned in standard SPI
9.3.6.13. 0x0044 SPI Bit-Aligned CLOCK Configuration Register (Default Value: 0x0000_0000)
NOTE
This register is only valid when Work Mode Select==0x10/0x11.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 647
Interfaces
NOTE
This register is only valid when Work Mode Select==0x10/0x11.
NOTE
This register is only valid when Work Mode Select==0x10/0x11.
9.3.6.16. 0x0088 SPI Normal DMA Mode Control Register(Default Value: 0x0000_00E5)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 648
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 649
Interfaces
9.4.1. Overview
The USB2.0 OTG is a dual-role device controller, which supports both device and host functions which can also be
configured as a Host-only or Device-only controller, fully compliant with the USB2.0 Specification. It can support
high-speed (HS, 480 Mbit/s), full-speed (FS, 12 Mbit/s), and low-speed (LS, 1.5 Mbit/s) transfers in Host mode. It can
support high-speed (HS, 480 Mbit/s), and full-speed (FS, 12 Mbit/s) in Device mode. Standard USB transceiver can be
used through its UTMI+PHY Level3 interface. The UTMI+PHY interface is bidirectional with 8-bit data bus. For saving
CPU bandwidth, USB-OTG DMA interface can support external DMA controller to take care of the data transfer
between the memory and USB-OTG FIFO. The USB-OTG core also supports USB power saving functions.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 650
Interfaces
USB2.0 OTG
Device AHB Slave Interface
VDD-SYS
Host VCC-USB
HCI
UTMI
DP USB Device
VDD-SYS SEL DM Or
PHY
ID USB Host
Device
Device Controller
EP IRQ
EP DRQ EP
SIE
Logic PHY Reset/Gating
BUS IRQ
OSC24M
AHB
OTG Reset/Gating
Hclk > 30M
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 651
Interfaces
9.5.1. Overview
USB2.0 Host Controller is fully compliant with the USB 2.0 specification, Enhanced Host Controller Interface (EHCI)
Specification, Revision 1.0, and the Open Host Controller Interface (OHCI) Specification Release 1.0a. The controller
supports high-speed, 480 Mbit/s transfers (40 times faster than USB 1.1 full-speed mode) using an EHCI Host
Controller, as well as full and low speeds through one or more integrated OHCI Host Controllers.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 652
Interfaces
VDD-SYS VCC-USB
SIE
Control
IRQ
CPUS Register
phyclk
EHCI DP
USB
PHY DM
Device
HS/FS
SEL
OHCI SCLK Gating 48M
OSC24M MUL
12M
OHCI
DIV
PLL_PERIPH
PHY Reset/Gating
AHB
EHCI Reset/Gating
OHCI Reset/Gating
OSC24M
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 653
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 654
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 655
Interfaces
6:4 / / /
N_PORTS
This field specifies the number of physical downstream ports implemented
on this host controller. The value of this field determines how many port
3:0 R 0x1
registers are addressable in the Operational Register Space. Valid values are
in the range of 0x1 to 0x0f.
This field is always 1.
0 / / /
in undefined behavior.
15:12 / / /
Asynchronous Schedule Park Mode Enable(OPTIONAL)
If the Asynchronous Park Capability bit in the HCCPARAMS register is a one,
then this bit defaults to a 1 and is R/W. Otherwise the bit must be a zero and
11 R 0x0
is Read Only. Software uses this bit to enable or disable Park mode. When
this bit is one, Park mode is enabled. When this bit is zero, Park mode is
disabled.
10 / / /
Asynchronous Schedule Park Mode Count(OPTIONAL)
Asynchronous Park Capability bit in the HCCPARAMS register is a one,
Then this field defaults to 0x3 and is W/R. Otherwise it defaults to zero and
is R. It contains a count of the number of successive transactions the host
9:8 R 0x0 controller is allowed to execute from a high-speed queue head on the
Asynchronous schedule before continuing traversal of the Asynchronous
schedule.
Valid value are 0x1 to 0x3.Software must not write a zero to this bit when
Park Mode Enable is a one as it will result in undefined behavior.
Light Host Controller Reset(OPTIONAL)
This control bit is not required.
If implemented, it allows the driver to reset the EHCI controller without
affecting the state of the ports or relationship to the companion host
controllers. For example, the PORSTC registers should not be reset to their
7 R/W 0x0
default values and the CF bit setting should not go to zero (retaining port
ownership relationships).
A host software read of this bit as zero indicates the Light Host Controller
Reset has completed and it si safe for software to re-initialize the host
controller. A host software read of this bit as a one indicates the Light Host
Interrupt on Async Advance Doorbell
This bit is used as a doorbell by software to tell the host controller to issue
an interrupt the next time it advances asynchronous schedule. Soft-
Ware must write a 1 to this bit to ring the doorbell.
When the host controller has evicted all appropriate cached schedule state,
it sets the Interrupt on Async Advance status bit in the USBSTS. if the
6 R/W 0x0
Interrupt on Async Advance Enable bit in the USBINTR register is a one then
the host controller will assert an interrupt at the next interrupt threshold.
The host controller sets this bit to a zero after it has set the Interrupt on
Async Advance status bit in the USBSTS register to a one.
Software should not write a one to this bit when the asynchronous schedule
is disabled. Doing so will yield undefined results.
Asynchronous Schedule Enable
This bit controls whether the host controller skips processing the
5 R/W 0x0
Asynchronous Schedule. Values mean:
Bit Value Meaning
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 658
Interfaces
schedule. When set to 0, the Host Controller completes the current and any
actively pipelined transactions on the USB and then halts. The Host
Controller must halt within 16 micro-frames after software clears this bit.
The HC Halted bit indicates when the Host Controller has finished its pending
pipelined transactions and has entered the stopped state.
Software must not write a one to this field unless the Host Controller is in
the Halt State.
The default value is 0x0.
one to the Interrupt on Async Advance Doorbell bit in the USBCMD register.
This status bit indicates the assertion of that interrupt source.
Host System Error
The Host Controller set this bit to 1 when a serious error occurs during a
4 R/WC 0x0 host system access involving the Host Controller module. When this error
occurs, the Host Controller clears the Run/Stop bit in the Command register
to prevent further execution of the scheduled TDs.
Frame List Rollover
The Host Controller sets this bit to a one when the Frame List Index rolls
over from its maximum value to zero. The exact value at which the rollover
3 R/WC 0x0 occurs depends on the frame list size. For example, if the frame list size is
1024, the Frame Index Register rolls over every time FRINDEX [13] toggles.
Similarly, if the size is 512, the Host Controller sets this bit to a one every
time FRINDEX [12] toggles.
Port Change Detect
The Host Controller sets this bit to a one when any port for which the Port
Owner bit is set to zero has a change bit transition from a zero to a one or a
Force Port Resume bit transition from a zero to a one as a result of a J-K
2 R/WC 0x0
transition detected on a suspended port. This bit will also be set as a result
of the Connect Status Chang being set to a one after system software has
relinquished ownership of a connected port by writing a one to a port’s Port
Owner bit.
USB Error Interrupt(USBERRINT)
The Host Controller sets this bit to 1 when completion of USB transaction
1 R/WC 0x0 results in an error condition(e.g. error counter underflow).If the TD on which
the error interrupt occurred also had its IOC bit set, both.
This bit and USBINT bit are set.
USB Interrupt(USBINT)
The Host Controller sets this bit to a one on the completion of a USB
transaction, which results in the retirement of a Transfer Descriptor that had
0 R/WC 0x0 its IOC bit set.
The Host Controller also sets this bit to 1 when a short packet is detected
(actual number of bytes received was less than the expected number of
bytes)
NOTE
This register must be written as a DWord. Byte writes produce undefined results.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 662
Interfaces
9.5.4.10. 0x0024 EHCI Periodic Frame List Base Address Register(Default Value:0x0000_0000)
NOTE
Writes must be Dword Writes.
NOTE
Write must be DWord Writes.
9.5.4.12. 0x0030 EHCI Timer Configured & Standby Interrupt Status register (Default Value:0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 663
Interfaces
11: 64ms
7:3 / / /
Standby irq enable, when usb in standby operation, open this bit, and close
2 R/W 0x0
it after quitting standby mode, high active
Standby irq status bit, write “1” to clear or timer auto clear when open
1 R/WC 0x0
timer enable bit, configured timer value see bit9:8.
0 R/W 0x0 Timer enable, high active
NOTE
This register is not used in the normal implementation.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 664
Interfaces
When software writes a one to this bit (from a zero), the bus reset sequence
as defined in the USB Specification Revision 2.0 is started. Software writes a
zero to this bit to terminate the bus reset sequence. Software must keep this
bit at a one long enough to ensure the reset sequence, as specified in the USB
Specification Revision 2.0, completes. Notes: when software writes this bit to
a one , it must also write a zero to the Port Enable bit.
Note that when software writes a zero to this bit there may be a delay before
the bit status changes to a zero. The bit status will not read as a zero until
after the reset has completed. If the port is in high-speed mode after reset is
complete, the host controller will automatically enable this port (e.g. set the
Port Enable bit to a one). A host controller must terminate the reset and
stabilize the state of the port within 2 milliseconds of software transitioning
this bit from a one to a zero. For example: if the port detects that the
attached device is high-speed during reset, then the host controller must
have the port in the enabled state with 2ms of software writing this bit to a
zero.
The HC Halted bit in the USBSTS register should be a zero before software
attempts to use this bit. The host controller may hold Port Reset asserted to a
one when the HC Halted bit is a one.
This field is zero if Port Power is zero.
Suspend
Port Enabled Bit and Suspend bit of this register define the port states as
follows:
Bits[Port Enables, Suspend] Port State
0x Disable
10 Enable
11 Suspend
When in suspend state, downstream propagation of data is blocked on this
port, except for port reset. The blocking occurs at the end of the current
transaction, if a transaction was in progress when this bit was written to 1. In
the suspend state, the port is sensitive to resume detection. Not that the bit
7 R/W 0x0
status does not change until the port is suspend and that there may be a
delay in suspending a port if there is a transaction currently in progress on
the USB.
A write of zero to this bit is ignored by the host controller. The host controller
will unconditionally set this bit to a zero when:
① Software sets the Force Port Resume bit to a zero(from a one).
② Software sets the Port Reset bit to a one(from a zero).
If host software sets this bit to a one when the port is not enabled(i.e. Port
enabled bit is a zero), the results are undefined.
This field is zero if Port Power is zero.
The default value in this field is ‘0’.
Force Port Resume
6 R/W 0x0 1 = Resume detected/driven on port. 0 = No resume (K-state) detected/
driven on port. Default value = 0.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 666
Interfaces
This functionality defined for manipulating this bit depends on the value of
the Suspend bit. For example, if the port is not suspend and software
transitions this bit to a one, then the effects on the bus are undefined.
Software sets this bit to a 1 drive resume signaling. The Host Controller sets
this bit to a 1 if a J-to-K transition is detected while the port is in the Suspend
state. When this bit transitions to a one because a J-to-K transition is
detected, the Port Change Detect bit in the USBSTS register is also set to a
one. If software sets this bit to a one, the host controller must not set the
Port Change Detect bit.
Note that when the EHCI controller owns the port, the resume sequence
follows the defined sequence documented in the USB Specification Revision
2.0. The resume signaling (Full-speed ‘K’) is driven on the port as long as this
remains a one. Software must appropriately time the Resume and set this bit
to a zero when the appropriate amount of time has elapsed. Writing a zero
(from one) causes the port to return high-speed mode (forcing the bus below
the port into a high-speed idle). This bit will remain a one until the port has
switched to high-speed idle. The host controller must complete this transition
within 2 milliseconds of software setting this bit to a zero.
This field is zero if Port Power is zero.
Over-current Change
5 R/WC 0x0 Default = 0. This bit gets set to a one when there is a change to Over-current
Active. Software clears this bit by writing a one to this bit position.
Over-current Active
0 = This port does not have an over-current condition. 1 = This port currently
4 R 0x0 has an over-current condition. This bit will automatically transition from a
one to a zero when the over current condition is removed.
The default value of this bit is ‘0’.
Port Enable/Disable Change
Default = 0. 1 = Port enabled/disabled status has changed. 0 = No change.
For the root hub, this bit gets set to a one only when a port is disabled due to
3 R/WC 0x0 the appropriate conditions existing at the EOF2 point (See Chapter 11 of the
USB Specification for the definition of a Port Error). Software clears this bit by
writing a 1 to it.
This field is zero if Port Power is zero.
Port Enabled/Disabled
1=Enable, 0=Disable. Ports can only be enabled by the host controller as a
part of the reset and enable. Software cannot enable a port by writing a one
to this field. The host controller will only set this bit to a one when the reset
sequence determines that the attached device is a high-speed device.
2 R/W 0x0 Ports can be disabled by either a fault condition(disconnect event or other
fault condition) or by host software. Note that the bit status does not change
until the port state actually changes. There may be a delay in disabling or
enabling a port due to other host controller and bus events.
When the port is disabled, downstream propagation of data is blocked on
this port except for reset.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 667
Interfaces
NOTE
This register is only reset by hardware or in response to a host controller reset.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 668
Interfaces
This bit is used by HCD to enable or disable the remote wakeup feature
upon the detection of upstream resume signaling. When this bit is set and
the ResumeDetected bit in HcInterruptStatus is set, a remote wakeup is
signaled to the host system. Setting this bit has no impact on the generation
of hardware interrupt.
RemoteWakeupConnected
This bit indicates whether HC supports remote wakeup signaling. If remote
wakeup is supported and used by the system, it is the responsibility of
9 R/W R/W 0x0 system firmware to set this bit during POST. HC clear the bit upon a
hardware reset but does not alter it upon a software reset. Remote wakeup
signaling of the host system is host-bus-specific and is not described in this
specification.
InterruptRouting
This bit determines the routing of interrupts generated by events registered
in HcInterruptStatus. If clear, all interrupt are routed to the normal host bus
8 R/W R 0x0 interrupt mechanism. If set interrupts are routed to the System
Management Interrupt. HCD clears this bit upon a hardware reset, but it
does not alter this bit upon a software reset. HCD uses this bit as a tag to
indicate the ownership of HC.
HostControllerFunctionalState for USB
00b USBReset
01b USBResume
10b USBOperational
11b USBSuspend
A transition to USBOperational from another state causes SOF generation to
begin 1 ms later. HCD may determine whether HC has begun sending SOFs
7:6 R/W R/W 0x0 by reading the StartoFrame field of
HcInterruptStatus.
This field may be changed by HC only when in the USBSUSPEND state. HC
may move from the USBSUSPEND state to the USBRESUME state after
detecting the resume signaling from a downstream port.
HC enters USBSUSPEND after a software reset, whereas it enters
USBRESET after a hardware reset. The latter also resets the Root
Hub and asserts subsequent reset signaling to downstream ports.
BulkListEnable
This bit is set to enable the processing of the Bulk list in the next
Frame. If cleared by HCD, processing of the Bulk list does not occur after the
5 R/W R 0x0 next SOF. HC checks this bit whenever it determines to process the list.
When disabled, HCD may modify the list. If HcBulkCurrentED is pointing to
an ED to be removed, HCD must advance the pointer by updating
HcBulkCurrentED before re-enabling processing of the list.
ControlListEnable
This bit is set to enable the processing of the Control list in the next Frame.
4 R/W R 0x0
If cleared by HCD, processing of the Control list does not occur after the
next SOF. HC must check this bit whenever it determines to process the list.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 669
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 670
Interfaces
15:4 / / / /
OwershipChangeRequest
This bit is set by an OS HCD to request a change of control of the HC. When
3 R/W R/W 0x0 set HC will set the OwnershipChange field in HcInterruptStatus. After the
changeover, this bit is cleared and remains so until the next request from
OS HCD.
BulklListFilled
This bit is used to indicate whether there are any TDs on the Bulk list. It is
set by HCD whenever it adds a TD to an ED in the Bulk list.
When HC begins to process the head of the Bulk list, it checks BLF. As long
as BulkListFilled is 0, HC will not start processing the Bulk list. If
2 R/W R/W 0x0
BulkListFilled is 1, HC will start processing the Bulk list and will set BF to 0.
If HC finds a TD on the list, then HC will set BulkListFilled to 1 causing the
Bulk list processing to continue. If no TD is found on the Bulk list, and if
HCD does not set BulkListFilled, then BulkListFilled will still be 0 when HC
completes processing the Bulk list and Bulk list processing will stop.
ControlListFilled
This bit is used to indicate whether there are any TDs on the Control list. It
is set by HCD whenever it adds a TD to an ED in the Control list.
When HC begins to process the head of the Control list, it checks CLF. As
long as ControlListFilled is 0, HC will not start processing the Control list. If
1 R/W R/W 0x0 CF is 1, HC will start processing the Control list and will set ControlListFilled
to 0. If HC finds a TD on the list, then HC will set ControlListFilled to 1
causing the Control list processing to continue. If no TD is found on the
Control list, and if the HCD does not set ControlListFilled, then
ControlListFilled will still be 0 when HC completes processing the Control
list and Control list processing will stop.
HostControllerReset
This bit is by HCD to initiate a software reset of HC. Regardless of the
functional state of HC, it moves to the USBSuspend state in which most of
the operational registers are reset except those stated otherwise; e.g, the
0 R/W R/E 0x0 InteruptRouting field of HcControl, and no Host bus accesses are allowed.
This bit is cleared by HC upon the completion of the reset operation. The
reset operation must be completed within 10 ms. This bit, when set, should
not cause a reset to the Root Hub and no subsequent reset signaling should
be asserted to its downstream ports.
This bit is set when the content of HcRhStatus or the content of any of
HcRhPortStatus[NumberofDownstreamPort] has changed.
FrameNumberOverflow
5 R/W R/W 0x0 This bit is set when the MSb of HcFmNumber (bit 15) changes value, from 0
to 1 or from 1 to 0, and after HccaFrameNumber has been updated.
UnrecoverableError
This bit is set when HC detects a system error not related to USB. HC
4 R/W R/W 0x0
should not proceed with any processing nor signaling before the system
error has been corrected. HCD clears this bit after HC has been reset.
ResumeDetected
This bit is set when HC detects that a device on the USB is asserting resume
3 R/W R/W 0x0 signaling. It is the transition from no resume signaling to resume signaling
causing this bit to be set. This bit is not set when HCD sets the USBRseume
state.
StartofFrame
2 R/W R/W 0x0 This bit is set by HC at each start of frame and after the update of
HccaFrameNumber. HC also generates a SOF token at the same time.
WritebackDoneHead
This bit is set immediately after HC has written HcDoneHead to
1 R/W R/W 0x0 HccaDoneHead. Further updates of the HccaDoneHead will not occur until
this bit has been cleared. HCD should only clear this bit after it has saved
the content of HccaDoneHead.
SchedulingOverrun
This bit is set when the USB schedule for the current Frame overruns and
0 R/W R/W 0x0 after the update of HccaFrameNumber. A scheduling overrun will also
cause the SchedulingOverrunCount of HcCommandStatus to be
incremented.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 672
Interfaces
Read/Write
Bit Default/Hex Description
HCD HC
EHCD[31:4]
The HcControlHeadED register contains the physical address of the first
31:4 R/W R 0x0 Endpoint Descriptor of the Control list. HC traverse the Control list starting
with the HcControlHeadED pointer. The content is loaded from HCCA
during the initialization of HC.
EHCD[3:0]
Because the general TD length is 16 bytes, the memory structure for the TD
3:0 R R 0x0
must be aligned to a 16-byte boundary. So the lower bits in the PCED,
through bit 0 to bit 3 must be zero in this field.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 675
Interfaces
BHED[3:0]
Because the general TD length is 16 bytes, the memory structure for the TD
3:0 R R 0x0
must be aligned to a 16-byte boundary. So the lower bits in the PCED,
through bit 0 to bit 3 must be zero in this field.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 676
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 677
Interfaces
Read/Write
Bit Default/Hex Description
HCD HC
31:16 / / / /
FrameNumber
This is incremented when HcFmRemaining is re-loaded. It will be rolled over
to 0x0 after 0x0ffff. When entering the USBOPERATIONAL state, this will be
15:0 R R/W 0x0 incremented automatically. The content will be written to HCCA after HC
has incremented the FrameNumber at each frame boundary and sent a
SOF but before HC reads the first ED in that Frame. After writing to HCCA,
HC will set the StartofFrame in HcInterruptStatus.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 678
Interfaces
Read/Write
Bit Default/Hex Description
HCD HC
PowerOnToPowerGoodTime[POTPGT]
This byte specifies the duration HCD has to wait before accessing a
31:24 R/W R 0x2
powered-on port of the Root Hub. It is implementation-specific. The unit of
time is 2 ms. The duration is calculated as POTPGT * 2ms.
23:13 / / / /
NoOverCurrentProtection
This bit describes how the overcurrent status for the Root Hub ports are
reported. When this bit is cleared, the OverCurrentProtectionMode field
12 R/W R 1 specifies global or per-port reporting.
0 Over-current status is reported collectively for all downstream
ports.
1 No overcurrent protection supported.
OverCurrentProtectionMode
This bit describes how the overcurrent status for the Root Hub ports are
reported. At reset, these fields should reflect the same mode as
PowerSwitchingMode. This field is valid only if the
11 R/W R 0
NoOverCurrentProtection field is cleared.
0 Over-current status is reported collectively for all downstream
ports.
1 Over-current status is reported on per-port basis.
Device Type
This bit specifies that the Root Hub is not a compound device. The Root
10 R R 0x0
Hub is not permitted to be a compound device. This field should always
read/write 0.
PowerSwitchingMode
This bit is used to specify how the power switching of the Root Hub ports is
controlled. It is implementation-specific. This field is only valid if the
NoPowerSwitching field is cleared.
0 All ports are powered at the same time.
1 Each port is powered individually. This mode allows port
9 R/W R 1
power to be controlled by either the global switch or per-port
switching. If the PortPowerControlMask bit is set, the port
responds only to port power commands
(Set/ClearPortPower). If the port mask is cleared, then the
port is controlled only by the global power switch
(Set/ClearGlobalPower).
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 679
Interfaces
NoPowerSwithcing
These bits are used to specify whether power switching is supported or
ports are always powered. It is implementation-specific. When this bit is
8 R/W R 0
cleared, the PowerSwitchingMode specifies global or per-port switching.
0 Ports are power switched.
1 Ports are always powered on when the HC is powered on.
NumberDownstreamPorts
These bits specify the number of downstream ports supported by the Root
7:0 R R 0x01
Hub. It is implementation-specific. The minimum number of ports is 1. The
maximum number of ports supported.
Read/Write
Bit Default/Hex Description
HCD HC
(write)ClearRemoteWakeupEnable
31 W R 0x0
Write a ‘1’ clears DeviceRemoteWakeupEnable. Writing a ‘0’ has no effect.
30:18 / / / /
OverCurrentIndicatorChang
This bit is set by hardware when a change has occurred to the
17 R/W R 0x0
OverCurrentIndicator field of this register. The HCD clears this bit by
writing a ‘1’. Writing a ‘0’ has no effect.
(read)LocalPowerStartusChange
The Root Hub does not support the local power status features, thus, this
bit is always read as ‘0’.
(write)SetGlobalPower
16 R/W R 0x0
In global power mode (PowerSwitchingMode=0), This bit is written to ‘1’
to turn on power to all ports (clear PortPowerStatus). In per-port power
mode, it sets PortPowerStatus only on ports whose
PortPowerControlMask bit is not set. Writing a ‘0’ has no effect.
(read)DeviceRemoteWakeupEnable
This bit enables a ConnectStatusChange bit as a resume event, causing a
USBSUSPEND to USBRESUME state transition and setting the
ResumeDetected interrupt.
15 R/W R 0x0 0 ConnectStatusChange is not a remote wakeup event.
1 ConnectStatusChange is a remote wakeup event.
(write)SetRemoteWakeupEnable
Writing a ‘1’ sets DeviceRemoveWakeupEnable. Writing a ‘0’ has no effect.
14:2 / / / /
OverCurrentIndicator
This bit reports overcurrent conditions when the global reporting is
1 R R/W 0x0 implemented. When set, an overcurrent condition exists. When cleared, all
power operations are normal.
If per-port overcurrent protection is implemented this bit is always ‘0’
(Read)LocalPowerStatus
When read, this bit returns the LocalPowerStatus of the Root Hub. The
Root Hub does not support the local power status feature; thus, this bit is
always read as ‘0’.
(Write)ClearGlobalPower
0 R/W R 0x0
When write, this bit is operated as the ClearGlobalPower. In global power
mode (PowerSwitchingMode=0), This bit is written to ‘1’ to turn off power
to all ports (clear PortPowerStatus). In per-port power mode, it clears
PortPowerStatus only on ports whose PortPowerControlMask bit is not
set. Writing a ‘0’ has no effect.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 681
Interfaces
Note: If the DeviceRemovable[NDP] bit is set, this bit is set only after a
Root Hub reset to inform the system that the device is attached.
15:10 / / / /
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 682
Interfaces
(read)LowSpeedDeviceAttached
This bit indicates the speed of the device attached to this port. When set, a
Low Speed device is attached to this port. When clear, a Full Speed device
is attached to this port. This field is valid only when the
CurrentConnectStatus is set.
9 R/W R/W 0x0 0 full speed device attached
1 low speed device attached
(write)ClearPortPower
The HCD clears the PortPowerStatus bit by writing a ‘1’ to this bit. Writing
a ‘0’ has no effect.
(read)PortPowerStatus
This bit reflects the port’s power status, regardless of the type of power
switching implemented. This bit is cleared if an overcurrent condition is
detected. HCD sets this bit by writing SetPortPower or SetGlobalPower.
HCD clears this bit by writing ClearPortPower or ClearGlobalPower. Which
power control switches are enabled is determined by
PowerSwitchingMode and
PortPortControlMask[NumberDownstreamPort]. In global switching
mode(PowerSwitchingMode=0), only Set/ClearGlobalPower controls
this bit. In per-port power switching (PowerSwitchingMode=1), if the
PortPowerControlMask[NDP] bit for the port is set, only
8 R/W R/W 0x1 Set/ClearPortPower commands are enabled. If the mask is not set, only
Set/ClearGlobalPower commands are enabled. When port power is
disabled, CurrentConnectStatus, PortEnableStatus, PortSuspendStatus,
and PortResetStatus should be reset.
0 port power is off
1 port power is on
(write)SetPortPower
The HCD writes a ‘1’ to set the PortPowerStatus bit. Writing a ‘0’ has no
effect.
Note: This bit is always reads ‘1b’ if power switching is not supported.
7:5 / / / /
(read)PortResetStatus
When this bit is set by a write to SetPortReset, port reset signaling is
asserted. When reset is completed, this bit is cleared when
PortResetStatusChange is set. This bit cannot be set if
CurrentConnectStatus is cleared.
4 R/W R/W 0x0
0 port reset signal is not active
1 port reset signal is active
(write)SetPortReset
The HCD sets the port reset signaling by writing a ‘1’ to this bit. Writing a
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 683
Interfaces
‘0’ has no effect. If CurrentConnectStatus is cleared, this write does not set
PortResetStatus, but instead sets ConnectStatusChange. This informs the
driver that it attempted to reset a disconnected port.
(read)PortOverCurrentIndicator
This bit is only valid when the Root Hub is configured in such a way that
overcurrent conditions are reported on a per-port basis. If per-port
overcurrent reporting is not supported, this bit is set to 0. If cleared, all
power operations are normal for this port. If set, an overcurrent condition
exists on this port. This bit always reflects the overcurrent input signal.
3 R/W R/W 0x0
0 no overcurrent condition.
1 overcurrent condition detected.
(write)ClearSuspendStatus
The HCD writes a ‘1’ to initiate a resume. Writing a ‘0’ has no effect. A
resume is initiated only if PortSuspendStatus is set.
(read)PortSuspendStatus
This bit indicates the port is suspended or in the resume sequence. It is set
by a SetSuspendState write and cleared when
PortSuspendStatusChange is set at the end of the resume interval. This bit
cannot be set if CurrentConnectStatus is cleared. This bit is also cleared
when PortResetStatusChange is set at the end of the port reset or when
the HC is placed in the USBRESUME state. If an upstream resume is in
progress, it should propagate to the HC.
2 R/W R/W 0x0
0 port is not suspended
1 port is suspended
(write)SetPortSuspend
The HCD sets the PortSuspendStatus bit by writing a ‘1’ to this bit. Writing
a ‘0’ has no effect. If CurrentConnectStatus is cleared, this write does not
set PortSuspendStatus; instead it sets ConnectStatusChange. This informs
the driver that it attempted to suspend a disconnected port.
(read)PortEnableStatus
This bit indicates whether the port is enabled or disabled. The Root Hub
may clear this bit when an overcurrent condition, disconnect event,
switched-off power, or operational bus error such as babble is detected.
This change also causes PortEnabledStatusChange to be set. HCD sets this
bit by writing SetPortEnable and clears it by writing ClearPortEnable. This
1 R/W R/W 0x0 bit cannot be set when CurrentConnectStatus is cleared. This bit is also set,
if not already, at the completion of a port reset when ResetStatusChange is
set or port suspend when
SuspendStatusChange is set.
0 port is disabled
1 port is enabled
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 684
Interfaces
(write)SetPortEnable
The HCD sets PortEnableStatus by writing a ‘1’. Writing a ‘0’ has no effect.
If CurrentConnectStatus is cleared, this write does not set
PortEnableStatus, but instead sets ConnectStatusChange. This informs the
driver that it attempted to enable a disconnected Port.
(read)CurrentConnectStatus
This bit reflects the current state of the downstream port.
0 No device connected
1 Device connected
0 R/W R/W 0x0 (write)ClearPortEnable
The HCD writes a ‘1’ to clear the PortEnableStatus bit. Writing ‘0’ has no
effect. The CurrentConnectStatus is not affected by any write.
Note: This bit is always read ‘1’ when the attached device is
nonremovalble(DviceRemoveable[NumberDownstreamPort]).
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 685
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 686
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 687
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 688
Interfaces
9.6.1. Overview
The Port Controller can be configured with multi-functional input/output pins. All these ports can be configured as
GPIO only if multiplexed functions are not used. The total 6 group external PIO interrupt sources are supported and
interrupt mode can be configured by software.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 689
Interfaces
When executing GPIO read state, the port controller reads the current level of pin into internal register bus. When not
executing GPIO read state, external pin and internal register bus is off-status, that is high-impedance.
The H616 includes 74 multi-functional input/output port pins. There are 6 ports as listed below.
The multiplex function pins are shown in Table 9-15 to Table 9-20.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 690
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 692
Interfaces
Port Controller supports 6 GPIOs, every GPIO can configure as Input, Output, Functional Peripheral, IO disable or
Interrupt function. The configuration instruction of every function is as follows.
Rpu
PAD
Rpd
GND
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 693
Interfaces
high-impedance, software configures the switch on Rpu and Rpd as off, and the multiplexing function of IO is set as IO
disable or input by software.
Pull-up, an uncertain signal is pulled high by a resistor, the resistor has current-limiting function. When pulling up, the
switch on Rpu is breakover by software configuration, IO is pulled up to VCC by Rpu.
Pull-down, an uncertain signal is pulled low by a resistor. When pulling down, the switch on Rpd is breakover by
software configuration, IO is pulled down to GND by Rpd.
The pull-up/down of each IO is weak pull-up/down, the pull-up/down resistor contains three kinds of resistance
values : 4.7 kΩ, 15 kΩ and 100 kΩ.
The setting of pull-down input, pull-up input, high-impledance input is decided by external circuit.
Each IO can be set as different buffer strength. The IO buffer diagram is as follows.
VCC
P0 P1 P2 P3
ro ro ro ro
ro ro ro ro
n0 n1 n2 n3
GND
When output high level, the n0,n1,n2,n3 of NMOS are off, the p0,p1,p2,p3 of PMOS are on. When buffer strength is
set to 0(buffer strength is weakest), only p0 is on, the output impedance is maximum, the impedance value is r0
(on-resistance). When buffer strength is set to 1, only p0 and p1 are on, the output impedance is equivalent to two r0
in parallel, the impedance value is r0/2. When buffer strength is 2, only p0,p1 and p2 are on, the output impedance is
equivalent to three r0 in parallel, the impedance value is r0/3. When buffer strength is 3, p0,p1,p2 and p3 are on, the
output impedance is equivalent to four r0 in parallel, the impedance value is r0/4.
When output low level, the p0,p1,p2,p3 of PMOS is off, the n0,n1,n2,n3 of NMOS is on. When buffer strength is set to
0(buffer strength is weakest), only n0 is on, the output impedance is maximum, the impedance value is r0. When
buffer strength is set to 1, only n0 and n1 are on, the output impedance is equivalent to two r0 in parallel, the
impedance value is r0/2. When buffer strength is 2, only n0,n1 and n2 are on, the output impedance is equivalent to
three r0 in parallel, the impedance value is r0/3. When buffer strength is 3, n0,n1,n2 and n3 are on, the output
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 694
Interfaces
When GPIO is set to input or interrupt function, between output driver circuit and port is unconnected, driver
configuration is invalid.
NOTE
The typical value of r0 has 180Ω, 120Ω, 100Ω and 50Ω.
9.6.3.5. Interrupt
Each group IO has independent interrupt number. IO within group uses one interrupt number, when one IO generates
interrupt, Port Controller sent interrupt request to GIC. External Interrupt Status Register is used to query which IO
generates interrupt.
Positive Edge: When low level changes to high level, the interrupt will generate. No matter how long high level
keeps, the interrupt generates only once.
Negative Edge: When high level changes to low level, the interrupt will generate. No matter how long low level
keeps, the interrupt generates only once.
High Level : Just keep high level and the interrupt will always generate.
Low Level : Just keep low level and the interrupt will always generate.
Double Edge : Positive and negative edge.
External Interrupt Configure Register is used to configure trigger type.
GPIO interrupt supports hardware debounce function by setting External Interrupt Debounce Register. Sample trigger
signal using lower sample clock, to reach the debounce effect because of the dither frequency of signal is higher than
sample frequency.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 695
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 696
Interfaces
010:NAND_RB0 011:SDC2_CMD
100:Reserved 101:BOOT_SEL4
110:PC_EINT6 111:IO Disable
23 / / /
PC5_SELECT
000:Input 001:Output
22:20 R/W 0x5 010:NAND_RE 011:SDC2_CLK
100:Reserved 100:BOOT_SEL3
110:PC_EINT5 111:IO Disable
19 / / /
PC4_SELECT
000:Input 001:Output
18:16 R/W 0x5 010:NAND_CE0 011:Reserved
100:SPI_MISO 101:BOOT_SEL2
110:PC_EINT4 111:IO Disable
15 / / /
PC3_SELECT
000:Input 001:Output
14:12 R/W 0x5 010:NAND_CE1 011:Reserved
100:SPI0_CS0 101:BOOT_SEL1
110:PC_EINT3 111:IO Disable
11 / / /
PC2_SELECT
000:Input 001:Output
10:8 R/W 0x7 010:NAND_CLE 011:Reserved
100:SPI0_MOSI 101:Reserved
110:PC_EINT2 111:IO Disable
7 / / /
PC1_SELECT
000:Input 001:Output
6:4 R/W 0x7 010:NAND_ALE 011:SDC2_RST
100:Reserved 101:Reserved
110:PC_EINT1 111:IO Disable
3 / / /
PC0_SELECT
000:Input 001:Output
2:0 R/W 0x7 010:NAND_WE 011:SDC2_DS
100:SPI0_CLK 101:Reserved
110:PC_EINT0 111:IO Disable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 697
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 698
Interfaces
PC8_SELECT
000:Input 001:Output
2:0 R/W 0x7 010:NAND_DQ7 011:SDC2_D3
100:Reserved 101:Reserved
110:PC_EINT8 111:IO Disable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 699
Interfaces
PC13_DRV
PC13 Multi-Driving Select
27:26 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
PC12_DRV
PC12 Multi-Driving Select
25:24 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
PC11_DRV
PC11 Multi-Driving Select
23:22 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
PC10_DRV
PC10 Multi-Driving Select
21:20 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
PC9_DRV
PC9 Multi-Driving Select
19:18 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
PC8_DRV
PC8 Multi-Driving Select
17:16 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
PC7_DRV
PC7 Multi-Driving Select
15:14 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
PC6_DRV
PC6 Multi-Driving Select
13:12 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
PC5_DRV
PC5 Multi-Driving Select
11:10 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
PC4_DRV
PC4 Multi-Driving Select
9:8 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
PC3_DRV
PC3 Multi-Driving Select
7:6 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
5:4 R/W 0x1 PC2_DRV
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 700
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 701
Interfaces
PC11_PULL
PC11 Pull-up/down Select
23:22 R/W 0x0
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PC10_PULL
PC10 Pull-up/down Select
21:20 R/W 0x0
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PC9_PULL
PC9 Pull-up/down Select
19:18 R/W 0x0
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PC8_PULL
PC8 Pull-up/down Select
17:16 R/W 0x0
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PC7_PULL
PC7 Pull-up/down Select
15:14 R/W 0x1
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PC6_PULL
PC6 Pull-up/down Select
13:12 R/W 0x1
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PC5_PULL
PC5 Pull-up/down Select
11:10 R/W 0x1
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PC4_PULL
PC4 Pull-up/down Select
9:8 R/W 0x1
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PC3_PULL
PC3 Pull-up/down Select
7:6 R/W 0x1
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PC2_PULL
PC2 Pull-up/down Select
5:4 R/W 0x0
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PC1_PULL
PC Pull-up/down Select
3:2 R/W 0x0
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
1:0 R/W 0x0 PC0_PULL
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 702
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 703
Interfaces
11 / / /
PF2_SELECT
000:Input 001:Output
10:8 R/W 0x7 010:SDC0_CLK 011:UART0_TX
100:Reserved 101:Reserved
110:PF_EINT2 111:IO Disable
7 / / /
PF1_SELECT
000:Input 001:Output
6:4 R/W 0x7 010:SDC0_D0 011:JTAG_DI
100:Reserved 101:Reserved
110:PF_EINT1 111:IO Disable
3 / / /
PF0_SELECT
000:Input 001:Output
2:0 R/W 0x7 010:SDC0_D1 011:JTAG_MS
100:Reserved 101:Reserved
110:PF_EINT0 111:IO Disable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 704
Interfaces
PF2_PULL
PF2 Pull-up/down Select
5:4 R/W 0x0
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PF1_PULL
PF1 Pull-up/down Select
3:2 R/W 0x0
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PF0_PULL
PF0 Pull-up/down Select
1:0 R/W 0x0
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 706
Interfaces
000:Input 001:Output
010:SDC1_D1 011:Reserved
100:Reserved 101:Reserved
110:PG_EINT3 111:IO Disable
11 / / /
PG2_SELECT
000:Input 001:Output
10:8 R/W 0x7 010:SDC1_D0 011:Reserved
100:Reserved 101:Reserved
110:PG_EINT2 111:IO Disable
7 / / /
PG1_SELECT
000:Input 001:Output
6:4 R/W 0x7 010:SDC1_CMD 011:Reserved
100:Reserved 101:Reserved
110:PG_EINT1 111:IO Disable
3 / / /
PG0_SELECT
000:Input 001:Output
2:0 R/W 0x7 010:SDC1_CLK 011:Reserved
100:Reserved 101:Reserved
110:PG_EINT0 111:IO Disable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 707
Interfaces
100:BIST_RESULT2 101:Reserved
110:PG_EINT13 111:IO Disable
19 / / /
PG12_SELECT
000:Input 001:Output
18:16 R/W 0x7 010:H_I2S2_LRCK 011:Reserved
100:BIST_RESULT1 101:Reserved
110:PG_EINT12 111:IO Disable
15 / / /
PG11_SELECT
000:Input 001:Output
14:12 R/W 0x7 010:H_I2S2_BCLK 011:Reserved
100:BIST_RESULT0 101:Reserved
110:PG_EINT11 111:IO Disable
11 / / /
PG10_SELECT
000:Input 001:Output
10:8 R/W 0x7 010:H_I2S2_MCLK 011:X32KFOUT
100:Reserved 101:Reserved
110:PG_EINT10 111:IO Disable
7 / / /
PG9_SELECT
000:Input 001:Output
6:4 R/W 0x7 010:UART1_CTS 011:Reserved
100:JTAG_DI 101:Reserved
110:PG_EINT9 111:IO Disable
3 / / /
PG8_SELECT
000:Input 001:Output
2:0 R/W 0x7 010:UART1_RTS 011:PLL_LOCK_DBG
100:JTAG_DO 101:Reserved
110:PG_EINT8 111:IO Disable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 708
Interfaces
11 / / /
PG18_SELECT
000:Input 001:Output
10:8 R/W 0x7 010:UART2_CTS 011:Reserved
100:Reserved 101:TWI3_SDA
110:PG_EINT18 111:IO Disable
7 / / /
PG17_SELECT
000:Input 001:Output
6:4 R/W 0x7 010:UART2_RTS 011:Reserved
100:Reserved 101:TWI3_SCK
110:PG_EINT17 111:IO Disable
3 / / /
PG16_SELECT
000:Input 001:Output
2:0 R/W 0x7 010:UART2_RX 011:Reserved
100:Reserved 101:TWI4_SDA
110:PG_EINT16 111:IO Disable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 709
Interfaces
PG2_DRV
PG2 Multi-Driving Select
5:4 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
PG1_DRV
PG1 Multi-Driving Select
3:2 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
PG0_DRV
PG0 Multi-Driving Select
1:0 R/W 0x1
00: Level 0--180Ω 01: Level 1--120Ω
10: Level 2--100Ω 11: Level 3--50Ω
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 711
Interfaces
PG3_PULL
PG3 Pull-up/down Select
7:6 R/W 0x1
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PG2_PULL
PG2 Pull-up/down Select
5:4 R/W 0x1
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PG1_PULL
PG1 Pull-up/down Select
3:2 R/W 0x1
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
PG0_PULL
PG0 Pull-up/down Select
1:0 R/W 0x0
00: Pull-up/down disable 01: Pull-up
10: Pull-down 11: Reserved
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 713
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 714
Interfaces
PH0_SELECT
000:Input 001:Output
2:0 R/W 0x7 010:UART0_TX 011:Reserved
100:PWM3 100:TWI1_SCK
110:PH_EINT0 111:IO Disable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 715
Interfaces
PH0_DRV
PH0 Multi-Driving Select
1:0 R/W 0x1
00: Level 0 01: Level 1
10: Level 2 11: Level 3
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 718
Interfaces
100:H_I2S0_DOUT0 101:H_I2S0_DIN1
110:PI_EINT3 111:IO Disable
11 / / /
PI2_SELECT
000:Input 001:Output
10:8 R/W 0x7 010:RGMII_RXD1/RMII_RXD1 011:DMIC_DATA1
100:H_I2S0_LRCK 101:HDMI_CEC
110:PI_EINT2 111:IO Disable
7 / / /
PI1_SELECT
000:Input 001:Output
6:4 R/W 0x7 010:RGMII_RXD2/RMII_NULL 011:DMIC_DATA0
100:H_I2S0_BCLK 101:HDMI_SDA
110:PI_EINT1 111:IO Disable
3 / / /
PI0_SELECT
000:Input 001:Output
2:0 R/W 0x7 010:RGMII_RXD3/RMII_NULL 011:DMIC_CLK
100:H_I2S0_MCLK 101:HDMI_SCL
110:PI_EINT0 111:IO Disable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 719
Interfaces
19 / / /
PI12_SELECT
000:Input 001:Output
18:16 R/W 0x7 010:RGMII_TXCTL/RMII_TXEN 011:UART3_CTS
100:TS0_D3 101:PWM2
110:PI_EINT12 111:IO Disable
15 / / /
PI11_SELECT
000:Input 001:Output
14:12 R/W 0x7 010:RGMII_TXCK/RMII_TXCK 011:UART3_RTS
100:TS0_D2 101:PWM1
110:PI_EINT11 111:IO Disable
11 / / /
PI10_SELECT
000:Input 001:Output
10:8 R/W 0x7 010:RGMII_TXD0/RMII_TXD0 011:UART3_RX
100:TS0_D1 101:TWI2_SDA
110:PI_EINT10 111:IO Disable
7 / / /
PI9_SELECT
000:Input 001:Output
6:4 R/W 0x7 010:RGMII_TXD1/RMII_TXD1 011:UART3_TX
100:TS0_D0 101:TWI2_SCK
110:PI_EINT9 111:IO Disable
3 / / /
PI8_SELECT
000:Input 001:Output
2:0 R/W 0x7 010:RGMII_TXD2/RMII_NULL 011:UART2_RTS
100:TS0_DVLD 101:TWI1_SDA
110:PI_EINT8 111:IO Disable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 720
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 721
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 722
Interfaces
PI16_DRV
PI16 Multi-Driving Select
1:0 R/W 0x1
00: Level 0--180Ω 01: Level 1--120Ω
10: Level 2--100Ω 11: Level 3--50Ω
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 724
Interfaces
EINT13_CFG
External INT13 Mode
0x0: Positive Edge
0x1: Negative Edge
23:20 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT12_CFG
External INT12 Mode
0x0: Positive Edge
0x1: Negative Edge
19:16 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT11_CFG
External INT11 Mode
0x0: Positive Edge
0x1: Negative Edge
15:12 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT10_CFG
External INT10 Mode
0x0: Positive Edge
0x1: Negative Edge
11:8 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT9_CFG
External INT9 Mode
0x0: Positive Edge
0x1: Negative Edge
7:4 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT8_CFG
External INT8 Mode
3:0 R/W 0x0 0x0: Positive Edge
0x1: Negative Edge
0x2: High Level
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 727
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 728
Interfaces
1: Enable
EINT11_CTL
External INT11 Enable
11 R/W 0x0
0: Disable
1: Enable
EINT10_CTL
External INT10 Enable
10 R/W 0x0
0: Disable
1: Enable
EINT9_CTL
External INT9 Enable
9 R/W 0x0
0: Disable
1: Enable
EINT8_CTL
External INT8 Enable
8 R/W 0x0
0: Disable
1: Enable
EINT7_CTL
External INT7 Enable
7 R/W 0x0
0: Disable
1: Enable
EINT6_CTL
External INT6 Enable
6 R/W 0x0
0: Disable
1: Enable
EINT5_CTL
External INT5 Enable
5 R/W 0x0
0: Disable
1: Enable
EINT4_CTL
External INT4 Enable
4 R/W 0x0
0: Disable
1: Enable
EINT3_CTL
External INT3 Enable
3 R/W 0x0
0: Disable
1: Enable
EINT2_CTL
External INT2 Enable
2 R/W 0x0
0: Disable
1: Enable
EINT1_CTL
External INT1 Enable
1 R/W 0x0
0: Disable
1: Enable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 729
Interfaces
EINT0_CTL
External INT0 Enable
0 R/W 0x0
0: Disable
1: Enable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 732
Interfaces
EINT4_CFG
External INT4 Mode
0x0: Positive Edge
0x1: Negative Edge
19:16 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT3_CFG
External INT3 Mode
0x0: Positive Edge
0x1: Negative Edge
15:12 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT2_CFG
External INT2 Mode
0x0: Positive Edge
0x1: Negative Edge
11:8 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT1_CFG
External INT1 Mode
0x0: Positive Edge
0x1: Negative Edge
7:4 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT0_CFG
External INT0 Mode
0x0: Positive Edge
0x1: Negative Edge
3:0 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
1: IRQ pending
Write ‘1’ to clear
EINT4_STATUS
External INT4 Pending Bit
4 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT3_STATUS
External INT3 Pending Bit
3 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT2_STATUS
External INT2 Pending Bit
2 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT1_STATUS
External INT1 Pending Bit
1 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT0_STATUS
External INT0 Pending Bit
0 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 735
Interfaces
EINT13_CFG
External INT13 Mode
0x0: Positive Edge
0x1: Negative Edge
23:20 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT12_CFG
External INT12 Mode
0x0: Positive Edge
0x1: Negative Edge
19:16 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT11_CFG
External INT11 Mode
0x0: Positive Edge
0x1: Negative Edge
15:12 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT10_CFG
External INT10 Mode
0x0: Positive Edge
0x1: Negative Edge
11:8 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT9_CFG
External INT9 Mode
0x0: Positive Edge
0x1: Negative Edge
7:4 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
EINT8_CFG
External INT8 Mode
3:0 R/W 0x0 0x0: Positive Edge
0x1: Negative Edge
0x2: High Level
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 738
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 739
Interfaces
EINT9_CTL
External INT9 Enable
9 R/W 0x0
0: Disable
1: Enable
EINT8_CTL
External INT8 Enable
8 R/W 0x0
0: Disable
1: Enable
EINT7_CTL
External INT7 Enable
7 R/W 0x0
0: Disable
1: Enable
EINT6_CTL
External INT6 Enable
6 R/W 0x0
0: Disable
1: Enable
EINT5_CTL
External INT5 Enable
5 R/W 0x0
0: Disable
1: Enable
EINT4_CTL
External INT4 Enable
4 R/W 0x0
0: Disable
1: Enable
EINT3_CTL
External INT3 Enable
3 R/W 0x0
0: Disable
1: Enable
EINT2_CTL
External INT2 Enable
2 R/W 0x0
0: Disable
1: Enable
EINT1_CTL
External INT1 Enable
1 R/W 0x0
0: Disable
1: Enable
EINT0_CTL
External INT0 Enable
0 R/W 0x0
0: Disable
1: Enable
1: IRQ pending
Write ‘1’ to clear
EINT10_STATUS
External INT10 Pending Bit
10 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT9_STATUS
External INT9 Pending Bit
9 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT8_STATUS
External INT8 Pending Bit
8 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT7_STATUS
External INT7 Pending Bit
7 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT6_STATUS
External INT6 Pending Bit
6 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT5_STATUS
External INT5 Pending Bit
5 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT4_STATUS
External INT4 Pending Bit
4 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT3_STATUS
External INT3 Pending Bit
3 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT2_STATUS
2 R/W 0x0 External INT2 Pending Bit
0: No IRQ pending
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 743
Interfaces
1: IRQ pending
Write ‘1’ to clear
EINT1_STATUS
External INT1 Pending Bit
1 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT0_STATUS
External INT0 Pending Bit
0 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 744
Interfaces
EINT0_CFG
External INT0 Mode
0x0: Positive Edge
0x1: Negative Edge
3:0 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
31:11 / / /
EINT10_CTL
External INT10 Enable
10 R/W 0x0
0: Disable
1: Enable
EINT9_CTL
External INT9 Enable
9 R/W 0x0
0: Disable
1: Enable
EINT8_CTL
External INT8 Enable
8 R/W 0x0
0: Disable
1: Enable
EINT7_CTL
External INT7 Enable
7 R/W 0x0
0: Disable
1: Enable
EINT6_CTL
External INT6 Enable
6 R/W 0x0
0: Disable
1: Enable
EINT5_CTL
External INT5 Enable
5 R/W 0x0
0: Disable
1: Enable
EINT4_CTL
External INT4 Enable
4 R/W 0x0
0: Disable
1: Enable
EINT3_CTL
External INT3 Enable
3 R/W 0x0
0: Disable
1: Enable
EINT2_CTL
External INT2 Enable
2 R/W 0x0
0: Disable
1: Enable
EINT1_CTL
External INT1 Enable
1 R/W 0x0
0: Disable
1: Enable
EINT0_CTL
External INT0 Enable
0 R/W 0x0
0: Disable
1: Enable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 747
Interfaces
1: IRQ pending
Write ‘1’ to clear
EINT2_STATUS
External INT2 Pending Bit
2 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT1_STATUS
External INT1 Pending Bit
1 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT0_STATUS
External INT0 Pending Bit
0 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 749
Interfaces
EINT16_CFG
External INT16 Mode
0x0: Positive Edge
0x1: Negative Edge
3:0 R/W 0x0
0x2: High Level
0x3: Low Level
0x4: Double Edge (Positive/ Negative)
Others: Reserved
0: Disable
1: Enable
EINT8_CTL
External INT8 Enable
8 R/W 0x0
0: Disable
1: Enable
EINT7_CTL
External INT7 Enable
7 R/W 0x0
0: Disable
1: Enable
EINT6_CTL
External INT6 Enable
6 R/W 0x0
0: Disable
1: Enable
EINT5_CTL
External INT5 Enable
5 R/W 0x0
0: Disable
1: Enable
EINT4_CTL
External INT4 Enable
4 R/W 0x0
0: Disable
1: Enable
EINT3_CTL
External INT3 Enable
3 R/W 0x0
0: Disable
1: Enable
EINT2_CTL
External INT2 Enable
2 R/W 0x0
0: Disable
1: Enable
EINT1_CTL
External INT1 Enable
1 R/W 0x0
0: Disable
1: Enable
EINT0_CTL
External INT0 Enable
0 R/W 0x0
0: Disable
1: Enable
EINT16_STATUS
External INT16 Pending Bit
16 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT15_STATUS
External INT15 Pending Bit
15 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT14_STATUS
External INT14 Pending Bit
14 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT13_STATUS
External INT13 Pending Bit
13 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT12_STATUS
External INT12 Pending Bit
12 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT11_STATUS
External INT11 Pending Bit
11 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT10_STATUS
External INT10 Pending Bit
10 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT9_STATUS
External INT9 Pending Bit
9 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT8_STATUS
External INT8 Pending Bit
8 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 755
Interfaces
EINT7_STATUS
External INT7 Pending Bit
7 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT6_STATUS
External INT6 Pending Bit
6 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT5_STATUS
External INT5 Pending Bit
5 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT4_STATUS
External INT4 Pending Bit
4 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT3_STATUS
External INT3 Pending Bit
3 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT2_STATUS
External INT2 Pending Bit
2 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT1_STATUS
External INT1 Pending Bit
1 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
EINT0_STATUS
External INT0 Pending Bit
0 R/W 0x0 0: No IRQ pending
1: IRQ pending
Write ‘1’ to clear
9.6.5.61. 0x0340 PIO Group Withstand Voltage Mode Select Register (Default Value: 0x0000_0000)
NOTE
When the power domain of GPIO is larger than 1.8 V, the withstand voltage is set to 3.3 V mode, the corresponding
value in 0x0340 register is set to 0.
When the power domain of GPIO is 1.8 V, the withstand voltage is set to 1.8 V mode, the corresponding value in
0x0340 register is set to 1.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 757
Interfaces
9.6.5.62. 0x0344 PIO Group Withstand Voltage Mode Select Control Register (Default Value: 0x0000_0000)
NOTE
For 1.8 V and 3.3 V power, the withstand function is enabled by default, the corresponding bit in 0x0344 register is
set to 0.
For 2.5 V power, the withstand function is disabled, the corresponding bit in 0x0344 register is set to 1, and the
withstand mode in 0x0340 register needs be set to 3.3 V.
4 / /
3 / /
2 R PC_Port Power Value
1 / /
0 / /
NOTE
When the reading value of the 0x0348 register is 0, it indicates that IO power voltage is greater than 2.5 V.
When the reading value of the 0x0348 register is 1, it indicates that IO power voltage is less than 2.0 V.
9.6.5.64. 0x0350 PIO Group Power Voltage Select Control Register (Default Value: 0x0000_0001)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 759
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 760
Interfaces
9.7. LRADC
9.7.1. Overview
The Low Rate ADC(LRADC) is 6-bit resolution for Key application. The LRADC can work up to maximum conversion rate
of 2 kHz.
Digital
LRADC ADC Logic Reg
Process
Vref IRQ
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 761
Interfaces
(3).Single Mode
ADC gathers 8 samples, the average of the 8 samples is updated in data register, and the data interrupt sign is enabled,
since then ADC stops sample.
9.7.3.4. Interrupt
Each LRADC channel has five interrupt sources and five interrupt enable controls.
DATA_IRQ_EN
DATA_IRQ
KEYDOWN_IRQ_EN
KEYDOWN_IRQ
KEYUP_IRQ_EN LRADC_IRQ
KEYUP_IRQ
HOLDKEY_IRQ_EN
HOLDKEY_IRQ
ALREADYHOLDKEY_IRQ_EN
ALREADYHOLDKEY_IRQ
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 762
Interfaces
When input voltage is between LEVELA(1.35V) and LEVELB(control by the bit[5:4] of LRADC_CTRL), IRQ1 can be
generated. When input voltage is lower than LEVELB, IRQ2 can be generated.
If the controller receives IRQ1, and does not receive IRQ2 at some time, then the controller will generate Hold KEY
Interrupt, otherwise DATA_IRQ Interrupt.
Hold KEY usually is used for self-locking key. When self-locking key holds locking status, the controller receives IRQ2,
then the controller will generate Already Hold Key Interrupt.
Start
Enable LRADC
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 763
Interfaces
0: Disable
1: Enable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 765
Interfaces
ADC0_ALRDY_HOLD_PENDING
ADC0 Already Hold Pending Bit
When hold key is pulled down and the general key is pulled down, and the
corresponding interrupt is enabled.
3 R/W1C 0x0
0: No IRQ
1: IRQ Pending
Writing 1 to the bit will clear it and its corresponding interrupt if the
interrupt is enabled.
ADC0_HOLDKEY_PENDING
ADC0 Hold Key Pending Bit
When hold key is pulled down, and the corresponding interrupt is enabled,
the status bit is set and the interrupt line is set.
2 R/W1C 0x0
0: NO IRQ
1: IRQ Pending
Writing 1 to the bit will clear it and its corresponding interrupt if the
interrupt is enabled.
ADC0_KEYDOWN_PENDING
ADC0 Key Down IRQ Pending Bit
When general key is pulled down, and the corresponding interrupt is
enabled, the status bit is set and the interrupt line is set.
1 R/W1C 0x0
0: No IRQ
1: IRQ Pending
Writing 1 to the bit will clear it and its corresponding interrupt if the
interrupt is enabled.
ADC0_DATA_PENDING
ADC0 Data IRQ Pending Bit
0: No IRQ
0 R/W1C 0x0
1: IRQ Pending
Writing 1 to the bit will clear it and its corresponding interrupt if the
interrupt is enabled.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 766
Interfaces
9.8.1. Overview
The CIR (Consumer Infrared) receiver is a capturer of the pulse from IR Receiver module and uses Run-Length Code
(RLC) to encode the pulse. The CIR receiver samples the input signal on the programmable frequency and records
these samples into RX FIFO when one CIR signal is found on the air. The CIR receiver uses Run-Length Code (RLC) to
encode pulse width. The encoded data is buffered in a 64 levels and 8-bit width RX FIFO; the MSB bit is used to record
the polarity of the receiving CIR signal. The high level is represented as ‘1’ and the low level is represented as ‘0’. The
rest 7 bits are used for the length of RLC. The maximum length is 128. If the duration of one level (high or low level) is
more than 128, another byte is used.
In the air, there is always some noise. One threshold can be set to filter the noise to reduce system loading and
improve the system stability.
IRQ
APB
CIR_RX CIR_RX
REG FIFO
LOGIC
SCLK
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 767
Interfaces
OSC24M
CLK_DIV_N CLK_DIV_M CIR_CLK SCS SAMPLE_CLK
(/1/2/4/8) (/1~16) (/1/64/128/512)
LOSC
VCC
CIR_RX
CIR_RX
IR Receiver
GND
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 768
Interfaces
ATHR ITHR
When CIR_RX signals satisfy ATHR (Active Threshold), CIR receiver can start to capture. In the process, the signal is
ignored if the pulse width of the signal is less than NTHR. When CIR_RX signals satisfy ITHR (Idle Threshold), the
capture process is stopped and the Receiver Packet End interrupt is generated, then Receiver Packet End Flag is
asserted.
In a capture process, every effective pulse is buffered to FIFO in bytes according to the form of Run-Length Code. The
MSB bit of a byte is polarity of pulse, and the rest 7 bits is pulse width by taking Sample Clock as basic unit. This is the
code form of RLC-Byte. When the level changes or the pulse width counting overflows, RLC-Byte is buffered to FIFO.
The CIR_RX module receives infrared signals transmitted by the infrared remote control, the software decodes the
signals.
Sample Clock
560us 560us
560us 1690us
Logical 0 Logical 1
ATHR(Active Threshold)
When CIR receiver is in Idle state, if electrical level of CIR_RX signal changes (positive jump or negative jump), and the
duration reaches this threshold, then CIR takes the starting of the signal as a lead code, turns into active state and
starts to capture CIR_RX signals.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 769
Interfaces
ATHR
LSB MSB
9ms 4.5ms Address
ITHR(Idle Threshold)
If electrical level of CIR_RX signals has no change, and the duration reaches this threshold, then CIR receiver enters
into Idle state and ends this capture.
ITHR
LSB MSB
Command
NTHR(Noise Threshold)
In capture process, the pulse is ignored if the pulse width is less than Noise Threshold.
LSB MSB
9ms 4.5ms Address
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 770
Interfaces
LSB MSB
9ms 4.5ms Address
When APAM = 11b, a negative pulse is a invalid leading code and will be ignored.
ATHR
LSB
9ms 4.5ms Address
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 771
Interfaces
Start
Configure
Pin Multiplex
Enable IRC
RX FIFO No
Available?
Yes
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 772
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 773
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 774
Interfaces
1: Enable
ROI_EN
Receiver FIFO Overrun Interrupt Enable
0 R/W 0x0
0: Disable
1: Enable
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 775
Interfaces
0 1 0 CIR_CLK /256
0 1 1 CIR_CLK /512
1 0 0 CIR_CLK
1 0 1 Reserved
1 1 0 Reserved
1 1 1 Reserved
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 777
Interfaces
9.9. PWM
9.9.1. Overview
The PWM controller has 4 PWM channels(PWM1,PWM2,PWM3,PWM4), and divides to 3 groups: PWM1, PWM23 pair,
PWM4. PWM23 pair consists of PWM2 and PWM3. PWM23 pair supports deadzone function.
PWM4
PWM1
PWM23
Module Generator
PWM23 Clock PWM23_CLK
Controller
PWM3 Logic PWM3 GPIO
I/O
Module
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 778
Interfaces
Using PWM23 pair as an example, the clock controller diagram is as follows. The clock diagram of PWM1 is the same
as PWM3 of the PWM23 pair. The clock diagram of PWM4 is the same as PWM2 of the PWM23 pair.
PWM23_CLK_DIV_M
PWM23_CLK_SRC_SEL /1 0000
/2 0001
OSC24M PWM23_CLK_GATING /4 0010
00 /8 0011
APB1 01 PWM23_CLK_SRC /16 0100 PWM23_CLK
/ /32 0101
/
10 /64
11 /128
0110
0111
/256 1000
BYPASS
PWM23_CLK_SRC_BYPASS_TO_PWM0
PWM2 PIN
PWM23_CLK_SRC_BYPASS_TO_PWM1
PWM3 PIN
PWM23 pair includes clock source select(PWM23_CLK_SRC_SEL), the first-level exponent divider
(PWM23_CLK_DIV_M), the second-level count divider(PRESCAL_K), clock source bypass(CLK_SRC_BYPASS) and clock
switch(PWM23_CLK_GATING).
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 779
Interfaces
The clock source bypass function is that clock source directly accesses PWM output, the PWM output waveform is the
waveform of clock controller output. The BYPASS gridlines in the above figure indicates clock source bypass function,
the details about implement, please see Figure 9-50.
Using PWM23 pair as an example, Figure 9-50 indicates the output logic module diagram of PWM23 pair. The logic
module diagram of PWM1 is the same as PWM3 of the PWM23 pair. The logic module diagram of PWM4 is the same
as PWM2 of the PWM23 pair.
PCR2 PCN T
PPR2 STR2 PCN TR2 PDZINTV23
PCR2.PWM_PRESCAL_K PWM23_CLK_SRC_BYPASS_TO_PWM2
PCIE2 PIS2
PWM2_EN
PWM23_CLK
PWM23_DZ_EN
PCR3 PCN T
PPR3 STR3 PCN TR3
PWM3_CLK_SRC PWM3_EN
PCR3.PWM_PRESCAL_K PWM3 PIN
1
1 0
8-bit PWM TIMER3 0
prescaler LOGIC
PWM23_CLK_SRC_BYPASS_TO_PWM3
PCIE3 PIS3
PWM3_EN
PWM Timer Logic module(PWM_TIMER_LOGIC) consists of one 16-bit up-counter and one 16-bit comparator. The
up-counter is used to control PWM cycle, the comparator is used to control duty-cycle.
The up-counter and the comparator support cache loading, after PWM output is enabled, the register values of the
up-counter and the comparator(PPR[PWM_ENTIRE_CYCLE] and PPR[PWM_ACTIVE_CYCLE]) can be changed anytime,
the changed value caches into the cache register. When the value of the up-counter reaches the value of
PPR[PWM_ENTIRE_CYCLE], the value of the cache register can be loaded to the up-counter and the comparator.
Cache-loading is good to avoid unstable PWM output waveform with burred feature when updating the values of the
up-counter and the comparator.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 780
Interfaces
The period, duty-cycle and active state of PWM output waveform are decided by the up-counter and comparator. The
rule of the comparator is as follows.
Low level
Figure 9- 51. The Period and Duty-cycle of PWM2 High Level Active State
Initial state
PWM2
Figure 9- 52. The Period and Duty-cycle of PWM2 Low Level Active State
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 781
Interfaces
PWM output supports pulse mode and cycle mode. PWM in pulse mode outputs one pulse waveform, but PWM in
cycle mode outputs continuous waveform. Figure 9-53 shows the PWM(take PWM2 as an example) output waveform
in pulse mode and cycle mode.
active state = low level PPR2.PWM_ENTIRE_CYCLE =10 PPR2.PWM_ENTIRE_CYCLE =10
Initial state PPR2.PWM_ACT_CYCLE = 3 PPR2.PWM_ACT_CYCLE = 1
Period mode
PCR2.PWM_MODE = 0
PWM2_EN = 1 active state
PPR2.PWM_ACT_CYCLE = 3 PPR2.PWM_ACT_CYCLE = 1
Initial state
Pulse mode
PCR2.PWM_MODE = 1
PWM2_EN = 1 active state active state active state
PCR2.PWM_PUL_START = 1 PCR2.PWM_PUL_START = 1 PCR2.PWM_PUL_START = 1
Period mode
PCR2.PWM_MODE = 0
PWM2_EN = 1
PPR2.PWM_ACT_CYCLE = 3
Initial state
Pulse mode
PCR2.PWM_MODE = 1
PWM2_EN = 1 active state active state
PCR2.PWM_PUL_START = 1 PCR2.PWM_PUL_START = 1
Figure 9- 53. PWM2 Output Waveform in Pulse Mode and Cycle Mode
When PCR2.PWM_MODE is 0, PWM2 outputs cycle waveform. The calculating formula of Tperiod and Tactive-state is as
follows.
Tperiod = (PWM23_CLK / PWM2_PRESCALE_K)-1 * PPR2. PWM_ENTIRE_CYCLE
Tactive state = (PWM23_CLK / PWM2_PRESCALE_K)-1 * PPR2.PWM_ACT_CYCLE
When PCR2.PWM_ACT_STA is 0, the active state of cycle waveform is low level.
When PCR2.PWM_ACT_STA is 1, the active state of cycle waveform is high level.
When PCR2.PWM_MODE is 1, PWM2 outputs pulse waveform. The calculating formula of pulse length is as follows.
Pulse length = PWM23_CLK / PWM2_PRESCALE_K * PPR2. PWM _ACT_CYCLE
When PCR2.PWM_ACT_STA is 0, the pulse level is low level, PWM0 channel outputs low pulse.
When PCR2.PWM_ACT_STA is 1, the pulse level is high level, PWM0 channel outputs high pulse.
After PWM2 channel enabled, PCR2. PWM_PUL_START needs be set to 1 when PWM2 needs output pulse waveform,
after completed output, PCR2. PWM_PUL_START can be cleared to 0 by hardware.
The up-counter and comparator for PWM2 channel support cache loading, after PWM2 channel is enabled, whether
cycle mode or pulse mode, PPR2 value is modified and cached to the buffer register of PPR2 , when the up-counter
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 782
Interfaces
value reaches PPR2. PWM_ENTIRE_CYCLE, the value in the buffer register will be loaded to up-counter and
comparator, namely the value of up-counter and comparator will be overloaded in the next cycle.
In cycle mode, the initial value of PPR2.PWM_ENTIRE_CYCLE is 10, the initial value of PPR2. PWM _ACT_CYCLE is 3. At
some time, the value of PPR2. PWM _ACT_CYCLE is modified to 1, during the current cycle, the modified PPR2 values
is cached to PPR2 buffer register, at the beginning of the next cycle, the value of PPR2 buffer register is loaded into
up-counter and comparator, then up-counter starts to work.
In pulse mode, the initial value of PPR2. PWM _ACT_CYCLE is 3, in the generation process of a single pulse , the value
of PPR2. PWM _ACT_CYCLE is modified to 1, during the current cycle, the modified PPR2 values is cached to PPR2
buffer register, when the value of up-counter reaches PPR2. PWM_ENTIRE_CYCLE, then the pulse waveform output
ends, the value of PPR2 buffer register is loaded into up-counter and comparator, at the next time, after PCR2.
PWM_PUL_START is set to 1, the modified value of PPR2 has taken effect.
NOTE
The time that loading PPR2 buffer register value into up-counter and comparator is very short, which can be ignored,
and does not affect the PWM output.
The PWM23 pair supports complementary pair output and PWM pair with dead-time. Figure 9-54 shows the
complementary pair output of PWM23 pair.
Initial state
PWM2
PWM3
The complementary pair output need satisfy the following three conditions:
The same frequency,the same duty-cycle
Opposite active state
Enable two channels of PWM pair at the same time
Every PWM pair has a programmable dead-time generator. When the dead-time function of PWM pair enabled,
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 783
Interfaces
PWM23 pair outputs a pair of PWM waveforms that insert dead-time, PWM23 pair output waveform is decided by
PWM2 timer logic module and DeadZone Generator23. Figure 9-55 shows the output waveform.
Before dead-time inserted
(complementary pair) 1 2 3
Initial state
PWM2
Initial state
PWM3 4 5 6
PWM2
Initial state
PWM3
For complementary pair of Dead Zone Generator 23, the principle of inserting dead-time is that to insert dead-time as
soon as the rising edge came. If high level time for mark② in the above figure is less than dead-time, then dead-time
will override the high level. The setting of dead-time need consider the period and duty-cycle of output waveform.
Dead-time formula is defined as follows:
Dead-time = (PWM23_CLK / PWM0_PRESCALE_K)-1 * PDZINTV23
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 784
Interfaces
CFLR2
CRLR2
CCR2
PPR2 PCNTR2
PCR2.PWM_PRESCAL_K CCR2.CAPINV
CAP2_EN
8-bit PWM TIMER2 0 PWM2 PIN
prescaler LOGIC 1
CFIE2 CCR2.CFLF
CFIS2
CRIE2 CCR2.CRLF
CRIS2
CAP2_EN
PWM23_CLK
CFLR3
CRLR3
CCR3
PPR3 PCNTR3
PCR3.PWM_PRESCAL_K CCR3.CAPINV
CAP3_EN
8-bit PWM TIMER3 0 PWM3 PIN
prescaler LOGIC 1
CFIE3 CCR3.CFLF
CFIS3
CRIE3 CCR3.CRLF
CRIS3
CAP3_EN
Besides the timer logic module of every PWM channel generates PWM output, it can be used to capture rising edge
and falling edge of the external clock. Using PWM2 channel as an example, PWM2 channel has one CFLR2 and one
CRLR2 for capturing up-counter value in falling edge and rising edge, respectively. You can calculate the period of
external clock by CFLR2 and CRLR2.
Thigh-level = (PWM23_CLK / PWM2_PRESCALE_K)-1 * CRLR2
Tlow-level = (PWM23_CLK / PWM2_PRESCALE_K)-1 * CFLR2
Tperiod = Thigh-level + Tlow-level
16-bit adding-counter 0 0 0 1 2 3 4 0 1 2 3 0 1 2 3 4 5
reload
external clock reload
CAP2_EN
No reload because of no CRIS2 or CFIS2 set
CRIE2
CFIE2
Set by HW
CRIS2 Clear by SW
Set by HW
CFIS2 Clear by SW
Set by HW Set by HW
CCR2.CRLF Clear by SW Clear by SW
Set by HW Set by HW
CCR2.CFLF Clear by SW Clear by SW
rising lock
CRLR2 4 falling lock
CFLR2 3
Figure 9- 57. PWM2 Channel Capture Timing
When the capture input function of PWM2 channel is enabled, the PCNTR of PWM2 channel starts to work.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 785
Interfaces
When the timer logic module of PWM2 captures one rising edge, the current value of up-counter is locked to CRLR2,
and CCR2.CRLF is set to 1. If CRIE2 is 1, then CRIS2 is set to 1, PWM2 channel sends interrupt request, and the
up-counter is loaded to 0 and continues to count. If CRIE2 is 0, the timer logic module of PWM2 captures rising edge,
CRIS2 can not be set to 1, the up-counter is not loaded to 0.
When the timer logic module of PWM2 captures one falling edge, the current value of PCNTR is locked to CFLR2, and
CCR2.CFLF is set to 1 . If CFIE2 is 1, then CFIS2 is set to 1, PWM2 channel sends interrupt request, and the up-counter
is loaded to 0 and continues to count. If CFIE2 is 0, the timer logic module of PWM2 captures falling edge, CFIS2 can
not be set to 1, the up-counter is not loaded to 0.
9.9.3.10. Interrupt
PWM supports interrupt generation when PWM channel is configured to PWM output or capture input .
For PWM output function, when one period of PWM waveform is output in cycle mode, the PIS of the corresponding
PWM channel is set to 1; when (PWM_PULNUM+1) periods of PWM waveform is output in pulse mode, the PIS of the
corresponding PWM channel is set to 1.
NOTE
The PIS bit is set to 1 automatically by hardware and cleared by software.
For capture input function, when the timer logic module of the capture channel2 captures rising edge, and CRIE2 is 1,
then CRIS2 is set to 1; when the timer logic module of the capture channel2 captures falling edge, and CFIE2 is 1, then
CFIS2 is set to 1.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 786
Interfaces
(1) PWM mode: Set PCR[PWM_MODE] to select cycle mode or pulse mode, if pulse mode, PWM_PUL_NUM needs
be configured.
(2) PWM valid level: Set PCR[PWM_ACT_STA] to select low level or high level.
(3) PWM duty-cycle: Configure PPR[PWM_ENTIRE_CYCLE] and PPR[PWM _ACT_CYCLE] after clock gating is opened.
(4) Enable PWM: Configure PER to select the corresponding PWM enable bit; when selecting pulse mode,
PCR[PWM_PUL_START] needs be enabled.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 787
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 788
Interfaces
PIS3
PWM Channel 3 Interrupt Status
When PWM channel 3 counter reaches Entire Cycle Value, this bit is set 1 by
hardware. Writing 1 to clear this bit.
3 R/W1C 0x0
Reads 0: PWM channel 3 interrupt is not pending.
Reads 1: PWM channel 3 interrupt is pending.
Writes 0: No effect.
Writes 1: Clear PWM channel 3 interrupt status.
PIS2
PWM Channel 2 Interrupt Status
When PWM channel 2 counter reaches Entire Cycle Value, this bit is set 1 by
hardware. Writing 1 to clear this bit.
2 R/W1C 0x0
Reads 0: PWM channel 2 interrupt is not pending.
Reads 1: PWM channel 2 interrupt is pending.
Writes 0: No effect.
Writes 1: Clear PWM channel 2 interrupt status.
PIS1
PWM Channel 1 Interrupt Status
When PWM channel 1 counter reaches Entire Cycle Value, this bit is set 1 by
hardware. Writing 1 to clear this bit.
1 R/W1C 0x0
Reads 0: PWM channel 1 interrupt is not pending.
Reads 1: PWM channel 1 interrupt is pending.
Writes 0: No effect.
Writes 1: Clear PWM channel 1 interrupt status.
0 / / /
9.9.6.3. 0x0010 PWM Capture IRQ Enable Register (Default Value: 0x0000_0000)
9.9.6.4. 0x0014 PWM Capture IRQ Status Register (Default Value: 0x0000_0000)
0100: /16
0101: /32
0110: /64
0111: /128
1000: /256
others: Reserved
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 793
Interfaces
9.9.6.8. 0x0030 PWM01 Dead Zone Control Register (Default Value: 0x0000_0000)
9.9.6.9. 0x0034 PWM23 Dead Zone Control Register (Default Value: 0x0000_0000)
9.9.6.10. 0x0038 PWM45 Dead Zone Control Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 795
Interfaces
1: PWM enable
PWM2_EN
When enable PWM, the 16-bit up-counter starts working and PWM
2 R/W 0x0 channel2 is permitted to output PWM waveform.
0: PWM disable
1: PWM enable
PWM1_EN
When enable PWM, the 16-bit up-counter starts working and PWM
1 R/W 0x0 channel1 is permitted to output PWM waveform.
0: PWM disable
1: PWM enable
0 / / /
0: 0 cycle
1: 1 cycle
…
N: N cycles
9.9.6.16. 0x006C + N*0x20 PWM Capture Control Register (Default Value: 0x0000_0000)
9.9.6.17. 0x0070 + N*0x20 PWM Capture Rise Lock Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 798
Interfaces
9.9.6.18. 0x0074 + N*0x20 PWM Capture Fall Lock Register (Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 799
Interfaces
9.10. TSC
9.10.1. Overview
The transport stream controller(TSC) is responsible for de-multiplexing and pre-processing the input multimedia data
defined in ISO/IEC 13818-1.
The transport stream controller receives multimedia data stream from SSI(Synchronous Serial Port)/SPI(Synchronous
Parallel Port) inputs and de-multiplexing the data into Packets by PID (Packet Identify). Before the Packet to be store to
memory by DMA, it can be pre-processed by the Transport Stream Descrambler.
The transport stream controller can be used for almost all multi-media application cases, for example: DVB Set top Box,
IPTV, Streaming-media Box, multi-media players and so on.
Features:
Supports SPI/SSI interface,interface timing parameters are configurable
32 channels PID filter for each TSF
Supports multiple transport stream packet (188, 192, 204) format
Hardware packet synchronous byte error detecting
Hardware PCR packet detecting
64x16-bits FIFO for TSG, 64x32-bits FIFO for TSF
Configurable SPI transport stream generator for streams in DRAM memory
Supports DVB-CSA V1.1, DVB-CSA V2.1 Descrambler
To AHB
TSC Register Control
TSG To Memory
Internal
SPI/SSI TSD0 DMA
PORT0
PORT0 MUX TSF0
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 800
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 801
Interfaces
9.10.4.1. Initialization
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 802
Interfaces
Request_bit = 1 N
RD_ptr-WR_ptr>=188?
N
Request_bit == 0?
NOTE
Request_bit is the bit8 of the TSF Control and Status Register.
9.10.6.3. 0x0020 TSC TSF Input Multiplex Control Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 805
Interfaces
Write ‘1’ to start TS Generator. TS Generator would fetch data from DRAM
and generate SPI stream to TS filter. This bit will clear to zero by hardware
after TS Generator is running.
9.10.6.7. 0x0008 TSG Interrupt Enable and Status Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 807
Interfaces
0: Disable
1: Enable
TSGErrSyncByteIE
TS Generator (TSG) Error Sync Byte Interrupt Enable
16 R/W 0x0
0: Disable
1: Enable
15:4 / / /
TSGEndSts
3 R/W1C 0x0 TS Generator (TSG) End Status
Write ‘1’ to clear.
TSGFFSts
2 R/W1C 0x0 TS Generator (TSG) Full Finish Status
Write ‘1’ to clear.
TSGHFSts
1 R/W1C 0x0 TS Generator (TSG) Half Finish Status
Write ‘1’ to clear.
TSGErrSyncByteSts
0 R/W1C 0x0 TS Generator (TSG) Error Sync Byte Status
Write ‘1’ to clear.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 808
Interfaces
NOTE
This value should be 4-word (16 bytes) align, and the lowest 4-bit of this
value should be zero.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 809
Interfaces
Writing ‘1’ by software will reset all status and state machine of TSF. And it is
cleared by hardware after finish reset.
Writing ‘0’ by software has no effect.
9.10.6.14. 0x0008 TSF Interrupt Enable and Status Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 810
Interfaces
TSFPPDIE
TS PCR Packet Detect Interrupt Enable
18 R/W 0x0
0: Disable
1: Enable
TSFCOIE
TS PID Filter (TSF) Channel Overlap Interrupt Global Enable
17 R/W 0x0
0: Disable
1: Enable
TSFCDIE
TS PID Filter (TSF) Channel DMA Interrupt Global Enable
16 R/W 0x0
0: Disable
1: Enable
15:4 / / /
TSFFOIS
3 R/W1C 0x0 TS PID Filter (TSF) Internal FIFO Overrun Status
Write ‘1’ to clear.
TSFPPDIS
2 R/W1C 0x0 TS PCR Packet Found Status
When it is ‘1’, one TS PCR Packet is found. Write ‘1’ to clear.
TSFCOIS
TS PID Filter (TSF) Channel Overlap Status
1 R 0x0
It is global status for 32 channel. It would clear to zero after all channels status
bits are cleared.
TSFCDIS
TS PID Filter (TSF) Channel DMA Status
0 R 0x0
It is global status for 32 channel. It would clear to zero after all channels status
bits are cleared.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 811
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 812
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 813
Interfaces
9.10.6.27. 0x0050 TSF Channel Buffer Base Address Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 814
Interfaces
9.10.6.29. 0x0058 TSF Channel Buffer Write Pointer Register(Default Value: 0x0000_0000)
9.10.6.30. 0x005C TSF Channel Buffer Read Pointer Register(Default Value: 0x0000_0000)
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 815
Interfaces
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 816
Security System
Contents
Chapter 10 Security System ......................................................................................................................................... 819
10.1. Crypto Engine ................................................................................................................................................... 819
10.1.1. Overview ............................................................................................................................................... 819
10.1.2. Block Diagram ....................................................................................................................................... 820
10.1.3. Operations and Functional Descriptions ............................................................................................... 820
10.1.4. Register List ........................................................................................................................................... 826
10.1.5. Register Description .............................................................................................................................. 827
10.2. Security ID ........................................................................................................................................................ 831
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 817
Security System
Figures
Figure 10- 1. CE Block Diagram ......................................................................................................................................... 820
Figure 10- 2. Task Chaining ............................................................................................................................................... 821
Figure 10- 3. Task Request Process ................................................................................................................................... 824
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 818
Security System
10.1.1. Overview
The Crypto Engine(CE) module is one encryption/decryption algorithm accelerator. It supports kinds of symmetric,
asymmetric, Hash, and RNG algorithms. There are two software interfaces for secure and non-secure world each. The
software interface is simple for configuration, only setting interrupt control, task description address and load tag.
Algorithm control information is written in memory by task descriptor, then CE automatically reads it when executing
request. It supports parallel requests from 4 channels, and has an internal DMA controller to transfer data between CE
and memory.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 819
Security System
AHB
register
HASH/RNG
Symm Asymm Raes(AES-
(SHA,PRNG/TRNG,
(AES/DES/TDES) (RSA/ECC) ECB/CBC/XTS)
HMAC)
MBUS
Software make request through task descriptor, providing algorithm type, mode, key address, source/destination
address and size, etc. The task descriptor is as follows.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 820
Security System
task id
common ctrl
symmetric ctrl
asymmetric ctrl
key addr
iv addr
ctr addr
data length
src sg0 addr
src sg0 size
14:9 / / /
OP DIR
Algorithm Operation Direction
8 R/W 0x0
0: Encryption
1: Decryption
7 / / /
Algorithm Type
0x0: AES
0x1: DES
0x2: Triple DES (3DES)
0x10: MD5
0x11: SHA-1
0x12: SHA-224
0x13: SHA-256
0x14: SHA-384
6:0 R/W 0x0
0x15: SHA-512
0x16: HMAC-SHA1
0x17: HMAC-SHA256
0x1C: TRNG
0x1D: PRNG
0x20: RSA
0x21: ECC
0x30: RAES
Others: Reserved
01: CFB8
10: CFB64
11: CFB128
PRNG_LD
17 R/W 0x0
Load new 15bits key into lfsr for PRNG
AES CTS last package flag
16 R/W 0x0 When setting to ‘1’, it means this is the last package for AES-CTS mode(the
size of the last package >128bit).
15:14 / / /
xts_last
13 R/W 0x0 0: not last block for XTS
1: last block for XTS
xts_first
12 R/W 0x0 0: not first block for XTS
1: first block for XTS
Operation Mode for Symmetric
AES/DES/3DES/RAES Modes
DES/3DES only supports ECB/CBC/CTR. RAES only supports ECB/CBC/XTS.
0000: Electronic Code Book (ECB) mode
0001: Cipher Block Chaining (CBC) mode
0010: Counter (CTR) mode
11:8 R/W 0x0
0011: CipherText Stealing (CTS) mode
0100: Output feedback (OFB)mode
0101: Cipher feedback (CFB)mode
0110: CBC-MAC mode
1001: XTS mode
Other: Reserved
7:4 / / /
CTR WIDTH
Counter width for CTR mode
00: 16-bit Counter
3:2 R/W 0x0
01: 32-bit Counter
10: 64-bit Counter
11: 128-bit Counter
AES KEY SIZE
00: 128-bit
1:0 R/W 0x0 01: 192-bit
10: 256-bit
11: Reserved
For ECC:
00000: point add
00001: point double
00010: point multiplication
00011: point verification
00100: encryption
00101: decryption
00110: sign
00111: sign verify
20:16 R/W 0x0 others: reserved
15:8 / / /
Asymmetric algorithm operation width field
7:0 R/W 0x0 It indicates how much width this request apply, as words.
Basically, there are 4 steps for one task handling from software.
Configure task
Configure registers Start task Wait task end
descriptor
Step1: Software should configure task descriptor in memory, including all fields in descriptor. Channel id corresponds
to one channel in CE. According to algorithm type, software should set the fields in common control, symmetric
control, asymmetric control, then provide key/iv/ctr address and the data length of this task. Source and destination sg
address and size are set based on upper application. If there is another task concatenating after this task, then set its
descriptor address at next descriptor field.
Step 2: Software should set registers, including task descriptor address, interrupt control.
Step 3: Software reads load register to ensure that the bit0 is zero, then starts request by pulling up the bit0 of the
load register.
Step 4: Wait task end.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 824
Security System
Data length field in task descriptor has different meaning for different algorithms.
For HASH algorithm, data length field indicates valid source data bit number, for others indicates source data byte
number. The data length of HASH should be 512/1024-bit aligned if current request is not the last data block, because
of hardware padding.
For PRNG, data length should be 5 words aligned.
For TRNG, data length should be 8 words aligned.
Data size in source and destination sg is as words, whose value should corresponds with data length field, or else CE
will report error and stop execution.
When CPU issues request to CE module, CE module will save the secure mode of CPU. When executing this request,
this state bit works as access tag for inner and system resource. For HUK/RSSK/SSK from SID, only secure mode can
access, or else these keys will be used as 0. For access to SID and keysram module through AHB bus, only secure mode
can success, or else will read 0 or can not write. When issuing MBUS read and write requests, CE will use send this
secure mode bit to BUS, so secure request can access secure and non-secure space, but non-secure request only can
access non-secure space.
Algorithms are divided into 3 types: symmetric, HASH/RNG, asymmetric. Each type has a task queue with 8 elements
for requests. Tasks in each queue are handled in sequence. Among these 3 types, task request and complete time are
not sure. If one type uses the outcome of another type, software should make sure that start one type after another
type is finished.
CE supports 4 channels in each world, and 3 suits algorithm type which can run in parallel. When software issues
request, it first checks if load bit is low, which means software can request. If load bit is high, which means last request
is not registered by CE, software should wait until load bit is low. If software makes several requests with the same
type, these tasks will be executed in request sequence. If software makes several requests with different types, these
tasks will be executed in parallel. Because parallel tasks would finish out of order, software should make different type
request with different channel id, which results in generating different interrupt status bit.
PKC module supports RSA, ECC asymmetric algorithms in the form of microcode. It implements basic modular add,
minus, multiplication, point add, point double, and logic computing, etc. Complete RSA/ECC encryption, decryption,
sign, verify are implemented with these microcode.
Asymmetric algorithms RSA/ECC are implemented as microcode in PKC module. Asymmetric encryption, decryption,
sign, verify operations are composed with certain fixed microcode with hardware.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 825
Security System
Before starting PKC, task description must be configured. Parameters to PKC are assigned to source sg, outcome is put
to destination sg.
For RSA, parameters should be at the order of key, modulus, plaintext.
For ECC point add P2 = P0 + P1, parameters should be at the order of p, P0x, P0y, P1x, P1y. Output is at the order of
P2x, P2y.
For ECC point double P2 = 2*P0, parameters should be at the order of p, a, P0x, P0y. Output is at the order of P2x, P2y.
For ECC point multiplication P2 = k*P0, parameters should be at the order of p, k, a, P0x, P0y. Output is at the order of
P2x, P2y.
For ECC point verification, parameters should be at the order of p, a, P0x, P0y, b. Output is 1 or 0.
For ECC encryption, parameters should be at the order of random k, p, a, Gx, Gy, Qx, Qy, m. Output is at the order of
Rx, Ry, c.
For ECC decryption, parameters should be at the order of random k, p, a, Rx, Ry, c. Output is m.
For ECC signature, parameters should be at the order of random k, p, a, Gx, Gy, n, d, e. Output is at the order of r, s.
For ECC signature verification, parameters should be at the order of n, s, e, r, p, a, Gx, Gy, Qx, Qy, n, r. Output is 1 or 0.
CE module includes error detection for task configuration, data computing error, and authentication invalid. When
algorithm type in task description is read into module, CE will check if this type is supported through checking
algorithm type field in common control. If type value is out of scope, CE will issue interrupt signal and set error state.
Each type has certain input and output data size. After getting task descriptor, input size and output size configuration
will be checked to avoid size error. If size configuration is wrong, CE will issue interrupt signal and set error state. To
protect keys would be put into keysram from disclose, if request using RSSK is for AES decryption and destination
address is not in keysram space, CE would not execute this task. It will issue interrupt signal and set error state.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 826
Security System
1: Finished
It indicates if task has been completed .
Write ‘1’ to clear it.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 828
Security System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 829
Security System
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 830
Security System
10.2. Security ID
The Security ID(SID) is one electrical efuse for saving key, which includes chip ID, thermal sensor, and security key, etc.
H616 User Manual(Revision 1.0) Copyright© 2019 Allwinner Technology Co.,Ltd. All Rights Reserved. Page 831