Creating DMA-based drivers 

We saw that, compared to a polled approach, the interrupt-based driver is considerably better in terms of CPU utilization. But what about applications with a high data rate that require millions of transfers per second? The next step in improved efficiency can be obtained by having the CPU involved as little as possible by pushing most of the work for transferring data around onto specialized peripheral hardware within the MCU. 

A short introduction to DMA was covered in Chapter 2, Understanding RTOS Tasks, in case you need a refresher before diving into this example.

In this example, we'll work through creating a driver using the same buffer-based interface as the interrupt-based driver. The only difference will be the use of DMA hardware to transfer bytes out of the peripheral's read data register (RDR) and into our buffer. Since we already have a good handle on configuring the USART2 peripheral from our other drivers, the first order of business for this variant is to figure out how to get data from USART2->RDR to the DMA controller and then into memory.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.130.31