based-on-stm32-taxi-meter/enREADME.md
小冯Sir 52c6733fc0
add enREADME.md.
Signed-off-by: 小冯Sir <fengsir.hy@foxmail.com>
2024-05-04 12:46:02 +00:00

25 lines
5.0 KiB
Markdown

# Preface
Firstly, this is my course design for comprehensive electronic innovation. I have chosen a taxi meter based on STM32 as my course design project. Although I have preliminarily completed the hardware construction and software programming of this project, I am well aware that there are still many areas that need to be improved in terms of code implementation and overall design. This project is not only an important time for me to learn STM32 applications, but also a comprehensive challenge to my electronic design abilities. In the following blog post, I will share the problems and solutions I encountered in designing a taxi meter, as well as some of my thoughts. I also look forward to suggestions and corrections from my peers.
## Why do I make a taxi meter
Mainly because the teacher asked us to choose one of the questions, our group chose the taxi meter. I was mainly responsible for hardware and software design, while other group members helped me write PowerPoint presentations and search for information.
# 1. Project file description
## 1.1 Firmware
The Firmware folder is the firmware of the entire project, which contains the complete code of the project. If the hardware design is consistent, it can be downloaded and used directly. Very convenient. In addition, the development environment is not cubeMX+Keil, but cubeMX+Clion, so it may be necessary to migrate the project to Keil or directly develop stm32 using Clion like I did. Here is also a tutorial on developing stm32 using Clion:[配置CLion用于STM32开发【优雅の嵌入式开发】](https://zhuanlan.zhihu.com/p/145801160)You can directly open the. ioc file to know the specific configuration.
## 1.2 Bootloader
The Bootloader folder is the firmware boot of the project, which can achieve IAP upgrade. However, due to time and technical reasons, the code in this folder has not been implemented, only a project has been created. It is also developed using Clion. The main thing is that the .bin file compiled by my firmware is about 152KB, so it will overflow if directly transferred to STM32, so streaming transfer to STM32 is used, which has not been implemented yet.
# Hardware architecture
The hardware of this project uses STM32F103VET6 as the controller, because it has 512KB of FLASH and 64KB of RAM, which is sufficient for this project. The firmware compiled by the firmware reaches 152KB, so when using other controllers, it should be larger than 152KB.
Of course, I didn't design the PCB myself, but directly used an off-the-shelf module, so my STM32 is using the Witch's development board (not an advertisement).[Link](https://item.taobao.com/item.htm?id=665365360620&spm=a1z10.1-c-s.w4004-23093508104.7.776f5c0eRfbjRn&skuId=4969448682317).
![alt text](https://cdn.jsdelivr.net/gh/LittleFengSir/fengsir-imgs/image-1.png)
Because I have this development board on hand, I used it just to be able to complete the course design. In addition, the screen is a 2.8-inch touch screen with the main control chip ILI9341, which is controlled by FSMC. Then my screen was squeezed out three slits by my classmates, fortunately it was still able to display normally, but the touch was gone.
Then, the motor simulates the normal driving of a taxi. I used a motor, a horse wheel, and an optocoupler speed measurement module here, which can be replaced with a motor with an encoder, combined with motor drive. I am using the 5V power supply of the development board directly for the motor here, but I did not use the motor drive, but I still need to pay attention to the overcurrent problem of the motor.
This project also uses an SD card, which has a capacity of 32GB.
# Program Architecture
When initializing the system, a config.txt with default parameters will be created and saved in the system directory. By reading the SD card, the relevant parameters of the system can be modified. But there are no parameters, just the date and price, as well as the username and password of the serial port (this is not implemented, just send the command directly after connecting to the serial port, without verifying the username and password).
The program of this project uses the cJSON library, so it is necessary to include the compilation of the cJSON library during compilation, and the middleware FATFS file system and USB device are used. According to. ioc, USB devices are known to be large capacity storage devices, mainly designed to access the contents of SD cards without unplugging them (this is not very comprehensive, there are some minor bugs, and there may be situations where the computer cannot recognize USB devices).
When the pricing starts, timer 4 will start working, calculating the speed and mileage every 1 second. After the pricing is completed, the interrupt of timer 4 will be closed, and an order file will be created and saved in. txt format. The content will be saved in JSON format for reading and storage. I also tried using the. json extension, but it seems that the Fatfs file system does not support it, so I used the. txt extension.