When adding a new time in the program, the register cannot be written during initialization. The reason is that the relevant initialization is not performed and a register is not enabled.
The procedure is as follows:
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
{
//GPIO_InitTypeDef GPIO_InitStruct;
if(htim_base->Instance==TIM7)
{
__TIM7_CLK_ENABLE();
HAL_NVIC_SetPriority(TIM7_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(TIM7_IRQn);
}
else if(htim_base->Instance==TIM3)
{
__TIM3_CL K_ENABLE() ;
}
else if(htim_base->Instance==TIM1)
{
__TIM1_CLK_ENABLE();
}
else if(htim_base->Instance==TIM2)
{
__TIM2_CLK_ENABLE();
HAL_NVIC_SetPriority(TIM2_IRQn, 1, 0);
HAL_NVIC_EnableIRQ(TIM2_IRQn);
}
When adding the enable operation, if the time is defined to generate an interrupt, you should also add the red font as shown above.
}
Previous article:STM32 SPI NSS pin usage configuration
Next article:Analysis of NSS management of STM32 microcontroller SPI interface
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- 【RT-Thread software package application work】Small alarm clock
- High-side current sampling problem
- China's first batch of autonomous driving unmanned commercial licenses issued! Do you dare to sit in an unmanned car? ?
- GDB debugging and DSP
- The IO pin of MSP430 is set as input, but it receives the output signal of the Hall sensor, and the chip-side signal does not switch.
- [Serial] [Starlight Lightning STM32F407 Development Board] Chapter 10 Serial Communication Experiment
- The relationship between serial port communication and interruption
- How to use a wiring harness tester to measure small resistance? Here's a method
- General Design Considerations for Embedded Systems
- Download the NI white paper "Overcoming the Challenges of Production Test for Complex Devices Under Test" for free and get a chance to win prizes!