Smart car based on GD32
! [WeChat picture_20230226162058.jpg]

Only basic pwm motor speed adjustment and Bluetooth communication control have been completed
# Mainly talk about the pits encountered during the debugging process
## ①After burning the test file, the device cannot be recognized
after the comprehensive test code in the burning group
! [1677399741881.png]

The internal storage cannot be found
! [5AEFAD5DBC0EF14FEF95D22B97A6A11E.png]

It cannot be found even with the unlocking tool
! [5C4827F424826FA1D2D73BD4F06C7370.png]

### The solution
needs to press the boot and reset keys to enter the reset mode, and then you can recognize that the device is burning other systems
## ②Small problems in motor debugging
### Burning test code problemThe
motor PWM code provided needs to be burned and reset before
the motor IO high and low points can respond and work directly.
I thought there was a problem with the PWM test code of the project or my board, and I checked it for a long time.
### Motor steering problemBecause
I didn’t pay special attention to the positive and negative directions during welding, the steering turned in the opposite direction after using the test code.
The simplest way is to adjust the value of the pin in reverse
![1677400471013.png]

This is also the biggest advantage of using macro definitions
. You only need to modify one place and pay attention to the fact that the set pin reuses the AF function, so in the basic forward and backward configuration, the PWM duty cycle must also be adjusted accordingly.
Before, I saw that AF_2 was reused and thought it was universal, which took a long time to troubleshoot
![1677400695361.png]

After I debugged these, the car can run normally.
## ③ Bluetooth debugging problem
### Problem using the Bluetooth module version.
Since I used the Bluetooth HC-08 module left over from before, I didn’t pay attention to the circuit difference at first.
Later I found that my module RX The DX interface is just the opposite of the circuit,
so I did not respond when I tested it directly
![1677400912385.png]

The solution to this problem is to modify the pin function
![1677401050918.png]

### Receiving data problem
After adjustment, the data transmission is successful, but I still cannot drive the data transmission using the official Bluetooth tool provided by www.hc01.com
because the pintf function is redirected. Just use serial port 0 to view the print data
![1677401197601.png]

Using the test code directly, I found that the data can be received and it is 1 that I input,
but the car does not move
, so I checked the code and found it
![1677401442069.png]

![1677401477994.png]

So it is a problem caused by different data types
, so I modified the code to add
g_recv_buff[0] = g_recv_buff[0] - 48;
![1677401561141.png]

Working properly
test video
[Remote control car - Bilibili] https://b23.tv/7uqzNdS