When debugging STM32 programs, some flags are accidentally cleared by the debugging software

Publisher:创客1992Latest update time:2015-04-14 Source: eechinaKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
During debugging, the status of peripheral registers can be easily viewed using the register or memory display window of the debugging software.

Many friends have encountered this problem: they cannot see the changes of certain flag bits in the display window during single-step debugging. When these flag bits should be set, the window displays 0. Many people mistakenly think that this is a chip problem.

We know that many status register bits of STM32 peripherals can be cleared by reading certain registers (such as many flag bits in I2C_SR1 of I2C). During debugging, whenever the program stops at a set breakpoint or single-step stop, the debugging software will automatically read out the contents of all specified registers and memories and refresh the window display. This read operation of the debugging software just clears those flag bits, causing the phenomenon described above.

There are several simple ways to solve this problem:

1) Close the register or memory display window
2) Do not display these sensitive registers in the register or memory display window
3) Do not put the breakpoint before the operation of these sensitive register bits to ensure that these register bits are not accidentally operated by the debugging software.
4) Readers add it yourself~~~~~
Keywords:STM32 Reference address:When debugging STM32 programs, some flags are accidentally cleared by the debugging software

Previous article:Clock source of timer in STM32
Next article:External interrupts and external events in STM32

Recommended ReadingLatest update time:2024-11-16 13:55

What does the STM32 series suffix mean?
For example: STM32 F 103 C 8 T 6  The "F" refers to the product type. Now it seems that there is only the general type, namely "F". The "103" refers to the product sub-series, 101 = basic type, 102 = USB basic type, USB 2.0 full-speed device, 103 = enhanced type, 105 or 107 = interconnect type. The "C" refers to the
[Microcontroller]
STM32 external interrupt library function implementation full analysis
Premise:   I have been working on this behind closed doors for two weeks. After various thoughts and inquiries, I have repeatedly read the relevant chapters of M3 Authoritative Guide and STM32 Incomplete Manual , as well as the experimental routines of the development board manufacturer. I finally understood the in
[Microcontroller]
STM32 external interrupt library function implementation full analysis
Summary of stm32 program download methods
Program downloading is the basis of everything. For those who are engaged in single-chip microcomputers, the first thing they learn is program downloading. When I first started learning 51 single-chip microcomputers, I only knew about serial port downloading, so I didn’t understand the role of USB-to-serial port chips
[Microcontroller]
Analysis of the phenomenon of stm32 freezing when exiting stop mode
         According to the description in the STM32 Chinese Reference Manual, there are three low-power modes for STM32: sleep mode, stop mode, and standby mode. (Some materials say that there are actually only two modes, and there is no sleep mode). Among them, the standby mode can achieve the lowest power consumption
[Microcontroller]
Analysis of the phenomenon of stm32 freezing when exiting stop mode
STM32 study notes 17 - the long road ahead is like iron, now we start from the beginning
1. Preface       In the second half of the year, I will continue to study STM32. A new starting point for new learning, determined to upgrade. The microcontroller will not be changed, but the debugging environment will be upgraded as a whole. Including the following aspects:       1. The debugger will be changed to
[Microcontroller]
Several implementation methods of STM32 running lights
#include “stm32f10x.h” void RCC_Configuration(void);//2 void GPIO_Configuration(void);//GPIO void Delay(u32 count) { u32 i=0; for(;i count;i++); } int main(void) { RCC_Configuration();//3 LED_Heat(); while(1) { GPIO_SetBits(GPIOA,GPIO_Pin_0); //The first light is on Delay(800000); //Delay GPIO_ResetBits(GPIO
[Microcontroller]
STM32 Program for TLC2543 and TLV5614
Use the two hardware SPIs of STM32 to complete data reading and writing. For details, see the program comments   1 /****************************(C) COPYRIGHT SunHao 2011****************** *************   2 Name: ADDA.c   3 Function: ADDA related configuration and reading function   6 Version: 1.0   7 Note: Refer to
[Microcontroller]
Calculate the period of input PWM using the PWM input function of STM32
1. Clock part, the clock frequency of TIMER2 is initialized to 36M. RCC_PCLK1Config(RCC_HCLK_Div2); //Set low speed AHB clock = system clock/2 RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9); // Frequency multiplication factor is 9 PLLCLK="8"*9=72 2.TIMER initialization TIM_DeInit(TIM2);
[Microcontroller]
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号