Contents Block Diagram ........................5 System Management ......................6 System Clock ...............................6 Clock Register ............................. 7 Memory Access ....................... 19 Low Power Mode ......................20 1. sleep mode,500uA ..........................20 4.1.1 Configuration of sleep mode ..........................20 Power-off mode (power off, 4uA) ......................20 4.2.1 Configuration of power-down mode .........................20 Interrupts .........................
Page 3
10.1 Features ..............................43 10.2 Special Function Registers ........................43 10.3 Independent Power RTC Registers ......................44 UART ..........................50 11.1 Features ..............................50 11.2 User Guide ..............................50 11.2.1 UART Special Function Registers ........................50 HSUART ........................... 53 12.1 Features ..............................53 12.2 User Guide ..............................
Page 4
17.1 Feature ..............................76 17.2 Control use ..............................76 Power Management ......................77 18.1 Charging process ............................77 18.2 Charging settings ............................77 18.3 Charging control function .......................... 77 Bluetooth ......................... 78 19.1 Feature ..............................78 19.2 SPP protocol ..............................78 19.2.1 SPP protocol is based on credit flow control mechanism ................78 19.2.2 SPP use and development in SDK ........................
2 System Management 2.1 System Clock Figure 2 System Clock Tree For details, see GW3323_clock.pdf. The maximum frequency of this chip is 160MHz, which can be set by set_sys_clk(). www.geehy.com Page 6...
4 Low Power Mode GW3323 supports two low-power modes: 4.1 1. sleep mode,500uA Sleep mode will auto gate system clock, close memory access, close RC2M, but some asyn clock should be disable by software. Sleep mode wake up source as follow. After wakeup, software run continue or enter interruptif enable.
Page 21
Reset after wake-up www.geehy.com Page 21...
5 Interrupts 5.1 Feature The Bluetooth priority has been set in the library, from high to low: Bluetooth> timers and other hardware interrupts>threading. The print function in the interrupt shall be the printk function, the global variable inside shall be declared volatile, and the interrupt function shall be placed in the isr area;...
Interrupt Address Description number SRC interrupt 0x84 0x88 Port interrupt 0x8c IIS interrupt 0x90 SARADC interrupt RTC and alarm interrupt LVD interrupt 0x94 WDT interrupt IIC interrupt 0x98 BSP interrupt Tick0 interrupt 0x9c Tick1 interrupt Note: (1) The related interrupts can be configured by calling sys_irq_init (int vector, int pr, isr_t isr), and this part is not open to customers.
Page 25
Name Mode Default Description GIEM Write 1 enable Global interrupt enable mask 15:8 Unused Unused HPINTEN Write 1 enable High priority interrupt LPINTEN Write 1 enable Low priority interrupt Write 1 enable Global interrupt Name Mode Default Description 31:17 Unused GIEMDIS Write 1 disable Global interrupt enable mask 15:8...
Page 26
Name Mode Default Description Interrupt 31 to 0 priority selection 1 bit; {PICPR1, PICPR} 00: low priority interrupt 31:0 IntPR1 01: high priority interrupt 10: high priority 2 interrupt 11: high priority 3 interrupt Name Mode Default Description 31:8 BADR 0x800 Interrupt entry address Name...
6 WatchDog 6.1 User Guide configure WDT reset or interrupt Select WDT time out Clear WDT 6.2 WDT Special Function Registers Name Mode Default Description WDT time out pending WDTPND 0: no pending 1: pending 30:28 Unused WDT time select bit write enable 27:24 TMRSEL_WR When write 0xa, bit20~bit22 can be write to TMRSEL, other value...
Page 28
WDT clear bit WDTCLR When write 0xa, WDT counter and WDTPND will be clear www.geehy.com Page 28...
7 GPIO Management 7.1 Features Control GPIO input/output direction by using direction register; Internal pull-up/pull-down resistor by using pull-up/pull-down resistor control register; Select suitable output driving current capability; 7.2 GPIO internal block diagram Figure 4 GPIO internal block diagram 7.3 GPIO general control register Name Mode Default...
Page 30
Name Mode Default Description 31:8 Unused Clear PAx output data. Write 1 clear output data. Write 0 affect GPIOACLR nothing. Name Mode Default Description 31:8 Unused PAx direction control GPIOADIR 0xFF 0: Output 1: Input Name Mode Default Description 31:8 Unused PAx 10KΩ...
Page 31
Name Mode Default Description PAx 200KΩ pull-down resister control. Valid when PAx is used as input GPIOAPD 0: disable 1: enable Name Mode Default Description 31:8 Unused PAx 300Ω pull-up resister control. Valid when PAx is used as input GPIOAPU 0: disable 1: enable Name...
7.4 GPIO function mapping Name Mode Default Description UART1 RX mapping 0000: no affect 0001: map to G1 31:28 UT1RXMAP 0010: map to G2 0011: map to TX pin by UT1TXMAP select 1111: Clear these bits Others is reserved UART1 TX mapping 0000: no affect 0001: map to G1 27:24...
Page 33
Name Mode Default Description 31:12 — — — — UART2 RX mapping 0000: no affect 0001: map to G1 11:8 UT2RXMAP 0010: map to G2 0011: map to TX pin by UT2TXMAP select 1111: Clear these bits Others is reserved UART2 TX mapping 0000: no affect 0001: map to G1...
Name Mode Default Description 0001: map to G1 1111: Clear these bits Others is reserved Timer3 capture Pin mapping 0000: no affect 0001: map to G1 0010: map to G2 0011: map to G3 TMR3CPTMAP 0100: map to G4 0101: map to G5 0110: map to G6 0111: map to G7 1111: Clear these bits...
Page 35
Wakeup circuit 2 Wakeup circuit 3 Wakeup circuit 4 WKO(PB5) Wakeup circuit 5 PORT_INT_FALL Wakeup circuit 6 PORT_INT_RISE Wakeup circuit 7 Name Mode Default Description 31:17 Unused Wake up interrupt enable WKIE 0: disable 1: enable 15:8 Unused Wake up input 7~0 enable WKEN 0: disable 1: enable...
Page 36
Name Mode Default Description Unused 15:0 Name Mode Default Description Port interrupt 0~31 enable bit 31:0 PORTINTEN 0: disable 1: enable Name Mode Default Description Port interrupt 0~31 edge select bit 31:0 PORTINTEDG 0: rise edge 1: fall edge www.geehy.com Page 36...
8DMA 8.1 Feature DMA supports such peripherals as HSUART, SPI, SDIO, and USB. (10) DMA cannot transmit data between registers or transfer data between two memory addresses. (11) DMA-SPI only supports transmitting and does not support receiving 8.2 Functional configuration Table 6 Functions DMA receiving DMA transmitting...
The official SDK with the system uses timer0 as tick, with a frequency of 1MHz. The PWM of GW3323 timer is in edge-aligned mode (the pulse counter is in cycle count-up with an initial count value of 0), without center-aligned mode (the pulse counter is in bidirectional counting with an initial count value of 0), and without complementary output mode.
Name Mode Default Description Timer Enable Bit TMREN 0: Disable 1: Enable Name Mode Default Description 31:16 Unused Timer overflow pending clear bit TPCLR 0: inactive 1: clear pending Unused Name Mode Default Description Timer counter. TMRCNT will increase when timer is enabled. It overflows when 31:0 TMRCNT TMRCNT = TMRPR, TMRCNT will be clear to 0x0000 when...
10 RTC 10.1 Features Support 32bit Independent power supply real time counter Support alarm interrupt and second interrupt 10.2 Special Function Registers Name Mode Default Description 31:23 Unused INBOX state INBOX 0: out of box 1: in box VUSB off state VUSBOFF 0: online 1: off state...
Name Mode Default Description 11: System Clock divide 32 Unused Name Mode Default Description 31:19 Unused CWKSLPPND Write 1 will clear RTC wakeup sleep pending CALMPND Write 1 will clear RTC alarm pending 16:0 Unused 10.3 Independent Power RTC Registers Name Mode Default...
Page 45
Name Mode Default Description CLK2M in RTC power domain source select bit CLK2MRTCSSEL 0: RTC 2M 1: XOSC 26M divide 8(3.25M) RTC first power up flag PWRUP1ST 0: not first power up 1: first power up External 32K select EXT32KS 0: use RTC internal 32K osc 1: use external 32K osc Touch key between core interface enable bit TKITF_EN...
Page 46
Name Mode Default Description SEL VDD pullup enable SELVDDPU 0: disable 1: enable 32K osc select bit 32KSEL 0: 32.768K 1: 32K Reserve,can’t be changed default value. Reserve,can’t be changed default value. Reserve,can’t be changed default value. Name Mode Default Description Unused Touch key long press wakeup enable bit...
Page 47
Name Mode Default Description VDDCORE enable bit VCOREEN 0: disable 1: enable VDDIO enable bit VIOEN 0: disable 1: enable BUCK enable bit BUCKEN 0: disable 1: enable Name Mode Default Description Reserve,can’t be changed default value. Reserve,can’t be changed default value. Reserve,can’t be changed default value.
Page 48
Name Mode Default Description INBOX wake up pending INBOXP 0: no pending 1: pending VUSB wake up pending VUSBP 0: no pending 1: pending WK pin wake up pending 0: no pending 1: pending When write: RTC 1 second pending clear 0: no affect 1: clear 1s pending RTC1SPC...
11 UART 11.1 Features UART is a serial port capable of asynchronous transmission. The UART can function in full duplex mode. Table 7 I/O ports corresponding to serial channels Channe Channe Channe Channe Channe Channe Channe Channe Channe Channe UART l G1 l G2 l G3...
Page 51
Clock source select CLKSRC 0: system clock 1: uart_inc Two Stop Bit enable SB2EN 0: 1-bit Stop Bit 1: 2 bit Stop Bit Transmit Interrupt Enable TXIE 0 = Transmit interrupt disable 1 = Transmit interrupt enable Receive Interrupt Enable RXIE 0: Receiver interrupt disable 1: Receiver interrupt enable...
Page 52
UART Data UARTDAT Write this register will load the data to transmitter buffer. Read this register will read the data from the receiver buffer.. www.geehy.com Page 52...
12 HSUART 12.1 Features Support full duplex mode Support async clock between UART interface part and control part Support interrupt Support 8/9 bit data mod,but not data parity checking. Support 16 bit baud rate setting. UART TX: Support single byte TX ...
Wait for TXPND to change to ‘1’, or wait for interrupt (10) Clear PNDing 12.2.3 TX n byte with DMA Configure GPIO in the correct direction. Configure HSUT0CON CLKSRC bit for high speed interface working source clock Configure HSUT0CON DMA mode ,8bit mode, 1/2 stop bit mode ConfigureHSUT0BAUD baud-rate Configure TX DMA start address HSUT0TXADR Enable UTXEN by setting...
(12) Clear PNDing, and will clear HSUT0FIFOCNT at the same time Reading from SRAM: get start address from HSUT0FIFOADR or program save variable get data count from HSUT0FIFOCNT or program save variable read N byte data from SRAM if not DMA loop buffer mode, clear RXPND will clear HSUT0FIFOCNT if DMA loop buffer mode, write N to SUBRXCNT(HSUT0CPND[16:0])to dec HSUT0FIFOCNT Reading from HSUT0FIFO...
Page 56
Figure 6 DMA High Speed Serial Port Sending Function Table 9 RXPND( RX Hang-up) Flag Bit Read Value Buffer Mode DMA Mode Notes ------- ------- ------- ------- HSUT0TMRCNT RXPND( RX Hang-up) RX and WRITE n byte RX 1 byte done enable and TMROV to SRAM finish Table 10 RXOV_set...
Page 57
Enter RXPND process first,get HSUT0FIFOCNT,and read data from RXFIFO Enter RXOVPND,get HSUT0FIFOCNT,and read data from RXFIFO。 HSUT0FIFOCNT != 0 If RXPND setting by received RXCNT byte data HSUT0FIFOCNT = 0 If RXPND setting by RXOVPND Clear RXOVPND It will be also clear RXFIFOCNT and initial RXFIFO_ADR to current RXWR_ADR by ...
Page 61
Name Mode Default Description 31:8 Unused RXFIFO read from SRAM done 0: read not finish RXFIFO_DONE 1; read done Auto clear by kick RXFIFO_RD bit RX read pluse 0: N/A RXFIFO_RD 1: read fifo kick start UART RX Data Read this register will read the data from the RXFIFO receiver SRAM buffer Name...
13 SPI 13.1 Features The chip has one SPI. The SPI is connected to the external I/O port by tying a cable and is available to users. Flash SPI is a 2-frequency division of the system clock. The SPI flash start address is 0x1000 0000.
Page 63
SPI DMA Mode Operation Flow: Set IO in the correct direction and data width mode. Select RXSEL for DMA direction Configure clock frequency Select one of the four timing modes Enable SPI module by setting SPIEN to ‘1’ Set SPIIE ‘1’ if needed configure SPI0DMAADR;...
14 IIC 14.1 Features Support IIC one master Support asynchronous clock source from RC2M or XOSC26M Support out data maximum 4 Byte Support in data maximum 4 Byte 14.2 User Guide IIS master mode Operation Flow: Configure IO mapping, SDA set pullup enable ...
15 ADC 15.1 Features This ADC has the following characteristics: Support 16 channel,10 bit sampling frequency The maximum sample rate is 78k/s; SARADC bit clock maximum is 1MHz ADC has internal 100K pull up resister 15.2 Channel select Code for reference: /***************************************************************************** * Module : ADC Path Selection List...
15.4 ADC_CTL Special Function Registers Name Mode Default Description 31:20 Unused Saradc auto enable analog enable bit ADCAEN 0: disable 1: enable Saradc auto enable analog IO enable bit ADCANGIO 0: Disable 1: Enable Saradc interrupt enable bit ADCIE 0: Disable 1: Enable Saradc enable bit ADCEN...
Page 71
Name Mode Default Description Channel 3 internal pullup enable bit CH3PUEN 0: Disable 1: Enable Channel 2 internal pullup enable bit CH2PUEN 0: Disable 1: Enable Channel 1 internal pullup enable bit CH1PUEN 0: Disable 1: Enable Channel 0 internal pullup enable bit CH0PUEN 0: Disable 1: Enable...
Page 72
Name Mode Default Description Channel 5 enable bit CH5EN 0: Disable 1: Enable Channel 4 enable bit CH4EN 0: Disable 1: Enable Channel 3 enable bit CH3EN 0: Disable 1: Enable Channel 2 enable bit CH2EN 0: Disable 1: Enable Channel 1 enable bit CH1EN 0: Disable...
16 DAC 16.1 Feature Output the offset value of DC at up to 780KHz (1.3us) to change the output DAC level; 16.2 Control use my_dac_init() sets the output DAC level for starting DAC_R or DAC_L pin set_bia_voltage_reg_R() sets DAC_R level; set_bia_voltage_reg_L() sets DAC_L level www.geehy.com Page 75...
17.1 Feature The full speed of USB Devise is 12 Mbits/s, D + internal pull-up resistor of USB. 17.2 Control use usb_detect();//this function will detect whether the USV is connected or disconnected usb_bulk_send();//batch transmission of USB data, waiting to be read by the host usb_insert_callback();//callback function for engineering call after usb is inserted usb_ep_config();//functions for configuring input and output ports www.geehy.com...
Power Management 18.1 Charging process After the vusb pin is connected to 5V voltage, the chip first judges whether the voltage connected to the vusb is high (the vusb voltage should be 0.2v higher than the battery voltage and be greater than 4.5v) (this condition can be configured whether to take effect). If the vusb voltage meets the charging conditions, enter the charging mode.
Figure 7 Flow Control Mechanism of Credit Initialize and inform each other of their RX credt A packet of data A packet of data A packet of data A packet of data TX credit is 0, stop sending Supplementary credit Resume sending Both sides of the serial port will have the count of two credits, i.e.
19.2.2.2 Instructions for API Two API are opened to inform the other side of SPP to supplement and update credit, i.e. void spp_set_rx_new_credit(uint8_t credit) and int spp_notify_rx_buffer_len(u16 len). The former void spp_set_rx_new_credit(uint8_t credit) is to directly notify the Bluetooth underlying layer to inform the other side to update the credit. The latter int spp_notify_rx_buffer_len(u16 len) is to divide the remaining available length of the incoming buffer by the MTU (maximum transmission unit, namely the maximum length of a packet of data) of the SPP to obtain the minimum number of data packets that can be received...
Description UUID Properties Notify Characteristic 0xFF14 Notify 19.3.1 Flow control mechanism of BLE protocol MTU exchange is to set the maximum amount of data that can be exchanged in a PDU between the master and slave. Through MTU exchange and confirmation by both parties (Note that this MTU is not negotiable, but only informs the other party.
19.3.2.3 Bluetooth transmits the function return value If ble_tx_notify returns 0, it indicates successful transmission; if the transmission is unsuccessful, return the error code, and actually not a single byte is transmitted. So the transmission fails, and the entire data needs to be transmitted again. Decimal 86 means "packet is empty, or the transmission length is greater than the buf size".
20 Revision history Table 14 Document Revision History Date Revision Change History 2023.5.10 Add charging module, USB, BLE, clock register and other 2023.8.24 instructions; Change the description of other modules. www.geehy.com Page 83...
Page 84
Statement This document is formulated and published by Geehy Semiconductor Co., Ltd. (hereinafter referred to as “Geehy”). The contents in this document are protected by laws and regulations of trademark, copyright and software copyright. Geehy reserves the right to make corrections and modifications to this document at any time.
Need help?
Do you have a question about the GW3323 and is the answer not in the manual?
Questions and answers