当前位置:网站首页>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
边栏推荐
- Compare three clock circuit schemes of single chip microcomputer
- [paper reading] tomoalign: a novel approach to correcting sample motion and 3D CTF in cryoet
- 207. Curriculum
- FLink CDC 的mysql connector中,mysql的字段是varbinary, 官方
- [note] the art of research - (tell a good story and argument)
- Mysql rownum 实现
- Greenplus enterprise deployment
- flutter只要是数据,都会判空的
- How to connect VMware virtual machine to external network under physical machine win10 system
- [deep learning] data preparation -pytorch custom image segmentation data set loading
猜你喜欢

Research on autojs wechat: the final product of wechat automatic information sending robot (effective demonstration)

Ionicons icon Encyclopedia

Implementation of simple matcap+fresnel shader in unity
![[cryoelectron microscope] relation4.0 - subtomogram tutorial](/img/5b/5364fbe68c495b67d9db5ed9bec2ac.png)
[cryoelectron microscope] relation4.0 - subtomogram tutorial

阿里巴巴政委体系-第一章、政委建在连队上

Mysql rownum 实现

Solving linear programming problems based on MATLAB

Go, how to become a gopher, and find work related to go language in 7 days, Part 1

10 common software architecture modes

Qt/PyQt 窗口类型与窗口标志
随机推荐
Cyberpunk special effect shader
@Use of jsonserialize annotation
Redshift 2.6.41 for maya2018 watermark removal
阿里巴巴政委体系-第一章、政委建在连队上
[beauty of software engineering - column notes] "one question and one answer" issue 2 | 30 common software development problem-solving strategies
Detailed explanation of two modes of FTP
Jianmu continuous integration platform v2.5.2 release
Dynamic Thresholds Buffer Management in a Shared Buffer Packet Switch论文总结
What are the principles and methods of implementing functional automation testing?
[beauty of software engineering - column notes] 26 | continuous delivery: how to release new versions to the production environment at any time?
Implementation of simple cubecap+fresnel shader in unity
330. Complete the array as required
MySQL 45 | 08 is the transaction isolated or not?
Monitor the bottom button of page scrolling position positioning (including the solution that page initialization positioning does not take effect on mouse sliding)
Resize2fs: bad magic number in super block
CDM - code division multiplexing (easy to understand)
Research on autojs wechat: the final product of wechat automatic information sending robot (effective demonstration)
Detailed explanation of the find command (the most common operation of operation and maintenance at the end of the article)
Phased learning about the entry-level application of SQL Server statements - necessary for job hunting (I)
[beauty of software engineering - column notes] 22 | how to do a good job in technology selection for the project?