Presentation is loading. Please wait.

Presentation is loading. Please wait.

WU-YANG Technology Co., Ltd. SIOC 實驗6:DMA 黃彥翔/陳慶瀚 MIAT實驗室.

Similar presentations


Presentation on theme: "WU-YANG Technology Co., Ltd. SIOC 實驗6:DMA 黃彥翔/陳慶瀚 MIAT實驗室."— Presentation transcript:

1 WU-YANG Technology Co., Ltd. SIOC 實驗6:DMA 黃彥翔/陳慶瀚 MIAT實驗室

2 2 實驗目的  控制DMA自動搬一記憶體或周邊之資料,並透過VCP 傳送到超級終端機顯示操作過程。 實作重點  DMA的控制 Polling Interrupt

3 SIOC DMA 簡介 DMA(Direct Memory Access),無須CPU可直接控 制記憶體,透過DMA,能使CPU的效率大為提高。 最多有兩個DMA控制器,DMA1有7個通道,每個通 道專門用來管理來自一個或多個外部的請求,還有 一個仲裁器來協調各個DMA請求的優先權。 3

4 WU-YANG Technology Co., Ltd. DMA Registers

5 DMA Channel Mapping 5

6 DMA Request Mapping 6

7 DMA Interrupt Status Register 7

8 DMA Interrupt Status Register Cont., 8

9 DMA Interrupt Flag Clear Register 9

10 DMA Channel x Configuration Register 10

11 DMA Channel x Configuration Register Cont., 11

12 DMA Channel x Configuration Register Cont., 12

13 DMA Channel x Number of Data Register 13

14 DMA Channel x Peripheral Address Register 14

15 DMA Channel x Memory Address Register 15

16 DMA Register Mapping 16

17 DMA Register Mapping Cont., 17

18 DMA Register Mapping Cont., 18

19 DMA Register Mapping Cont., 19

20 WU-YANG Technology Co., Ltd. DMA Standard Driver Library

21 DMA Standard Driver Library List 21

22 DMA DeInit Function 22

23 DMA Init Function 23

24 DMA Init Function Cont., 24

25 DMA Init Function Cont., 25

26 DMA Init Function Cont., 26

27 DMA Init Function Cont., 27

28 DMA Init Function Cont., 28

29 DMA Init Function Cont., 29

30 DMA Command Function 30

31 DMA Interrupt Function 31

32 DMA Interrupt Function Cont., 32

33 DMA Get CurrDataCounter Function 33

34 DMA Get Flag Status Function 34

35 DMA Get Flag Status Function Cont., 35

36 DMA Get Flag Status Function Cont., 36

37 DMA Get Flag Status Function Cont., 37

38 DMA Get Flag Status Function Cont., 38

39 DMA Clear Flag Function 39

40 DMA Get Interrupt Status Function 40

41 DMA Get Interrupt Status Function Cont., 41

42 DMA Get Interrupt Status Function Cont., 42

43 DMA Get Interrupt Status Function Cont., 43

44 DMA Clear Interrupt Pending Bit Function 44

45 實驗 1 – Polling DMA  Goal Use DMA to copy data from memory to memory  Principle Check the DMA flag 45

46 Development Flow 46 Embedded So ftware Side Download Program to the Flash of the STM32

47 RCC Configure 47 /* RCC Configure */ /* DMA1 clock enable */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE); Turn On DMA1 Clock

48 DMA Configure 48 /* DMA Configure */ void DMA_Configuration(void) { DMA_InitTypeDef DMA_InitStructure; /* DMA1 channel6 configuration */ DMA_DeInit(DMA1_Channel6); DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)SRC_Const_Buffer; DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)DST_Buffer; DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; DMA_InitStructure.DMA_BufferSize = BufferSize; DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Enable; DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word; DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word; DMA_InitStructure.DMA_Mode = DMA_Mode_Normal; DMA_InitStructure.DMA_Priority = DMA_Priority_High; DMA_InitStructure.DMA_M2M = DMA_M2M_Enable; DMA_Init(DMA1_Channel6, &DMA_InitStructure); }

49 User Program 49 /* User Program */ while (DMA_GetFlagStatus(DMA1_FLAG_TC5) == RESET); DMA_ClearFlag(DMA1_FLAG_TC5); DMA_Configuration(); //DMA_Cmd(DMA1_Channel5, ENABLE);

50 實驗 2 – Interrupt DMA  Goal Use DMA to copy data from memory to memory  Principle Use the DMA Interrupt 50

51 Development Flow 51 Download Program to the Flash of the STM32F103C8

52 Q & A


Download ppt "WU-YANG Technology Co., Ltd. SIOC 實驗6:DMA 黃彥翔/陳慶瀚 MIAT實驗室."

Similar presentations


Ads by Google