STM32 APB1 bus clock configuration problem

Publisher:pengbinyyyLatest update time:2016-10-07 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
When debugging the carrier communication system, I encountered such a problem: two devices, A and B, both used timers 2~4 for communication, PCLK1 of device A was configured as HCLK, and PCLK1 of device B was configured as 1/2HCLK. During the communication process, it was found that A and B could communicate occasionally and could not communicate occasionally, showing that the communication was not stable. In theory, it should be completely impossible to communicate. After in-depth research on the data sheet of STM32F101C8T6, I found the problem. The screenshot is as follows:
STM32 APB1 bus clock configuration problem - kanku - kanku's blog
Figure 1 STM32 functional block diagram
STM32 APB1 bus clock configuration problem - kanku - kanku's blog
Figure 2 STM32 clock system

From Figure 1, we can see that the APB1 bus is connected to devices such as TIM2~4, UART2~2...WWD, etc. Then from Figure 2, we can see that only the peripherals directly use the APB1 clock as the actual clock, and TIM2~4 are adjusted according to the APB1 clock. Therefore, when the PCLK1 of device B is configured to 1/2HCLK, APB1 is actually configured to 1/2HCLK. At this time, because the frequency division coefficient of APB1 is not 1, the clock used by TIM2~4 is automatically doubled, and the actual frequency is HCLK. Since the frequency division by 2 and then doubled is theoretically consistent with HCLK, factors such as circuit structure will cause the result to be inconsistent with the direct assignment of HCLK, resulting in unstable communication. Finally, by adjusting the PCLK1 of device A to 1/2HCLK, stable communication can be achieved.

Keywords:STM32 Reference address:STM32 APB1 bus clock configuration problem

Previous article:stm32 USART_IT_IDLE
Next article:STM32F107 external crystal oscillator 25MHz configured to run at 72MHz

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号