Research on the problem of ORE flag bit appearing in STM32 serial port

Publisher:平和思绪Latest update time:2018-10-16 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Test environment, STM32L476, when the HAL library uses UART, an ORE error occurs in the interrupt flag register, as described below:

Research on the problem of ORE flag appearing in STM32 serial port
Cause of code error:

1. Initialize the serial port, uart_USB_init(); this function does not start the interrupt

2. Delay 3000S, during which the computer sends data to the serial port every 50ms.

3. Start interrupt reception. HAL_NVIC_SetPriority(USART_IRQn, 5, 1); 

  HAL_NVIC_EnableIRQ(USART_IRQn);

4. An ORE error occurred.

After analysis, there may be two reasons. After the serial port is initialized, the serial port receives data (not processed), and then opens the interrupt to receive data again. Therefore, there is a difference between the two reception interrupt and non-interruption processing. It is also possible that the first non-interruption reception data is not processed.

Solution: Modify the above order

1. Delay 3000S, during which the computer sends data to the serial port every 50ms.

2. Initialize the serial port, uart_USB_init(); this function does not start the interrupt

3. Start interrupt reception. HAL_NVIC_SetPriority(USART_IRQn, 5, 1); 

  HAL_NVIC_EnableIRQ(USART_IRQn);

Specifically, serial port initialization and interrupt enable should be placed closely together.


Keywords:STM32 Reference address:Research on the problem of ORE flag bit appearing in STM32 serial port

Previous article:STM32 DMA receives data from the serial port
Next article:What about STM32 development reset

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

STM32 DMA self-study brief summary
        Simply record the configuration instructions of STM32's DMA--------         According to the DMA program of the serial port of Wildfire, you can simply understand the instructions----- ----Part 1----DMA Configuration----- void USART1_DMA_Config(void) { DMA_InitTypeDef DMA_InitStructure; RCC_AHBPeriphClockCmd(
[Microcontroller]
STM32 DMA self-study brief summary
stm32 hal i2c library read and write sd3088 clock
Corrections from the previous version. sd3008 does a bus reset 0.5s at the beginning of each communication, so there is no need to consider the i2c bug problem of stm32. And, should the HAL library also consider patching this bug in the software? Using HAL_I2C_Mem_Read/Write makes the code look very nice. Simula
[Microcontroller]
STM32 system clock setting, using external active crystal oscillator related configuration issues
Today, I encountered a problem when debugging the STM32 system clock setting: TIM2 timing 1Ms, TIM2 interrupt service function time++, LED state changes when time=100. After the program runs, I found that the LED does not flash according to the 0.1S time, but flashes very slowly. The program search found that when the
[Microcontroller]
Summary of the advantages of STM32 over 51 microcontrollers
STM32  8051 Core Cortex-M3, 32Bit@72MHz 51 Core, 8Bit@2MHz Max (after frequency division) 1.25DMIPS 0.06DMIPS Address space 4GB 64KB On-chip memory ROM: 20K-1MB 2K-64K RAM:8K-256K 128B-1K Peripherals AD, DA, Timer, WWDG, IWDG, three timers and one serial port CRC, DMA, IIC, SPI, USART, etc. Development
[Microcontroller]
STM32 Learning Road (Part 3)——GPIO+USART Joint Debugging
I'm used to watching tutorials that only play "lighting up" for the first time, which is boring. This time I'm going to play with the serial port and "lighting up" together. You need to read more about the relevant registers and library functions beforehand. There are a little too many, but you will get used to it soon
[Microcontroller]
STM32 MCU releases PB3/PB4/PA15 as common IO port
  When using multiple IO ports of STM32F103RCT6 microcontroller, I found that no matter how to configure, PB3, PB4, PA15 could not control the output high and low levels normally, while other IO ports were normal. The IO port initialization operation is as follows:     GPIO_InitTypeDef GPIO_Init;     __HAL_RCC_GPI
[Microcontroller]
Design of full-color LED display system based on STM32
As a new display device, LED display screen has been widely used in recent years. With the continuous updating of technology, LED display screen is developing towards full color. A LED display screen control system is designed. The system uses the ARMCortex-M3 core chip STM32F103ZET6 as the control center, completes
[Microcontroller]
Design of full-color LED display system based on STM32
STM32 external interrupt 2
STM32 external interrupt configuration     1Configure interrupt 1. Allocate interrupt vector table: /* Set the Vector Table base location at 0x20000000 */ NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); 2. Set interrupt priority: NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); //Set interrupt priorit
[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号