DMA reception of stm32 serial port

Publisher:breakthrough3Latest update time:2018-09-05 Source: eefocusKeywords:stm32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

UART5 does not support DMA

Different peripherals require different DMA


UART4 needs to use DMA2 channel 3 or 5

For example:
void DMA1_Channel5_IRQHandler(void)
{
u16 i,j=0;
OS_ENTER_CRITICAL(); /* Tell uC/OS-II that we are starting an ISR */
    OSIntNesting++;
    OS_EXIT_CRITICAL();
if(DMA_GetITStatus(DMA1_IT_TC5)!= RESET)
{
DMA_ClearITPendingBit(DMA1_IT_GL5); //Clear all interrupt flags
DMA_ClearITPendingBit(DMA1_IT_TC5);
DMA_ClearFlag(DMA1_FLAG_TC5);
/*Each distance test data packet has 3 bytes (labeled A, B, C in sequence), the high bits of the first two bytes are 0, and
the high bit of the last byte is 1, marking the end of this data packet*/
memcpy(Uart_Rx_Backup,Uart_Rx,UART_RX_LEN);
if((Uart_Rx_Backup[0]&0x80) != 0)//
j=1;
else if((Uart_Rx_Backup[1]&0x80) != 0)//
j=2;
else if((Uart_Rx_Backup[2]&0x80) != 0)//
j=0;

for(i=0;i<50;i++)
{
RecorderData_FileWrite[i ]=DecodeLaseData3Byte(Uart_Rx_Backup+i*3+j);
}
}
else if(DMA_GetITStatus(DMA1_IT_HT5) == SET)
    {
        DMA_ClearITPendingBit(DMA1_IT_HT5);
        DMA_ClearITPendingBit(DMA1_IT_GL5);                                
    }
OSIntExit(); 
}


Keywords:stm32 Reference address:DMA reception of stm32 serial port

Previous article:stm32 independent watchdog clock configuration
Next article:STM32 AD DMA mode

Recommended ReadingLatest update time:2024-11-16 11:32

STM32 Notes 13: Prank, two watchdogs
a)               Purpose: Understand the difference and basic usage between the two types of watchdogs (I call them: system operation fault detectors and independent system fault detectors. Newcomers are often confused by this unimaginative pictographic name). b)               Same: They are all used to detect sys
[Microcontroller]
Selection of stm32 chip startup file type
First, look at the startup file in the latest STM32 firmware library 3.5. As shown in the figure:  The corresponding relationship is as follows: 
[Microcontroller]
[STM32] Input capture of general timer (Example: Input capture)
General Purpose Timer Input Capture Overview How Input Capture Works In the general timer block diagram, the top part (count clock selection), the middle part (time base unit), and the lower left part (input capture) are mainly involved. Here we mainly explain the lower left part (input capture), and the other
[Microcontroller]
[STM32] Input capture of general timer (Example: Input capture)
STM32 Notes External Interrupt GPIO
b) Initialization function definition: void EXTI_Configuration(void); //Define IO interrupt initialization function c) Initialization function call: EXTI_Configuration(); //IO interrupt initialization function call Simple application: d) Initialization function: void EXTI_Configuration(void) {   EXTI_InitTypeDef
[Microcontroller]
Create a new project with STM32, KEIL, MDK
At present, I feel that this file structure arrangement is the most reasonable. First, create the following files in the selected folder: Then put the relevant files into the corresponding folder according to the chip. Now take STM32F103RCT6 as an example. Copy stm32f10x.h, system_stm32f10x.h, system_stm32f10x.copy
[Microcontroller]
Create a new project with STM32, KEIL, MDK
Study notes on SD card FATFS file system based on STM32
Before porting the file system, first master some basic knowledge (must be mastered): 1. Analysis of FATFS file system format To work on the file system, you must first understand the structure and partitions in the SD card, as shown below 1. Boot sector The boot sector contains many important parameters of the dis
[Microcontroller]
STM32 captures 4 PWM waves simultaneously using one timer
statement of problem: Recently, I need to use a model airplane remote controller to control a remote control car. The 32-bit single-chip microcomputer is used as the main control. Four channels are needed, that is, four PWM waves need to be captured. If four timers are used to capture four PWM waves, it will be a wast
[Microcontroller]
STM32 Preschool Tutorial 6: These codes are useful to everyone
Note: Below are some commonly used codes. There are many on the Internet, but most of them are not fully commented. It is no problem for experts to read, but it is difficult for us novices... So I have collected these codes and commented them sentence by sentence, hoping that they will be valuable to novices.   Read
[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号