当前位置:网站首页>STM32 serial port garbled
STM32 serial port garbled
2022-07-29 08:02:00 【BobBobBao】
Problem description
With punctual atoms STM32F4 Explorer development board debugging wildfire scorching sun motor driver , It is found that the serial port output is always garbled . Troubleshoot problems :
- Serial port debugging assistant coding method ? The same serial port debugging assistant , With punctual atoms 、STM32CubeMX The generated program sends data normally . Eliminate the problem of serial port debugging assistant .
- Serial port configuration function problem ? Carefully check the serial port configuration ,GPIO To configure , use STM32CubeMX Replace with the scorching sun program , The problem is still there .
- HAL Interference of other files in the library ? Delete redundant HAL The library files , And STM32CubeMX The library files used are consistent . The problem is still there .
- Reference resources STM32 Detailed processing method of serial communication garbled code , change stm32f4xx_hal_conf.h In file HSE_VALUE = 8000000, The clock frequency of external crystal oscillator is set here , and SystemClock_Config() Function RCC_OscInitStruct.PLL.PLLM = 8; yes PLLM Division coefficient . Many parameters in the system are called directly HSE_VALUE Value , So be sure to change this value .
#if !defined (HSE_VALUE)
#define HSE_VALUE 8000000U /*!< Value of the External oscillator in Hz */
#endif /* HSE_VALUE */
/** * @brief System Clock Configuration * @retval None */
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {
0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {
0};
/** Configure the main internal regulator output voltage */
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
/** Initializes the RCC Oscillators according to the specified parameters * in the RCC_OscInitTypeDef structure. */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 8;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 4;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Initializes the CPU, AHB and APB buses clocks */
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK)
{
Error_Handler();
}
}

Reference resources :
STM32 Detailed processing method of serial communication garbled code
边栏推荐
- 【学术相关】为什么很多国内学者的AI的论文复现不了?
- The database uses PSQL and JDBC to connect remotely and disconnect automatically from time to time
- NLP introduction + practice: Chapter 5: using the API in pytorch to realize linear regression
- (视频+图文)机器学习入门系列-第5章 机器学习实践
- [beauty of software engineering - column notes] 21 | architecture design: can ordinary programmers also implement complex systems?
- Cs61abc sharing session (VI) detailed explanation of program input and output - standard input and output, file, device, EOF, command line parameters
- Technology sharing | quick intercom integrated dispatching system
- [note] the art of research (understand the importance of the problem)
- Postman interface test | JS script blocking sleep and non blocking sleep
- What are the common error types and solutions of black box testing?
猜你喜欢
![[freeze electron microscope] analysis of the source code of the subtomogram alignment function of relion4.0 (for self use)](/img/fe/0efdd151f9661d5cd06a79b7266754.png)
[freeze electron microscope] analysis of the source code of the subtomogram alignment function of relion4.0 (for self use)

The new colleague wrote a few pieces of code, broke the system, and was blasted by the boss!
![[cryoelectron microscope | paper reading] interpretation of sub fault average m software: multi particle cryo EM refining with M](/img/5e/69987afcd1e50ba37bc49441dd3a50.png)
[cryoelectron microscope | paper reading] interpretation of sub fault average m software: multi particle cryo EM refining with M

Redshift 2.6.41 for maya2018 watermark removal

【学术相关】为什么很多国内学者的AI的论文复现不了?

Amaze UI 图标查询
What are the principles and methods of implementing functional automation testing?

Go 事,如何成为一个Gopher ,并在7天找到 Go 语言相关工作,第1篇

Up sampling deconvolution operation
![[lecture notes] how to do in-depth learning in poor data?](/img/7d/5767c078600bd88b7d2146069f4f40.jpg)
[lecture notes] how to do in-depth learning in poor data?
随机推荐
Up sampling deconvolution operation
As long as flutter is data, it will be judged null
Research on autojs wechat: the final product of wechat automatic information sending robot (effective demonstration)
Unity beginner 2 - tile making and world interaction (2D)
Keyboard processing in jetpack compose
Chapter contents of the romance of the Three Kingdoms
阿里巴巴政委体系-第一章、政委建在连队上
Space shooting Lesson 17: game over (end)
In the MySQL connector of flynk CDC, the MySQL field is varbinary, which is officially
[deep learning] data preparation -pytorch custom image segmentation data set loading
[note] the art of research - (tell a good story and argument)
Go, how to become a gopher, and find work related to go language in 7 days, Part 1
在一个sql文件中,上面定义一个测试表及数据,下面可以select* from 测试表
Tcp/ip five layer reference model and corresponding typical devices and IPv6
下推分析的限制
20 hacker artifacts
MySQL uses date_ FORMAT(date,'%Y-%m')
Jump from mapper interface to mapping file XML in idea
Some thoughts on growing into an architect
Unity beginner 1 - character movement control (2D)