yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
520 Motor📖
1.About motor
  • About motor
2.ROS robot control board drive
  • 2.1 Control motor
  • 2.2 Timer captures encoder data
  • 2.3 PID control robot car
  • 2.4 Kinematic Analysis-Mecanum wheel structure
  • 2.5 Kinematic Analysis-Ackerman structure
  • 2.6 Kinematic Analysis-4WD structure
3.STM32 Self-balancing car tutorials
Get started quickly
  • 03.P, PI, PD controller theory
  • 01.Balancing car assembly
  • 02.Get started quicklyy
  • 03.Balance car interface description
  • 04.Common Problem Analysis
  • 05.Balance Car V2 Library Function Development Manual
Environment construction and development
  • 01.MDK-ARM installation
  • 02.STM32CubeIDE installation
  • 03.Common driver installation
  • 04.Download the program
  • 05.MDK-ARM project usage
  • 06.Program simulation
Robot car PID control course
  • 01.PID basic concept
  • 02.PID example analysis
  • 04.Position PID
  • 05.Incremental PID
  • 06.Cascade PID
  • 07.Balance principle of car
  • 08.Car upright control (PD)
  • 09.Car speed ​​control (PI)
  • 10.Car steering control (PD)
  • 11.Got angle and angular velocity (DMP algorithm)
  • 12.Got angle and angular velocity (Kalman filter algorithm)
  • 13.Got angle and angular velocity(Complementary filter algorithm)
Robot car basic course
  • 01.Car parameter adjustment
  • 02.Ultrasonic obstacle avoidance
  • 03.Ultrasonic follow
  • 04.Bluetooth remote control
  • 05.Load balance
Robot car LQR control
  • Robot car LQR control
Circuit design
  • 01.Overall circuit design
  • 02.STM32 minimum system
  • 03.Serial port circuit design
  • 04.Power circuit design
  • 05.MPU6050 Circuit Design
  • 06.Motor drive circuit design
Mathematical model
  • Balance car mathematical model
4.4-channel motor drive module
Introduction and Debug
  • 1.Introduction to 4-channel motor drive board
  • 2.Control command
  • 3.Motor introduction and usage
  • 4.PC host
IIC communication
  • For Arduino
  • For ESP32
  • For Jetson NANO
  • For MSPM0G3507
  • For MSPM0G3519new
  • For PICO2
  • For RDK X5
  • For RPi5
  • For STM32
USART communication
  • For Arduino
  • For ESP32
  • For Jetson NANO
  • For MSPM0G3507
  • For MSPM0G3519new
  • For PICO2
  • For RDK X5
  • For RPi5
  • For STM32
5.2-channel motor drive module
For MSPM0G3507
  • 1.AT8236 drive tutorials
  • 2.TB6612 drive tutorials
For MSPM0G3519
  • 1.AT8236 drive tutorialsnew
  • 2.TB6612 drive tutorialsnew
Download
  • Model File
  • Annex_ROS_robot_board
  • Annex_STM32_balancing_car
  • Annex_4channel_motor_drive
  • Annex_2channel_motor_drive
Download ZIP

Welcome to 520 Motor repository

06.Program simulation

Program simulation

Program simulationOpen the projectCompile the projectConfigure the debuggerProgram downloadProgram debuggingStart/stop debuggingDebug optionsBreakpointsMonitor variablesComplete demonstrationRun the program

The tutorial mainly demonstrates the simple debugging steps of the development board using ST-Link.

Tutorial Demonstration Case: LED Control (GPIO)

Since we only provide the standard library version source code for a single case, the tutorial only demonstrates the simulation steps of MDK-ARM

Open the project

xxxxxxxxxx
Product supporting materials source code path: Attachment → Source Code Summary → 1.Base_Course → 2.LED

After decompressing the corresponding project file, find the file with the .uvprojx suffix and double-click it to open it.

xxxxxxxxxx
The .uvprojx suffix file is located in the USER directory of the project file

image-20240830141611686

Compile the project

Click the Rebuild option on the toolbar to compile the project, and the compilation output bar will prompt the compilation result.

xxxxxxxxxx
Compiling the project can confirm whether there are any syntax problems in the program you programmed

image-20240821213014404

Configure the debugger

Select Options for Target... → Debug → ST-Link Debugger

image-20240826105708016

If the system detects ST-Link, you can see the hardware information when entering the debugger interface:

image-20240826105938122

Program download

Check Reset and Run to run automatically after downloading the program using ST-Link:

image-20240826110103636

Click Download to download the program to the development board via ST-Link:

image-20240826110812832

Program debugging

Start/stop debugging

Click Start/Stop Debug Session to start and stop debugging mode:

image-20240826120728076

Debug options

The tutorial only introduces commonly used options:

Serial numberDescription
1Reset: The program performs a reset operation
2Run at full speed: The program starts to run normally at full speed until the program stops when it encounters a breakpoint
3Stop running: The program stops running
4Enter function to run: Run once per click
5Run line by line: Do not enter the function, run single line
6Jump out of function to run: Run other statements in the function, and then jump out of the current function to run
7The program runs to the cursor

image-20240826163953300

Breakpoints

When the program reaches a breakpoint, it will stop running. Click the gray area of the picture to add and cancel breakpoints: click once to add, and click again to cancel the breakpoint

image-20240826165615143

Monitor variables

To view the program's variable data in real time, you need to check View → Periodic Window Update:

image-20240826191307761

Since there are no viewable variables in the program, we slightly adjust the code: To adjust the code, you need to exit Debug mode, then recompile the project, and re-enter Debug mode

Add variables

Select the variable in the program and right-click to add it to the monitoring window:

image-20240826191745268

Select the variable in the monitoring window and right-click to change the data display format: cancel the hexadecimal display and use decimal for easy observation

​x
A breakpoint needs to exist in the program, otherwise the data will not be updated when the program is running, and it will be displayed as out of range

image-20240826191927026

Complete demonstration

Use LED control (GPIO) project to demonstrate a simple simulation process.

Run the program

image-20240826192929511

The program will run to the breakpoint and the delay time value will be updated to 500:

image-20240826192951739

Click the line-by-line run icon to control the progress of code execution. At this time, you can observe the LED light phenomenon of the development board.

image-20240826193142511

Click the Debug option to exit the debugging interface:

image-20240826193505198

MDK-ARM project usage
PID basic concept

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文