STM32 DMA串口发送 FIFO错误中断频繁进的问题
STM32F407ZET6的片子,采用DMA进行串口发送,DMA部分相关固定配置如下: DMA_InitStructure.DMA_BufferSize =255;//固定要发送的字节长度DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
DMA在发送中断中,置完成标志位,下次发送时检查该标志位,发送完成则再次发送。
发送能正常发送,发送完成中断也能正常进,但每次发送时都会先进FIFO错误中断。何解????
在配置完DMA之后,再使能串口触发DMA发送 该问题即可解决 每次DMA发送之侯,下次发送之前 关闭一下 串口触发DMA发送,使能DMA之后再将使能打开 DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
FIFO失能,后面的配置有什么用?! 楼上的说的对,
既然FIFO都关闭了,
应该把FIFO的中断也关闭吧。 :lol:lol:lol:lol:lol:lol:lol 先签到下 In direct mode, the FIFO error flag can also be set under the following conditions:
• In the peripheral-to-memory mode, the FIFO can be saturated (overrun) if the memory
bus is not granted for several peripheral requests
• In the memory-to-peripheral mode, an underrun condition may occur if the memory bus
has not been granted before a peripheral request occurs
If the TEIFx or the FEIFx flag is set due to incompatibility between burst size and FIFO
threshold level, the faulty stream is automatically disabled through a hardware clear of its
EN bit in the corresponding stream configuration register (DMA_SxCR).
页:
[1]