• Off-chip memory Flash 1.3 Function description The BL702/704/706 bus connection and address access are summarized as follows: The bus master includes CPU, Ethernet, DMA, encryption engine, debugging interface. The bus slave includes memory, peripherals, and Zigbee/BLE. Except for Ethernet and encryption engine which can only access memory, all other bus masters can access all bus slaves.
BL702/704/706 Reference Manual Table 1.1: Bus connection Ethernet Encryption Debug Slave/Master engine interface memory Peripheral Zigbee/BLE The address access mainly distinguishes ”memory” or ”peripheral” by [27:24], and the [31:28] bits can be ignored. The memory space is consecutive addresses 0x2010000~0x202FFFF (128KB SRAM),the read-only memory address is 0x1000000,...
– Software system reset (reg_ctrl_sys_reset): Trigger the rising edge of this register by software, retain neces- sary logic processing such as power management unit, and reset the chip part of the system – Software module reset: Set software reset according to the needs of specific modules 26/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
• System reset: All peripherals and CPU will be reset, but related registers in the AON domain will not be reset • Power-on reset: the entire system including the related registers of the AON domain will be reset The application can choose to use the corresponding reset method as needed. 29/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
BL702/704/706 Reference Manual 3.2.3 Bus management Provide bus arbitration settings and bus error settings, you can set whether to generate an interrupt when a bus error occurs, and provide error bus address information to facilitate user debugging. 3.2.4 Memory management...
BL702/704/706 Reference Manual 3.2.8 GPIO function setting The function of GPIO is set through the GPIO_CFGCTL register group. The main setting items include: • func_sel: select GPIO function • pu: Choose whether to pull up • pd: Choose whether to drop down •...
BL702/704/706 Reference Manual • 1 : UART0_CTS • 2 : UART0_TXD • 3 : UART0_RXD • 4 : UART1_RTS • 5 : UART1_CTS • 6 : UART1_TXD • 7 : UART1_RXD Take GPIO0 as an example, when fun_sel selects UART, GPIO0 selects UART_SIG0. By default, the value of UART_- SIG0_SEL is 0, which is UART0_RTS, that is, GPIO is UART0_RTS function.
BL702/704/706 Reference Manual affect the function. But as the input direction, IE must be set and the configuration of OE does not affect the function; when used as swgpio, both IE and OE need to be configured correctly. 3.2.12 GPIO interrupt settings To use the interrupt function of GPIO, you need to set GPIO to input mode first, and the interrupt trigger mode is set through the GPIO_INT_MODE_SET register group.
BL702/704/706 Reference Manual Name Type Reset Description Bits PLLSEL pll clock selection 0: 57.6MHz 1: 96MHz 2: 144MHz 3: 120MHz (Clock Freq will be changes with Audio PLL, not sugges use this CLK) BLCKEN bclk force on HCLKEN hclk force on...
BL702/704/706 Reference Manual Name Type Reset Description Bits CPURST cpu reset, see the software reset table for details PWORST power on reset, see the software reset table for details 3.3.8 cgen_cfg0 Address:0x40000020 RSVD RSVD CGENM Name Type Reset Description Bits...
BL702/704/706 Reference Manual Name Type Reset Description Bits 15:14 RSVD 32KCOMP Compensation => Duty of dig_32k_out = dig_32k_div : (dig_32k_div+1) 32KEN Enable dig_32k_out RSVD 10:0 32KDIV 11’d1000 (PLL 32MHz or xclk) / dig_32k_div Ex: Set 750 for 24MHz ; Set 1000 for 32MHz ; Set 1200 for 38.4MHz ;...
BL702/704/706 Reference Manual Name Type Reset Description Bits GP2PU GPIO Pull Up Control GP2DRV GPIO Driving Control GP2SMT GPIO SMT Control GP2IE GPIO Input Enable 3.3.20 GPIO_CFGCTL2 Address:0x40000108 RSVD GP5FUNC RSVD GP5DRV RSVD GP4FUNC RSVD GP4DRV Name Type Reset Description...
BL702/704/706 Reference Manual Name Type Reset Description Bits GP35PD GPIO Pull Down Control GP35PU GPIO Pull Up Control 19:18 GP35DRV GPIO Driving Control GP35SMT GPIO SMT Control GP35IE GPIO Input Enable 15:6 RSVD GP34PD GPIO Pull Down Control GP34PU GPIO Pull Up Control...
Page 75
BL702/704/706 Reference Manual Name Type Reset Description Bits GP17OE Register Controlled GPIO Output Enable (Used when GPIO Function select to Register Control GPIO) GP16OE Register Controlled GPIO Output Enable (Used when GPIO Function select to Register Control GPIO) GP15OE Register Controlled GPIO Output Enable (Used when GPIO...
Page 87
BL702/704/706 Reference Manual Name Type Reset Description Bits 11:8 IRRXGPSL 4’h0 0 : disable ir_rx select gpio 1 15 :select gpio 19 33 as ir_rx (GPIO need to set as SWG- PIO mode) LDRVIBIA 4’h8 ir led drive strength, [7:4]*8mA RSVD 3.3.56 usb_xcvr...
Page 88
BL702/704/706 Reference Manual Name Type Reset Description Bits OEBREG 1’b1 Leave it as the default OEBSEL 1’b0 0: usb_oeb; 1: usb_oeb_reg Leave it as the default RSVD 10:8 ROUTPMOS 3’h3 Leave it as the default RSVD ROUTNMOS 3’h3 Leave it as the default PUIDO 1’b0...
Page 89
BL702/704/706 Reference Manual Name Type Reset Description Bits RSVD 14:12 PUTUNE 3’h2 pull up resistor tuning Leave it as the default USECTRL 1’b1 1: USB XCVR use on-chip usb controller ; 0: USB XCVR usb off-chip usb controller Leave it as the default...
Page 90
– Two input modes: single-ended and differential – Support jitter compensation – User can set conversion result offset value • Analog channels – 12 external analog channels 90/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
BL702/704/706 Reference Manual pushed into the FIFO. 4.3.1 ADC pins and internal signals Table 4.1: ADC internal signals Internal Signal type Description signals VBAT/2 Input Voltage signal divided from the power pin TSEN Input Internal temperature sensor output voltage VREF...
BL702/704/706 Reference Manual • ADC CH8 • ADC CH9 • ADC CH10 • ADC CH11 • VSSA • DAC OUTA • DAC OUTB • VBAT/2 • TSEN • VREF • GND It should be noted that if VBAT/2 or TSEN is selected as the input signal to be acquired, gpadc_vbat_en or gpadc_- ts_en needs to be set.
Page 94
BL702/704/706 Reference Manual Inside the ADC module, a clock divider is provided, which can divide the input clock by 1/4/8/12/16/20/24/32. Users can adjust the ADC clock source and various frequency division coefficients according to actual sampling require- ments. Note that the maximum input clock of ADC is 2MHZ.
BL702/704/706 Reference Manual implement multiple sampling conversions on a channel. ADC conversion results are generally placed in the FIFO. The ADC module does not provide conversion completion interrupts. Users need to set the FIFO receive data threshold interrupt based on the actual number of conversion channels.
Page 96
BL702/704/706 Reference Manual In single-ended mode, there is no sign bit, that is, when 12 bits are selected, bit15-bit4 is the conversion result and bit15 is the MSB. In actual use, the results of the ADC are generally placed in the FIFO, which is particularly important in the multi- channel scan mode.
Page 97
BL702/704/706 Reference Manual Using the threshold interrupt of the FIFO, when the interrupt is generated and the number of ADC data reaches the threshold, the CPU can read the length of the ADC FIFO in the interrupt service function and read it all.
Page 98
BL702/704/706 Reference Manual 4.3.9 VBAT measurement The VBAT/2 measurement is the voltage of the chip VDD33, not the voltage of an external battery such as a lithium battery. If you need to measure the voltage of a power supply head such as a lithium battery, you can divide the voltage and then input it to the ADC’s GPIO analog channel.
Page 106
BL702/704/706 Reference Manual Name Type Reset Description Bits 24:22 PGA2GAIN 3’h0 3’h0: disable 3’h1: gain=1 3’h2: gain=2 3’h3: gain=4 3’h4: gain=8 3’h5: gain=16 3’h6: gain=32 3’h7: gain=32 21:19 TESTSEL 3’h0 select test point 0 7 TESTEN 1’b0 Analog test enable.
Page 107
BL702/704/706 Reference Manual 4.4.6 gpadc_reg_scn_pos1 Address:0x4000f918 RSVD SCP5 SCP4 SCP3 SCP3 SCP2 SCP1 SCP0 Name Type Reset Description Bits 31:30 RSVD 29:25 SCP5 5’hf definition is the same as adc_reg_cmd.adc_pos_sel 24:20 SCP4 5’hf definition is the same as adc_reg_cmd.adc_pos_sel 19:15 SCP3 5’hf...
Page 108
BL702/704/706 Reference Manual 4.4.8 gpadc_reg_scn_neg1 Address:0x4000f920 RSVD SCN5 SCN4 SCN3 SCN3 SCN2 SCN1 SCN0 Name Type Reset Description Bits 31:30 RSVD 29:25 SCN5 5’hf definition is the same as adc_reg_cmd.adc_neg_sel 24:20 SCN4 5’hf definition is the same as adc_reg_cmd.adc_neg_sel 19:15 SCN3 5’hf...
Page 109
BL702/704/706 Reference Manual 4.4.10 gpadc_reg_status Address:0x4000f928 RSVD RSVD DARD Name Type Reset Description Bits 31:1 RSVD DARD 1’b0 ADC final conversion data ready 4.4.11 gpadc_reg_isr Address:0x4000f92c RSVD RSVD RSVD RSVD Name Type Reset Description Bits 31:10 RSVD 1’h0 write 1 mask 1’h0...
Page 110
BL702/704/706 Reference Manual 4.4.12 gpadc_reg_raw_result Address:0x4000f934 RSVD RSVD RAWDA Name Type Reset Description Bits 31:12 RSVD 11:0 RAWDA 12’h0 ADC Raw data 4.4.13 gpadc_reg_define Address:0x4000f938 RSVD OSCALDA Name Type Reset Description Bits 31:16 RSVD 15:0 OSCALDA 16’h0 User defined or self calculated offset data 16-bit signed...
Page 111
• The output pin of DAC is fixed to ChannelA as GPIO11, ChannelB as GPIO17 • DAC reference voltage can be selected internally 5.3 DAC function description The basic block diagram of the DAC module is shown in the figure. 111/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
BL702/704/706 Reference Manual Fig. 5.1: DAC basic block diagram The DAC module contains two DAC modulation circuits and a power supply circuit related to modulating analog signals. The user can use Ref_Sel to select whether the DAC reference voltage is external/internal, and Ref_Rng to select the internal reference voltage source.
BL702/704/706 Reference Manual sequence, and the modulation order is {A0},{A1},{A2},... If gpdac_dma_format is 1, the high 16 bits of the data transferred into gpdac_dma_wdata by DMA are modulated in Channel B, and the low 16 bits are modulated in Channel A. The modulation sequence is {B0,A0},{B1,A1},{B2,A2},..
Page 114
BL702/704/706 Reference Manual 5.4.1 gpdac_config Address:0x40002040 RSVD CHBSEL CHASEL RSVD MODE RSVD DSMMODE RSVD Name Type Reset Description Bits 31:24 RSVD 23:20 CHBSEL Channel B Source Select 0: Reg 1: DMA 2: DMA + Filter 3: Sin Gen 4: A (The same as channel A)
Page 116
BL702/704/706 Reference Manual 5.4.4 gpdac_ctrl Address:0x40000308 RSVD RSVD TSEN RSVD Name Type Reset Description Bits 31:9 RSVD REFSEL 1’h0 Reference select 1’h0 Internal reference 1’h1 External reference TSEN 1’h0 Test enable 1’h0 analog test disabled (ATEST is set in Hi-Z state) 1’h1 analog test point enabled to ATEST...
Page 117
BL702/704/706 Reference Manual Name Type Reset Description Bits IOAEN 1’h0 Channel A conversion output to pad enable 1’h0 Disable channel A conversion result to GPIO 1’h1 Enable channel A conversion result to GPIO 1’h0 Channel A enable/disable signal 1’h0 Disable channel A conversion.
Page 118
BL702/704/706 Reference Manual 5.4.7 gpdac_data Address:0x40000314 RSVD ADATA RSVD BDATA Name Type Reset Description Bits 31:26 RSVD 25:16 ADATA 10’h0 Channel A Data input 15:10 RSVD BDATA 10’h0 Channel B Data input BL702/704/706 Reference Manual 118/ 375 @2021 Bouffalo Lab...
Page 120
BL702/704/706 Reference Manual 6.3 DMA functional description 6.3.1 Working principle When a device attempts to transfer data (usually a large amount of data) directly to another device via the bus, it will first send a DMA request signal to the CPU. The peripheral device makes a bus request to the CPU to take over the bus control right through the DMA.
BL702/704/706 Reference Manual DMA Controller DMA_Channel0 REQ0 REQ1 «« FIFO «« REQ31 DMA_Channel1 REQ0 REQ1 «« FIFO «« REQ31 AHB Master ・ ・ ・ DMA_Channe7 REQ0 REQ1 «« FIFO AHB slave «« AHB Slave Programming REQ31 Fig. 6.1: DMA architecture The DMA includes a set of AHB Master interfaces and a set of AHB Slave interfaces.
Page 122
BL702/704/706 Reference Manual 6.3.2 DMA channel configuration DMA supports 8 channels in total, each channel does not interfere with each other and can run at the same time. The following is the configuration process of DMA channel x: 1. Set 32-bit source address in DMA_C0SrcAddr register 2.
Page 123
BL702/704/706 Reference Manual 2. Set the value of the DMA_C0Config [DSTPH] bit to 10, that is, set the Destination peripheral to SPI_RX ADC uses DMA to transfer data The configuration is as follows: 1. Set the value of the DMA_C0Config [SRCPH] bit to 22, that is, set the Source peripheral to GPADC...
BL702/704/706 Reference Manual IDLE channel enable Source Address Dest Address Next LLI IntTCEnable= DMA Control Source Address Dest Address Next LLI IntTCEnable= DMA Control IntTCEnable= · · · IntTCEnable= Source Address Dest Address Next LLI DMA Control Fig. 6.2: LLI architecture 6.3.5 DMA interrupt...
Page 125
BL702/704/706 Reference Manual 6.4 Transmission mode 6.4.1 Memory to memory After this mode is started, the DMA will move the data from the source address to the destination address according to the set transfer size. After the transfer, the DMA controller will automatically return to the idle state and wait for the next transfer.
Page 126
BL702/704/706 Reference Manual 6.4.3 Peripheral to memory In this working mode, when the source peripheral request is triggered, the source configuration is burst to the buffer until the set number of moves reaches the stop. On the other hand, when the internal cache is enough for the target...
Page 127
BL702/704/706 Reference Manual 6.5 Register description Description Name DMA_IntStatus Interrupt status DMA_IntTCStatus Interrupt terminal count request status DMA_IntTCClear Terminal count request clear DMA_IntErrorStatus Interrupt error status DMA_IntErrClr Interrupt error clear DMA_RawIntTCStatus Status of the terminal count interrupt prior to masking...
Page 128
BL702/704/706 Reference Manual Description Name DMA_C2Config Channel DMA configuration DMA_C3SrcAddr Channel DMA source address DMA_C3DstAddr Channel DMA Destination address DMA_C3LLI Channel DMA link list DMA_C3Control Channel DMA bus control DMA_C3Config Channel DMA configuration DMA_C4SrcAddr Channel DMA source address DMA_C4DstAddr Channel DMA Destination address...
Page 129
BL702/704/706 Reference Manual 6.5.1 DMA_IntStatus Address:0x4000c000 RSVD RSVD INTSTA Name Type Reset Description Bits 31:8 RSVD INTSTA Status of the DMA interrupts after masking 6.5.2 DMA_IntTCStatus Address:0x4000c004 RSVD RSVD INTTCSTA Name Type Reset Description Bits 31:8 RSVD INTTCSTA Interrupt terminal count request status 6.5.3 DMA_IntTCClear...
Page 130
BL702/704/706 Reference Manual Name Type Reset Description Bits 6.5.4 DMA_IntErrorStatus Address:0x4000c00c RSVD RSVD Name Type Reset Description Bits 31:8 RSVD Interrupt error status 6.5.5 DMA_IntErrClr Address:0x4000c010 RSVD RSVD Name Type Reset Description Bits 31:8 RSVD Interrupt error clear 6.5.6 DMA_RawIntTCStatus Address:0x4000c014...
Page 131
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:8 RSVD SOTCIPTM Status of the terminal count interrupt prior to masking 6.5.7 DMA_RawIntErrorStatus Address:0x4000c018 RSVD RSVD SOTEIPTM Name Type Reset Description Bits 31:8 RSVD SOTEIPTM Status of the error interrupt prior to masking 6.5.8 DMA_EnbldChns...
Page 132
BL702/704/706 Reference Manual 6.5.9 DMA_SoftBReq Address:0x4000c020 Name Type Reset Description Bits 31:0 Software burst request 6.5.10 DMA_SoftSReq Address:0x4000c024 Name Type Reset Description Bits 31:0 Software single request 6.5.11 DMA_SoftLBReq Address:0x4000c028 SLBR SLBR Name Type Reset Description Bits 31:0 SLBR Software last burst request...
Page 133
BL702/704/706 Reference Manual 6.5.12 DMA_SoftLSReq Address:0x4000c02c SLSR SLSR Name Type Reset Description Bits 31:0 SLSR Software last single request 6.5.13 DMA_Config Address:0x4000c030 RSVD RSVD SDMA Name Type Reset Description Bits 31:2 RSVD AHBMEC AHB Master endianness configuration: 0 = little-endian, 1...
Page 134
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:0 DSLFDRS DMA synchronization logic for DMA request signals: 0 = enable, 1 = disable 6.5.15 DMA_C0SrcAddr Address:0x4000c100 DMASA DMASA Name Type Reset Description Bits 31:0 DMASA DMA source address 6.5.16 DMA_C0DstAddr Address:0x4000c104...
Page 135
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:0 FLLI First linked list item. Bits [1:0] must be 0. 6.5.18 DMA_C0Control Address:0x4000c10c PROTECT RSVD FIXCNT RSVD MODE MODE Name Type Reset Description Bits TCIEN Terminal count interrupt enable bit. It controls whether the current LLI is expected to trigger the terminal count inter- rupt.
Page 136
BL702/704/706 Reference Manual 6.5.19 DMA_C0Config Address:0x4000c110 RSVD LLICOUNT RSVD HALT LOCK TIVE TCIM FLOWCTRL DSTPH SRCPH CHEN Name Type Reset Description Bits 31:30 RSVD 29:20 LLICOUNT LLI counter. Increased 1 each LLI run. Cleared 0 when config Control. RSVD HALT Halt: 0 = enable DMA requests, 1 = ignore subsequent source DMA requests.
Page 137
BL702/704/706 Reference Manual Name Type Reset Description Bits CHEN Channel enable. 6.5.20 DMA_C1SrcAddr Address:0x4000c200 DMASA DMASA Name Type Reset Description Bits 31:0 DMASA DMA source address 6.5.21 DMA_C1DstAddr Address:0x4000c204 DMADA DMADA Name Type Reset Description Bits 31:0 DMADA DMA Destination address 6.5.22 DMA_C1LLI...
Page 138
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:2 FLLI First linked list item. Bits [1:0] must be 0. RSVD 6.5.23 DMA_C1Control Address:0x4000c20c PROTECT RSVD FIXCNT MODE MODE Name Type Reset Description Bits TCIEN Terminal count interrupt enable bit. It controls whether the current LLI is expected to trigger the terminal count inter- rupt.
Page 139
BL702/704/706 Reference Manual 6.5.24 DMA_C1Config Address:0x4000c210 RSVD HALT LOCK TIVE TCIM FLOWCTRL DSTPH SRCPH CHEN Name Type Reset Description Bits 31:19 RSVD HALT Halt: 0 = enable DMA requests, 1 = ignore subsequent source DMA requests. ACTIVE Active: 0 = no data in FIFO of the channel, 1 = FIFO of the channel has data.
Page 141
BL702/704/706 Reference Manual 6.5.28 DMA_C2Control Address:0x4000c30c PROTECT RSVD FIXCNT MODE MODE Name Type Reset Description Bits TCIEN Terminal count interrupt enable bit. It controls whether the current LLI is expected to trigger the terminal count inter- rupt. 30:28 PROTECT Protection.
Page 142
BL702/704/706 Reference Manual 6.5.29 DMA_C2Config Address:0x4000c310 RSVD HALT LOCK TIVE TCIM FLOWCTRL DSTPH SRCPH CHEN Name Type Reset Description Bits 31:19 RSVD HALT Halt: 0 = enable DMA requests, 1 = ignore subsequent source DMA requests. ACTIVE Active: 0 = no data in FIFO of the channel, 1 = FIFO of the channel has data.
Page 144
BL702/704/706 Reference Manual 6.5.33 DMA_C3Control Address:0x4000c40c PROTECT RSVD FIXCNT MODE MODE Name Type Reset Description Bits TCIEN Terminal count interrupt enable bit. It controls whether the current LLI is expected to trigger the terminal count inter- rupt. 30:28 PROTECT Protection.
Page 145
BL702/704/706 Reference Manual 6.5.34 DMA_C3Config Address:0x4000c410 RSVD HALT LOCK TIVE TCIM FLOWCTRL DSTPH SRCPH CHEN Name Type Reset Description Bits 31:19 RSVD HALT Halt: 0 = enable DMA requests, 1 = ignore subsequent source DMA requests. ACTIVE Active: 0 = no data in FIFO of the channel, 1 = FIFO of the channel has data.
Page 147
BL702/704/706 Reference Manual 6.5.38 DMA_C4Control Address:0x4000c50c PROTECT RSVD FIXCNT MODE MODE Name Type Reset Description Bits TCIEN Terminal count interrupt enable bit. It controls whether the current LLI is expected to trigger the terminal count inter- rupt. 30:28 PROTECT Protection.
Page 148
BL702/704/706 Reference Manual 6.5.39 DMA_C4Config Address:0x4000c510 RSVD HALT LOCK TIVE TCIM FLOWCTRL DSTPH SRCPH CHEN Name Type Reset Description Bits 31:19 RSVD HALT Halt: 0 = enable DMA requests, 1 = ignore subsequent source DMA requests. ACTIVE Active: 0 = no data in FIFO of the channel, 1 = FIFO of the channel has data.
Page 150
BL702/704/706 Reference Manual 6.5.43 DMA_C5Control Address:0x4000c60c PROTECT RSVD FIXCNT MODE MODE Name Type Reset Description Bits TCIEN Terminal count interrupt enable bit. It controls whether the current LLI is expected to trigger the terminal count inter- rupt. 30:28 PROTECT Protection.
Page 151
BL702/704/706 Reference Manual 6.5.44 DMA_C5Config Address:0x4000c610 RSVD HALT LOCK TIVE TCIM FLOWCTRL DSTPH SRCPH CHEN Name Type Reset Description Bits 31:19 RSVD HALT Halt: 0 = enable DMA requests, 1 = ignore subsequent source DMA requests. ACTIVE Active: 0 = no data in FIFO of the channel, 1 = FIFO of the channel has data.
Page 153
BL702/704/706 Reference Manual 6.5.48 DMA_C6Control Address:0x4000c70c PROTECT RSVD FIXCNT MODE MODE Name Type Reset Description Bits TCIEN Terminal count interrupt enable bit. It controls whether the current LLI is expected to trigger the terminal count inter- rupt. 30:28 PROTECT Protection.
Page 154
BL702/704/706 Reference Manual 6.5.49 DMA_C6Config Address:0x4000c710 RSVD HALT LOCK TIVE TCIM FLOWCTRL DSTPH SRCPH CHEN Name Type Reset Description Bits 31:19 RSVD HALT Halt: 0 = enable DMA requests, 1 = ignore subsequent source DMA requests. ACTIVE Active: 0 = no data in FIFO of the channel, 1 = FIFO of the channel has data.
Page 156
BL702/704/706 Reference Manual 6.5.53 DMA_C7Control Address:0x4000c80c PROTECT RSVD FIXCNT MODE MODE Name Type Reset Description Bits TCIEN Terminal count interrupt enable bit. It controls whether the current LLI is expected to trigger the terminal count inter- rupt. 30:28 PROTECT Protection.
Page 157
BL702/704/706 Reference Manual 6.5.54 DMA_C7Config Address:0x4000c810 RSVD HALT LOCK TIVE TCIM FLOWCTRL DSTPH SRCPH CHEN Name Type Reset Description Bits 31:19 RSVD HALT Halt: 0 = enable DMA requests, 1 = ignore subsequent source DMA requests. ACTIVE Active: 0 = no data in FIFO of the channel, 1 = FIFO of the channel has data.
Flash, the less time wasted, the higher the efficiency. The L1C cache can be used as a lubricating role between the processor and the Flash to improve the efficiency of the processor. 158/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
BL702/704/706 Reference Manual 7.2 L1C main features • 4-way Set-Associative mapping • Variable cache size • Connect to TCM address space, can easily configure L1C space as TCM space • Support cache performance statistics 7.3 L1C function description 7.3.1 Mutual conversion between TCM and Cache RAM resources In order to increase memory usage efficiency, it is supported to adjust all or part of the Cache’s 16K RAM to TCM...
BL702/704/706 Reference Manual index offset valid Word 3 Word 2 Word 1 Word 0 Fig. 7.2: Cache architecture Each set of associative mapping caches contains two parts, the first is a tag, which contains the valid value and the address mapping relationship. The second part is data storage. When the processor accesses the cache, the cache processor compares the relationship between the address and the tag.
Page 161
BL702/704/706 Reference Manual 7.4.1 l1c_config Address:0x40009000 RSVD RSVD WAYDIS RSVD ABLE Name Type Reset Description Bits 31:12 RSVD 11:8 WAYDIS 4’b1111 Disable part of cache ways & used as ITCM RSVD CNTEN CACABLE 7.4.2 hit_cnt_lsb Address:0x40009004 CNTLSB CNTLSB Name Type...
Page 162
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:0 CNTMSB total hit count = hit_cnt_msb*23̂ 2 + hit_cnt_lsb 7.4.4 miss_cnt Address:0x4000900c MISSCNT MISSCNT Name Type Reset Description Bits 31:0 MISSCNT BL702/704/706 Reference Manual 162/ 375 @2021 Bouffalo Lab...
Page 163
8.3.1 Fixed receiving protocol IR receiver supports two fixed protocols, NEC protocol and RC-5 protocol. • NEC protocol The logic 1 and logic 0 waveforms of the NEC protocol are shown in the following figure: 163/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
BL702/704/706 Reference Manual Logical”1” Logical”0” 560us 560us 560us 2.25ms 1.12ms Fig. 8.1: nec logical Logic 1 is 2.25ms, pulse time is 560us; logic 0 bit is 1.12ms, pulse time is 560us. The specific format of the NEC protocol is shown in the following figure: 9ms 4.5...
Page 165
BL702/704/706 Reference Manual bit1 bit2 bit3 bit4 bit5 bit6 bit7 bit8 bit9 bit10 bit11 bit12 bit13 bit14 “1” “1” “0” “0” “1” “0” “1” “1” “1” “0” “1” “0” “1” “0” Address Command Start bits always“1” Fig. 8.4: rc5 The first two bits are the start bit, fixed to logic 1, and the third bit is the flip bit. When a key value is issued and then pressed, the bit will be inverted.
Page 166
BL702/704/706 Reference Manual 8.3.5 Carrier modulation Setting the upper 16 bits of the IRTX_PULSE_WIDTH register can generate carriers with different frequencies and duty cycles. The <TXMPH1W> bit in this register sets the width of carrier phase 1, and the <TXMPH0W> bit sets the width of carrier phase 0.
Page 167
BL702/704/706 Reference Manual Description Name irrx_data_word0 IR RX data word0 irrx_data_word1 IR RX data word1 irrx_swm_fifo_config_0 IR RX FIFO configuration irrx_swm_fifo_rdata IR RX software mode pulse width data 8.4.1 irtx_config Address:0x4000a600 RSVD TXDATANU TXDATANU TPHL TXTP RSVD TXL1 TXL0 TXDA...
Page 168
BL702/704/706 Reference Manual Name Type Reset Description Bits TXMDEN 1’b0 Enable signal of output modulation TXOEN 1’b0 Output inverse signal 1’b0: Output stays at Low during idle state 1’b1: Output stays at High during idle state TXEN 1’b0 Enable signal of IRTX function...
Page 169
BL702/704/706 Reference Manual 8.4.3 irtx_data_word0 Address:0x4000a608 TXDW0 TXDW0 Name Type Reset Description Bits 31:0 TXDW0 32’h0 TX data word 0 (Don’t care if SWM is enabled) 8.4.4 irtx_data_word1 Address:0x4000a60c TXDW1 TXDW1 Name Type Reset Description Bits 31:0 TXDW1 32’h0 TX data word 1 (Don’t care if SWM is enabled) 8.4.5 irtx_pulse_width...
Page 170
BL702/704/706 Reference Manual Name Type Reset Description Bits 8.4.6 irtx_pw Address:0x4000a614 TXTPH1W TXTPH0W TXHPH1W TXHPH0W TXL1PH1W TXL1PH0W TXL0PH1W TXL0PH0WS Name Type Reset Description Bits 31:28 TXTPH1W 4’d0 Pulse width of tail pulse phase 1 (Don’t care if SWM is en-...
Page 171
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:0 TXSWPW0 32’h0 IRTX Software Mode pulse width data #0 #7, each pulse is represented by 4-bit ([3:0] is the 1st pulse, [7:4] is the 2nd pulse, [11:8] is the 3rd pulse, etc) 8.4.8 irtx_swm_pw_1...
Page 172
BL702/704/706 Reference Manual 8.4.10 irtx_swm_pw_3 Address:0x4000a64c TXSWPW3 TXSWPW3 Name Type Reset Description Bits 31:0 TXSWPW3 32’h0 IRTX Software Mode pulse width data #24 #31, each pulse is represented by 4-bit ([3:0] is the 1st pulse, [7:4] is the 2nd pulse, [11:8] is the 3rd pulse, etc) 8.4.11 irtx_swm_pw_4...
Page 173
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:0 TXSWPW5 32’h0 IRTX Software Mode pulse width data #40 #47, each pulse is represented by 4-bit ([3:0] is the 1st pulse, [7:4] is the 2nd pulse, [11:8] is the 3rd pulse, etc) 8.4.13 irtx_swm_pw_6...
Page 174
BL702/704/706 Reference Manual 8.4.15 irrx_config Address:0x4000a680 RSVD RSVD RXDEGCNT RSVD RXDG RXMODE RXIN RXEN Name Type Reset Description Bits 31:12 RSVD 11:8 RXDEGCNT 4’d0 De-glitch function cycle count RSVD RXDGEN 1’b0 Enable signal of IRRX input de-glitch function RXMODE 2’d0...
Page 175
BL702/704/706 Reference Manual Name Type Reset Description Bits 23:17 RSVD RXECLR 1’b0 Interrupt clear of irrx_end_int 15:9 RSVD RXEMASK 1’b1 Interrupt mask of irrx_end_int RSVD RXEINT 1’b0 IRRX transfer end interrupt 8.4.17 irrx_pw_config Address:0x4000a688 RXETH RXDATH Name Type Reset Description...
Page 176
BL702/704/706 Reference Manual 8.4.19 irrx_data_word0 Address:0x4000a694 RXDAW0 RXDAW0 Name Type Reset Description Bits 31:0 RXDAW0 32’h0 RX data word 0 8.4.20 irrx_data_word1 Address:0x4000a698 RXDAW1 RXDAW1 Name Type Reset Description Bits 31:0 RXDAW1 32’h0 RX data word 1 8.4.21 irrx_swm_fifo_config_0 Address:0x4000a6c0...
Page 177
BL702/704/706 Reference Manual Name Type Reset Description Bits RXFOF 1’b0 Overflow flag of RX FIFO, can be cleared by rx_fifo_clr RSVD RXFCLR 1’b0 Clear signal of RX FIFO 8.4.22 irrx_swm_fifo_rdata Address:0x4000a6c4 RSVD RXFRDA Name Type Reset Description Bits 31:16 RSVD...
Page 178
• Both master and slave devices support 1/2/3/4 byte transmission mode • Flexible clock configuration, support up to 40M clock • Configurable MSB/LSB priority transmission • Acceptance filtering function • Timeout mechanism under the slave • Support DMA transfer mode 178/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
BL702/704/706 Reference Manual 9.3 SPI function description 9.3.1 Clock control According to different clock phases and polarity settings, the SPI clock has four modes, which can be set by bit4 (CPOL) and bit5 (CPHA) of the SPI_CONFIG register. CPOL is used to determine the level of the SCK clock signal when idle, CPOL = 0 means the idle level is low, and CPOL = 1 means the idle level is high.
BL702/704/706 Reference Manual 9.3.3 Acceptance filtering function By setting the start and end bits that need to be filtered out, the SPI discards the corresponding data segment in the received data. As shown below: Address Opcode Dummy Byte High-Impedance State Fig.
Page 181
BL702/704/706 Reference Manual 9.3.7 DMA transfer mode SPI supports DMA transfer mode. The use of this mode requires the TX and RX FIFO thresholds to be set separately. When this mode is enabled, the UART will check the TX / RX FIFO. Once the TX / RX FIFO available count value is greater than its set threshold, a DMA request will be initiated , DMA will move data to TX FIFO or out of RX FIFO according to the setting.
Page 182
BL702/704/706 Reference Manual Description Name spi_fifo_config_0 SPI FIFO configuration register0 spi_fifo_config_1 SPI FIFO configuration register1 spi_fifo_wdata SPI FIFO write data spi_fifo_rdata SPI FIFO read data 9.4.1 spi_config Address:0x4000a200 RSVD DEGCNT RSVD MCEN IGNR BYTE SCLK SCLK FSIZE Name Type Reset...
Page 183
BL702/704/706 Reference Manual Name Type Reset Description Bits SCLKPOL 1’b0 SCLK polarity 0: SCLK output LOW at IDLE state 1: SCLK output HIGH at IDLE state FSIZE 2’d0 SPI frame size (also the valid width for each FIFO entry) 2’d0: 8-bit 2’d1: 16-bit...
Page 184
BL702/704/706 Reference Manual Name Type Reset Description Bits 18:17 RSVD ENDCLR 1’b0 Interrupt clear of spi_end_int 15:14 RSVD FERMASK 1’b1 Interrupt mask of spi_fer_int TXUMASK 1’b1 Interrupt mask of spi_txu_int STOMASK 1’b1 Interrupt mask of spi_sto_int RXFMASK 1’b1 Interrupt mask of spi_rxv_int TXFMASK 1’b1...
Page 185
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:1 RSVD BUSBUSY 1’b0 Indicator of SPI bus busy 9.4.4 spi_prd_0 Address:0x4000a210 PRDPH1 PRDPH0 PRDP PRDS Name Type Reset Description Bits 31:24 PRDPH1 8’d15 Length of DATA phase 1 (please refer to ”Timing” tab)
Page 186
BL702/704/706 Reference Manual 9.4.6 spi_rxd_ignr Address:0x4000a218 RSVD RXDIGS RSVD RXDIGP Name Type Reset Description Bits 31:21 RSVD 20:16 RXDIGS 5’d0 Starting point of RX data ignore function 15:5 RSVD RXDIGP 5’d0 Stopping point of RX data ignore function 9.4.7 spi_sto_value Address:0x4000a21c...
Page 187
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:8 RSVD RFUF 1’b0 Underflow flag of RX FIFO, can be cleared by rx_fifo_clr RFOF 1’b0 Overflow flag of RX FIFO, can be cleared by rx_fifo_clr TFUF 1’b0 Underflow flag of TX FIFO, can be cleared by tx_fifo_clr TFOF 1’b0...
Page 188
BL702/704/706 Reference Manual 9.4.10 spi_fifo_wdata Address:0x4000a288 FWDATA FWDATA Name Type Reset Description Bits 31:0 FWDATA SPI FIFO write data 9.4.11 spi_fifo_rdata Address:0x4000a28c FRDATA FRDATA Name Type Reset Description Bits 31:0 FRDATA 32’h0 SPI FIFO read data BL702/704/706 Reference Manual 188/ 375...
10.3.1 Data format description Normal UART communication data is composed of a start bit, a data bit, a parity bit, and a stop bit. The BL702’s UART supports configurable data bits, parity bits, and stop bits, all of which are set in the UTX_CONFIG and URX_CONFIG registers.
BL702/704/706 Reference Manual FCLK hbn_uart_clk_sel Fig. 10.2: UART clock 10.3.3 Baud rate setting he user can generate the required baud rate by setting the register UART_BIT_PRD. The upper 16 bits and lower 16 bits of this register correspond to RX and TX respectively, that is, the baud rates of RX and TX can be set independently.
BL702/704/706 Reference Manual UART Clock Stop Start Baud rate 115200 = 96M/833 Sampling Time 5000 10000 10000 Start 10000 Baud rate 9600 = 96M/10000 Fig. 10.3: UART sampling waveform 10.3.4 Transmitter The transmitter contains a 128-byte transmit FIFO to store the data to be transmitted. Software can write TX FIFO through APB bus, and can also move data into TX FIFO through DMA.
BL702/704/706 Reference Manual 10.3.6 Automatic baud rate detection The UART module supports automatic baud rate detection. The detection is divided into two types, one is general mode and the other is fixed character mode. The two detection modes will be enabled every time the bit <ABREN>...
BL702/704/706 Reference Manual 10.3.7 Hardware flow control The UART supports hardware flow control in CTS / RTS mode to prevent data in the FIFO from being lost because it is too late to process. The hardware flow control connection is shown in the following figure:...
Page 195
BL702/704/706 Reference Manual 10.3.9 DMA transfer mode UART supports DMA transfer mode. To use this mode, you need to set the thresholds of TX and RX FIFO through the bits <TFITH> and <RFITH> of the register UART_FIFO_CONFIG_1. When this mode is enabled, the UART will check the TX/RX FIFO.
Page 196
BL702/704/706 Reference Manual 10.4 Register description Description Name utx_config UART TX configuration register urx_config UART RX configuration register uart_bit_prd UART period control register data_config UART data configuration register utx_ir_position UART TX ir position control register urx_ir_position UART RX ir position control register...
Page 197
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:16 TXLEN 16’d0 Length of UART TX data transfer (Unit: character/byte) (Don’t-care if cr_utx_frm_en is enabled) 15:13 TXBCNTP 3’d4 UART TX BREAK bit count (for LIN protocol) Note: Additional 8 bit times will be added since LIN Break...
Page 198
BL702/704/706 Reference Manual Name Type Reset Description Bits DEGEN 1’b0 Enable signal of RXD input de-glitch function 10:8 RXBCNTD 3’d7 UART RX DATA bit count for each character IRRXINV 1’b0 Inverse signal of UART RX input in IR mode IRRXEN 1’b0...
Page 199
BL702/704/706 Reference Manual 10.4.4 data_config Address:0x4000a00c RSVD RSVD Name Type Reset Description Bits 31:1 RSVD BITINV 1’b0 Bit-inverse signal for each data byte 0: Each byte is sent out LSB-first 1: Each byte is sent out MSB-first 10.4.5 utx_ir_position Address:0x4000a010...
Page 200
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:16 RSVD 15:0 RXIRPS 16’d111 START position of UART RXD pulse recovered from IR sig- 10.4.7 urx_rto_timer Address:0x4000a018 RSVD RSVD RXRTOVA Name Type Reset Description Bits 31:8 RSVD RXRTOVA 8’d15 Time-out value for triggering RTO interrupt (unit: bit time) 10.4.8 uart_sw_mode...
Page 201
BL702/704/706 Reference Manual 10.4.9 uart_int_sts Address:0x4000a020 RSVD RSVD RLSE RFER TFIN RPCE RRTO RFIN TFIN REIN TEIN Name Type Reset Description Bits 31:9 RSVD RLSEINT 1’b0 UART RX LIN mode sync field error interrupt RFERINT 1’b0 UART RX FIFO error interrupt, auto-cleared when FIFO...
Page 202
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:9 RSVD RLSEMASK 1’b1 Interrupt mask of urx_lse_int RFERMASK 1’b1 Interrupt mask of urx_fer_int TFERMASK 1’b1 Interrupt mask of utx_fer_int RPCEMASK 1’b1 Interrupt mask of urx_pce_int RRTOMASK 1’b1 Interrupt mask of urx_rto_int RFMS 1’b1...
Page 203
BL702/704/706 Reference Manual 10.4.12 uart_int_en Address:0x4000a02c RSVD RSVD RLSE RFER TFER RPCE RRTO RFIF TFIF REND TEND Name Type Reset Description Bits 31:9 RSVD RLSE 1’b1 Interrupt enable of urx_lse_int RFER 1’b1 Interrupt enable of urx_fer_int TFER 1’b1 Interrupt enable of utx_fer_int RPCE 1’b1...
Page 204
BL702/704/706 Reference Manual 10.4.14 sts_urx_abr_prd Address:0x4000a034 ABRPRD ABRPRDS Name Type Reset Description Bits 31:16 ABRPRD 16’d0 Bit period of Auto Baud Rate detection using codeword 0x55 15:0 ABRPRDS 16’d0 Bit period of Auto Baud Rate detection using START bit 10.4.15 uart_fifo_config_0 Address:0x4000a080...
Page 205
BL702/704/706 Reference Manual 10.4.16 uart_fifo_config_1 Address:0x4000a084 RSVD RFITH RSVD TFITH RFICNT TFICNT Name Type Reset Description Bits RSVD 30:24 RFITH 7’d0 RX FIFO threshold, dma_rx_req will not be asserted if tx_- fifo_cnt is less than this value RSVD 22:16 TFITH 7’d0...
If two or more hosts are initialized at the same time, data transmission can prevent data from being destroyed through collision detection and arbitration. BL702 includes an I2C controller host, which can be flexibly configured with slaveAddr, subAddr, and data transmission to facilitate communication with slave devices. It provides 2 word depth fifo and provides interrupt functions. It can be used with DMA to improve efficiency and flexibly adjust clock frequency.
BL702/704/706 Reference Manual 11.3.1 Start and stop conditions All transfers begin with a START condition and end with a STOP condition. The start and stop conditions are generally generated by the master. The bus is considered to be in a busy state after the start condition, and is considered to be in an idle state for a period of time after the stop condition.
BL702/704/706 Reference Manual SLAVE ADDRESS DATA A/A DATA data transferred '0'(write) (n bytes + acknowledge) A = acknowledge(SDA LOW) from master to slave A = not acknowledge(SDA HIGH) S = START condition from slave to master P = STOP condition Fig.
BL702/704/706 Reference Manual master 1 loses arbitration DATA 1 ≠ SDA DATA1 DATA2 Fig. 11.5: Tx and Rx together 11.4 I2C clock setting The I2C clock is derived from bclk (bus clock), which can be divided based on the bclk clock.
Page 211
BL702/704/706 Reference Manual • Enable signal 11.5.2 Read and write flags I2C supports two working states: sending and receiving. Register PKTDIR indicates the sending or receiving status. When it is set to 0, it indicates the sending state, and when it is set to 1, it indicates the receiving state.
Page 212
BL702/704/706 Reference Manual 11.5.8 Enable signal After the above configurations are completed, write the enable signal register MEN to 1 to automatically start the I2C transmission process. When the read-write flag is set to 0, I2C sends data, and the host sends the process: 1.
Page 213
BL702/704/706 Reference Manual • TX FIFO underflow: When the size of the data filled in the TX FIFO does not meet the configured I2C data length PKTLEN, and there is no new data to be filled into the TX FIFO, the register TFIU will be set;...
Page 214
BL702/704/706 Reference Manual 11.7.2 DMA receiving process 1. Configure the read-write flag i2c_config[PKTDIR] to 1 2. Configure the slave device address i2c_config[SLVADDR] 3. Configure slave device register address i2c_sub_addr, slave device register address length i2c_config[SABC], configure slave device register address enable bit i2c_config[SAEN] to 1 4.
Page 215
BL702/704/706 Reference Manual Description Name i2c_bus_busy I2C bus busy control register i2c_prd_start I2C length of start phase i2c_prd_stop I2C length of stop phase i2c_prd_data I2C length of data phase i2c_fifo_config_0 I2C FIFO configuration register0 i2c_fifo_config_1 I2C FIFO configuration register1 i2c_fifo_wdata...
Page 216
BL702/704/706 Reference Manual Name Type Reset Description Bits DEGEN 1’b0 Enable signal of I2C input de-glitch function (for all input pins) PKTDIR 1’b1 Transfer direction of the packet 1’b0: Write; 1’b1: Read 1’b0 Enable signal of I2C Master function Asserting this bit will trigger the transaction, and should be de-asserted after finish 11.9.2 i2c_int_sts...
Page 217
BL702/704/706 Reference Manual Name Type Reset Description Bits NAKMASK 1’b1 Interrupt mask of i2c_nak_int RXFMASK 1’b1 Interrupt mask of i2c_rxf_int TXFMASK 1’b1 Interrupt mask of i2c_txf_int ENDMASK 1’b1 Interrupt mask of i2c_end_int RSVD FERINT 1’b0 I2C TX/RX FIFO error interrupt, auto-cleared when FIFO...
Page 218
BL702/704/706 Reference Manual 11.9.4 i2c_bus_busy Address:0x4000a30c RSVD RSVD BUSY BUSY Name Type Reset Description Bits 31:2 RSVD BUSYCLR 1’b0 Clear signal of bus_busy status, not for normal usage (in case I2C bus hangs) BUSY 1’b0 Indicator of I2C bus busy 11.9.5 i2c_prd_start...
Page 219
BL702/704/706 Reference Manual 11.9.6 i2c_prd_stop Address:0x4000a314 PRDPPH3 PRDPPH2 PRDPPH1 PRDPPH0 Name Type Reset Description Bits 31:24 PRDPPH3 8’d15 Length of STOP condition phase 3 23:16 PRDPPH2 8’d15 Length of STOP condition phase 2 15:8 PRDPPH1 8’d15 Length of STOP condition phase 1 PRDPPH0 8’d15...
Page 220
BL702/704/706 Reference Manual 11.9.8 i2c_fifo_config_0 Address:0x4000a380 RSVD RSVD RFIU RFIO TFIU TFIO DREN DTEN Name Type Reset Description Bits 31:8 RSVD RFIU 1’b0 Underflow flag of RX FIFO, can be cleared by rx_fifo_clr RFIO 1’b0 Overflow flag of RX FIFO, can be cleared by rx_fifo_clr TFIU 1’b0...
Page 221
BL702/704/706 Reference Manual Name Type Reset Description Bits 15:10 RSVD RFICNT 2’d0 RX FIFO available count RSVD TFICNT 2’d2 TX FIFO available count 11.9.10 i2c_fifo_wdata Address:0x4000a388 FIWD FIWD Name Type Reset Description Bits 31:0 FIWD I2C FIFO write data 11.9.11 i2c_fifo_rdata Address:0x4000a38c...
Page 222
Each counter has its own 16-bit frequency divider. The PWM counter will use the divided clock as the counting cycle unit, and perform one action every time a counting cycle passes . 222/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
BL702/704/706 Reference Manual 12.3.2 Pulse generation principle There is a counter in the PWM. When the counter is in the middle of two settable thresholds, the PWM output is 1, otherwise when the counter is outside the two set thresholds, the PWM output is 0. As shown below:...
BL702/704/706 Reference Manual 12.3.3 PWM interrupt For each PWM channel, you can set the cycle count value. When the cycle number of the PWM output reaches this count value, a PWM interrupt will be generated. Table 12.1: Duty Cycle Parameters Freq/MHz Supported duty cycle(n is an integer,and 2 <= n <= 65535^2)
Page 229
BL702/704/706 Reference Manual 12.4.8 pwm1_clkdiv Address:0x4000a440 RSVD CLKDIV Name Type Reset Description Bits 31:16 RSVD 15:0 CLKDIV 16’b0 PWM clock division 12.4.9 pwm1_thre1 Address:0x4000a444 RSVD THRE1 Name Type Reset Description Bits 31:16 RSVD 15:0 THRE1 16’b0 PWM first counter threshold, can’t be larger that pwm_thre2 12.4.10 pwm1_thre2...
Page 230
BL702/704/706 Reference Manual Name Type Reset Description Bits 15:0 THRE2 16’d0 PWM sencond counter threshold, can’t be smaller that pwm_thre1 12.4.11 pwm1_period Address:0x4000a44c RSVD PERIOD Name Type Reset Description Bits 31:16 RSVD 15:0 PERIOD 16’d0 PWM period setting 12.4.12 pwm1_config Address:0x4000a450...
Page 231
BL702/704/706 Reference Manual Name Type Reset Description Bits 12.4.13 pwm1_interrupt Address:0x4000a454 RSVD INTPECN Name Type Reset Description Bits 31:17 RSVD INTEN 1’b0 PWM interrupt enable 15:0 INTPECN 16’d0 PWM interrupt period counter threshold 12.4.14 pwm2_clkdiv Address:0x4000a460 RSVD CLKDIV Name Type...
Page 232
BL702/704/706 Reference Manual 12.4.15 pwm2_thre1 Address:0x4000a464 RSVD THRE1 Name Type Reset Description Bits 31:16 RSVD 15:0 THRE1 16’b0 PWM first counter threshold, can’t be larger that pwm_thre2 12.4.16 pwm2_thre2 Address:0x4000a468 RSVD THRE2 Name Type Reset Description Bits 31:16 RSVD 15:0 THRE2 16’d0...
Page 233
BL702/704/706 Reference Manual Name Type Reset Description Bits 15:0 PERIOD 16’d0 PWM period setting 12.4.18 pwm2_config Address:0x4000a470 RSVD RSVD STOP STOP STOP CLKSEL MODE FVAL MODE Name Type Reset Description Bits 31:8 RSVD STOPSTA 1’b0 PWM stop status STOPEN 1’b0...
Page 234
BL702/704/706 Reference Manual Name Type Reset Description Bits 15:0 INTPECN 16’d0 PWM interrupt period counter threshold 12.4.20 pwm3_clkdiv Address:0x4000a480 RSVD CLKDIV Name Type Reset Description Bits 31:16 RSVD 15:0 CLKDIV 16’b0 PWM clock division 12.4.21 pwm3_thre1 Address:0x4000a484 RSVD THRE1 Name...
Page 235
BL702/704/706 Reference Manual 12.4.22 pwm3_thre2 Address:0x4000a488 RSVD THRE2 Name Type Reset Description Bits 31:16 RSVD 15:0 THRE2 16’d0 PWM sencond counter threshold, can’t be smaller that pwm_thre1 12.4.23 pwm3_period Address:0x4000a48c RSVD PERIOD Name Type Reset Description Bits 31:16 RSVD 15:0 PERIOD 16’d0...
Page 236
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:8 RSVD STOPSTA 1’b0 PWM stop status STOPEN 1’b0 PWM stop enable SWMODE 1’b0 PWM SW Mode setting SWFVAL 1’b0 PWM SW Mode force value STOPMODE 1’b1 PWM stop mode, 1’b1 - graceful ; 1’b0 - abrupt OUTINV 1’b0...
Page 237
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:16 RSVD 15:0 CLKDIV 16’b0 PWM clock division 12.4.27 pwm4_thre1 Address:0x4000a4a4 RSVD THRE1 Name Type Reset Description Bits 31:16 RSVD 15:0 THRE1 16’b0 PWM first counter threshold, can’t be larger that pwm_thre2 12.4.28 pwm4_thre2...
Page 238
BL702/704/706 Reference Manual 12.4.29 pwm4_period Address:0x4000a4ac RSVD PERIOD Name Type Reset Description Bits 31:16 RSVD 15:0 PERIOD 16’d0 PWM period setting 12.4.30 pwm4_config Address:0x4000a4b0 RSVD RSVD STOP STOP STOP CLKSEL MODE FVAL MODE Name Type Reset Description Bits 31:8 RSVD STOPSTA 1’b0...
BL702/704/706 Reference Manual • Fclk--System master clock • 32K--32K clock • 1K--1K clock(32K frequency division) • Xtal--External crystal Each counter has its own 8-bit frequency divider. The selected clock can be divided by 1-256 through APB. Specifically, when it is set to 0, it means no frequency division, and when it is set to 1, it divides it by 2. The maximum frequency division coefficient is 256, the counter will use the divided clock as the unit of the counting cycle, each time a counting cycle is increased by one.
BL702/704/706 Reference Manual In FreeRun mode, the timer working sequence is basically the same as PreLoad, the difference is that the counter will start to accumulate from 0 to the maximum value. The mechanism of the generated compare flags and compare interrupts is the same as in PreLoad mode.
BL702/704/706 Reference Manual 13.3.5 Watchdog alarm A comparison value can be set for each counter. When the software fails to reset the watchdog counter to zero due to a system error, which causes the watchdog counter to exceed the comparison value, a watchdog alarm is triggered.
Page 245
BL702/704/706 Reference Manual Description Name TMR3_0 Timer3 match register 0 TMR3_1 Timer3 match register 1 TMR3_2 Timer3 match register 2 TCR2 Timer2 counter register TCR3 Timer3 counter register TMSR2 Timer2 match register status TMSR3 Timer3 match register status TIER2 Timer2 match interrupt enable register...
Page 246
BL702/704/706 Reference Manual Description Name TCVSYN2 Timer2 synchronous value of counter register TCVSYN3 Timer3 synchronous value of counter register TCDR WDT/Timer clock division register 13.4.1 TCCR Address:0x4000a500 RSVD RSVD CSWDT RSVD RSVD RSVD Name Type Reset Description Bits 31:10 RSVD CSWDT 2’d0...
Page 247
BL702/704/706 Reference Manual 13.4.2 TMR2_0 Address:0x4000a510 TMR20 TMR20 Name Type Reset Description Bits 31:0 TMR20 32’hffffffff Timer2 match register 0 13.4.3 TMR2_1 Address:0x4000a514 TMR21 TMR21 Name Type Reset Description Bits 31:0 TMR21 32’hffffffff Timer2 match register 1 13.4.4 TMR2_2 Address:0x4000a518...
Page 248
BL702/704/706 Reference Manual 13.4.5 TMR3_0 Address:0x4000a51c TMR30 TMR30 Name Type Reset Description Bits 31:0 TMR30 32’hffffffff Timer3 match register 0 13.4.6 TMR3_1 Address:0x4000a520 TMR31 TMR31 Name Type Reset Description Bits 31:0 TMR31 32’hffffffff Timer3 match register 1 13.4.7 TMR3_2 Address:0x4000a524...
Page 250
BL702/704/706 Reference Manual Name Type Reset Description Bits T2MR1S 1’b0 Timer2 match register 1 status/Clear interrupt would also clear this bit T2MR0S 1’b0 Timer2 match register 0 status/Clear interrupt would also clear this bit 13.4.11 TMSR3 Address:0x4000a53c RSVD RSVD Name...
Page 251
BL702/704/706 Reference Manual Name Type Reset Description Bits TIER21 1’b0 Timer2 match register 1 interrupt enable register TIER20 1’b0 Timer2 match register 0 interrupt enable register 13.4.13 TIER3 Address:0x4000a548 RSVD RSVD TIER TIER31 TIER30 Name Type Reset Description Bits 31:3...
Page 252
BL702/704/706 Reference Manual 13.4.15 TPLVR3 Address:0x4000a554 TPLVR3 TPLVR3 Name Type Reset Description Bits 31:0 TPLVR3 32’h0 Timer3 pre-load value register 13.4.16 TPLCR2 Address:0x4000a55c RSVD RSVD TPLCR2 Name Type Reset Description Bits 31:2 RSVD TPLCR2 2’h0 Timer2 pre-load control register 2’d0 - No pre-load 2’d1 - Pre-load with match comparator 0...
Page 253
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:2 RSVD TPLCR3 2’h0 Timer3 pre-load control register 2’d0 - No pre-load 2’d1 - Pre-load with match comparator 0 2’d2 - Pre-load with match comparator 1 2’d3 - Pre-load with match comparator 2 13.4.18 WMER...
Page 254
BL702/704/706 Reference Manual 13.4.20 WVR Address:0x4000a56c RSVD Name Type Reset Description Bits 31:16 RSVD 15:0 16’h0 WDT counter value register 13.4.21 WSR Address:0x4000a570 RSVD RSVD Name Type Reset Description Bits 31:1 RSVD 1’b0 WDT timer reset indication, Indicates that reset was caused by the WDT.
Page 255
BL702/704/706 Reference Manual 13.4.22 TICR2 Address:0x4000a578 RSVD RSVD TCLR TCLR TCLR Name Type Reset Description Bits 31:3 RSVD TCLR22 1’b0 Timer2 Interrupt clear for match comparator 2 TCLR21 1’b0 Timer2 Interrupt clear for match comparator 1 TCLR20 1’b0 Timer2 Interrupt clear for match comparator 0 13.4.23 TICR3...
Page 260
BL702/704/706 Reference Manual 13.4.33 TCVWR3 Address:0x4000a5ac TCVWR3 TCVWR3 Name Type Reset Description Bits 31:0 TCVWR3 32’h0 Timer3 capture value of counter 13.4.34 TCVSYN2 Address:0x4000a5b4 TCVSYN2 TCVSYN2 Name Type Reset Description Bits 31:0 TCVSYN2 32’h0 Timer2 synchronous value of counter 13.4.35 TCVSYN3 Address:0x4000a5b8...
Page 261
BL702/704/706 Reference Manual 13.4.36 TCDR Address:0x4000a5bc WCDR TCDR3 TCDR2 RSVD Name Type Reset Description Bits 31:24 WCDR 8’h0 WDT clock division value register 23:16 TCDR3 8’h0 Timer3 clock division value register 15:8 TCDR2 8’h0 Timer2 clock division value register RSVD...
Page 262
• Built-in a LED function that can flash with sampling (LED on/off 0~511 us/sample) • Interrupt can be configured (sample interrupt, report interrupt, error interrupt, overflow interrupt) • Can be configured as a wake-up source for PDS (clock source needs to be configured as 32k) 262/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
Page 263
BL702/704/706 Reference Manual 14.3 QDEC function description The expected operating frequency of QDEC is 1MHz, and the faster the detection speed, the higher the operating frequency required. Each sampling will decode the A/B two-phase pulse output by the encoder into high and low levels. Compare the previous sampling results to get the current encoder rotation direction and pulse count change (clockwise rotation +1, counterclockwise rotation -1 , No change, no change, error report and count).
BL702/704/706 Reference Manual Phase A Phase A Phase B Quadrature Encoder Quadrature decoder Phase B QDEC work at 1MHz = XCLK/(div+1) led_period XCLK select 32MHz div is 31 spl_period: 0: 32 us/sample 1: 64 us/sample 2: 128 us/sample 3: 256 us/sample...
Page 265
BL702/704/706 Reference Manual Description Name qdec1_value QDEC1 value qdec1_int_en QDEC1 interrupt enable qdec1_int_sts QDEC1 interrupt status qdec1_int_clr QDEC1 interrupt clear qdec2_ctrl0 QDEC2 control0 qdec2_ctrl1 QDEC2 control1 qdec2_value QDEC2 value qdec2_int_en QDEC2 interrupt enable qdec2_int_sts QDEC2 interrupt status qdec2_int_clr QDEC2 interrupt clear 14.4.1 qdec0_ctrl0...
Page 266
BL702/704/706 Reference Manual Name Type Reset Description Bits 11:8 4’h2 ”SPL” sample period in [us/sample]. The SAMPLE register will be updated for every new sample (at 1MHz) 0: 32 us 1: 64 2: 128 3: 256 4: 512 5: 1 ms...
Page 267
BL702/704/706 Reference Manual Name Type Reset Description Bits spl option 0: Stop sample if rpt_rdy 1: Continue sample acc option 0: Stop accumulate if overflow 1: Continue ac- cumulate 14.4.3 qdec0_value Address:0x4000a808 RSVD SPLVAL RSVD ACC2VAL ACC1VAL Name Type Reset...
Page 268
BL702/704/706 Reference Manual Name Type Reset Description Bits OFEN overflow interrupt enable DREN double error interrupt enable SREN sample interrupt enable RREN report interrupt enable 14.4.5 qdec0_int_sts Address:0x4000a814 RSVD RSVD Name Type Reset Description Bits 31:4 RSVD OFSTS ACC1 or ACC2 overflow...
Page 269
BL702/704/706 Reference Manual Name Type Reset Description Bits DRCL double error interrupt clear SRCL sample interrupt clear RRCL report interrupt clear 14.4.7 qdec1_ctrl0 Address:0x4000a840 RSVD DEGCNT QDEC Name Type Reset Description Bits 31:28 RSVD 27:12 16’d10 ”RPT” report period in [samples/report]. Specifies the num-...
Page 270
BL702/704/706 Reference Manual Name Type Reset Description Bits LEDEN qdec led enable QDECEN qdec enable 14.4.8 qdec1_ctrl1 Address:0x4000a844 RSVD LEDPED RSVD Name Type Reset Description Bits 31:25 RSVD 24:16 LEDPED Period in us the LED is switched on prior to sampling...
Page 271
BL702/704/706 Reference Manual Name Type Reset Description Bits 29:28 SPLVAL Sample value. Direction of last change 00: no change 01: clockwise 11: counter-clockwise 10: Error 27:20 RSVD 19:16 ACC2VAL Double error accumulation (0 15) 15:0 ACC1VAL Sample accumulation (-32768 32767) clockwise +1, counter-clockwise -1 14.4.10 qdec1_int_en...
Page 272
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:4 RSVD OFSTS ACC1 or ACC2 overflow DRSTS ACC2 double error SRSTS Event being generated for every new sample value written to the SAMPLE register RRSTS Non-null report ready 14.4.12 qdec1_int_clr Address:0x4000a858...
Page 273
BL702/704/706 Reference Manual Name Type Reset Description Bits 27:12 16’d10 ”RPT” report period in [samples/report]. Specifies the num- ber of samples to be accumulated in the ACC1 register be- fore the RPT_RDY and DBL_RDY events can be generated ”RPT_US” report period in [us/report] = SP * RP 11:8 4’h2...
Page 274
BL702/704/706 Reference Manual Name Type Reset Description Bits input a/b swap rpt option 0: Count time only if sample change 1: Continue time spl option 0: Stop sample if rpt_rdy 1: Continue sample acc option 0: Stop accumulate if overflow 1: Continue ac- cumulate 14.4.15 qdec2_value...
Page 277
GPIO with the function of ROW_0, that is, from any one of GPIO0/GPIO8/GPIO16/GPIO24. The column pins need to be selected in order from the GPIO with the function of COL_0, that is, from any one of GPIO0/GPIO20. 277/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
Page 278
BL702/704/706 Reference Manual 15.3.3 Key value The key value will be stored in the register KEYCODE_VALUE, every 8 bits is a key value, and the first key value will be stored in the lowest 8 bits. When the bit corresponding to the serial number in the register KEYCODE_CLR is set to one, the corresponding key value and interrupt flag bit will be cleared.
Page 279
BL702/704/706 Reference Manual Name Type Reset Description Bits RCEXT 2’d3 idle duration between column scans DEGCNT deglitch count DEGEN deglitch GHEN ghost key event detection RSVD KSEN Keyscan en 15.4.2 ks_int_en Address:0x4000a910 RSVD RSVD KSIT Name Type Reset Description Bits...
Page 280
BL702/704/706 Reference Manual 15.4.4 keycode_clr Address:0x4000a918 RSVD RSVD KCCLR Name Type Reset Description Bits 31:4 RSVD KCCLR Keycode clear 15.4.5 keycode_value Address:0x4000a91c Name Type Reset Description Bits 31:24 8’hff Col = keycode / (row_num+1) Row = keycode % (row_num+1) 23:16 8’hff...
• The width of the data transmission FIFO is 32 bits and the depth is 16 • The width of the data receiving FIFO is 32 bits and the depth is 16 16.3 I2S function description Table 16.1: I2S pin list 281/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
Page 282
BL702/704/706 Reference Manual Name Type Description I2Sx_DI input Serial data input I2Sx_DO output Serial data output I2Sx_BCLK input/output Synchronous transmission clock, output when used as a master, and input when used as a slave I2Sx_FS input/output Data start/end signal, output when used as master, input when used as slave 16.4 Register description...
Page 284
BL702/704/706 Reference Manual Name Type Reset Description Bits TXDEN 1’b0 Enable signal of I2S TXD signal SLAEN 1’b0 Enable signal of I2S Slave function, cannot enable both csr_i2s_m_en & csr_i2s_s_en MASEN 1’b0 Enable signal of I2S Master function, cannot enable both csr_i2s_m_en &...
Page 285
BL702/704/706 Reference Manual 16.4.3 i2s_bclk_config Address:0x4000aa10 RSVD BDIVH RSVD BDIVL Name Type Reset Description Bits 31:28 RSVD 27:16 BDIVH 12’d1 I2S BCLK active high period (unit: cycle of i2s_clk) 15:12 RSVD 11:0 BDIVL 12’d1 I2S BCLK active low period (unit: cycle of i2s_clk) 16.4.4 i2s_fifo_config_0...
Page 286
BL702/704/706 Reference Manual Name Type Reset Description Bits LRMG 1’b0 Each FIFO entry contains both L/R channel data if this bit is enabled Can only be enabled if data size is 8 or 16 bits Note: cr_fifo_lr_merge &cr_mono_mode should NOT be enabled at the same time Note: cr_fifo_lr_merge &cr_fifo_l_shift should NOT be en-...
Page 287
BL702/704/706 Reference Manual 16.4.6 i2s_fifo_wdata Address:0x4000aa88 FIWD FIWD Name Type Reset Description Bits 31:0 FIWD I2S FIFO write data 16.4.7 i2s_fifo_rdata Address:0x4000aa8c FIRD FIRD Name Type Reset Description Bits 31:0 FIRD 32’h0 I2S FIFO read data 16.4.8 i2s_io_config Address:0x4000aafc RSVD...
Page 288
BL702/704/706 Reference Manual Name Type Reset Description Bits DEGCNT 3’d0 Deglitch cycle count (unit: cycle of I2S kernel clock) 3’d0: 1 cycle 3’d1: 2 cycles … BCLKINV 1’b0 Inverse BCLK signal 0: No inverse, 1: Inverse FSINV 1’b0 Inverse FS signal...
Page 289
• Support 10Mbps and 100Mbps Ethernet • Support half duplex and full duplex • In full duplex mode, support automatic flow control and control frame generation • Support collision detection and retransmission in half-duplex mode 289/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
Page 290
BL702/704/706 Reference Manual • Support CRC generation and verification • Data frame preamble generation and removal • When sending, automatically expand short data frames • Detect too long or too short data frame (length limit) • Can transmit long data frames (> standard Ethernet frame length) •...
BL702/704/706 Reference Manual Ethernet Core Tx Data Tx Data Tx Control Signals Tx PHY TX Ethernet MAC Control Tx Control Signals Signals Tx Control Signals MAC Control Module (Flow control) Host Interface Ethernet Ethernet PHY Rx Data Tx Control Signals...
BL702/704/706 Reference Manual The send and receive buffer descriptor group is connected to the external RAM, which is used to store the Ethernet data frames sent and received. Each descriptor contains the corresponding control status word and the corresponding buffer memory address. There are 128 groups of descriptors, which can be flexibly allocated for sending or receiving.
BL702/704/706 Reference Manual Table 17.1: Transmission signal RMII Name ECOL ECOL: collision detection ERXDV ERXDV: data valid ECRSDV: Carrier detect/data valid ERX0-ERX3 ERX0-ERX3: 4-bit receive data ERX0-ERX1: 2-bit receive data ERXER ERXER: Receive error indication ERXER: Receive error indication ERXCK...
Page 294
BL702/704/706 Reference Manual 17.7.2 Send data frame • Configure bit fields such as data frame format and interval in the EMAC_MODE register • By configuring the TXBDNUM field in the EMAC_TX_BD_NUM register to specify the number of BDs used for transmission, the remaining BDs are RX BDs •...
Page 295
BL702/704/706 Reference Manual • In particular, if it is the last valid receiving BD, the WR bit needs to be set, and EMAC will ”wrap around” to the first receiving BD for processing after processing this BD • If there are multiple BDs available to receive data, repeat the steps of setting BD to fill all BDs •...
Page 296
BL702/704/706 Reference Manual Description Name TXCTRL TX control 17.8.1 MODE Address:0x4000d000 RSVD RMII RECS MALL RSVD FULL RSVD RSVD TXEN RXEN Name Type Reset Description Bits 31:18 RSVD RMIIEN 1’b0 RMII mode enable 0: MII PHY I/F is used 1: RMII PHY I/F is used RECSMALL 1’b0...
Page 297
BL702/704/706 Reference Manual Name Type Reset Description Bits 1’b0 Inter frame gap check 0: IFG is verified before each frame be received. 1: All frames are received regardless to IFG requirement. 1’b0 Promiscuous mode enable 0: The destination address is checked before receiving.
Page 298
BL702/704/706 Reference Manual Name Type Reset Description Bits 1’b0 Receive control frame This bit indicates that the control frame was received. It is cleared by writing 1 to it. Bit RXFLOW in the CTRLMODE register must be set to 1 in order to get the RXC bit set.
Page 299
BL702/704/706 Reference Manual 17.8.3 INT_MASK Address:0x4000d008 RSVD RSVD RXCM TXCM RXEM RXBM TXEM TXBM Name Type Reset Description Bits 31:7 RSVD RXCM 1’b1 Receive control frame mask ENABLE 0: Interrupt is un-masked 1: Interrupt is masked TXCM 1’b1 Transmit control frame mask ENABLE...
Page 300
BL702/704/706 Reference Manual 17.8.4 IPGT Address:0x4000d00c RSVD RSVD IPGT Name Type Reset Description Bits 31:7 RSVD IPGT 7’h18 Inter packet gap The recommended value is 0x18 (24 clock cycles), which equals 9.6 us for 10 Mbps and 0.96 us for 100 Mbps mode 17.8.5 PACKETLEN...
Page 301
BL702/704/706 Reference Manual 17.8.6 COLLCONFIG Address:0x4000d01c RSVD MAXRET RSVD COLLVAL Name Type Reset Description Bits 31:20 RSVD 19:16 MAXRET 4’hF Maximum retry This field specifies the maximum number of consequential retransmission attempts after the collision is detected. When the maximum number has been reached, the TX MAC reports an error and stops transmitting the current packet.
Page 302
BL702/704/706 Reference Manual Name Type Reset Description Bits RSVD 22:16 TXBDPTR 7’h0 TX buffer descriptors (BD) pointer, pointing at the TXBD currently being used 15:8 RSVD TXBDNUM 8’h40 TX buffer descriptors (BD) number Number of TX BD. TX and RX share 128 (0x80) descriptors, so the number of RX BD equals 0x80 - TXBDNUM.
Page 303
BL702/704/706 Reference Manual 17.8.9 MIICOMMAND Address:0x4000d02c RSVD RSVD WCTR RSTA SCAS DATA Name Type Reset Description Bits 31:3 RSVD WCTRDATA 1’b0 Write control data, setting this bit to 1 will trigger the com- mand (auto cleared) Note: [2]/[1]/[0] cannot be asserted at the same time, exe-...
Page 304
BL702/704/706 Reference Manual 17.8.11 MIITX_DATA Address:0x4000d034 RSVD CTRLDATA Name Type Reset Description Bits 31:16 RSVD 15:0 CTRLDATA 16’h0 Control Data to be written to PHY 17.8.12 MIIRX_DATA Address:0x4000d038 RSVD PRSD Name Type Reset Description Bits 31:16 RSVD 15:0 PRSD 16’h0 Received Data from PHY 17.8.13 MIISTATUS...
Page 305
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:2 RSVD MIIMBUSY 1’b0 MIIM I/F busy signal 0: The MIIM I/F is ready. 1: The MIIM I/F is busy. MIIMLF 1’b0 MIIM I/F link fail signal 17.8.14 MAC_ADDR0 Address:0x4000d040 MACB2 MACB3...
Page 306
BL702/704/706 Reference Manual 17.8.16 HASH0_ADDR Address:0x4000d048 HASH0 HASH0 Name Type Reset Description Bits 31:0 HASH0 32’h0 Lower 32-bit of HASH register 17.8.17 HASH1_ADDR Address:0x4000d04c HASH1 HASH1 Name Type Reset Description Bits 31:0 HASH1 32’h0 Upper 32-bit of HASH register 17.8.18 TXCTRL Address:0x4000d050...
Page 307
BL702/704/706 Reference Manual Name Type Reset Description Bits TXPRQ 1’b0 TX Pause Request Writing 1 to this bit starts sending control frame and is au- tomatically cleared to zero. 15:0 TXPTV 16’h0 TX Pause Timer Value The value that is sent in the pause control frame.
Page 308
1. Configure the internal transceiver, the corresponding addresses are 0x40000228 and 0x4000022C 2. Configure usb_config and epx_config of each endpoint 3. Configure USB interrupt related registers 4. Configure USB DMA related (optional) 5. Configure GPIO as USB function (internal transmitter----function is 10) 308/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
Page 309
BL702/704/706 Reference Manual 6. 0x40000228[20]usb_enum is set to 1, so that the host recognizes that the USB device is inserted and triggers the enumeration process 18.3.2 Part of the register configuration and function description • swrdy:Read only, only when this bit is 0, can write 1 to cr_usb_ep0_sw_rdy •...
Page 311
BL702/704/706 Reference Manual 18.3.3 USB enumeration phase interrupt processing flow 1. The first is a reset of more than 10ms, which will trigger the reset interrupt. 2. When the reset ends, the reset end interrupt will be triggered. 3. The SETUP transaction, IN transaction, and OUT transaction of the enumeration process will trigger e0sdit, e0icit, and ep0dit respectively.
Page 312
BL702/704/706 Reference Manual – Clear interrupt flag – Exit interrupt • EPx(x=1...7)——IN transaction data transmission: – Enter interrupt – Determine the epxcit interrupt flag bit – Wait for exrs to be 0 before writing data to extfw (exs needs to be changed to 1 only when only 1 byte is sent) –...
BL702/704/706 Reference Manual Only a er swrdy=0 can you fill in data to e0 w; Se ng a crsr a er the data is filled will make the handshake phase reply ACK; device -> host host -> device host -> device...
BL702/704/706 Reference Manual Table 18.2: Register configuration 2 usb_xcvr_config value usb_v_hys_m Note: You need to set pu_usb and usb_enum to one when you are ready to open the internal transceiver. 18.4 Register description Description Name usb_config USB configuration usb_lpm_config USB lpm configuration...
Page 316
BL702/704/706 Reference Manual Description Name ep1_fifo_status EP1 fifo status ep1_tx_fifo_wdata EP1 tx fifo write data ep1_rx_fifo_rdata EP1 rx fifo write data ep2_fifo_config EP2 fifo configuration ep2_fifo_status EP2 fifo status ep2_tx_fifo_wdata EP2 tx fifo write data ep2_rx_fifo_rdata EP2 rx fifo write data...
Page 317
BL702/704/706 Reference Manual 18.4.1 usb_config Address:0x4000d800 RSVD CRSR E0SS E0SIZE EOSWADDR E0SC RSVD RBEN RSVD Name Type Reset Description Bits 31:29 RSVD SWRDY 1’b0 EP0 transaction ready status bit. Asserted with sw_rdy, and de-asserted when ACK is sent/received. CRSR 1’b0 EP0 transaction ready.
Page 318
BL702/704/706 Reference Manual Name Type Reset Description Bits E0SC 1’b0 EP0 software control enable 1’b1: EP0 IN/OUT transaction is fully contolled by SW 1’b0: EP0 IN/OUT transaction is controlled by HW must be 1 RSVD RBEN 1’b1 Enable signal of ROM-based descriptors (don’t care if ep0_- sw_ctrl is asserted) 1’b1: USB descriptors stored in ROM will be used...
Page 320
BL702/704/706 Reference Manual 18.4.5 usb_error Address:0x4000d81c RSVD RSVD CRC16 CRC5 PCSE PSEO IEEO TTEO UREO Name Type Reset Description Bits 31:7 RSVD CRC16ERR 1’b0 Data CRC error occurs, cleared by cr_usb_err_clr, enabled by ueen CRC5ERR 1’b0 Token CRC error occurs, cleared by cr_usb_err_clr, en-...
Page 321
BL702/704/706 Reference Manual Name Type Reset Description Bits UEEN 1’b1 Interrupt enable of usb_err_int S3EN 1’b0 Interrupt enable of sof_3ms_int SOF is absent for 3 times (3ms) interrupt enable LPEN 1’b0 Interrupt enable of lpm_pkt_int receive link power mangement packet interrupt enable LWEN 1’b0...
Page 322
BL702/704/706 Reference Manual Name Type Reset Description Bits VTEN 1’b1 Interrupt enable of vbus_tgl_int vbus voltage toggle interrupt enable, for detect equipment plug UREN 1’b1 Interrupt enable of usb_reset_int reset interrupt enable 1’b1 Interrupt enable of sof_int SOF interrupt enable 18.4.7 usb_int_sts...
Page 323
BL702/704/706 Reference Manual Name Type Reset Description Bits EP3CIT 1’b0 EP3 IN or OUT command is received EP2DIT 1’b0 EP2 IN or OUT command is finished EP2CIT 1’b0 EP2 IN or OUT command is received EP1DIT 1’b0 EP1 IN or OUT command is finished EP1CIT 1’b0...
Page 324
BL702/704/706 Reference Manual Name Type Reset Description Bits E7DM 1’b1 Interrupt mask of ep7_done_int E7CM 1’b1 Interrupt mask of ep7_cmd_int E6DM 1’b1 Interrupt mask of ep6_done_int E6CM 1’b1 Interrupt mask of ep6_cmd_int E5DM 1’b1 Interrupt mask of ep5_done_int E5CM 1’b1...
Page 325
BL702/704/706 Reference Manual Name Type Reset Description Bits 1’b0 Interrupt clear of usb_err_int 1’b0 Interrupt clear of sof_3ms_int 1’b0 Interrupt clear of lpm_pkt_int 1’b0 Interrupt clear of lpm_wkup_int 1’b0 Interrupt clear of usb_rend_int 26:24 RSVD E7DC 1’b0 Interrupt clear of ep7_done_int E7CC 1’b0...
Page 326
BL702/704/706 Reference Manual 18.4.10 ep1_config Address:0x4000d840 RSVD EPRS ENRE ESRE EPMP Name Type Reset Description Bits 31:20 RSVD EPRS 1’b0 Endpoint ready status bit. Asserted with ep_rdy, and de- asserted when ACK is sent/received. 1’b0 Endpoint ready. When Endpoint NACK is enabled, assert-...
Page 327
BL702/704/706 Reference Manual 18.4.11 ep2_config Address:0x4000d844 RSVD E2RS Name Type Reset Description Bits 31:20 RSVD E2RS 1’b0 Endpoint ready status bit. Asserted with ep_rdy, and de- asserted when ACK is sent/received. 1’b0 Endpoint ready. When Endpoint NACK is enabled, assert- ing this bit will allow one packet to be transferred 1’b1...
Page 328
BL702/704/706 Reference Manual 18.4.12 ep3_config Address:0x4000d848 RSVD E3RS E3RS Name Type Reset Description Bits 31:20 RSVD E3RS 1’b0 Endpoint ready status bit. Asserted with ep_rdy, and de- asserted when ACK is sent/received. E3RS 1’b0 Endpoint ready. When Endpoint NACK is enabled, assert- ing this bit will allow one packet to be transferred 1’b1...
Page 329
BL702/704/706 Reference Manual 18.4.13 ep4_config Address:0x4000d84c RSVD E4RS Name Type Reset Description Bits 31:20 RSVD E4RS 1’b0 Endpoint ready status bit. Asserted with ep_rdy, and de- asserted when ACK is sent/received. 1’b0 Endpoint ready. When Endpoint NACK is enabled, assert- ing this bit will allow one packet to be transferred 1’b1...
Page 330
BL702/704/706 Reference Manual 18.4.14 ep5_config Address:0x4000d850 RSVD E5RS E5RS Name Type Reset Description Bits 31:20 RSVD E5RS 1’b0 Endpoint ready status bit. Asserted with ep_rdy, and de- asserted when ACK is sent/received. E5RS 1’b0 Endpoint ready. When Endpoint NACK is enabled, assert- ing this bit will allow one packet to be transferred 1’b1...
Page 331
BL702/704/706 Reference Manual 18.4.15 ep6_config Address:0x4000d854 RSVD E6RS Name Type Reset Description Bits 31:20 RSVD E6RS 1’b0 Endpoint ready status bit. Asserted with ep_rdy, and de- asserted when ACK is sent/received. 1’b0 Endpoint ready. When Endpoint NACK is enabled, assert- ing this bit will allow one packet to be transferred 1’b1...
Page 332
BL702/704/706 Reference Manual 18.4.16 ep7_config Address:0x4000d858 RSVD E7RS Name Type Reset Description Bits 31:20 RSVD E7RS 1’b0 Endpoint ready status bit. Asserted with ep_rdy, and de- asserted when ACK is sent/received. 1’b0 Endpoint ready. When Endpoint NACK is enabled, assert- ing this bit will allow one packet to be transferred 1’b1...
Page 333
BL702/704/706 Reference Manual 18.4.17 ep0_fifo_config Address:0x4000d900 RSVD RSVD DREN DTEN Name Type Reset Description Bits 31:8 RSVD E0RFU 1’b0 Underflow flag of RX FIFO, can be cleared by rx_fifo_clr E0RFO 1’b0 Overflow flag of RX FIFO, can be cleared by rx_fifo_clr E0TFU 1’b0...
Page 334
BL702/704/706 Reference Manual Name Type Reset Description Bits 22:16 E0RFC 7’d0 RX FIFO available count E0TFF 1’b0 TX FIFO full flag E0TFE 1’b1 TX FIFO empty flag 13:7 RSVD E0TFC 7’d64 TX FIFO available count 18.4.19 ep0_tx_fifo_wdata Address:0x4000d908 RSVD RSVD...
Page 335
BL702/704/706 Reference Manual 18.4.21 ep1_fifo_config Address:0x4000d910 RSVD RSVD DREN DTEN Name Type Reset Description Bits 31:8 RSVD E1RFU 1’b0 Underflow flag of RX FIFO, can be cleared by rx_fifo_clr E1RFO 1’b0 Overflow flag of RX FIFO, can be cleared by rx_fifo_clr E1TFU 1’b0...
Page 336
BL702/704/706 Reference Manual Name Type Reset Description Bits 22:16 E1RFC 7’d0 RX FIFO available count E1TFF 1’b0 TX FIFO full flag E1TFE 1’b1 TX FIFO empty flag 13:7 RSVD E1TFC 7’d64 TX FIFO available count 18.4.23 ep1_tx_fifo_wdata Address:0x4000d918 RSVD RSVD...
Page 337
BL702/704/706 Reference Manual 18.4.25 ep2_fifo_config Address:0x4000d920 RSVD RSVD DREN DTEN Name Type Reset Description Bits 31:8 RSVD E2RFU 1’b0 Underflow flag of RX FIFO, can be cleared by rx_fifo_clr E2RFO 1’b0 Overflow flag of RX FIFO, can be cleared by rx_fifo_clr E2TFU 1’b0...
Page 338
BL702/704/706 Reference Manual Name Type Reset Description Bits 22:16 E2RFC 7’d0 RX FIFO available count E2TFF 1’b0 TX FIFO full flag E2TFE 1’b1 TX FIFO empty flag 13:7 RSVD E2TFC 7’d64 TX FIFO available count 18.4.27 ep2_tx_fifo_wdata Address:0x4000d928 RSVD RSVD...
Page 339
BL702/704/706 Reference Manual 18.4.29 ep3_fifo_config Address:0x4000d930 RSVD RSVD DTEN DTEN Name Type Reset Description Bits 31:8 RSVD E3RFU 1’b0 Underflow flag of RX FIFO, can be cleared by rx_fifo_clr E3RFO 1’b0 Overflow flag of RX FIFO, can be cleared by rx_fifo_clr E3TFU 1’b0...
Page 340
BL702/704/706 Reference Manual Name Type Reset Description Bits 22:16 E3RFC 7’d0 RX FIFO available count E3TFF 1’b0 TX FIFO full flag E3TFE 1’b1 TX FIFO empty flag 13:7 RSVD E3TFC 7’d64 TX FIFO available count 18.4.31 ep3_tx_fifo_wdata Address:0x4000d938 RSVD RSVD...
Page 341
BL702/704/706 Reference Manual 18.4.33 ep4_fifo_config Address:0x4000d940 RSVD RSVD DREN DTEN Name Type Reset Description Bits 31:8 RSVD E4RFU 1’b0 Underflow flag of RX FIFO, can be cleared by rx_fifo_clr E4RFO 1’b0 Overflow flag of RX FIFO, can be cleared by rx_fifo_clr E4TFU 1’b0...
Page 342
BL702/704/706 Reference Manual Name Type Reset Description Bits 22:16 E4RFC 7’d0 RX FIFO available count E4TFF 1’b0 TX FIFO full flag E4TFE 1’b1 TX FIFO empty flag 13:7 RSVD E4TFC 7’d64 TX FIFO available count 18.4.35 ep4_tx_fifo_wdata Address:0x4000d948 RSVD RSVD...
Page 343
BL702/704/706 Reference Manual 18.4.37 ep5_fifo_config Address:0x4000d950 RSVD RSVD DREN DTEN Name Type Reset Description Bits 31:8 RSVD E5RFU 1’b0 Underflow flag of RX FIFO, can be cleared by rx_fifo_clr E5RFO 1’b0 Overflow flag of RX FIFO, can be cleared by rx_fifo_clr E5TFU 1’b0...
Page 344
BL702/704/706 Reference Manual Name Type Reset Description Bits 22:16 E5RFC 7’d0 RX FIFO available count E5TFF 1’b0 TX FIFO full flag E5TFE 1’b1 TX FIFO empty flag 13:7 RSVD E5TFC 7’d64 TX FIFO available count 18.4.39 ep5_tx_fifo_wdata Address:0x4000d958 RSVD RSVD...
Page 345
BL702/704/706 Reference Manual 18.4.41 ep6_fifo_config Address:0x4000d960 RSVD RSVD DREN DTEN Name Type Reset Description Bits 31:8 RSVD E6RFU 1’b0 Underflow flag of RX FIFO, can be cleared by rx_fifo_clr E6RFO 1’b0 Overflow flag of RX FIFO, can be cleared by rx_fifo_clr E6TFU 1’b0...
Page 346
BL702/704/706 Reference Manual Name Type Reset Description Bits 22:16 E6RFC 7’d0 RX FIFO available count E6TFF 1’b0 TX FIFO full flag E6TFE 1’b1 TX FIFO empty flag 13:7 RSVD E6TFC 7’d64 TX FIFO available count 18.4.43 ep6_tx_fifo_wdata Address:0x4000d968 RSVD RSVD...
Page 347
BL702/704/706 Reference Manual 18.4.45 ep7_fifo_config Address:0x4000d970 RSVD RSVD DREN DTEN Name Type Reset Description Bits 31:8 RSVD E7RFU 1’b0 Underflow flag of RX FIFO, can be cleared by rx_fifo_clr E7RFO 1’b0 Overflow flag of RX FIFO, can be cleared by rx_fifo_clr E7TFU 1’b0...
Page 348
BL702/704/706 Reference Manual Name Type Reset Description Bits 22:16 E7RFC 7’d0 RX FIFO available count E7TFF 1’b0 TX FIFO full flag E7TFE 1’b1 TX FIFO empty flag 13:7 RSVD E7TFC 7’d64 TX FIFO available count 18.4.47 ep7_tx_fifo_wdata Address:0x4000d978 RSVD RSVD...
Working Mode Natural wake up Idle Power Saving Mode Sleep Mode interrupt Fig. 19.1: Low power mode 349/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
Page 350
• Sleep Control (HBN): Contains 3 levels of HBN0/1/2, global power saving, long response time 19.3 Function description 19.3.1 Power domain There are 9 power domains in BL702, and the main functions of each power domain are as follows: • PD_AON – HBN state machine controls power/isolation/reset/clock –...
BL702/704/706 Reference Manual – Peripherals (analog part) • PD_CPU – CPU/Cache Controller – ROM/High-speed RAM • PD_BZ – Bluetooth and ZigBee • PD_USB – USB Each power domain is controlled by 9 different power modes. The specific control methods are shown in the following table: Table 19.1: Power mode...
Page 352
BL702/704/706 Reference Manual 19.3.2 Wakeup source The chip supports multiple wake-up sources and can wake up from different power modes. The CPU will not reset after the PDS0/1/2/3 mode wakes up, and the CPU will reset after the PDS4/5/6/7/31 and HBN0/1/2 modes wake up.
Page 353
BL702/704/706 Reference Manual time delay. 1. Enter sleep mode The software can make this module enter the power-down mode through PDS configuration and wait for processing. After entering the waiting interrupt mode (WFI), the PDS module will trigger the clock control module to enter the gate clock operation and notify the analog circuit to turn off the PLL and external crystal oscillator.
Page 354
BL702/704/706 Reference Manual Description Name RTC_TIME_L RTC time latched value RTC_TIME_H RTC time latched value HBN_IRQ_MODE HBN irq mode HBN_IRQ_STAT HBN irq state HBN_IRQ_CLR HBN irq clear HBN_PIR_CFG HBN pir configuration HBN_PIR_VTH PIR compare threshold HBN_PIR_INTERVAL PIR interval HBN_MISC HBN misc configuration...
Page 355
BL702/704/706 Reference Manual Name Type Reset Description Bits POFFVRT Set 1 to disable power off VDDCORE_RT at HBN mode (for low power) POFFVCOR Set 1 to disable power off VDDCORE at HBN mode (for debug) SRST soft reset POFFHRTC Power Off HBN RTC @ Enter hibernate...
Page 356
BL702/704/706 Reference Manual Name Type Reset Description Bits 31:8 RSVD HBNTIMH 8’h0 RTC timer compare bit 39:32 19.4.4 RTC_TIME_L Address:0x4000f00c RTCTIMLL RTCTIMLL Name Type Reset Description Bits 31:0 RTCTIMLL 32’h0 RTC time latched value bit 31:0 19.4.5 RTC_TIME_H Address:0x4000f010 RSVD...
Page 361
BL702/704/706 Reference Manual Name Type Reset Description Bits 23:22 RSVD 21:16 PULLUPAON 6’h0 [5] : 1 : Turn on Flash PAD PU (GPIO28), Only Set this bit when Flash @ Deep Power Down Mode [4] : 1 : Turn on Flash PAD PU (GPIO27), Only Set this bit...
Page 363
BL702/704/706 Reference Manual 19.5 Register description Description Name PDS_CTL PDS control register PDS_TIME1 PDS sleep time PDS_INT PDS interrupt PDS_CTL2 PDS control register 2 PDS_CTL3 PDS control register 3 PDS_CTL4 PDS control register 4 pds_stat PDS state pds_ram1 PDS ram control...
Page 364
BL702/704/706 Reference Manual Name Type Reset Description Bits 29:28 CTRLRF 2’b01 00 : PDS don’t control RF on/off 01 : PDS control RF on/off depend on soc_en 10 : PDS control RF on/off depend on BLE power on/off 11 : PDS control RF on/off whe pds at idle state...
Page 365
BL702/704/706 Reference Manual Name Type Reset Description Bits GATECLK 0 : don’ t_touch clock gating during PDS (all power domain) 1 : gate clock during PDS (each pwr domain has its own control) CPFS 0 : don’’t touch Flash power during all PDS (Flash Power...
Page 366
BL702/704/706 Reference Manual 19.5.3 PDS_INT Address:0x4000e00c WUEV WUSEN INCL RSVD PDMS RDMS RSVD WUMS CRSE RSEV PDIT RDIT RSVD WKIT Name Type Reset Description Bits 31:24 WUEV Record Wakeup resason, and be clear by cr_pds_int_clr [31]: wakeup trigger by kys_int...
Page 368
BL702/704/706 Reference Manual Name Type Reset Description Bits RSVD FNPPWOF manual force NP power off 19.5.5 PDS_CTL3 Address:0x4000e014 RSVD MSIS RSVD RSVD RSVD FBLE FMIS RSVD FBLE FMIS RSVD FBLE FMIS RSVD FBLE RSVD FBLE FMIS RSVD GCLK GCLK MSTB...
Page 369
BL702/704/706 Reference Manual Name Type Reset Description Bits RSVD FBLEISO manual force BZ_BLE iso_en RSVD FBLEPWOF manual force BZ_BLE pwr_off FMISPWOF manual force MISC pwr_off RSVD 19.5.6 PDS_CTL4 Address:0x4000e018 MISC MISC RSVD MISC MISC MISC MISC DPOF APOF GCLK MSTB...
Page 370
BL702/704/706 Reference Manual Name Type Reset Description Bits MISCPWOF 1 : make core_misc Power off at PDS Sleep state 0 : make core_misc power on at PDS Sleep state USBGCLK 1 : make usb clock gated at PDS Sleep state...
Revision history Table 20.1: Document revision history Date Revision Changes 2020/9/9 Initial release 2021/3/8 Modify the GPIO port corresponding to the DAC 2021/9/30 Update KeyScan register description, introduction of low-power wake-up source 375/ 375 @2021 Bouffalo Lab BL702/704/706 Reference Manual...
Need help?
Do you have a question about the BL702 and is the answer not in the manual?
Questions and answers