0
0
Embedded Cprogramming~10 mins

Why DMA is needed in Embedded C - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a DMA transfer.

Embedded C
DMA_StartTransfer([1]);
Drag options to blanks, or click blank then click option'
Adata
Bbuffer
Clength
Daddress
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the length instead of the data buffer.
Using the address variable which is not defined here.
2fill in blank
medium

Complete the code to check if DMA transfer is complete.

Embedded C
if (DMA_Status() == [1]) {
    // Transfer done
}
Drag options to blanks, or click blank then click option'
ADMA_DONE
BDMA_BUSY
CDMA_ERROR
DDMA_IDLE
Attempts:
3 left
💡 Hint
Common Mistakes
Checking for DMA_BUSY instead of DMA_DONE.
Using DMA_ERROR which means a problem occurred.
3fill in blank
hard

Fix the error in the DMA initialization code.

Embedded C
DMA_Init([1]);
DMA_StartTransfer(buffer, size);
Drag options to blanks, or click blank then click option'
Asize
Bbuffer
Cconfig
Daddress
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the data buffer to DMA_Init instead of config.
Passing size or address which are not config structures.
4fill in blank
hard

Fill both blanks to create a DMA transfer that moves data from memory to peripheral.

Embedded C
DMA_SetSource([1]);
DMA_SetDestination([2]);
Drag options to blanks, or click blank then click option'
Amemory_address
Bperipheral_address
Cbuffer
Dsize
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping source and destination addresses.
Using buffer or size instead of addresses.
5fill in blank
hard

Fill all three blanks to configure DMA with correct parameters.

Embedded C
DMA_Config config = {
    .source = [1],
    .destination = [2],
    .length = [3]
};
Drag options to blanks, or click blank then click option'
Amemory_addr
Bperipheral_addr
Ctransfer_size
Dbuffer
Attempts:
3 left
💡 Hint
Common Mistakes
Using buffer instead of addresses.
Mixing up source and destination.