1. Basic process of USMART debugging components
USMART is a smart serial port debugging interactive component developed by ALIENTEK. Through it, you can call any function in the program through the serial port assistant and execute it.
1. What is USMART
You can send commands to the microcontroller through the serial port. After receiving the command, the microcontroller will call the corresponding function. This can speed up the debugging of the program and is more convenient.
2. Characteristics of USMART
Functions that need to be debugged with USMART need to be registered in usmart_config.c.
example:
// Initialize the function name list (added by the user)
//Users directly enter the function name and search string to be executed here
struct _m_usmart_nametab usmart_nametab[]=
{
#if USMART_USE_WRFUNS==1 //If read and write operations are enabled
(void*)read_addr,"u32 read_addr(u32 addr)",
(void*)write_addr,"void write_addr(u32 addr,u32 val)",
#endif
(void*)delay_ms,"void delay_ms(u16 nms)",
(void*)delay_us,"void delay_us(u32 nus)",
(void*)LCD_Clear,"void LCD_Clear(u16 Color)",
(void*)LCD_Fill,"void LCD_Fill(u16 xsta,u16 ysta,u16 xend,u16 yend,u16 color)",
(void*)LCD_DrawLine,"void LCD_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2)",
(void*)LCD_DrawRectangle,"void LCD_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2)",
(void*)LCD_Draw_Circle,"void Draw_Circle(u16 x0,u16 y0,u8 r)",
(void*)LCD_ShowNum,"void LCD_ShowNum(u16 x,u16 y,u32 num,u8 len,u8 size)",
(void*)LCD_ShowString,"void LCD_ShowString(u16 x,u16 y,u16 width,u16 height,u8 size,u8 *p)",
(void*)led_set,"void led_set(u8 sta)",
(void*)test_fun,"void test_fun(void(*ledset)(u8),u8 sta)",
(void*)LCD_ReadPoint,"u16 LCD_ReadPoint(u16 x,u16 y)",
};
2. USMART Configuration
Note: Different platforms use different USMART packages, for example, the Battleship version cannot be used on the Mini version.
Take LCD experiment as an example:
1. Copy the USMART folder to the LCD experiment.
2. Open the LCD project, create a new USMART group in Groups, then add the three .c files in USMART, and add the path of the header file to the project path.
3. Register the function to be debugged
Note that you need to comment out the two external declarations and the two functions that have been declared.
4. Initialize USMART in the main() function
Now the compilation fails.
Because the timer is used in USMART, the timer library function needs to be added to the project.
After adding it, compile it.
Initialize USMART
usmart_dev.init(72); //The entry parameter is the system clock.
In the main() function, include the USMART header file.
Then register the function to be called in usmart_config.c
For example:
(void*)LCD_Clear,"void LCD_Clear(u16 Color)",
Pay attention to the format when registering.
3. USMART debugging experiment
First use list to list the available functions
Enter the function in the serial debugging assistant and observe the phenomenon.
You can debug functions through the serial port debugging assistant, without having to re-write new programs into the microcontroller every time, which is very convenient.
Previous article:34. Memory Management
Next article:I2C bus learning and EEPROM
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- TI millimeter wave radar evaluation report summary
- MSP430 communication resources IIC communication
- [TI recommended course] #Live replay: TI's new generation C2000? microcontroller#
- IAR burning program shows error
- Application of state machine principle in control program design.pdf
- The board has been mailed, please check the courier number in the post~
- Crazy Shell AI open source drone timer (LED flight status light, indicator light flashing)
- How to debug a custom Flash loader in IAR development environment?
- I can't find any information about these two chips.
- [Project source code] Determine the correspondence between the dedicated clock input pin of the FPGA and the PLL