[National Technology N32WB452 Review] + Basic Function Usage
[Copy link]
[National Technology N32WB452 Review] + Basic Function Usage
The N32WB452 series is a BLE5.0 MCU chip based on the 32-bit ARM Cortex-M4F + Cortex-M0 dual-core, with TX/RX power consumption of 3.5mA, transmit power +3dBm, receive sensitivity -94dBm, main frequency of 144MHz, support for floating-point operations and DSP instructions, built-in 512KB Flash, 144KB SRAM, integrated 7xU(S)ART, 4xI2C, 3xSPI, 2xCAN 2.0B, 1x USB 2.0 FS Device, 1xSDIO, digital video interface, 2x12bit 5Msps ADC, 2x1Msps 12bit DAC, support up to 18-channel capacitive touch buttons, and built-in cryptographic algorithm hardware acceleration engine.
According to the chip data sheet, the chip functions are very powerful. First, use the basic functions, such as GPIO, PWM, ADC, SPI, touch buttons, etc., to familiarize yourself with the ideas of software development and learn to design software development thinking. I hope you will gain a lot from the following studies.
- The routine code structure is very concise, and the redundant and unused underlying drivers are not loaded. The software structure is also the mainstream structure, which is very easy to use. The N32WB452 series quick development guide document clearly describes the overall software architecture, as shown in the figure:
2. First, turn on the light to verify whether the compilation environment, download program function, and MCU minimum system function are in place.
3. The actual effect is shown in the figure
LED1 is always red, LED2 is always white and is controlled by the inverse function. LED3 and LED4 are switch control functions, but their pin control functions are customized. The following function is very interesting, and I have never encountered such an application in previous development.
/**
* @brief Turns selected Led on or off.
* @param GPIOx x can be A to G to select the GPIO port.
* @param Pin This parameter can be one of the following values:
* @arg GPIO_PIN_0~GPIO_PIN_15: set related pin on
* @arg (GPIO_PIN_0<<16)~(GPIO_PIN_15<<16): clear related pin off
*/
void LedOnOff(GPIO_Module* GPIOx, uint32_t Pin)
{
GPIOx->PBSC = Pin;
}
- Touch Screen Switch (TSC)
- Software structure,Dome project uses four application layer driver files: serial port printing, timer, TSC, and GPIO.
After checking and analyzing the code, the main function of the timer is to regularly detect whether the touch button has action. Its main loop detects once every 10ms, and the timer interrupt function and the key trigger detection function call detection frequency are as high as 10ms/50. I think it should be used for anti-shake processing. According to this method, it can also be used for short-press and long-press judgment of buttons.
There are 23 touch button TSC channels:
// The following is the corresponding relationship of port, TSC channel, pulse data and key of this demo.
/* port <--------> TSC channel <--------> key on board
PA4 <--------> TSC channel 0 <--------> NC
PA5 <--------> TSC channel 1 <--------> NC
PB14 <--------> TSC channel 2 <--------> NC
PB15 <--------> TSC channel 3 <--------> NC
PD8 <--------> TSC channel 4 <--------> NC
PD9 <--------> TSC channel 5 <--------> NC
PD11 <--------> TSC channel 6 <--------> NC
PD12 <--------> TSC channel 7 <--------> NC
PC6 <--------> TSC channel 8 <--------> NC
PC7 <--------> TSC channel 9 <--------> NC
PC8 <--------> TSC channel 10 <--------> NC
PC9 <--------> TSC channel 11 <--------> NC
PC10 <--------> TSC channel 12 <--------> T6
PC11 <--------> TSC channel 13 <--------> T4
PC12 <--------> TSC channel 14 <--------> T5
PD2 <--------> TSC channel 15 <--------> T3
PD4 <--------> TSC channel 16 <--------> NC
PD5 <--------> TSC channel 17 <--------> NC
PD6 <--------> TSC channel 18 <--------> NC
PD7 <--------> TSC channel 19 <--------> NC
PB6 <--------> TSC channel 20 <--------> NC
PB7 <--------> TSC channel 21 <--------> NC
PB8 <--------> TSC channel 22 <--------> NC
PB9 <--------> TSC channel 23 <--------> NC
*/
- Actual Results
The four buttons correspond to the four LED dots, and there is a serial port print output.
3. Timer PWM (TIM)
Everyone knows that PWM output uses the timer output channel. There are many TIM timer demos, and I am too lazy to verify them one by one. I would like to praise the demo project for being very user-friendly. The timer calculation formula and duty cycle are clearly stated in the download program.
- Actual Results
ADC
Up to two 12-bit 5Msps sampling rate successive approximation ADCs, supporting single-ended and differential inputs.
I hope the official can unify the ADC software structure. When using the TSCdemo project, the names of files such as tim.c are independent, while the configuration program and logic control program of ADC related projects are all in the main.c file. It feels intuitively that multiple engineers cooperated in development without a unified development idea. Now I am more worried about the reliability of the national technology manufacturer's program.
- Hardware schematics, onboard features
- LCD uses SPI interface communication
- Reset and wake-up buttons can be used to test the sleep mechanism
- Adjustable resistor, with pwm pulse output, use knob resistor to adjust pwm pulse
- USB interface, USB2.0 full-speed device technical specification (12Mbit/s)
- Nslink interface, equivalent to jlinkV9.0 with serial port function
- Button battery, RTC clock circuit complete
- The Flash chip model is 25Q128
- Temperature and humidity sensor chip, HDC2010 adopts ultra-compact integrated design, very beautiful.
- Three-axis accelerometer acceleration sensor QMA7981,
- DVP camera interface
- TSC touch button
- Buzzer interface
|