当前位置:网站首页>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
边栏推荐
- [cryoelectron microscope | paper reading] a feature guided, focused 3D signal permutation method for subtogram averaging
- Unity beginner 4 - frame animation and protagonist attack (2D)
- [skill accumulation] presentation practical skill accumulation, common sentence patterns
- Cyberpunk special effect shader
- Detailed explanation of two modes of FTP
- [dry goods memo] 50 kinds of Matplotlib scientific research paper drawing collection, including code implementation
- Do you want to meet all the needs of customers
- Use the cloud code to crack the problem of authentication code encountered during login
- Compare three clock circuit schemes of single chip microcomputer
- 阿里巴巴政委体系-第四章、政委建在连队上
猜你喜欢

Compare three clock circuit schemes of single chip microcomputer

Implementation of simple matcap+fresnel shader in unity

Mutationobserver document learning

Monitor the bottom button of page scrolling position positioning (including the solution that page initialization positioning does not take effect on mouse sliding)

The new colleague wrote a few pieces of code, broke the system, and was blasted by the boss!

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

An Optimal Buffer Management Scheme with Dynamic Thresholds论文总结

10 common software architecture modes
![[cryoelectron microscope | paper reading] emclarity: software for high-resolution cryoelectron tomography and sub fault averaging](/img/1e/9f05862288261e16a6b04508b9b292.png)
[cryoelectron microscope | paper reading] emclarity: software for high-resolution cryoelectron tomography and sub fault averaging
![[paper reading] tomoalign: a novel approach to correcting sample motion and 3D CTF in cryoet](/img/3a/75c211f21758ca2d9bb1a40d739d80.png)
[paper reading] tomoalign: a novel approach to correcting sample motion and 3D CTF in cryoet
随机推荐
Process and concept of process
Joseph Ring problem
[paper reading | cryoelectron microscope] interpretation of the new subtomogram averaging method in relion 4.0
你学习·我奖励,21天学习挑战赛 | 等你来战
Detailed explanation of two modes of FTP
Space shooting Lesson 17: game over (end)
Volatile keyword parsing of C #
[beauty of software engineering - column notes] "one question and one answer" issue 2 | 30 common software development problem-solving strategies
Technology sharing | quick intercom integrated dispatching system
在js中,0表示false,非0表示true
Rotation in model space and rotation in world space
Exercise: store department information
Cs61abc sharing session (VI) detailed explanation of program input and output - standard input and output, file, device, EOF, command line parameters
Jiamusi Market Supervision Bureau carried out special food safety network training on epidemic and insect prevention
How to connect VMware virtual machine to external network under physical machine win10 system
Official tutorial redshift 01 basic theoretical knowledge and basic characteristics learning
Basic introduction to pod
[cryoEM] Introduction to FSC, Fourier shell correlation
10 common software architecture modes
flutter只要是数据,都会判空的