Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start a DMA transfer.
Embedded C
DMA_StartTransfer([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the length instead of the data buffer.
Using the address variable which is not defined here.
✗ Incorrect
The function DMA_StartTransfer needs the data buffer to begin the transfer.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Checking for DMA_BUSY instead of DMA_DONE.
Using DMA_ERROR which means a problem occurred.
✗ Incorrect
The status DMA_DONE indicates the DMA transfer has finished.
3fill in blank
hardFix 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'
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.
✗ Incorrect
The DMA_Init function requires a configuration structure, not the buffer or size.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping source and destination addresses.
Using buffer or size instead of addresses.
✗ Incorrect
The source is the memory address and the destination is the peripheral address for this transfer.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using buffer instead of addresses.
Mixing up source and destination.
✗ Incorrect
The DMA config needs source and destination addresses and the transfer size.