1 / 52

SIOC 實驗 6 : DMA

SIOC 實驗 6 : DMA. 黃彥翔 / 陳慶瀚 MIAT 實驗室. 實驗目的. 控制 DMA 自動搬一記憶體或周邊之資料,並透過 VCP 傳送到超級終端機顯示操作過程。 實作重點 DMA 的控制 Polling Interrupt. SIOC DMA 簡介. DMA(Direct Memory Access) ,無須 CPU 可直接控制記憶體,透過 DMA ,能使 CPU 的效率大為提高。 最多有兩個 DMA 控制器, DMA1 有 7 個通道,每個通道專門用來管理來自一個或多個外部的請求,還有一個仲裁器來協調各個 DMA 請求的優先權。.

fay
Download Presentation

SIOC 實驗 6 : DMA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SIOC 實驗6:DMA 黃彥翔/陳慶瀚 MIAT實驗室

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

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

  4. DMA Registers

  5. DMA Channel Mapping

  6. DMA Request Mapping

  7. DMA Interrupt Status Register

  8. DMA Interrupt Status Register Cont.,

  9. DMA Interrupt Flag Clear Register

  10. DMA Channel x Configuration Register

  11. DMA Channel x Configuration Register Cont.,

  12. DMA Channel x Configuration Register Cont.,

  13. DMA Channel x Number of Data Register

  14. DMA Channel x Peripheral Address Register

  15. DMA Channel x Memory Address Register

  16. DMA Register Mapping

  17. DMA Register Mapping Cont.,

  18. DMA Register Mapping Cont.,

  19. DMA Register Mapping Cont.,

  20. DMA Standard Driver Library

  21. DMA Standard Driver Library List

  22. DMA DeInit Function

  23. DMA Init Function

  24. DMA Init Function Cont.,

  25. DMA Init Function Cont.,

  26. DMA Init Function Cont.,

  27. DMA Init Function Cont.,

  28. DMA Init Function Cont.,

  29. DMA Init Function Cont.,

  30. DMA Command Function

  31. DMA Interrupt Function

  32. DMA Interrupt Function Cont.,

  33. DMA Get CurrDataCounter Function

  34. DMA Get Flag Status Function

  35. DMA Get Flag Status Function Cont.,

  36. DMA Get Flag Status Function Cont.,

  37. DMA Get Flag Status Function Cont.,

  38. DMA Get Flag Status Function Cont.,

  39. DMA Clear Flag Function

  40. DMA Get Interrupt Status Function

  41. DMA Get Interrupt Status Function Cont.,

  42. DMA Get Interrupt Status Function Cont.,

  43. DMA Get Interrupt Status Function Cont.,

  44. DMA Clear Interrupt Pending Bit Function

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

  46. Development Flow Download Program to the Flash of the STM32

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

  48. DMA Configure /* 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 /* 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

More Related