Nations N32WB45xL EVB User manual

Development guide
N32WB452 Series Quick Development Guide
Introduction
The purpose of this document is to allow users to quickly familiarize themselves with the development kits of
N32WB452 series MCUs and the related settings of Keil MDK-ARM, so as to reduce the preparation time in the
early stage of development and the difficulty of development.

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
I
CONTENTS
1. Introduction to the Development Kit.......................................................................................................1
2. Introduction to the development board...................................................................................................3
2.1 N32WB45xL_EVB (QFN88) full-function evaluation board...............................................................3
2.1.1 Introduction to N32WB45xL_EVB..................................................................................................3
2.1.2 N32WB45xL_EVB development board interface definition description......................................4
2.1.3 N32WB45xL_EVB development board jumper function description...........................................6
3. Introduction to the firmware development kit.......................................................................................7
3.1 Firmware....................................................................................................................................................8
3.2 Projects......................................................................................................................................................9
3.3 Projects framework...................................................................................................................................9
4. Compilation environment and configuration......................................................................................... 11
4.1 Compile environment installation..........................................................................................................11
4.2 Firmware support package installation.................................................................................................11
4.3 Software compilation..............................................................................................................................11
4.4 Compile environment configuration......................................................................................................12
4.5 Download and simulation......................................................................................................................17
4.5.1 Download firmware.........................................................................................................................17
4.5.2 Simulation debugging......................................................................................................................17
5. NS-LINK debugging tool ..........................................................................................................................20
5.1 Download/simulation interface...............................................................................................................20
5.2 Virtual serial port...................................................................................................................................20
5.3 Common interface problems..................................................................................................................20
6. Version history............................................................................................................................................22
7. NOTICE .......................................................................................................................................................23

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
1
1. Introduction to the Development Kit
Development kits usually include related product profiles, data sheets, user manuals, application notes and reference
guides, as well as development evaluation board EVK, software development kit SDK, related download tools and
documentation.
Product introduction:
Usually starting with the letter "PB", the chip feature introduction document is used to quickly understand the
chip resource overview, order model, package information, etc., and is used in the chip selection stage before
project development.
Data sheet:
Usually starting with the letter "DS", the chip technical parameter document is used to understand the chip
module resources, pin definitions, electrical characteristics, packaging information, etc., used in the hardware
design stage and software development stage.
User manual:
Usually starting with the letter "UM", the detailed introduction of each functional module of the chip, including
the internal structure of the module, instructions for use, register description, etc., is used as the main reference
document in the software development stage.
Application note:
Usually starting with the letter "AN", the detailed usage instructions of a certain functional module of the chip,
including the implementation principle, software process, introduction to the core code implementation,
operation instructions, etc., are used as the main reference documents in the software development process.
User guide:
Usually starting with the letter "UG", the usage guide of the firmware library of the chip-specific function
module, including the firmware architecture, software process, core code implementation introduction,

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
2
operation instructions, etc., as the core reference document in the software development process.
EVK:
N32WB45xL_EVB (QFN88)
Contains all the above development board information, including schematic diagram/PCB/development board
instruction manual.
SDK:
Software Development Design Kit, including Keil DFP pack, firmware library (low-level driver code and
reference routines).

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
3
2. Introduction to the development board
2.1 N32WB45xL_EVB (QFN88) full-function evaluation board
2.1.1 Introduction to N32WB45xL_EVB
N32WB45xL_EVB is a full-function evaluation board for the National Technology BLE 5.0 SOC chip
N32WB452LEQ6 (QFN88). The functional structure diagram of the development board is described as follows:
Figure 2-1 Front view of N32WB45xL_EVB V1.1 development board
GPIO
LCD
GPIO
Fingerprint
module
interface
Potentiometer
TSC
NSLINK
MCU
Beeper

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
4
Figure 2-2 Reverse view of N32WB45xL_EVB V1.1 development board
2.1.2 N32WB45xL_EVB development board interface definition description
1) Power supply for the development board
The development board can be powered by the USB interface (J3 or J4), which is connected to the 3.3V LDO
input port through the switch S1. The output end is divided into three channels. The first channel is the power
supply VCC_MCU for the MCU, and the interface is J6; the second channel is the power supply VCC3.3 for
other peripheral chips except MCU, and the interface is J5; the third channel is the power supply VCC_BLE
DVP
Battery
holder

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
5
reserved for Bluetooth, and the interface is J15.
2) USB interface (J3)
Use MicroUSB interface (J4) to connect to the onboard NSLINK chip (U4), which can be used for program
download and debugging. When using it, pay attention to connecting the jumpers J2 and J20.
3) USB interface (J4)
Use MicroUSB interface (J4), connect MCU DP DM, can be used for USB interface communication.
4) Debug interface (J2&J20)
It is used to connect other debugging tools for program download and debugging, and supports two modes of
SWD/JTAG. J20 is the download port in SWD mode, and it needs to be disconnected from the NSLINK chip
when using it. J20&J2 can be used as JTAG mode download port.
5) Reset and wake-up buttons (S2, S3)
S2 and S3 are reset buttons and wake buttons respectively, which are connected to NRST pins and PA0-WKUP
pins of the chip respectively for chip reset and wake functions.
6) BOOT (J9, J11)
J9 and J11 are the jumpers of the BOOT0 and BOOT1 pins of the MCU main chip respectively connected to the
reserved pull-up and pull-down resistors.
7) Battery holder J7(BAT)
The batteryholder can hold a CR1220 battery, which is connected to the VBATpin of the chip to provide power.
8) GPIO port (J14, J19, J16, J18)
The GPIO interfacesof the chip are all led out, pins are inserted and GND is reserved. See the schematic diagram
for the interface definition.
9) FLASH chip (U7)
The development board has an onboard SPI flash chip, bit number U7, which is connected to the MCU SPI pins
through the J1, J21, J30, and J32 interfaces.
10) Temperature and humidity sensor (U8)
The development board has an onboard temperature and humidity sensor HDC2010, bit number U8, which
communicates with the MCU through I2C2.
11) G-SENSOR (U5)
The development board has a G-SENSOR chip QMA7981, bit number U5, which communicates with the MCU
through I2C1.
12) DVP interface (J149)
The development board has an onboard DVP interface, bit number J149, 24pin connector, connected to the
camera through a flexible cable.
13) LCD (U6)
The development board has an onboard LCD screen, bit number U6, which can be directly used and debugged

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
6
by customers.
14) Fingerprint module (J28)
The development board has an onboard fingerprint module interface, bit number J28, which can be connected
to an external fingerprint module for customer debugging.
2.1.3 N32WB45xL_EVB development board jumper function description
Table 2-1 Development board jumper function description
No.
Jumper bit number
Jumper function
Instructions for use
1
J5、J6、J15
3.3V power supply jumper
J6: MCU power supply interface
J5: Power supply interface for other peripherals
J15: BLE reserved power supply interface
2
J1、J21、J30、J32
SPI FLASH jumper
If using FLASH, you need to connect J1, J21, J30, J32
3
J8
DVP power supply interface
If using DVP, connect J8
4
J2、J20
Debug interface
J20: SWD mode download port
J20&J2: JTAG mode download port
5
J9,J11
BOOT jumper
J9:BOOT0
J11:BOOT1
6
J17
Adjustable resistor jumpers
If the ADC function is used, connect this jumper

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
7
3. Introduction to the firmware development kit
Usually the SDK provides a Keil PACK package, as well as the SDK source code compressed file package.
The SDK directory is a file named after the firmware library version. The directory structure and description are as
follows:
Encryption algorithm library
Bluetooth driver library
Standard peripheral driver library
USBdriver library
Peripheral driver routines

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
8
3.1 Firmware
CMSIS:
The Microcontroller Software Interface Standard, a vendor-independent hardware abstraction layer for the
Cortex-M processor family, CMSIS provides a common interface between the kernel and peripherals, real-time
operating systems, and intermediate devices.
Contains the name definition, address definition and configuration function of the register device used to
access the kernel. This interface includes debug channel definitions.
Provide definitions of all peripherals on-chip, including all peripheral register header files, startup files,
and system initialization template files.
DSP library, providing optimized signal processing algorithms.
n32wb452_algo_lib:
Algorithm library files, including: encryption algorithm, HASH algorithm, random number algorithm, etc.
n32wb452_ble driver:
BLE driver files, including the header file inc used bythe ble algorithm library, the Bluetooth driver library
lib, the chip-related resource file platform, and ble frofile. The Bluetooth driver library lib contains the
libraryfiles of the two development environments of IAR and KEIL, including the Bluetooth protocol stack
driver library (host.lib, host_16bit.lib, host_16bit.a) and the Bluetooth underlying driver library
(n32wb452_ble.lib, n32wb452_ble_16bit.lib, n32wb452_ble_16bit.a).
When using the BLE function, the user can call the API function in n32wb452_ble_api.c to realize the
registration, callback, broadcast, connection, etc. of the Bluetooth function.
n32wb452_std_periph_driver:
Standard driver functions for chip peripherals, including .c source files and .h header files. Users can
migrate to the project and quickly complete the use of a peripheral module.
n32wb452_usbfs_driver:
USB device driver library files, including .c source files and .h header files. The necessary files when

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
9
developing USB devices and completing the construction of the USB bottom layer protocol stack, users
only need to care about the development of the application layer.
3.2 Projects
BSP:
Contains the debugging serial port print function file/LOG, which is used to print various debugging
information during the debugging process.
Examples:
Routine projects including various peripheral function modules are the focus of development engineers,
and realize the basic application development of each peripheral module. Users can quickly understand
chip usage, programming skills, and module transplantation through these routine projects.
Under normal circumstances, users can choose a project with the closest application as the initial code for
development according to actual needs.
3.3 Projects framework
Take the BLE Slave project as an example:
STARTUP:
Contains the startup file of N32WB452.

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
10
CMSIS:
Contains the system_n32wb452.c source file.
FWLIB:
Contains the driver files for n32wb452.
USER:
Contains the development board carrying the user application layer files.
BSP:
Contains the BSP file of n32wb452.
BT_API:
Contains BLE API interface files.
BT_BLE_LIB:
Contains BLE Bluetooth protocol stack driver library and underlying driver library files.
BT_PROFILE:
Contains the BLE Profile file.
BT_PLATFORM:
Contains source files for BLE using n32wb452 chip related resources.
DOC:
Routine brief description document

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
11
4. Compilation environment and configuration
4.1 Compile environment installation
Please install the KEIL MDK-ARM development environment, and the version requirement is V5.26 or later. The
CMSIS architecture of MDKV5 and later versions can support the online update function. In the future, Nations will
place the latest CMSIS version online, and users can update directly through the Pack Installer in the Keil
environment. (If the amount of compiled code exceeds 32K, you need to purchase a KEILproduct license key).
4.2 Firmware support package installation
Please install the firmware support package:
After the installation is successful, you can see the list of supported devices in the Pack Installer interface of KEIL:
4.3 Software compilation
Select a project in the SDK and open it, click Global Compile.
The default unmodified project can be compiled successfully.

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
12
4.4 Compile environment configuration
Click the magic wand to open the OPTION setting interface.
1) Set the size of ROM and RAM in the Target interface (set according to different models)
2) Select the hex output file in the Output interface

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
13
3) Memory Map file generation
The .map file records the usage of program storage space, and it is convenient to view the address space and size of
variables, constants, and functions, as shown in the following figure.

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
14
4) If you need to generate a burning file in bin format, copy fromelf --bin -o "$L@L.bin" "#L" to the
following image
5) Linker Scatter File settings (set according to the actual needs of the project)

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
15
.sct is a text file that specifies how the ARM linker allocates the storageaddresses of RO, RW, ZI and other data when
generating an image file by writing a scatter-loading file. Under normal circumstances, theARM linker will generate
image files by default.
In some cases, we want to put some data at a specified address.
There is a complex address mapping: for example, code and data need to be stored in multiple areas (usually
used in boot code).
There are multiple memory types: including Flash, ROM,SDRAM, etc.According to the characteristics of code
and data, they are stored in different memories.
Use the Scatter file to place a function at a fixed address, regardless of whether its application has been changed
or recompiled.
Memory-mapped IO:A data segment can be placed at a precise address by using scatter file.
6) Simulation related settings in the Debug interface

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
16
a) Select the NSLINK emulator (if connecting to other LINKs, select the corresponding LINK type).
b) If the connection is successful, the device serial number of the emulator can be displayed in position 2.
c) In the Flash Download interface, check the reset operation.
Click Flash Download settings, check "Reset and Run", the code will automatically reset and run after downloading.

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
17
The compilation environment settings are completed here.
4.5 Download and simulation
4.5.1 Download firmware
As shown in the figure above, the development board/debugger board is already running the program at this time.
4.5.2 Simulation debugging
When the emulator is connected and the program is compiled successfully, click the emulate button.
Enter the simulation interface as shown below, and the simulation tool button appears in the toolbar.

Nations Technologies Inc.
Tel:+86-755-86309900
Email:info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
18
1) Execute simulation steps and control the execution process (single step, line by line, full speed, reset, etc.).
2) Monitor the simulation status, such as registers, variables, FLASH and other information.
KEILcommon simulation tools
1) Click button 1 to open the variable view window
2) Click button 2 to open the memory view window
3) Click button 3 to open the register viewing window.
Table of contents
Other Nations Microcontroller manuals
Popular Microcontroller manuals by other brands

Kinco
Kinco K5 Series Hardware manual

Equinox Systems
Equinox Systems Flash 8051 Getting started

Microchip Technology
Microchip Technology PIC18C 8 Series manual

Telit Wireless Solutions
Telit Wireless Solutions SE873Q5 Product user guide

Atmel
Atmel AT32UC3A3256S manual

ST
ST STM32F205 series Programming manual